Skip to content

Keep incremental search "Highlight all" up to date - #18490

Open
LucaSorvillo wants to merge 1 commit into
notepad-plus-plus:masterfrom
LucaSorvillo:incSearch_autoRehighlight_20261015
Open

LucaSorvillo wants to merge 1 commit into
notepad-plus-plus:masterfrom
LucaSorvillo:incSearch_autoRehighlight_20261015

Conversation

@LucaSorvillo

Copy link
Copy Markdown
Contributor

With "Highlight all" checked, the incremental search bar now keeps its highlighting up to date:

  • FindIncrementDlg::refreshHighlightAll() highlights the matches of the text of the bar in the current document. It uses the text of the bar, not the selection like markSelectedTextInc(), because after a tab switch or an edit the selection may be anything;
  • it is called by Notepad_plus::notifyBufferActivated() (tab or view switch), by IDM_SEARCH_FINDINCREMENT when the bar is shown again with nothing selected, and 300 ms after the last edit of the document (refreshHighlightAllLater(): a timer of the bar, started from SCN_MODIFIED where the count is already reset);
  • when the bar is hidden, an activated document loses the highlighting left by an earlier search: today closing the bar clears only the current document;
  • like Smart Highlighting, a large file is not highlighted automatically when the large file restriction does not allow Smart Highlighting.

Searching from the bar works as before (the typed text, "Match case", the arrows...).

Tested on Windows 11 with a Release x64 build of this branch (0 warnings), with an automated GUI test (Win32 messages, separate settings folder): typed text highlighted as before; switching to another document and back; a new match typed in the document highlighted after the delay; "Match case" toggled; bar closed: the current and the other document left without highlighting; bar shown again with nothing selected; large file with the restriction: not highlighted.

AI disclosure: the code and this description were written with Claude Code (Claude Opus 5.5); the build and the tests above were run on a real Windows 11 machine.

fix #18489

🤖 Generated with Claude Code

With "Highlight all" checked, the matches of the text of the incremental
search bar are highlighted again when another document is activated,
after the document is edited (300 ms after the last change) and when the
bar is shown again. When the bar is hidden, an activated document loses
the highlighting left by an earlier search. Like Smart Highlighting,
large files are not highlighted automatically.

Fix notepad-plus-plus#18489

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature request] Incremental search: keep "Highlight all" up to date when switching documents and editing

1 participant