• Login
Community
  • Login

Highlight doesn't work on a clone view of the same file.

Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
7 Posts 3 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.
  • T
    Taihai Chen
    last edited by Aug 8, 2017, 4:07 PM

    Hello there,

    When I clone the current file to other view and highlight a variable, the same variable won’t be highlighted in the other view unless that view is in the same portion of the origin view.

    Any ideas how to make the highlight works in both views?

    Best regards,

    1 Reply Last reply Reply Quote 0
    • G
      gstavi
      last edited by gstavi Aug 10, 2017, 7:02 AM Aug 10, 2017, 7:00 AM

      Interesting.
      I am actually a bit surprised it is highlighted at all at the clone.

      Some details as far as I understand it:
      Scintilla, the editing component NPP is based upon, is responsible for text rendering and highlighting.
      To optimize performance syntax highlighting isn’t performed on entire file, only on text at the current view. So for every editing operation and every scroll operation which modify the view trigger syntax highlighting operation at Scintilla.
      The clone view is something that NPP is doing and as far as I know Scintilla is not really aware of. Scintilla is aware of the view of the active pane and is not aware of the view of the inactive pane so it does not refresh it. Any modifications that is performed by Scintilla for the active pane is propagated to the inactive pane but the existence of the inactive pane does not rigger modifications into Scintilla.

      Note that if you select different text in each pane, the selection is remembered. When you switch pane (and scroll to force refresh) the selection is highlighted.

      So a feature that I would like is synchronized selection. Every selection in one pane will be applied to both panes and highlight in both regardless if its a clone or not.

      T 1 Reply Last reply Sep 11, 2017, 1:43 PM Reply Quote 0
      • D
        dail
        last edited by Aug 10, 2017, 1:21 PM

        @gstavi said:

        and is not aware of the view of the inactive pane so it does not refresh it.

        Scintilla is aware of both “editors” being attached to the same “document”. There are certain attributes that are specific to the “editor” such as cursor position, where the view is scrolled, etc. Other attributes, such as indicators (this is how the Smart Highlighting is implemented) are tied to the document itself, meaning if an indicator is added to the document it will show up in both views automatically.

        The way Notepad++ implements smart highlighting is that it only searches the currently visible text. So if one of the editors is showing lines 50 to 100, it only marks the matches in those lines. However the other editor may be viewing lines 200 to 250, so the smart hilighter will have no effect on these lines. This is due to efficiency reasons because why search the entire file for matches if you don’t have to :)

        However, something important to note is a specific feature in Notepad++. It is under Settings > Preferences > Highlighting > Highlight another view which I thought should solve the issue as described above. However it seems to work if it is 2 completely separate documents…oddly enough it doesn’t work for cloned documents.

        T 1 Reply Last reply Sep 12, 2017, 9:32 AM Reply Quote 1
        • T
          Taihai Chen @gstavi
          last edited by Sep 11, 2017, 1:43 PM

          @gstavi That’s exactly what I am asking. I totally agree with your last point there too.

          1 Reply Last reply Reply Quote 0
          • T
            Taihai Chen @dail
            last edited by Sep 12, 2017, 9:32 AM

            @dail Thanks for your comments there. As you said the highlight another view doesn’t quite work… Is there any updates in the pipeline that will resolve this issue?

            D 1 Reply Last reply Sep 12, 2017, 11:29 AM Reply Quote 0
            • D
              dail @Taihai Chen
              last edited by Sep 12, 2017, 11:29 AM

              @Taihai-Chen No not as far as I know.

              T 1 Reply Last reply Sep 13, 2017, 3:00 PM Reply Quote 0
              • T
                Taihai Chen @dail
                last edited by Sep 13, 2017, 3:00 PM

                @dail That’s a shame.

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