Skip to content

Re-add search history to browse mode Find dialog#20484

Draft
LeonarddeR wants to merge 5 commits into
nvaccess:masterfrom
LeonarddeR:i8482-find-history
Draft

Re-add search history to browse mode Find dialog#20484
LeonarddeR wants to merge 5 commits into
nvaccess:masterfrom
LeonarddeR:i8482-find-history

Conversation

@LeonarddeR

Copy link
Copy Markdown
Collaborator

Link to issue number:

Closes #8482

Summary of the issue:

NVDA's browse mode Find dialog (Control+NVDA+F) has no search history: every time
the dialog is opened, previously searched terms are gone and must be retyped. This
has been requested for years (originally PR #6484, later #8921). A prior
implementation was reverted in #9993 because, with some IMEs, pressing Escape to
cancel the candidate list also closed the dialog. As discussed in #8482, that IME
behaviour is a pre-existing wx/Windows issue affecting editable combo boxes
(e.g. the Remote connection dialog and the Add-on Store search box), not something
introduced by search history.

Description of user facing changes:

The Find dialog in browse mode now remembers previously searched terms and offers
them from a combo box, most-recent first (up to 20 entries). The history is kept in
memory only and is cleared when NVDA restarts.

A new "Keep search history" combo box has been added to the Browse Mode settings
panel. It is enabled by default. When disabled, the Find dialog reverts to a plain
edit field, which gives users affected by the IME/Escape behaviour a way to opt out.

Description of development approach:

Based on the earlier work by @marlon-sousa in #8921, reduced to a session-only,
opt-out-able implementation per the discussion in #8482.

  • cursorManager.py:
    • Added a shared, class-level in-memory history CursorManager._searchEntries
      (most-recent first) plus MAX_SEARCH_HISTORY_ENTRIES = 20.
    • _updateSearchHistory() inserts the just-searched term at the front, dedups
      case-insensitively (wx.ComboBox on Windows cannot hold two entries differing
      only in case) keeping the most recent casing, and trims to the max length.
      Called from doFindText() only when the feature flag is enabled.
    • FindDialog.__init__ takes a new optional searchEntries argument and, when
      the flag is enabled, builds the find field as a wx.ComboBox
      (style=wx.CB_DROPDOWN) instead of a wx.TextCtrl. Added type hints and
      docstrings.
  • config/configSpec.py: new [virtualBuffers] findHistory feature flag
    (BoolFlag, default enabled).
  • gui/settingsDialogs.py: added the "Keep search history" FeatureFlagCombo to
    the Browse Mode panel, wired to the BrowseModeSettingsSearchHistory help anchor,
    and saved in onSave.
  • Docs: changes.md entry and a new "Keep search history" user guide section, plus a
    note on the Find dialog field behaviour.
  • Tests: extended tests/unit/test_cursorManager.py.

Testing strategy:

  • Unit tests for the history update/dedup/trim logic in test_cursorManager.py.
  • Manual: searched several terms; reopened Find dialog and confirmed terms appear in
    the combo box, most-recent first, case-insensitive dedup, capped at 20, cleared on
    restart. Toggled the setting off and confirmed the dialog reverts to a plain edit
    field.

Known issues with pull request:

  • History is session-only; persistence across restarts (and any associated privacy
    controls) is intentionally deferred to a follow-up, as agreed in Introduce search history in NvDA Find dialog #8482.
  • The pre-existing IME Escape-closes-dialog behaviour in editable combo boxes is not
    addressed here; the opt-out setting is provided for affected users.

Code Review Checklist:

  • Documentation:
    • Change log entry
    • User Documentation
    • Developer / Technical Documentation
    • Context sensitive help for GUI changes
  • Testing:
    • Unit tests
    • System (end to end) tests
    • Manual testing
  • UX of all users considered:
    • Speech
    • Braille
    • Low Vision
    • Different web browsers
    • Screen reader users

LeonarddeR and others added 5 commits July 9, 2026 23:15
…d dialog (nvaccess#8482)

Introduce the "findHistory" feature flag (config.conf["virtualBuffers"]["findHistory"],
enabled by default) and the core CursorManager._updateSearchHistory logic that maintains
a most-recent-first, case-insensitively deduped, 20-entry in-memory history of search
terms typed in the Find dialog. FindDialog now swaps in a wx.ComboBox pre-populated with
that history when the flag is on; with the flag off, behavior is unchanged (plain
wx.TextCtrl). History updates happen at a single choke point in doFindText, so it covers
both the dialog and find-next/previous.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Remove Marlon Brandão de Sousa from copyright headers in configSpec.py and
test_cursorManager.py where he did not author the content. Per copyrightHeaders.md,
contributors should only appear in files they actually authored. Marlon's
find-history feature attribution remains correct in cursorManager.py.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…#8482)

Add a FeatureFlagCombo control for the virtualBuffers.findHistory
feature flag introduced in a previous commit, so users can enable,
disable, or restore the default behavior of keeping browse mode find
history from the Browse Mode settings panel.
Document the new "Keep search history" browse mode setting: a note in
the Find dialog help explaining the combo box behavior, a new
Browse Mode Settings subsection (anchor BrowseModeSettingsSearchHistory
matching the F1 context help binding), and a New Features changelog
entry.
@LeonarddeR LeonarddeR changed the title Add search history to browse mode Find dialog Re-add search history to browse mode Find dialog Jul 11, 2026
@LeonarddeR

Copy link
Copy Markdown
Collaborator Author

Would be great if potential IME users like @cary-rowen, @josephsl, @nishimotz can test this with and without the feature enabled in NVDA's browse mode settings. If there is no difference in behavior, we might yet as well remove the toggle altogether.

@marlon-sousa

Copy link
Copy Markdown
Contributor

@LeonarddeR cince you already added a anel with the opt-out which, for me, should be kept, can you also parameterize (default 20) number of entries?

Would be great if potential IME users like @cary-rowen, @josephsl, @nishimotz can test this with and without the feature enabled in NVDA's browse mode settings. If there is no difference in behavior, we might yet as well remove the toggle altogether.

@CyrilleB79

Copy link
Copy Markdown
Contributor

I'm quite reluctant to add many parameters before knowing associated use cases.

Regarding the number of entries, how many do you usually use @marlon-sousa? Have you various use cases, preferably real-life ones, why a fix number would not be satisfactory for all?

A pragmatic approach could be to introduce the feature with a fix number of entries and make it customisable if we have feedback from people.

@CyrilleB79

Copy link
Copy Markdown
Contributor

Thanks @LeonarddeR for trying this pragmatic approach to push this feature forward without waiting for many other years!

You can add the case sencitivity issue in known issues IMO. Though, this should not prevent this feature to be merged.

Re dedup,

@josephsl

Copy link
Copy Markdown
Contributor

Hi,

IME testing: the issue of closing IME window also closing the find dialog (or any NVDA dialog when focused on a combo box) still occurs. I strongly suspect this is a wxWidgets/wxPython limitation unless Windows is also involved.

Thanks.

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.

Introduce search history in NvDA Find dialog

4 participants