• Login
Community
  • Login

Problem with style token

Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
7 Posts 3 Posters 4.7k 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.
  • M
    Markus Sulk
    last edited by Jul 13, 2021, 8:29 AM

    I often need to highlight a combination of three digits, start parentheses, some more digits and end parentheses.
    I´ve been using npp for a very long time and this has never been any problem, just until now. As soon as I mark the start parentheses, it´s not possible to highlight.

    421(0.248)
    This for example, I can highlight 421 and 0.248, but I can´t highlight the entire string.

    P 1 Reply Last reply Jul 13, 2021, 1:06 PM Reply Quote 0
    • P
      PeterJones @Markus Sulk
      last edited by PeterJones Jul 13, 2021, 1:07 PM Jul 13, 2021, 1:06 PM

      @Markus-Sulk ,

      Could you be more specific?

      • What version are you using (?-menu, Debug Info)
      • How are you trying to apply the “style token” or “mark” (Notepad++ has many similar concepts with similar names)

      Because you said “style token”, I thought maybe Search > Mark One > Using 1st Style, which works:
      e4f8d9a9-e710-4bb1-b544-5ad054d580dd-image.png

      Or, select the first 421(0.248) when there are multiple instances of that in the document, then Search > Mark All > Using 1st Style, which also works:
      b17990bb-78f7-4f2f-adca-f40dc068bcda-image.png

      But maybe you mean the smart highlighting, where you select one instance, it will temporarily highlight all the matches. If I do that on the 421 or on the 248, it does the highlighting:
      1160c431-cc2a-4a7e-a106-1a321bd1a9dd-image.png
      36eb13c9-8c45-4750-a389-84c09ea44f90-image.png
      … but if I cross over the . in 0.248 or across a parenthesis, then it won’t:
      23b985c4-5dd3-416b-857f-fd461c4f5885-image.png
      … As you might be able to guess from my wider screenshot, which shows Settings > Preferences > Highlighting, I am about to show you that by un-checking the Smart Highlighting > Matching > ☐ Match whole word only, it will go back to working, even if you cross a boundary:
      217775c0-8c33-45bf-9a55-325acd82861b-image.png
      30119782-f5ea-486b-b4f9-53a785280bf8-image.png

      Hope this helps

      1 Reply Last reply Reply Quote 2
      • M
        Markus Sulk
        last edited by Jul 14, 2021, 9:40 AM

        Thanks for your reply.

        I´ve got different versions of npp. On one server this is the version:

        2c790c70-ade7-44b8-be04-38f1202778ca-image.png

        Here everything works just fine, just the way I want it. Default settings does the job;

        a8030326-f9e8-4f7f-8b53-cf86fdd7ebe2-image.png

        873(0.59) is highlighted with style token nr 1. This is with match whole word only ticked.

        As you can see, just marking it wont highlight it:

        b302d1ca-acee-4d72-b977-60d6d06e6a8e-image.png

        Although giving it a style token works.

        Then I have another server with this version:

        b095716f-4128-4e80-9bd1-d47b40a47560-image.png

        This is where it gets very strange. :-)

        25f1e763-b4d5-475c-a696-5014a2aee61c-image.png

        I´ve copied 421(0.248) from row 6 to row nr 1, so the format is the very same.

        If I mark the first row, it doesn´t get highlighted:

        88dfc212-f4fd-4ba0-975d-1e2331acd62f-image.png

        These are the settings:
        5d5783cd-1ae2-4baa-a13e-e5d9ada92657-image.png

        If I mark the same string on row 6, it still doesn´t get highlighted:

        334bfa4e-c91a-478a-ae9e-af29b1557955-image.png

        This is as it´s supposed to due to my settings.

        However, if I mark the first row and add a style token to it, it works, but just at the very first row:

        6bf8e482-f246-4639-956b-fb953fcae38b-image.png

        6157a1fd-81aa-4a2a-b318-2a659cf395ad-image.png

        I figured the : might have something to do with it so once again I copied the string from row 6, including the :.

        6cf6ef61-14c2-4b35-aa9c-d3027eec3dd2-image.png

        Then I get this strange result:

        001a80fd-5d95-4e4b-8bbd-af1d7b7ec074-image.png

        As you can see, row 4 is marked, but the token only applied to the string on row 1.

        This just beats me :-)

        1 Reply Last reply Reply Quote 0
        • E
          Ekopalypse
          last edited by Ekopalypse Jul 14, 2021, 10:05 AM Jul 14, 2021, 10:03 AM

          @Markus-Sulk

          For the selecting issue:
          on the server where it is working, check the “word character list”

          b8ad3dac-6a19-4a27-a07f-e28e8b1356fa-image.png

          I assume this has been modified.

          The styling issue looks like it is a bug.
          Fresh 8.1.1 version behaves like reported.

          d328a0fb-76ef-46a6-8f16-a291310ce647-image.png

          P 1 Reply Last reply Jul 14, 2021, 1:09 PM Reply Quote 2
          • P
            PeterJones @Ekopalypse
            last edited by Jul 14, 2021, 1:09 PM

            This post is deleted!
            1 Reply Last reply Reply Quote 1
            • P
              PeterJones
              last edited by PeterJones Jul 14, 2021, 1:39 PM Jul 14, 2021, 1:39 PM

              @Markus-Sulk ,

              Please note that your right-click context menu appears to be out of date, compared to my fresh unzips of v8.0, v8.1 and v8.1.1: There should be both “Style all occurrences of token” and “Style one token”
              0f54b780-d335-4dd3-a406-7ff523bb6ca5-image.png
              (These line up with the v8.x menu system of Search > Mark All and Search > Mark One that I referenced in my first reply.)

              When you look at contextMenu.xml (Settings > Edit popup contextMenu), you should have both these groups:

                      <Item FolderName="Style all occurrences of token" id="43022"/>
                      <Item FolderName="Style all occurrences of token" id="43024"/>
                      <Item FolderName="Style all occurrences of token" id="43026"/>
                      <Item FolderName="Style all occurrences of token" id="43028"/>
                      <Item FolderName="Style all occurrences of token" id="43030"/>
              		
                      <Item FolderName="Style one token" id="43062"/>
                      <Item FolderName="Style one token" id="43063"/>
                      <Item FolderName="Style one token" id="43064"/>
                      <Item FolderName="Style one token" id="43065"/>
                      <Item FolderName="Style one token" id="43066"/>
              

              If you only have one group (probably with id=“43022”-“43030” but a different FolderName), then you’ll want to paste the ones I just posted overtop, save, exit Notepad++, and re-run Notepad++. Now your right-click context menu should have both “style all occurrences of token” and “style one token”.

              -----
              I originally had a different reply posted after this, but some experiments after I posted proved that the rest of what I said was wrong, so I deleted it.
              -----

              New experiments show that it’s still affected by the checkmarks in the Preferences > Highlighting settings.

              1. Paste in data:

                421(0.248)
                
                13:09.69.51-900: 421(0.248):
                13:09.69.51-900: 421(0.248)
                13:09.69.51-900: 421(0.248):
                13:09.69.51-900: 421(0.248)
                13:09.69.51-900: 421(0.248):
                13:09.69.51-900: 421(0.248)
                13:09.69.51-900: 421(0.248):
                13:09.69.51-900: 421(0.248)
                

                Note: some have colons after, some do not; this is important to show my point

              2. Take the default settings in Preferences > Highlighting, select one without the colon and try to select one without the colon: It will not show any smart-match highlighting, and will only apply the marking-style to the ones without colons:

              3. Change Preferences > Highlighting to un-check Mark All > ☐ Match whole word only: now if you select one without the colon: it will still not show any smart-match highlighting, but will apply to the marking-style to the ones with and without colons:

              4. I won’t do a third video, but if you also un-check Smart Highlighting > Matching > ☐ Match whole word only, it will do the green smart-matching while you’re selecting it, even when you cross a boundary (like I showed in my original static screenshots)

              There is a section in the manual about how the Highlighting preferences affect things, but given that “Mark” has two meanings in Notepad++ (Search > Mark… which has a Mark All button, vs Search > Mark All/Search > Mark One which are called Style all…/Style one… in the right-click context menu), that may be ambiguous as to which is meant for that preference.

              M 1 Reply Last reply Jul 23, 2021, 6:28 AM Reply Quote 3
              • M
                Markus Sulk @PeterJones
                last edited by Jul 23, 2021, 6:28 AM

                @PeterJones
                Thank you so very much for your time and effort!
                Now I can make sure that npp works in the way I want it to.

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