Community
    • Login

    highliters function

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    16 Posts 3 Posters 9.4k 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.
    • Stefano RiccardiS
      Stefano Riccardi
      last edited by

      hello Claudia, it doesn’t work. I think that these delimiters are something other.

      1 Reply Last reply Reply Quote 0
      • pnedevP
        pnedev
        last edited by

        Hi @Stefano-Riccardi and @Claudia-Frank,

        The delimiters Claudia mentions actually work when you hold Ctrl key and double-left-click on a text. Everything in between the two delimiters set in Settings->Preferences->Delimiter gets selected.

        Stefano, that could be used if you specify the char immediately preceding and the char immediately following your text (neither should be present in the text you are about to select).
        For example if you have ‘<00:01:02:03>’ and specify as start delimiter the symbol ‘<’ and as stop - ‘>’ when you hold down Ctrl and double-left-click ‘inside’ 00:01:02:03 it would be selected.
        It is not exactly what you are looking for but could possibly be of use.

        Scintilla itself has the setting you mention but I haven’t seen an option in Notepad++ where you can change that.

        Regards,
        Pavel

        1 Reply Last reply Reply Quote 0
        • Stefano RiccardiS
          Stefano Riccardi
          last edited by

          thank you very much pnedev, now it is all clear.
          But unfortunely I need to choose which delemiter to use, more than one.

          Now I want to try scintilla editor, thank you all guys

          1 Reply Last reply Reply Quote 0
          • Stefano RiccardiS
            Stefano Riccardi
            last edited by

            please @pnedev can you indicate me where is the settings in SciTE ? I unable to find it :(

            1 Reply Last reply Reply Quote 0
            • pnedevP
              pnedev
              last edited by

              Hi @Stefano-Riccardi,

              It seems I have mislead you a bit with my previous post, sorry for that.
              By “Scintilla” I meant not the SciTE editor but the internal Notepad++ editor engine.
              Unfortunately you (as a user) cannot configure this. It is not difficult from programmatic perspective as this configuration is already a part of the editor engine.
              That’s what I meant.

              Best Regards,
              Pavel

              1 Reply Last reply Reply Quote 0
              • Claudia FrankC
                Claudia Frank
                last edited by Claudia Frank

                @Stefano-Riccardi and @pnedev,

                it actually is working when using space as the delimiter.
                If there is a need to specify more delimiter to be treaten as wordpart then
                you need to extend the Wordchars which can be done using python script plugin
                and a script like

                chars = editor.getWordChars() + “@#_()[]”
                editor.setWordChars(chars)

                Cheers
                Claudia

                1 Reply Last reply Reply Quote 0
                • Stefano RiccardiS
                  Stefano Riccardi
                  last edited by

                  Thank you guys, I am very grateful.

                  @Claudia-Frank I am not a programmer, but if you can tell me more information about the script I can try.
                  If it is too difficult … peace :)

                  Claudia FrankC 1 Reply Last reply Reply Quote 0
                  • Claudia FrankC
                    Claudia Frank @Stefano Riccardi
                    last edited by

                    @Stefano-Riccardi

                    it depends what exactly you want to achieve.
                    Should every document which gets opened be extended with additional chars or
                    is it just a few which maybe have in common the file extension or is it more like
                    now there is a document which needs this situation?
                    First thing you need to do is to install the python script plugin either by using plugin manager or,
                    because it way already reported that it happens that installation failed, using the msi from the website.

                    Then we need to write a script, which depends on your requirements.

                    Cheers
                    Claudia

                    1 Reply Last reply Reply Quote 0
                    • Stefano RiccardiS
                      Stefano Riccardi
                      last edited by

                      @Claudia-Frank

                      I would like that every document opened be extended with additional chars.

                      I installed Pyithon plugin :)

                      Claudia FrankC 1 Reply Last reply Reply Quote 0
                      • Claudia FrankC
                        Claudia Frank @Stefano Riccardi
                        last edited by

                        @Stefano-Riccardi

                        Having python script installed gives you two ways to execute the needed python script.
                        Either by doing it manually or by letting it execute when python script starts.
                        The latter is done by changing the configuration Plugins->Python Script->Configuration
                        At the bottom there is a dropbox called Initialisation which has per default Lazy
                        and needs to be changed to ATSTARTUP.
                        This means when npp starts, a users startup.py gets executed as well.
                        Let’s create this startup.py goto Plugins->Python Script->New Script and name it, well, startup.py.
                        Put the code from below into it and save it. Restart npp.
                        type something like test:test in a temporary file and double click on it -> if everything went ok, it should be highlighted completely.

                        So, what does the script. It registers two callbacks, one which gets called when notepad starts (callback_READY)
                        and one which gets called whenever you open/switch to a new tab (callback_BUFFERACTIVATED). In both cases the
                        function extendWordChar will be called.

                        additionalChars is the only place where you need to modify it to your needs.
                        Currently only colon has been defined as an additional wordchar.
                        If you wan’t for example ? and [ as well as ] to be added then change

                        additionalChars = ':'
                        

                        to

                        additionalChars = ':?[]'
                        

                        done.

                        One word of warning, python is strict about tabbing, which means you
                        need to indent code to make it run and in addition the tabs must be either
                        a tab control char or spaces but not both mixed. In python community there is a silent
                        agreement that spaces should be used but real tabs would work also.

                        def extendWordChar():
                            additionalChars = ':'
                            chars = editor.getWordChars()
                            if additionalChars not in chars:
                                editor.setWordChars(chars + additionalChars)
                        
                        def callback_READY(args):
                            extendWordChar()
                            
                        def callback_BUFFERACTIVATED(args):
                            extendWordChar()
                        
                        notepad.clearCallbacks([NOTIFICATION.BUFFERACTIVATED ])
                        notepad.callback(callback_BUFFERACTIVATED, [NOTIFICATION.BUFFERACTIVATED ])
                        notepad.callback(callback_READY, [NOTIFICATION.READY ])
                        

                        Did I forget something? Most likely but if there is something you wanna know, let me know ;-)

                        Cheers
                        Claudia

                        1 Reply Last reply Reply Quote 0
                        • Stefano RiccardiS
                          Stefano Riccardi
                          last edited by

                          Hello @Claudia-Frank ,
                          I am very gratefull for your help ! sorry for delay but I was very busy.

                          Anyway, I created Phyton script and I copied and pasted your script, I checked tabbing. I restarted NP++, at start a pop up warn “Exception: Unknown exception”, I push ok and I tested hilighters function unsuccesfully.

                          Can you still help me ?
                          thank you

                          Claudia FrankC 1 Reply Last reply Reply Quote 0
                          • Claudia FrankC
                            Claudia Frank @Stefano Riccardi
                            last edited by

                            Hello @Stefano-Riccardi,

                            what you describe sounds like an incomplete installation of python script plugin.
                            I assume you installed it by using plugin manager, didn’t you?
                            May I ask you to use the msi instead?

                            Cheers
                            Claudia

                            1 Reply Last reply Reply Quote 0
                            • Stefano RiccardiS
                              Stefano Riccardi
                              last edited by

                              ooh sorry yes I use Scrip manager. I try remove all and reinstall it using your link… I update you…

                              1 Reply Last reply Reply Quote 0
                              • Stefano RiccardiS
                                Stefano Riccardi
                                last edited by

                                @Claudia-Frank I removed the old installation and I have installed Plugin manually and now run very well !! thank you very much you are super :)

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