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



  • 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,



  • 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.



  • @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.



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



  • @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?



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



  • @dail That’s a shame.


Log in to reply