• Login
Community
  • Login

How can I unmark any seperated word?

Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
18 Posts 4 Posters 3.5k 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.
  • A
    Alan Kilborn @sang heon baik
    last edited by Mar 26, 2019, 12:35 PM

    @sang-heon-baik

    Currently there is no way to “unmark” partially. As you noticed it is an all or nothing clearing of marking.

    Regarding your second question, I for one am not following what you are asking about.

    1 Reply Last reply Reply Quote 3
    • S
      sang heon baik
      last edited by Mar 27, 2019, 5:55 AM

      Then,Would you recommend any editor of notepad++ alternative which enable me to highlight Non-Contiguous word(seperated word) in two or three colors?

      M A E 3 Replies Last reply Mar 27, 2019, 9:40 AM Reply Quote 1
      • M
        Meta Chuh moderator @sang heon baik
        last edited by Meta Chuh Mar 27, 2019, 9:50 AM Mar 27, 2019, 9:40 AM

        @sang-heon-baik

        Then,Would you recommend any editor of notepad++ alternative which enable me to highlight Non-Contiguous word(seperated word) in two or three colors?

        this is a very good and nicely paradoxic question. i like. 👍

        i suppose that most users at the notepad++ community are mainly notepad++ users, and most people that have found a more suitable editor, will hang around at the community forum of their respective new editor, hence not visiting the notepad++ community.
        so even if they know which one would be best, they probably could not answer this question, due to their absence at this platform.

        so the big question is how can anyone find the most suitable editor for all own personal needs, without trying out all of them ?

        S 1 Reply Last reply Mar 28, 2019, 11:19 AM Reply Quote 1
        • A
          Alan Kilborn @sang heon baik
          last edited by Mar 27, 2019, 12:15 PM

          @sang-heon-baik said:

          Then,Would you recommend any editor of notepad++ alternative

          Nope. :)

          can’t highlight any word with two or three colors

          Well, you can do this with Search > Mark All > Using xxx Style multiple times, but you can’t partially undo it later (in relation to your first original question).

          1 Reply Last reply Reply Quote 2
          • E
            Ekopalypse @sang heon baik
            last edited by Ekopalypse Mar 27, 2019, 12:21 PM Mar 27, 2019, 12:21 PM

            @sang-heon-baik

            concerning your first request of deleting existing marks resulted from mark dialog,
            if you don’t mind to install pythonscript plugin you might be able to get around this limitation by using a script like this

            FIND_MARK_INDICATOR = 31
            for i in range(editor.getSelections()):
                start = editor.getSelectionNStart(i)
                end = editor.wordEndPosition(start, True)
                editor.setIndicatorCurrent(FIND_MARK_INDICATOR)
                editor.indicatorClearRange(start, end-start)
            

            You would either double click the word or select the whole word and run the script
            to clear the marks. Works with multiedit setting as well.

            A 1 Reply Last reply Mar 27, 2019, 12:25 PM Reply Quote 4
            • A
              Alan Kilborn @Ekopalypse
              last edited by Mar 27, 2019, 12:25 PM

              @Ekopalypse

              I was thinking of a Pythonscript, too, but then I thought what if a user marks with a regular expression…how to tell the script the regex to unmark. It gets complicated. I like yours, unmarking possible only for simple, selectable text…

              E 1 Reply Last reply Mar 27, 2019, 12:28 PM Reply Quote 3
              • E
                Ekopalypse @Alan Kilborn
                last edited by Mar 27, 2019, 12:28 PM

                @Alan-Kilborn

                user marks with a regular expression

                that what made me holding back at first glance as well but then I thought, at least
                a possible workaround even if it doesn’t fit into every possible unmark wish.
                Let’s see what OP is thinking about it. :-)

                A 1 Reply Last reply Mar 27, 2019, 12:30 PM Reply Quote 1
                • A
                  Alan Kilborn @Ekopalypse
                  last edited by Mar 27, 2019, 12:30 PM

                  @Ekopalypse

                  Yea, I often don’t do things because I see the complications right from the beginning. Or maybe more accurately, I overcomplicate it from the beginning… :)

                  E 1 Reply Last reply Mar 27, 2019, 12:33 PM Reply Quote 5
                  • E
                    Ekopalypse @Alan Kilborn
                    last edited by Mar 27, 2019, 12:33 PM

                    @Alan-Kilborn

                    maybe more accurately, I overcomplicate it from the beginning…

                    LOL :_D - A good advise which I should have known by yesterday - wink, wink

                    1 Reply Last reply Reply Quote 3
                    • S
                      sang heon baik @Meta Chuh
                      last edited by sang heon baik Mar 28, 2019, 11:21 AM Mar 28, 2019, 11:19 AM

                      @Meta-Chuh
                      It seemed that I misunderstand there must be some of veteran user in notepad++ community who have a lot of experience in text editor field So they would already known what text editor is able to highlight seperated word in two or three color.

                      @Alan-Kilborn
                      I follow your advice(Search > Mark All > Using xxx Style) but it is impossible to highlight selected word in two color. For example, If I selected just letter ‘a’ from below word, It only highlight all of letter ‘a’ in different color. I want to highlight just two or three of letter ‘a’ from below word and it must be different color each to each.

                      aaaaaaaaaaaaaaaaaaaaaaaaaa
                      aaaaaaaaaaaaaaaaaaaa
                      ssssssssssssss

                      @Ekopalypse
                      Thank you very much for your wonderful plugin,It really remove any mark which I selected.But if there is any mark which is created by Mark All command(Search > Mark All > Using xxx Style),your plugin cannot remove them…

                      E A 2 Replies Last reply Mar 28, 2019, 12:07 PM Reply Quote 0
                      • E
                        Ekopalypse @sang heon baik
                        last edited by Mar 28, 2019, 12:07 PM

                        @sang-heon-baik

                        if there is any mark which is created by Mark All command(Search > Mark All > Using xxx Style),your plugin cannot remove them…

                        You are correct, would you mind specifying how exactly you want it to behave?
                        If you just want to have a single script which clears every possible mark indicator
                        we could change it like so

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

                        but if you want to have a different behavior just let me know.

                        I want to highlight just two or three of letter ‘a’ from below word and it must be different color each to each

                        Sorry, but still confused about this.
                        Let’s assume you have a text like this

                        Just a sample text with a couple of a like in apple

                        Now if you select the a in between Just and sample,
                        you want to have automatically selected
                        a from sample,
                        a before couple,
                        a before like
                        and a in apple
                        and each of them in different color?
                        Or something else?

                        S 1 Reply Last reply Mar 28, 2019, 11:56 PM Reply Quote 2
                        • A
                          Alan Kilborn @sang heon baik
                          last edited by Mar 28, 2019, 12:21 PM

                          @sang-heon-baik said:

                          I follow your advice(Search > Mark All > Using xxx Style) but it is impossible to highlight selected word in two color. For example, If I selected just letter ‘a’ from below word, It only highlight all of letter ‘a’ in different color. I want to highlight just two or three of letter ‘a’ from below word and it must be different color each to each.

                          The feature is called “Mark all”. Thus if you highlight a single a and invoke the feature, of course it will do all of the a present.

                          Regarding “two color”, what I meant was, if you first color with, say Style1 and then you color the same thing with Style2, what will result will be a color combination of the colors of Style1 and Style2.

                          Is there still remaining confusion? I think the answer is that you can’t do what you are trying to do.

                          1 Reply Last reply Reply Quote 0
                          • S
                            sang heon baik @Ekopalypse
                            last edited by Mar 28, 2019, 11:56 PM

                            @Ekopalypse
                            your script is excellent.I am content with your script.

                            With your example of below text, I intend to highlight letter ‘a’ in between “Just” and “sample” in blue color, and to highlight letter ‘a’ in between “of” and “like” in green color.

                            Just a sample text with a couple of a like in apple

                            But As Alan Kilborn said, Notepad++ won’t support to highlight(mark) seperated word in respectively different color.So It would be impossible that your script Implement the function of my request.

                            E 1 Reply Last reply Mar 29, 2019, 12:48 PM Reply Quote 2
                            • E
                              Ekopalypse @sang heon baik
                              last edited by Mar 29, 2019, 12:48 PM

                              @sang-heon-baik

                              It would be impossible that your script Implement the function of my request.

                              That’s not exactly true.
                              It is true that Notepad++ does not provide such a function,
                              but that doesn’t mean that we can’t create it with a python script.
                              For example, putting the cursor into a word (no selection) and running this script
                              would result in marking the current word and the next 2 occurrences in different color.
                              Using style1, 2 and 3.

                              def find():
                                  current_pos = editor.getCurrentPos()
                                  start = editor.wordStartPosition(current_pos, True)
                                  end = editor.wordEndPosition(current_pos, True)
                                  text = editor.getTextRange(start, end)
                                  document_end_pos = editor.getTextLength()
                                  while start:
                                      yield start, end
                                      pos = editor.findText(0, end, document_end_pos, text)
                                      if pos is None:
                                          break
                                      start, end = pos
                                  
                              
                              _find = find()
                              number_of_matches = 3
                              try:
                                  for i in range(number_of_matches ):
                                      start, end = next(_find)
                                      editor.setIndicatorCurrent(21+i)
                                      editor.indicatorFillRange(start, end-start)
                              except StopIteration:
                                  pass
                              
                              A 1 Reply Last reply Mar 29, 2019, 12:50 PM Reply Quote 3
                              • A
                                Alan Kilborn @Ekopalypse
                                last edited by Mar 29, 2019, 12:50 PM

                                @Ekopalypse said:

                                marking the current word and the next 2 occurrences in different color

                                It can be done, but is there value in that? Not sure I’m following what the OP’s true end-goal is, and how something like that helps.

                                E 1 Reply Last reply Mar 29, 2019, 12:52 PM Reply Quote 1
                                • E
                                  Ekopalypse @Alan Kilborn
                                  last edited by Mar 29, 2019, 12:52 PM

                                  @Alan-Kilborn

                                  I agree, I can’t see the benefit too but I hope the OP will clarify why this is a good thing.
                                  :-)

                                  1 Reply Last reply Reply Quote 1
                                  • A Alan Kilborn referenced this topic on Oct 17, 2024, 3:27 PM
                                  • A
                                    Alan Kilborn
                                    last edited by Oct 17, 2024, 3:29 PM

                                    Similar topic HERE.

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