• Login
Community
  • Login

Change History markers

Scheduled Pinned Locked Moved General Discussion
16 Posts 4 Posters 1.6k Views
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.
  • R
    richlux
    last edited by Mar 27, 2023, 9:43 PM

    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

    L 1 Reply Last reply Mar 27, 2023, 11:05 PM Reply Quote 0
    • L
      Lycan Thrope @richlux
      last edited by Mar 27, 2023, 11:05 PM

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

      R 1 Reply Last reply Mar 29, 2023, 12:02 PM Reply Quote 1
      • R
        richlux @Lycan Thrope
        last edited by Mar 29, 2023, 12:02 PM

        @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

        A 1 Reply Last reply Mar 29, 2023, 12:05 PM Reply Quote 2
        • A
          Alan Kilborn @richlux
          last edited by Mar 29, 2023, 12:05 PM

          @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).

          R 1 Reply Last reply Mar 29, 2023, 12:27 PM Reply Quote 1
          • R
            richlux @Alan Kilborn
            last edited by Mar 29, 2023, 12:27 PM

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

            Rich

            A 1 Reply Last reply Mar 29, 2023, 12:29 PM Reply Quote 0
            • A
              Alan Kilborn @richlux
              last edited by Mar 29, 2023, 12:29 PM

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

              R 1 Reply Last reply Mar 29, 2023, 1:19 PM Reply Quote 4
              • R
                richlux @Alan Kilborn
                last edited by Mar 29, 2023, 1:19 PM

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

                Rich

                M 1 Reply Last reply Mar 29, 2023, 1:44 PM Reply Quote 0
                • M
                  Michael Vincent @richlux
                  last edited by Mar 29, 2023, 1:44 PM

                  @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
                  • A
                    Alan Kilborn
                    last edited by Alan Kilborn Mar 29, 2023, 2:41 PM Mar 29, 2023, 2:37 PM

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

                    R 2 Replies Last reply Mar 29, 2023, 3:08 PM Reply Quote 3
                    • R
                      richlux @Alan Kilborn
                      last edited by Mar 29, 2023, 3:08 PM

                      @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
                      • R
                        richlux @Alan Kilborn
                        last edited by Mar 29, 2023, 9:30 PM

                        @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

                        A 1 Reply Last reply Mar 30, 2023, 10:59 AM Reply Quote 0
                        • A
                          Alan Kilborn @richlux
                          last edited by Mar 30, 2023, 10:59 AM

                          @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()
                          
                          R 2 Replies Last reply Mar 30, 2023, 3:40 PM Reply Quote 3
                          • A Alan Kilborn referenced this topic on Mar 30, 2023, 10:59 AM
                          • R
                            richlux @Alan Kilborn
                            last edited by richlux Mar 30, 2023, 3:41 PM Mar 30, 2023, 3:40 PM

                            @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
                            • R
                              richlux @Alan Kilborn
                              last edited by Mar 30, 2023, 8:21 PM

                              @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

                              A 1 Reply Last reply Mar 30, 2023, 8:48 PM Reply Quote 0
                              • A
                                Alan Kilborn @richlux
                                last edited by Mar 30, 2023, 8:48 PM

                                @richlux said in Change History markers:

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

                                Maybe THIS?

                                R 1 Reply Last reply Mar 30, 2023, 9:29 PM Reply Quote 1
                                • R
                                  richlux @Alan Kilborn
                                  last edited by Mar 30, 2023, 9:29 PM

                                  @Alan-Kilborn said in Change History markers:

                                  Maybe THIS?

                                  That did it!

                                  Thanks again,
                                  Rich

                                  1 Reply Last reply Reply Quote 3
                                  2 out of 16
                                  • First post
                                    2/16
                                    Last post
                                  The Community of users of the Notepad++ text editor.
                                  Powered by NodeBB | Contributors