Community

    • Login
    • Search
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search

    Change History markers

    General Discussion
    4
    16
    172
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • richlux
      richlux last edited by

      Is there a way to have the Change History markers automatically clear when the file is saved? It makes more sense to have the Change History markers show changes since the file was last saved and not since the file was last opened.

      Thanks,
      Rich

      Lycan Thrope 1 Reply Last reply Reply Quote 0
      • Lycan Thrope
        Lycan Thrope @richlux last edited by

        @richlux ,
        Not if you’re still editing the file, and don’t remember if something was changed, or accidentally changed something. Having saved changes (green) that show while still editing the document and making more changes (orange) let’s you know you didn’t save those changes, and still need to.

        richlux 1 Reply Last reply Reply Quote 1
        • richlux
          richlux @Lycan Thrope last edited by

          @Lycan-Thrope Wow, thanks! I’m color blind and had no idea the color changed after it was saved. Being red/green color blind (as most color blind people are), orange and green are perhaps the worse two colors to use. Do you know if the colors can be customized? I couldn’t find a setting anywhere for that.

          Thanks,
          Rich

          Alan Kilborn 1 Reply Last reply Reply Quote 2
          • Alan Kilborn
            Alan Kilborn @richlux last edited by

            @richlux said in Change History markers:

            Do you know if the colors can be customized?

            Currently Notepad++ doesn’t allow direct access to that.
            But it should be doable via scripting, if you’re interested in that type of solution (involves using a plugin).

            richlux 1 Reply Last reply Reply Quote 1
            • richlux
              richlux @Alan Kilborn last edited by

              @Alan-Kilborn Thanks. If I do it via a script, will I need to re-run it every time I upgrade NPP?

              Rich

              Alan Kilborn 1 Reply Last reply Reply Quote 0
              • Alan Kilborn
                Alan Kilborn @richlux last edited by

                @richlux said in Change History markers:

                If I do it via a script, will I need to re-run it every time I upgrade NPP?

                Nope, it would be a “set it and forget it” type thing, and it would persist across update installs.

                It would be set (i.e., the colors changed) every time Notepad++ starts up, but you wouldn’t be involved; stuff can be set to be run automatically on startup.

                richlux 1 Reply Last reply Reply Quote 4
                • richlux
                  richlux @Alan Kilborn last edited by

                  @Alan-Kilborn Thanks. I’ll have to look into doing this.

                  Rich

                  Michael Vincent 1 Reply Last reply Reply Quote 0
                  • Michael Vincent
                    Michael Vincent @richlux last edited by

                    @richlux

                    Have a look at Changed Lines. This may help if you just want to change colors.

                    Cheers.

                    1 Reply Last reply Reply Quote 1
                    • Alan Kilborn
                      Alan Kilborn last edited by Alan Kilborn

                      …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.

                      richlux 2 Replies Last reply Reply Quote 3
                      • richlux
                        richlux @Alan Kilborn last edited by

                        @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

                        1 Reply Last reply Reply Quote 3
                        • richlux
                          richlux @Alan Kilborn last edited by

                          @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

                          Alan Kilborn 1 Reply Last reply Reply Quote 0
                          • Alan Kilborn
                            Alan Kilborn @richlux last edited by

                            @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()
                            
                            richlux 2 Replies Last reply Reply Quote 3
                            • Referenced by  Alan Kilborn Alan Kilborn 
                            • richlux
                              richlux @Alan Kilborn last edited by richlux

                              @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

                              1 Reply Last reply Reply Quote 2
                              • richlux
                                richlux @Alan Kilborn last edited by

                                @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

                                Alan Kilborn 1 Reply Last reply Reply Quote 0
                                • Alan Kilborn
                                  Alan Kilborn @richlux last edited by

                                  @richlux said in Change History markers:

                                  Is there something that needs to be done to get the startup (User) script to run

                                  Maybe THIS?

                                  richlux 1 Reply Last reply Reply Quote 1
                                  • richlux
                                    richlux @Alan Kilborn last edited by

                                    @Alan-Kilborn said in Change History markers:

                                    Maybe THIS?

                                    That did it!

                                    Thanks again,
                                    Rich

                                    1 Reply Last reply Reply Quote 3
                                    • First post
                                      Last post
                                    Copyright © 2014 NodeBB Forums | Contributors