Community
    • Login

    I want change style token individually

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    11 Posts 3 Posters 509 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.
    • gonyaliselimG
      gonyaliselim
      last edited by

      Hello all

      I select anything here with shortcut. When I do something wrong and want to remove it, it deletes everything. I just want what I marked to be deleted. is there a way to do this? Or is there a similar higlight tactic I can use?

      54b92f53-d132-4644-936c-dbf273b3254c-image.png

      PeterJonesP 1 Reply Last reply Reply Quote 1
      • PeterJonesP
        PeterJones @gonyaliselim
        last edited by

        @gonyaliselim ,

        Hmm, if I am correctly understanding what you are asking for, then the answer is “no”: there is not currently a way to clear the Style#N on just one token, rather than all of Style#N. That surprises me.

        Given text like
        5bfc5a2a-07dd-4363-9009-7b0299485847-image.png
        … I can see that you might want to be able to select the second three and choose something like Search > Clear Style > Clear Styles (One Token) to result in only one three having the Style cleared, but allowing the twos and the other three to stay highlighted, like:
        bcda0ae0-5709-42d8-9ce0-ba58a0ce8df5-image.png

        … And, to also be able to select one of the twos and pick something like Search > Clear Style > Clear Styles (All Occurrences of Token) , so that it can clear the Style on all instances of two without having to clear the same Style on other tokens.

        Great idea.

        If that’s a feature you would like, I would recommend reading our FAQ on making a feature request, which tells you where to go to make an official feature request. (Feel free to borrow my phrasing or images when you make the feature request.)

        If you do make an official request, please come back here and paste a link, so that people who read about your idea here can see what progress, if any, there is on the official feature request. Good luck.

        Or is there a similar higlight tactic I can use?

        As far as a workaround: I think it might be possible to remove the style from a single token using PythonScript or other scripting plugin, but I’m forgetting right now which scintilla feature Notepad++ uses for doing the background color for the Style tokens, so I cannot remember which scintilla command I would point you to. Maybe someone else will remember. (Or maybe I’ll have time later to do more research.)

        Alan KilbornA gonyaliselimG 3 Replies Last reply Reply Quote 1
        • Alan KilbornA
          Alan Kilborn @PeterJones
          last edited by

          @PeterJones said in I want change style token individually:

          but I’m forgetting right now which scintilla feature Notepad++ uses for doing the background color for the Style tokens

          Indicators.

          1 Reply Last reply Reply Quote 0
          • gonyaliselimG
            gonyaliselim @PeterJones
            last edited by

            @PeterJones yes I want remove individually on as you posted different pics and it doesnt work it just removing all highlights

            1 Reply Last reply Reply Quote 0
            • gonyaliselimG
              gonyaliselim @PeterJones
              last edited by

              @PeterJones said in I want change style token individually:

              Clear Styles (One Token)

              cant see this

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

                @gonyaliselim said in I want change style token individually:

                @PeterJones said in I want change style token individually:

                Clear Styles (One Token)

                cant see this

                You misunderstood me. I was saying “it would be nice if it gave those two new options”. You will have to put in a feature request to ask for them, because they don’t exist.

                gonyaliselimG 1 Reply Last reply Reply Quote 0
                • gonyaliselimG
                  gonyaliselim @PeterJones
                  last edited by

                  @PeterJones sad. thank you for information

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

                    It’s been discussed before, HERE.

                    PeterJonesP 1 Reply Last reply Reply Quote 1
                    • Alan KilbornA Alan Kilborn referenced this topic on
                    • PeterJonesP
                      PeterJones @Alan Kilborn
                      last edited by PeterJones

                      @Alan-Kilborn ,

                      You are right

                      @gonyaliselim ,

                      The post here by @Ekopalypse contains almost the script you would want. I would recommend modifying it to

                      from Npp import editor
                      INDICATORS = [21, 22, 23, 24, 25, 31]
                      for i in range(editor.getSelections()):
                          start = editor.getSelectionNStart(i)
                          end = editor.getSelectionNEnd(i)
                          if end-start == 0:
                              start = editor.wordStartPosition(start, True)
                              end = editor.wordEndPosition(start, True)
                          for indicator in INDICATORS:
                              editor.setIndicatorCurrent(indicator)
                              editor.indicatorClearRange(start, end-start)
                      

                      The changes I made to the script compared to the version from the old post:

                      • the original post’s script would only go to the end of the first word in each selection; mine will go from start to end of the selection (or of each selection, for multi-select mode)
                      • mine adds the feature that if you just click inside a single word (or do ctrl+click to do multiple zero-width selections), it will assume you want to clear the Style on the whole word that you clicked inside
                      • mine adds the boilerplate at the top, because some people’s PythonScript startup.py don’t import all the used objects

                      To use that script, you would follow the instructions in our PythonScript FAQ to install the PythonScript plugin. Once it’s installed (and i recommend giving it a keyboard shortcut), you can select one or more words, and run the script using the menu or shortcut, and the script will remove the style indicator(s) for any of the selected text, while leaving anything else that has that style alone – effectively implementing the Clear Styles (One Token) that I suggested. This will give you what you asked for, without asking for and waiting for a new feature to be implemented in Notepad++.

                      update: assuming you name the script ClearStylesOneToken.py, and if you use PythonScript Configuration to move it into the main PythonScript menu (like you would have done if you wanted a keyboard shortcut), then you could use <Item FolderName="Clear style" PluginEntryName="Python Script" PluginCommandItemName="ClearStylesOneToken" ItemNameAs="Clear Styles (One Token)" /> in your contextMenu.xml (using Settings > Edit Popup ContextMenu) in order to put it into your right-click context menu; if you put it right after the other FolderName="Clear style" entries in that XML, it will show up in the same submenu as the other Clear styles actions – but only in the context menu, not in the Search menu. To get it to show up, you will have to save contextMenu.xml and exit/restart Notepad++

                      But, as I said in my first reply, you really should put in the feature request, because it’s something that should be native in Notepad++. But if no one asks, it will never be implemented.

                      gonyaliselimG 1 Reply Last reply Reply Quote 2
                      • gonyaliselimG
                        gonyaliselim @PeterJones
                        last edited by gonyaliselim

                        @PeterJones

                        YOU ARE KING ! 👑

                        This Video link
                        streamable com/eq1psw

                        other question. If i add highlights when someone open that txt on his computer would can he see my highlights as it ?

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

                          @gonyaliselim said in I want change style token individually:

                          If i add highlights when someone open that txt on his computer would can he see my highlights as it

                          Sorry, no. Text files have no way to store things like highlighting – they are literally saved as just the text characters in the file. Notepad++ is not going to add any new binary commands or metadata to the file to be able to store such information (if it did, it would cease to be a text editor and instead would be a rather primitive, 80s-style word processor). [see, for reference, FAQ: Notepad++ is a Text Editor, not a Word Processor]

                          If you really needed to share the highlights, you could either print to PDF (if you don’t already have a print-to-PDF printer, you can search the internet to find a print-to-PDF driver that works for your needs), or you could use the Plugins > NppExport commands to export with the highlights to RTF or HTML (or put all formats into the clipboard, then paste into the Word Processor of your choice). But once you export to RTF or HTML or paste into a Word Processor, the file you are sending ceases to be a text file. We cannot decide for you whether or not that meets your needs.

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