• Login
Community
  • Login

How to highlight lines with color one by one?

Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
22 Posts 7 Posters 3.8k 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
    Michael Vincent @Alan Kilborn
    last edited by Jan 20, 2022, 9:17 PM

    @alan-kilborn said in How to highlight lines with color one by one?:

    I was wondering if @dail or @michael-vincent could shed some light here?

    Changed Lines uses markers 10 (changes) and 11 (saves). I don’t think I leave that customizable - you can change the marker “type”, but not the ID. Markers I think are cumulative, that is the marker is basically a 32-bit binary number where I’m flipping bits 10 and 11 for ChangedLines and you’re flipping bit 0 or 7 (if I read your post correctly). The markers aren’t supposed to interfere with each other - seems you’re using SC_MARK_FULLRECT for ChangedLines and SC_MARK_BACKGROUND for your script.

    Cheers.

    A 1 Reply Last reply Jan 20, 2022, 9:21 PM Reply Quote 1
    • A
      Alan Kilborn @Michael Vincent
      last edited by Alan Kilborn Jan 20, 2022, 9:23 PM Jan 20, 2022, 9:21 PM

      @michael-vincent said in How to highlight lines with color one by one?:

      if I read your post correctly

      I believe you did.

      So what you’ve said and what I know indicates there should be no interference. Hmmm…

      Maybe @dail will have some insight. Thanks for yours.

      Free marker (and indicator) allocation could be handled better by N++. It seems like there should be a “pool” and N++ could hand them out when a plugin (or script) says “gimme a free one”. Maybe that’s asking too much.

      seems you’re using SC_MARK_FULLRECT for ChangedLines and SC_MARK_BACKGROUND for your script.

      And this wouldn’t be a point of possible interference anyway. The interference would be in reusing a marker id number, not how that marker manifests visually on screen.

      M 1 Reply Last reply Jan 20, 2022, 9:35 PM Reply Quote 1
      • M
        Michael Vincent @Alan Kilborn
        last edited by Jan 20, 2022, 9:35 PM

        @alan-kilborn said in How to highlight lines with color one by one?:

        And this wouldn’t be a point of possible interference anyway. The interference would be in reusing a marker id number, not how that marker manifests visually on screen.

        Agree, but I allow changing a marker type in Changed Lines and if both were trying to use line background coloring, I’m not sure what would happen - a combination of both colors? Last one to execute wins? In any case, you’re right - different visuals so visual interference is not the answer in this case.

        Cheers.

        1 Reply Last reply Reply Quote 1
        • D
          dail
          last edited by Jan 21, 2022, 4:41 PM

          @Alan-Kilborn My only suggestion would be maybe look at SCI_SETMARGINMASKN to see if changing what margins the markers are applied to can make a difference.

          A 1 Reply Last reply Jan 21, 2022, 6:49 PM Reply Quote 2
          • A
            Alan Kilborn @dail
            last edited by Jan 21, 2022, 6:49 PM

            @dail

            I tried some experimentation with that but I didn’t get a change in effect. My original use of marker 0 showed that it wasn’t assigned to any margin. I tried assigning it to some of the margins using the command you cited, but again it didn’t make a difference. Of course when the effect is seen visually NOT in any true margin, it is kind of hard to understand how it works.

            Regardless, the slight downside of not being able to see change indications for lines that will be background-colored by my script is acceptable.

            1 Reply Last reply Reply Quote 1
            • T
              T W @Alan Kilborn
              last edited by Feb 6, 2024, 4:58 AM

              @Alan-Kilborn
              If selected Word Wrap, the display as below,if possible,please modify the code to highlight lines with color one by one.
              Best Regards

              1ec3b1c1-a8d4-4f12-b7a6-407b96d3cf38-image.png

              A 1 Reply Last reply Feb 6, 2024, 11:49 AM Reply Quote 0
              • A
                Alan Kilborn @T W
                last edited by Feb 6, 2024, 11:49 AM

                @T-W said:

                If selected Word Wrap, the display as below,if possible,please modify the code to highlight lines with color one by one.

                I don’t think what you’re asking for is possible.
                But…when you really sit back and consider it, isn’t it better the way your example shows it anyway?
                A line that is visually wrapped so it appears on 2+ lines is still only one line…

                T 1 Reply Last reply Feb 6, 2024, 2:58 PM Reply Quote 0
                • T
                  T W @Alan Kilborn
                  last edited by Feb 6, 2024, 2:58 PM

                  @Alan-Kilborn said in How to highlight lines with color one by one?:

                  @T-W said:

                  If selected Word Wrap, the display as below,if possible,please modify the code to highlight lines with color one by one.

                  I don’t think what you’re asking for is possible.
                  But…when you really sit back and consider it, isn’t it better the way your example shows it anyway?
                  A line that is visually wrapped so it appears on 2+ lines is still only one line…

                  The interlaced brightening function increases the Angle of view of the eye by 3 times, reducing the load of the eye and improving the reading speed. I think it’s still necessary to focus on the visual line rather than the document line. I would like to try to change it based on yours. Can you give me some clues, such as the keywords you use, grammar and other background knowledge?

                  A 1 Reply Last reply Feb 7, 2024, 1:26 AM Reply Quote 0
                  • A
                    Alan Kilborn @T W
                    last edited by Feb 7, 2024, 1:26 AM

                    @T-W

                    I took a closer look at the script, and I think I’ve changed my mind about it not being possible. Let me see if I can put together a changed script that will do as you want…

                    T 1 Reply Last reply Feb 7, 2024, 3:19 AM Reply Quote 0
                    • T
                      T W @Alan Kilborn
                      last edited by Feb 7, 2024, 3:19 AM

                      @Alan-Kilborn said in How to highlight lines with color one by one?:

                      I took a closer look at the script, and I think I’ve changed my mind about it not being possible. Let me see if I can put together a changed script that will do as you want…

                      thanks

                      A 1 Reply Last reply Feb 7, 2024, 12:04 PM Reply Quote 0
                      • A
                        Alan Kilborn @T W
                        last edited by Feb 7, 2024, 12:04 PM

                        @T-W

                        I’m going to waffle back to my original comment in that the new desire isn’t reasonably possible. In the original script, position is used heavily to decide where to put the “coloring”. While line information (both document and display) is easy to obtain, position data for wrapped lines (e.g. position of where each wrapping occurs) doesn’t seem to be available.

                        Now I’m not going to say it is impossible, because software is amazing and can do extraordinary things, but I think it would be a bigger effort than I consider worth it to put in. Unless…someone sees it differently and there is a straightforward way to do it.

                        A C 2 Replies Last reply Feb 7, 2024, 1:19 PM Reply Quote 0
                        • A
                          Andi Kiissel @Alan Kilborn
                          last edited by Feb 7, 2024, 1:19 PM

                          Something with Split Lines perhaps…?

                          A 1 Reply Last reply Feb 7, 2024, 7:17 PM Reply Quote 0
                          • A
                            Alan Kilborn @Andi Kiissel
                            last edited by Feb 7, 2024, 7:17 PM

                            @Andi-Kiissel

                            Not sure what good Split Lines would do here, at all!

                            1 Reply Last reply Reply Quote 0
                            • C
                              Coises @Alan Kilborn
                              last edited by Feb 7, 2024, 9:35 PM

                              @Alan-Kilborn said in How to highlight lines with color one by one?:

                              While line information (both document and display) is easy to obtain, position data for wrapped lines (e.g. position of where each wrapping occurs) doesn’t seem to be available.
                              […]
                              I think it would be a bigger effort than I consider worth it to put in. Unless…someone sees it differently and there is a straightforward way to do it.

                              I had to deal with a somewhat similar problem (getting the “real” pixel width of text that might be wrapped) here. It’s possible, but messy — SCI_WRAPCOUNT will tell you if a line is wrapped, but then you have to loop through character by character checking SCI_POINTYFROMPOSITION to determine where the wrapping happens.

                              A 1 Reply Last reply Feb 7, 2024, 10:04 PM Reply Quote 2
                              • A
                                Alan Kilborn @Coises
                                last edited by Alan Kilborn Feb 8, 2024, 12:17 AM Feb 7, 2024, 10:04 PM

                                @Coises said in How to highlight lines with color one by one?:

                                …loop through character by character checking SCI_POINTYFROMPOSITION to determine where the wrapping happens

                                The original script fires its logic every time the UI is updated (maybe that could be changed to every time the data is modified instead).
                                When I wrote the original script, I had “performance” concerns for the script, with moderately-sized files and larger.
                                I have even more concerns about that if the script is changed for the newly requested feature for it (which would incorporate the “looping” @Coises mentioned).

                                1 Reply Last reply Reply Quote 1
                                • A Alan Kilborn referenced this topic on Oct 4, 2024, 11:39 AM
                                • First post
                                  Last post
                                The Community of users of the Notepad++ text editor.
                                Powered by NodeBB | Contributors