Community
    • Login

    Highlight modified text

    Scheduled Pinned Locked Moved General Discussion
    38 Posts 7 Posters 19.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.
    • Alan KilbornA
      Alan Kilborn @Ekopalypse
      last edited by Alan Kilborn

      @Ekopalypse said:

      if there is a way to delete the old Eko-palypse account you have my approval to remove it

      Hmm…second thoughts. There are probably some nuggets you composed under that ID. Probably should just keep it. I’ll try to remember which one is current.

      lifetime of such markers end when closing npp?

      Yes, for me it is fine. For those people that love to quit N++ and have red tab icons, it is probably not ideal, but forget them, they have bigger issues. :)

      deleting lines

      They are gone, can’t see them…no indication they were ever there in this scheme.

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

        @Alan-Kilborn

        , they have bigger issues

        I see, to know that there was a change but you see only NULLs isn’t funny LOL

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

          @Ekopalypse

          Probably the best way to get a feel for this is to install LocationNavigate and turn on the Mark Changed Line option. If you’re so inclined. 32-bit only AFAIK.

          Once exposed, it quickly becomes a feature you can’t live without, IMO.

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

            @Alan-Kilborn

            thx - to portable - I’ll give it a try and thx for the hint about 32bit.

            1 Reply Last reply Reply Quote 1
            • Meta ChuhM
              Meta Chuh moderator @AZJIO AZJIO
              last edited by

              @AZJIO-AZJIO and all

              Direct relationship. The author asked to control the change. Plugin marks modified lines.

              i disagree. the op requested the changes to be highlighted. (diff)
              meaning every single word, section, or character that have been added and or deleted shall be highlighted.

              original quote:

              I want my changes to be highlighted

              as far as i can see while testing, location navigate can not do that.
              only complete lines are marked, but not the changed words or sections, in green for added and red for deleted, and deleted text is not shown at all.

              can you confirm, or are there settings to achieve a diff view as requested ?

              example of deleted and added text diff view in compare:
              Imgur

              Alan KilbornA 1 Reply Last reply Reply Quote 2
              • Alan KilbornA
                Alan Kilborn @Meta Chuh
                last edited by

                @Meta-Chuh

                Wow, you are correct again. I wish people’s opinions would stop changing my mind! :)

                There’s really 2 schools of thought here, one is a diff from a basis, one is marking lines that are changed on a ternary scheme (no mark=no change, colored-mark: changed since last save, different colored mark: changed since start of session but now saved). Both schemes have value, but at different times.

                When I want a diff, I’ll call one up. I want line-has-been-changed marking constantly.

                1 Reply Last reply Reply Quote 2
                • EkopalypseE
                  Ekopalypse
                  last edited by Ekopalypse

                  As far as I have understood, there are two main functions that LN has.

                  1. marking lines with changes and
                  2. jump to historical cursor positions (which is what I always wanted to have but never really started to implement)

                  That basically means a script needs to provide two lists per buffer
                  which do get loaded on bufferactivated event.
                  Filesaved event changes the color of the markers.
                  Fileclosed event deletes the two lists of that buffer.
                  And an additional margin, which is used by the markers, needs to be introduced.

                  Configuration options for cursor positions are

                  1. position offset (basically when new position is valid to be recorded)
                  2. limit of how many historical positions are stored

                  configuration options for marking is what kind of marking to be used

                  I guess, that’s it - more or less, right?

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

                    @Ekopalypse

                    LN has several functions but personally I find only line change markers useful. If you are going to tackle it, why not do this functionality first? Follow the KISS principle. :)

                    Meta ChuhM 1 Reply Last reply Reply Quote 2
                    • Meta ChuhM
                      Meta Chuh moderator @Alan Kilborn
                      last edited by

                      welcome to the notepad++ invariant mind helpdesk, @Alan-Kilborn

                      I wish people’s opinions would stop changing my mind!

                      solution: if they don’t have boobs, there’s no need to change your mind 😉

                      AZJIO AZJIOA 1 Reply Last reply Reply Quote 1
                      • AZJIO AZJIOA
                        AZJIO AZJIO @Meta Chuh
                        last edited by

                        @Meta-Chuh
                        If the author spoke about comparing the two files, the question would have sounded different. There are professional programs for this.
                        If you cling to the words, the author would like to see the changes, looking through 1 file. Therefore, your interpretation also does not match the request.
                        By the way, the way of marking lines can be done by highlighting the entire line.

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

                          @AZJIO-AZJIO said:

                          If the author spoke about comparing the two files

                          I think it is up to interpretation…it could go either way. Unless the OP clarifies we will never know. Often an OP says one thing, and then when people answer, the OP comes back and says No I meant something totally different.

                          the way of marking lines can be done by highlighting the entire line

                          Yes, but that may get a little “heavy”. Maybe it could be an option…either a colored blob in a new margin (like LN) or a background color change for the entire line.

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

                            @Alan-Kilborn

                            here, first naive approach, something to play with
                            There is already a disclaimer which, I assume, cannot be solved easily.
                            I’ve tested to paste 100 000 lines - which took, on my machine, ~2 seconds
                            saving those changes does also take ~2 seconds but deleting it took ~10 seconds.
                            LN seems to suffer from the same problem and has nearly the same performance by the way.
                            So, this script is only useful on normal text editing actions but NOT for huge change sets.

                            Script includes two sets of markers just to show how this could be changed.
                            Marker image is of 14x14 pixel and each pixel is represented by 4 bytes (rgba).
                            Tip, color the \x00 instances and the symbol is visible :-)

                            from Npp import editor, MARGINTYPE, MODIFICATIONFLAGS
                            
                            # marker symbols
                            # change_marker = '''\
                            # \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xF9\xA6\x72\xFF\xFA\xA7\x73\xFF\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\
                            # \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xF7\xA4\x70\xFF\xF8\xB6\x8B\xFF\xF8\xA5\x71\xFF\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\
                            # \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xF5\xA2\x6E\xFF\xFE\xCA\xA8\xFF\xF4\xB3\x87\xFF\xF6\xA3\x6F\xFF\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\
                            # \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xF3\xA0\x6C\xFF\xF6\xC5\xA2\xFF\xF6\xC6\xA2\xFF\xF0\xB0\x83\xFF\xF4\xA1\x6D\xFF\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\
                            # \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xF1\x9E\x6A\xFF\xFD\xC1\x9B\xFF\xFE\xC1\x9C\xFF\xF0\xC2\x9D\xFF\xFD\xAE\x81\xFF\xF3\xA0\x6C\xFF\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\
                            # \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xEF\x9C\x68\xFF\xF5\xBC\x95\xFF\xF6\xBD\x95\xFF\xF8\xBE\x97\xFF\xFB\xBF\x99\xFF\xFB\xAD\x7F\xFF\xF1\x9E\x6A\xFF\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\
                            # \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xED\x9A\x66\xFF\xFD\xB8\x8E\xFF\xFE\xB8\x8F\xFF\xF0\xB9\x90\xFF\xF4\xBB\x93\xFF\xF9\xBE\x97\xFF\xF9\xAB\x7D\xFF\xFF\x9C\x68\xFF\x00\x00\x00\x00\x00\x00\x00\x00\
                            # \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xEC\x99\x65\xFF\xF4\xB3\x87\xFF\xF6\xB4\x88\xFF\xF8\xB5\x8A\xFF\xFD\xB8\x8E\xFF\xF2\xBA\x92\xFF\xF1\xA6\x76\xFF\xFD\x9A\x66\xFF\x00\x00\x00\x00\x00\x00\x00\x00\
                            # \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xEA\x97\x63\xFF\xFC\xAE\x80\xFF\xFE\xAF\x82\xFF\xF1\xB1\x84\xFF\xF7\xB4\x89\xFF\xFC\xA3\x72\xFF\xFB\x98\x64\xFF\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\
                            # \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xE8\x95\x61\xFF\xF4\xAA\x7A\xFF\xF6\xAB\x7C\xFF\xFB\xAE\x80\xFF\xF6\x9F\x6D\xFF\xF9\x96\x62\xFF\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\
                            # \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xE6\x93\x5F\xFF\xFC\xA5\x73\xFF\xFF\xA7\x76\xFF\xF1\x9B\x68\xFF\xF7\x94\x60\xFF\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\
                            # \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xE4\x91\x5D\xFF\xF4\xA1\x6D\xFF\xFC\x97\x64\xFF\xF5\x92\x5E\xFF\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\
                            # \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xE2\x8F\x5B\xFF\xFA\x96\x63\xFF\xF2\x8F\x5B\xFF\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\
                            # \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xE0\x8D\x59\xFF\xF0\x8D\x59\xFF\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'''
                            
                            change_marker = '''\
                            \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xF9\xA6\x72\xFF\xF9\xA6\x72\xFF\xF9\xA6\x72\xFF\x00\x00\x00\x00\x00\x00\x00\x00\
                            \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xF7\xA4\x70\xFF\xF7\xA4\x70\xFF\xF7\xA4\x70\xFF\x00\x00\x00\x00\x00\x00\x00\x00\
                            \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xF5\xA2\x6E\xFF\xF5\xA2\x6E\xFF\xF5\xA2\x6E\xFF\x00\x00\x00\x00\x00\x00\x00\x00\
                            \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xF3\xA0\x6C\xFF\xF3\xA0\x6C\xFF\xF3\xA0\x6C\xFF\x00\x00\x00\x00\x00\x00\x00\x00\
                            \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xF1\x9E\x6A\xFF\xF1\x9E\x6A\xFF\xF1\x9E\x6A\xFF\x00\x00\x00\x00\x00\x00\x00\x00\
                            \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xEF\x9C\x68\xFF\xEF\x9C\x68\xFF\xEF\x9C\x68\xFF\x00\x00\x00\x00\x00\x00\x00\x00\
                            \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xED\x9A\x66\xFF\xED\x9A\x66\xFF\xED\x9A\x66\xFF\x00\x00\x00\x00\x00\x00\x00\x00\
                            \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xEC\x99\x65\xFF\xEC\x99\x65\xFF\xEC\x99\x65\xFF\x00\x00\x00\x00\x00\x00\x00\x00\
                            \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xEA\x97\x63\xFF\xEA\x97\x63\xFF\xEA\x97\x63\xFF\x00\x00\x00\x00\x00\x00\x00\x00\
                            \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xE8\x95\x61\xFF\xE8\x95\x61\xFF\xE8\x95\x61\xFF\x00\x00\x00\x00\x00\x00\x00\x00\
                            \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xE6\x93\x5F\xFF\xE6\x93\x5F\xFF\xE6\x93\x5F\xFF\x00\x00\x00\x00\x00\x00\x00\x00\
                            \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xE4\x91\x5D\xFF\xE4\x91\x5D\xFF\xE4\x91\x5D\xFF\x00\x00\x00\x00\x00\x00\x00\x00\
                            \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xE2\x8F\x5B\xFF\xE2\x8F\x5B\xFF\xE2\x8F\x5B\xFF\x00\x00\x00\x00\x00\x00\x00\x00\
                            \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xE0\x8D\x59\xFF\xE0\x8D\x59\xFF\xE0\x8D\x59\xFF\x00\x00\x00\x00\x00\x00\x00\x00'''
                            
                            
                            # save_marker = '''\
                            # \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x19\xA6\x72\xFF\x1A\xA7\x73\xFF\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\
                            # \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x17\xA4\x70\xFF\x18\xB6\x8B\xFF\x18\xA5\x71\xFF\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\
                            # \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x15\xA2\x6E\xFF\x1E\xCA\xA8\xFF\x14\xB3\x87\xFF\x16\xA3\x6F\xFF\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\
                            # \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x13\xA0\x6C\xFF\x16\xC5\xA2\xFF\x16\xC6\xA2\xFF\x10\xB0\x83\xFF\x14\xA1\x6D\xFF\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\
                            # \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x11\x9E\x6A\xFF\x1D\xC1\x9B\xFF\x1E\xC1\x9C\xFF\x10\xC2\x9D\xFF\x1D\xAE\x81\xFF\x13\xA0\x6C\xFF\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\
                            # \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x0F\x9C\x68\xFF\x15\xBC\x95\xFF\x16\xBD\x95\xFF\x18\xBE\x97\xFF\x1B\xBF\x99\xFF\x1B\xAD\x7F\xFF\x11\x9E\x6A\xFF\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\
                            # \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x0D\x9A\x66\xFF\x1D\xB8\x8E\xFF\x1E\xB8\x8F\xFF\x10\xB9\x90\xFF\x14\xBB\x93\xFF\x19\xBE\x97\xFF\x19\xAB\x7D\xFF\x1F\x9C\x68\xFF\x00\x00\x00\x00\x00\x00\x00\x00\
                            # \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x0C\x99\x65\xFF\x14\xB3\x87\xFF\x16\xB4\x88\xFF\x18\xB5\x8A\xFF\x1D\xB8\x8E\xFF\x12\xBA\x92\xFF\x11\xA6\x76\xFF\x1D\x9A\x66\xFF\x00\x00\x00\x00\x00\x00\x00\x00\
                            # \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x0A\x97\x63\xFF\x1C\xAE\x80\xFF\x1E\xAF\x82\xFF\x11\xB1\x84\xFF\x17\xB4\x89\xFF\x1C\xA3\x72\xFF\x1B\x98\x64\xFF\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\
                            # \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08\x95\x61\xFF\x14\xAA\x7A\xFF\x16\xAB\x7C\xFF\x1B\xAE\x80\xFF\x16\x9F\x6D\xFF\x19\x96\x62\xFF\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\
                            # \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x06\x93\x5F\xFF\x1C\xA5\x73\xFF\x1F\xA7\x76\xFF\x11\x9B\x68\xFF\x17\x94\x60\xFF\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\
                            # \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x04\x91\x5D\xFF\x14\xA1\x6D\xFF\x1C\x97\x64\xFF\x15\x92\x5E\xFF\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\
                            # \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x8F\x5B\xFF\x1A\x96\x63\xFF\x12\x8F\x5B\xFF\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\
                            # \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x8D\x59\xFF\x10\x8D\x59\xFF\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'''
                            
                            save_marker = '''\
                            \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x19\xA6\x72\xFF\x19\xA6\x72\xFF\x19\xA6\x72\xFF\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\
                            \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x17\xA4\x70\xFF\x17\xA4\x70\xFF\x17\xA4\x70\xFF\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\
                            \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x15\xA2\x6E\xFF\x15\xA2\x6E\xFF\x15\xA2\x6E\xFF\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\
                            \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x13\xA0\x6C\xFF\x13\xA0\x6C\xFF\x13\xA0\x6C\xFF\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\
                            \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x11\x9E\x6A\xFF\x11\x9E\x6A\xFF\x11\x9E\x6A\xFF\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\
                            \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x0F\x9C\x68\xFF\x0F\x9C\x68\xFF\x0F\x9C\x68\xFF\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\
                            \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x0D\x9A\x66\xFF\x0D\x9A\x66\xFF\x0D\x9A\x66\xFF\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\
                            \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x0C\x99\x65\xFF\x0C\x99\x65\xFF\x0C\x99\x65\xFF\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\
                            \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x0A\x97\x63\xFF\x0A\x97\x63\xFF\x0A\x97\x63\xFF\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\
                            \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08\x95\x61\xFF\x08\x95\x61\xFF\x08\x95\x61\xFF\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\
                            \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x06\x93\x5F\xFF\x06\x93\x5F\xFF\x06\x93\x5F\xFF\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\
                            \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x04\x91\x5D\xFF\x04\x91\x5D\xFF\x04\x91\x5D\xFF\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\
                            \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x8F\x5B\xFF\x02\x8F\x5B\xFF\x02\x8F\x5B\xFF\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\
                            \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x8D\x59\xFF\x00\x8D\x59\xFF\x00\x8D\x59\xFF\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'''
                            
                            
                            MARKER_CHANGE = 15
                            MARKER_CHANGE_MASK = 1<<MARKER_CHANGE
                            MARKER_SAVED = 14
                            MARKER_SAVED_MASK = 1<<MARKER_SAVED
                            
                            def setup():
                                editor1.rGBAImageSetWidth(14)
                                editor1.rGBAImageSetHeight(14)
                                editor1.markerDefineRGBAImage(MARKER_CHANGE, change_marker)
                                editor1.markerDefineRGBAImage(MARKER_SAVED, save_marker)
                                editor1.setMarginTypeN(3, MARGINTYPE.SYMBOL)
                                editor1.setMarginWidthN(3, 16)
                                editor1.setMarginMaskN(3, MARKER_CHANGE_MASK | MARKER_SAVED_MASK)
                                editor2.rGBAImageSetWidth(14)
                                editor2.rGBAImageSetHeight(14)
                                editor2.markerDefineRGBAImage(MARKER_CHANGE, change_marker)
                                editor2.markerDefineRGBAImage(MARKER_SAVED, save_marker)
                                editor2.setMarginTypeN(3, MARGINTYPE.SYMBOL)
                                editor2.setMarginWidthN(3, 16)
                                editor2.setMarginMaskN(3, MARKER_CHANGE_MASK | MARKER_SAVED_MASK)
                            
                            
                            def locnav_filesaved(args):
                                marker_line = editor.markerNext(0, MARKER_CHANGE_MASK)
                                while marker_line >= 0:
                                    editor.markerDelete(marker_line, MARKER_CHANGE)
                                    if editor.markerGet(marker_line) & MARKER_SAVED_MASK == 0:
                                        editor.markerAdd(marker_line, MARKER_SAVED)
                                    marker_line = editor.markerNext(marker_line, MARKER_CHANGE_MASK)
                            
                            
                            def locnav_modified(args):
                                current_line = editor.lineFromPosition(args['position'])
                                current_marker_mask = editor.markerGet(current_line)
                                lines_added = args['linesAdded']
                                length = args['length']
                             
                                if lines_added == 0:
                                    if current_marker_mask & MARKER_CHANGE_MASK:
                                        return
                                    if current_marker_mask & MARKER_SAVED_MASK:
                                        editor.markerDelete(current_line, MARKER_SAVED)
                                    editor.markerAdd(current_line, MARKER_CHANGE)
                                elif lines_added > 0:
                                    last_line = editor.lineFromPosition(args['position'] + length)
                                    for i in range(current_line, last_line+1):
                                        editor.markerAdd(i, MARKER_CHANGE)
                            
                                else:  # delete multiple lines
                                    pass
                             
                            
                            setup()
                            notepad.callback(locnav_filesaved, [NOTIFICATION.FILESAVED])
                            editor.callbackSync(locnav_modified, [SCINTILLANOTIFICATION.MODIFIED])
                            
                            
                            Alan KilbornA 1 Reply Last reply Reply Quote 2
                            • Alan KilbornA
                              Alan Kilborn @Ekopalypse
                              last edited by Alan Kilborn

                              @Ekopalypse said:

                              So, this script is only useful on normal text editing actions but NOT for huge change sets.

                              It’s OK. That’s really only where it is useful anyway. :)

                              I gave it a brief go, it seemed to hang N++ when I saved, probably some interaction with something else (not LN–I disabled that first) I’ve got running. Will give it a deeper look when I get a chance…

                              Thanks for taking on this task! :)

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

                                @Alan-Kilborn

                                it seemed to hang N++ when I saved …

                                happened to me as well one time - interesting, so it must be the script - thought it might
                                be me doing registering callback, deleting callback … over and over for testing
                                Did you do something similar perhaps?

                                Btw. I’m currently trying to figure out how one could easily assign a shortcut from script

                                shortcut_dict = {}
                                
                                def register_shortcut(shortcut):
                                    def decorator(function):
                                        if shortcut not in shortcut_dict:
                                            shortcut_dict[shortcut] = function
                                            print 'shortcut', shortcut, 'assigned to', function.__name__
                                        else:
                                            print 'shortcut {} already assigned to funtion {}'.format(shortcut, shortcut_dict[shortcut])
                                    return decorator
                                
                                
                                # important to note that this function cannot be called from within the script
                                @register_shortcut('CTRL+-')
                                def test():
                                    print 'test_it'
                                    
                                # test()  <--- that does not work
                                

                                run this the first time, then comment the shortcut_dict = {} line and run it a second time. Finally call shortcut_dict['CTRL+-']() from the console

                                The only thing left is to hook the scintilla hwnd :-)

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

                                  @Ekopalypse said:

                                  Did you do something similar perhaps?

                                  No, but I have a lot of other cute scripts running, will have to dig in and disable some for this testing.

                                  run this the first time, then comment the shortcut_dict = {} line and run it a second time

                                  why not?:

                                  try:
                                      shortcut_dict
                                  except NameError:
                                      shortcut_dict = {}
                                  
                                  EkopalypseE 1 Reply Last reply Reply Quote 1
                                  • EkopalypseE
                                    Ekopalypse @Alan Kilborn
                                    last edited by Ekopalypse

                                    @Alan-Kilborn

                                    why not …

                                    LOL because my brain doesn’t work like that :-D
                                    First I type something and then if it works I try to optimize it,
                                    but have posted it before even thinking about doing it properly :-D

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

                                      @Ekopalypse said:

                                      The only thing left is to hook the scintilla hwnd

                                      Yes, but there are some caveats. I tried this kind of thing before. If same shortcut is already mapped in Shortcut Mapper, you won’t see it. Not sure if this matters to you, could be a point of confusion for your users (as you now seem to be publishing! :) )

                                      BTW, this thread is now officially deemed hijaaked, not once but now twice.

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

                                        @Alan-Kilborn

                                        If same shortcut is already mapped in Shortcut Mapper

                                        I would argue if you register a shortcut within a script you know that you did it?
                                        But you are right - might be a area of confusion - hmm …

                                        I guess, once I have something useful I will open a different thread :-)

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

                                          @Ekopalypse said:

                                          I would argue if you register a shortcut within a script you know that you did it?

                                          People tend to just run scripts, forgetting the details… :(

                                          And, BTW, I HATE plugins (and maybe in the future, scripts!) that hijaak keycombos I’m possibly already using. Ugh. Better to leave them unassigned and let ME decide which functions need them, and then what they should be.

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

                                            @Alan-Kilborn

                                            Better to leave them unassigned and let ME decide which functions need them, and then what they should be.

                                            Agreed, I assume that something like

                                            PREVIOUS_CHANGE = None  # replace None with e.g. CTRL+- to assign a shortcut
                                            @register_shortcut(PREVIOUS_CHANGE)
                                            

                                            and checking in register_shortcut for None would be ok.

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