Change History markers
-
@Alan-Kilborn Thanks. I’ll have to look into doing this.
Rich
-
-
…colors can be customized?
Here’s a demo script that shows how it can be done, for one of the colors:
# -*- coding: utf-8 -*- from Npp import * RGB_TUPLE = (255, 0, 0) SC_MARKNUM_HISTORY_REVERTED_TO_ORIGIN = 21 SC_MARKNUM_HISTORY_SAVED = 22 SC_MARKNUM_HISTORY_MODIFIED = 23 SC_MARKNUM_HISTORY_REVERTED_TO_MODIFIED = 24 editor.markerSetBack(SC_MARKNUM_HISTORY_MODIFIED, RGB_TUPLE) editor.markerSetFore(SC_MARKNUM_HISTORY_MODIFIED, RGB_TUPLE)
For more info on scripting in general see the FAQ entry for it.
-
@Alan-Kilborn Thank you so much for this sample. It is very helpful. I’m going to submit a feature request to see if they will add this as a setting that can be changed.
Rich
-
@Alan-Kilborn That worked great. Can you tell me what I need to put in the startup.py to have this script file run at startup automatically?
Rich
-
@richlux said in Change History markers:
what I need to put in the startup.py to have this script file run at startup automatically?
Let’s formalize the script a bit more, which will allow what you’re asking in a nice fashion.
I’ll call the script
ChangeHistoryColors.py
and revise it thusly:# -*- coding: utf-8 -*- from __future__ import print_function ######################################### # # ChangeHistoryColors (CHC) # ######################################### # references: # https://community.notepad-plus-plus.org/topic/24309/change-history-markers #------------------------------------------------------------------------------- from Npp import * #------------------------------------------------------------------------------- class CHC(object): def __init__(self): RGB_TUPLE = (255, 0, 0) SC_MARKNUM_HISTORY_REVERTED_TO_ORIGIN = 21 SC_MARKNUM_HISTORY_SAVED = 22 SC_MARKNUM_HISTORY_MODIFIED = 23 SC_MARKNUM_HISTORY_REVERTED_TO_MODIFIED = 24 editor.markerSetBack(SC_MARKNUM_HISTORY_MODIFIED, RGB_TUPLE) editor.markerSetFore(SC_MARKNUM_HISTORY_MODIFIED, RGB_TUPLE) #------------------------------------------------------------------------------- if __name__ == '__main__': CHC()
Then, to embed a call to it in the
startup (User)
script, do this:import ChangeHistoryColors ChangeHistoryColors.CHC()
-
-
@Alan-Kilborn That works great. Thanks again for all your help. I actually modified your script a little so only changes since the last save are highlighted. Here’s the core of it in case someone else want’s to use it.
RGB_MODIFIED = (255, 0, 0) RGB_SAVED = (228, 228, 228) SC_MARKNUM_HISTORY_REVERTED_TO_ORIGIN = 21 SC_MARKNUM_HISTORY_SAVED = 22 SC_MARKNUM_HISTORY_MODIFIED = 23 SC_MARKNUM_HISTORY_REVERTED_TO_MODIFIED = 24 editor.markerSetBack(SC_MARKNUM_HISTORY_MODIFIED, RGB_MODIFIED) editor.markerSetFore(SC_MARKNUM_HISTORY_MODIFIED, RGB_MODIFIED) editor.markerSetBack(SC_MARKNUM_HISTORY_REVERTED_TO_ORIGIN, RGB_MODIFIED) editor.markerSetFore(SC_MARKNUM_HISTORY_REVERTED_TO_ORIGIN, RGB_MODIFIED) editor.markerSetBack(SC_MARKNUM_HISTORY_REVERTED_TO_MODIFIED, RGB_MODIFIED) editor.markerSetFore(SC_MARKNUM_HISTORY_REVERTED_TO_MODIFIED, RGB_MODIFIED) editor.markerSetBack(SC_MARKNUM_HISTORY_SAVED, RGB_SAVED) editor.markerSetFore(SC_MARKNUM_HISTORY_SAVED, RGB_SAVED)
Rich
-
@Alan-Kilborn I have one last question for you. Is there something that needs to be done to get the startup (User) script to run when NPP is started? It doesn’t seem to be running automatically. I can manually run it after I start NPP, but obviously that defeats the purpose of a startup script!
Thank,
Rich -
@richlux said in Change History markers:
Is there something that needs to be done to get the startup (User) script to run
Maybe THIS?
-