Community
    • Login

    Selected text

    Scheduled Pinned Locked Moved General Discussion
    32 Posts 4 Posters 2.3k 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 @Ruud Schmeitz
      last edited by

      @Ruud-Schmeitz said in Selected text:

      where did you find the Pythonscript ?

      Not sure I understand the question, exactly.
      It isn’t much of a script, it is just a one-liner that mimics the Scintilla command SCI_SETSELEOLFILLED.
      If you can elaborate more on what you mean, I’ll certainly try to answer…

      I’m looking for a way to change the ‘White space symbol’

      I don’t think you reasonably can do this.
      What’s wrong with the existing one?
      What would you change it to?

      Ruud SchmeitzR 1 Reply Last reply Reply Quote 0
      • Ruud SchmeitzR
        Ruud Schmeitz @Alan Kilborn
        last edited by

        Not sure I understand the question, exactly.
        It isn’t much of a script, it is just a one-liner that mimics the Scintilla command SCI_SETSELEOLFILLED.
        If you can elaborate more on what you mean, I’ll certainly try to answer…

        I clicked on the link , and the Scintilla-page sort of answers my question .
        This is new to me . Are all those Scintilla-commands available for Notepad++ ?

        I don’t think you reasonably can do this.
        What’s wrong with the existing one?
        What would you change it to?

        The dots in the middle of the space-character can be a bit confusing . Changing the color of the White space symbols is not always enough .
        I would rather have (a small version of) the underscore as White space symbol .

        1 Reply Last reply Reply Quote 0
        • PeterJonesP
          PeterJones @Ruud Schmeitz
          last edited by

          @Ruud-Schmeitz,

          where did you find the Pythonscript

          All the PythonScript commands are found in the Plugins > Python Script > Context-Help which is bundled with the PythonScript plugin; that menu command opens a local set of HTML files in your default web browser; in the table of contents on the left, the Notepad++ Object and Editor Object pages will be the ones you use for finding out what goes with notepad.* and editor.*

          I’m looking for a way to change the ‘White space symbol’

          As far as I can tell, it’s not a “symbol”, per se. SCI_WHITESPACESIZE calls them “dots”. The size is 0 for invisible, or 2 when you turn on viewing whitespace. But when you change the size, using the PythonScript editor.setWhitespaceSize(size) command, you see that it’s likely not a symbol/character; it appears that PythonScript is drawing a size ✕ size square – and if you set size bigger than about half the font height, the “dots” start blending together.

          So if your goal in changing the “symbol” is to make them slightly bigger, you can just use editor.setWhitespaceSize(size) to change the dimensions of the “dot”.

          Otherwise, you can use SCI_SETREPRESENTATION through editor.setRepresentation(' ', 'SP'), and it will change the visual display of the space character to SP in a black box. Change the 'SP' to a string containing whatever black-boxed character(s) you’d like to see. (This is technically not part of the view-whitespace setting; however, it accomplishes the goal of changing what you see instead of the dot.) If you want to undo this change, use editor.clearRepresentation(' ')

          Ruud SchmeitzR 3 Replies Last reply Reply Quote 3
          • Ruud SchmeitzR
            Ruud Schmeitz @PeterJones
            last edited by

            @PeterJones said in Selected text:

            All the PythonScript commands are found in the Plugins > Python Script > Context-Help which is bundled with the PythonScript plugin; that menu command opens a local set of HTML files in your default web browser; in the table of contents on the left, the Notepad++ Object and Editor Object pages will be the ones you use for finding out what goes with notepad.* and editor.*

            I tried your suggestion , Peter :
            Plugins > Python Script > Context-Help

            but instead of the PythonScript commands , I got this error-message :
            Error - Cannot open file.png

            Despite the error-message , the folder does exist !

            So I double-clicked on file index.html in folder :
            C:\Program Files\Notepad++\plugins\PythonScript\doc
            and got the information you described .

            I’m not sure what caused the error . It could be the space in C:\Program Files… .

            PeterJonesP EkopalypseE 2 Replies Last reply Reply Quote 1
            • PeterJonesP
              PeterJones @Ruud Schmeitz
              last edited by

              @Ruud-Schmeitz ,

              It looks like it’s building the path incorrectly, with the c:\program files\notepad++\ portion twice in the path, which isn’t going to work.

              You might want to go to the PythonScript repo and report that as a minor issue.

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

                @Ruud-Schmeitz

                May ask you how you installed PythonScript plugin and which
                version you are using (either use about from the menu or the
                output from the console)?
                I remember seeing this strange path in an older version of PS,
                but should be fixed already.

                Ruud SchmeitzR 1 Reply Last reply Reply Quote 1
                • Ruud SchmeitzR
                  Ruud Schmeitz @Ekopalypse
                  last edited by

                  @Ekopalypse said in Selected text:

                  @Ruud-Schmeitz

                  May ask you how you installed PythonScript plugin and which
                  version you are using (either use about from the menu or the
                  output from the console)?
                  I remember seeing this strange path in an older version of PS,
                  but should be fixed already.

                  This is how I installed Python Script :
                  • start Notepad++
                  • in menubar , click on Plugins
                  • in list , click on Plugins Admin…
                  • in list , select PythonScript
                  • click on Install

                  and this is the version I’m using :
                  Python Script version.png

                  EkopalypseE 2 Replies Last reply Reply Quote 1
                  • EkopalypseE
                    Ekopalypse @Ruud Schmeitz
                    last edited by

                    @Ruud-Schmeitz

                    Thanks, yes, that is the latest stable version.
                    Hmm strange - I’ll have to do some tests.

                    1 Reply Last reply Reply Quote 1
                    • EkopalypseE
                      Ekopalypse @Ruud Schmeitz
                      last edited by

                      @Ruud-Schmeitz

                      Seems to work for me.
                      Can you do me another favor and post your debug-info
                      which is available from the last menu entry, the ? menu?

                      Ruud SchmeitzR 1 Reply Last reply Reply Quote 1
                      • Ruud SchmeitzR
                        Ruud Schmeitz @Ekopalypse
                        last edited by

                        @Ekopalypse said in Selected text:

                        @Ruud-Schmeitz

                        Seems to work for me.
                        Can you do me another favor and post your debug-info
                        which is available from the last menu entry, the ? menu?

                        The requested debug-info :
                        Debug Info.png

                        EkopalypseE 1 Reply Last reply Reply Quote 1
                        • Ruud SchmeitzR
                          Ruud Schmeitz @PeterJones
                          last edited by

                          This post is deleted!
                          1 Reply Last reply Reply Quote 0
                          • Ruud SchmeitzR
                            Ruud Schmeitz @PeterJones
                            last edited by

                            @PeterJones said in Selected text:

                            Otherwise, you can use SCI_SETREPRESENTATION through editor.setRepresentation(' ', 'SP'), and it will change the visual display of the space character to SP in a black box. Change the 'SP' to a string containing whatever black-boxed character(s) you’d like to see. (This is technically not part of the view-whitespace setting; however, it accomplishes the goal of changing what you see instead of the dot.) If you want to undo this change, use editor.clearRepresentation(' ')

                            Like I wrote before , I’m looking for a way to use (a small version of) the underscore as White space symbol .

                            In the Python Script documentation :
                            file:///C:/Program%20Files/Notepad++/plugins/PythonScript/doc/scintilla.html#scintilla-methods

                            I found 3 promising Python Script commands to achieve this :
                            editor.setRepresentation(encodedCharacter, representation)
                            editor.setWhitespaceFore(useSetting, fore)
                            editor.setWhitespaceBack(useSetting, back)

                            Then I did some testing (I used ‘-’ instead of ‘_’ for testing purposes) .

                            Original code :
                            code - Orig.png

                            Script 1
                            editor.setRepresentation(’ ', ‘-’)
                            editor.setWhitespaceFore(1,( 64, 64, 64))
                            editor.setWhitespaceBack(1,(255,255,255))

                            Result after running Script 1 :
                            code - PyScript01.png
                            • the first command has been executed
                            • the second and third have been ignored

                            Script 2
                            editor.setWhitespaceFore(1,( 64, 64, 64))
                            editor.setWhitespaceBack(1,(224,224,224))
                            editor.setRepresentation(’ ', ‘-’)

                            Result after running Script 2:
                            code - PyScript02.png
                            • the first and second command have been executed .
                            • the third has been ignored .

                            I’m obviously doing something wrong .
                            Are those commands commands mutually exclusive ?

                            Alan KilbornA PeterJonesP 2 Replies Last reply Reply Quote 0
                            • Alan KilbornA
                              Alan Kilborn @Ruud Schmeitz
                              last edited by

                              @Ruud-Schmeitz

                              A bit off the trail of this thread now, but when you said:

                              The dots in the middle of the space-character can be a bit confusing . Changing the color of the White space symbols is not always enough .
                              I would rather have (a small version of) the underscore as White space symbol .

                              My reply to that is: I don’t know if you’ll be able to achieve something for this that isn’t overwhelmingly intrusive.

                              I thought of maybe a “squiggle” like spell-checker plugins use for misspelled words; could be the best thing (IMO) here, but it seems like that would make knowing how many whitespace characters are there a bit difficult…

                              Ruud SchmeitzR 1 Reply Last reply Reply Quote 1
                              • PeterJonesP
                                PeterJones @Ruud Schmeitz
                                last edited by

                                @Ruud-Schmeitz said in Selected text:

                                Are those commands commands mutually exclusive ?

                                Effectively, yes. Because the setWhitespaceX commands affect the dot-drawing; when you have a representation for the ASCII space character, then it is not displaying the dot-drawing, it is displaying that character in the black-box reverse-video representation. I don’t think there’s a way to manually define the black-box stylings, but I could be wrong.

                                As to why your script 2 was still showing the whitespace dots rather than the black-box representation, I don’t know… maybe there was a typo (since you just pasted the code in the forum, rather than using the </> button to mark the code as plain text, the forum changed ASCII single-quotes into “smart ‘quotes’” some of the time, and I don’t know – maybe you had a syntax error in script 2 that you didn’t notice the error message for.

                                So, I think your choices are

                                1. Use the representation to set the black-boxed hyphen or underscore as the display character of choice for the space character, but give up on independent control of the color
                                2. Use the “dot” drawing with whatever colors you want, and maybe choosing a bigger size to make it slightly more like a small horizontal rectangle
                                3. Apply the squiggle, like Alan suggested
                                4. Rather than squiggle, maybe you could apply a normal underline feature to the normal space character – you can add extra highlighting to a builtin lexer or to a User Defined Language (UDL) using regexes via the script EnhanceAnyLexer.py that @Ekopalypse shares in his github repo. I am not sure, when using the “indicator” method that Ekopalypse shows, whether you can influence the underlining property of the match, but I would think so; if so, and you did a regex searching for the space character and applied that indicator, that might do what you want.

                                I don’t know whether any of these solutions are going to make you happy, but I think they are your best options.

                                Ruud SchmeitzR 2 Replies Last reply Reply Quote 1
                                • Ruud SchmeitzR
                                  Ruud Schmeitz @Alan Kilborn
                                  last edited by

                                  @Alan-Kilborn said in Selected text:

                                  My reply to that is: I don’t know if you’ll be able to achieve something for this that isn’t overwhelmingly intrusive.

                                  You’re right , the character replacing the White space symbol shouldn’t be intrusive : that’s why I chose the underscore .

                                  Back in the days , when you couldn’t use capitals in variable-names , the use of underscores was very common , and the result was quite readable .
                                  For example :
                                  new : ObjectPascalUserManual
                                  old : object_pascal_user_manual

                                  I thought of maybe a “squiggle” like spell-checker plugins use for misspelled words; could be the best thing (IMO) here, but it seems like that would make knowing how many whitespace characters are there a bit difficult…

                                  And again you’re right : being able to know the number of whitespaces is important . That’s why I wanted a small version of the underscore .

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

                                    @Ruud-Schmeitz said in Selected text:

                                    Back in the (old) days … old : object_pascal_user_manual

                                    I guess I am trapped in the “old days” as this is still my preferred way to name things, in Python.

                                    1 Reply Last reply Reply Quote 0
                                    • Ruud SchmeitzR
                                      Ruud Schmeitz @PeterJones
                                      last edited by

                                      @PeterJones said in Selected text:

                                      So, I think your choices are

                                      1. Use the representation to set the black-boxed hyphen or underscore as the display character of choice for the space character, but give up on independent control of the color
                                      2. Use the “dot” drawing with whatever colors you want, and maybe choosing a bigger size to make it slightly more like a small horizontal rectangle
                                      3. Apply the squiggle, like Alan suggested
                                      4. Rather than squiggle, maybe you could apply a normal underline feature to the normal space character – you can add extra highlighting to a builtin lexer or to a User Defined Language (UDL) using regexes via the script EnhanceAnyLexer.py that @Ekopalypse shares in his github repo. I am not sure, when using the “indicator” method that Ekopalypse shows, whether you can influence the underlining property of the match, but I would think so; if so, and you did a regex searching for the space character and applied that indicator, that might do what you want.

                                      I don’t know whether any of these solutions are going to make you happy, but I think they are your best options.

                                      Thanks for your suggestions , Peter .
                                      I guess , I’ll have to do some more testing .
                                      🙂

                                      1 Reply Last reply Reply Quote 0
                                      • Ruud SchmeitzR
                                        Ruud Schmeitz @PeterJones
                                        last edited by

                                        @PeterJones said in Selected text:
                                        for.

                                        So, I think your choices are

                                        1. Use the representation to set the black-boxed hyphen or underscore as the display character of choice for the space character, but give up on independent control of the color
                                        2. Use the “dot” drawing with whatever colors you want, and maybe choosing a bigger size to make it slightly more like a small horizontal rectangle
                                          (…)
                                          I don’t know whether any of these solutions are going to make you happy, but I think they are your best options.

                                        Using the representation , resulting in colour-boxed (not only black , also gray , magenta , red etc.) characters , is unacceptable because the result is way to intrusive .

                                        So I’ve decided to go for this option :
                                        editor.setWhitespaceSize(1)
                                        editor.setWhitespaceFore(1,( 64, 64, 64))
                                        editor.setWhitespaceBack(1,(255,255,255))

                                        I hope that makes me happy .
                                        😀

                                        Ruud SchmeitzR 1 Reply Last reply Reply Quote 2
                                        • EkopalypseE
                                          Ekopalypse @Ruud Schmeitz
                                          last edited by

                                          @Ruud-Schmeitz

                                          Concerning the help page issue, I guess you suffer from this issue, don’t you?

                                          Ruud SchmeitzR 1 Reply Last reply Reply Quote 1
                                          • Ruud SchmeitzR
                                            Ruud Schmeitz @Ekopalypse
                                            last edited by

                                            @Ekopalypse said in Selected text:

                                            @Ruud-Schmeitz

                                            Concerning the help page issue, I guess you suffer from this issue, don’t you?

                                            You’re right .

                                            My HTML-files are indeed associated with N++ , and I still get the error-message with Plugins > Python Script > Context-Help .

                                            For testing purposes , I temporarily associated HTML-files with Edge (my default browser) , and then Plugins > Python Script > Context-Help correctly opens the PythonScript HTML help-files in Edge .

                                            But I prefer HTML-files associated with NPP , so as a workaround , I opened file :
                                            C:\Program Files\Notepad++\plugins\PythonScript\doc\index.html
                                            in Edge , and added the opened index-file to Favorites .

                                            Because Edge is almost always open on my PCs, this works just as quick as Plugins > Python Script > Context-Help in N++ .
                                            Perhaps even quicker ! 😄

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