Re-add search history to browse mode Find dialog#20484
Conversation
…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.
|
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. |
|
@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?
|
|
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. |
|
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, |
|
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. |
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:CursorManager._searchEntries(most-recent first) plus
MAX_SEARCH_HISTORY_ENTRIES = 20._updateSearchHistory()inserts the just-searched term at the front, dedupscase-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 optionalsearchEntriesargument and, whenthe flag is enabled, builds the find field as a
wx.ComboBox(
style=wx.CB_DROPDOWN) instead of awx.TextCtrl. Added type hints anddocstrings.
config/configSpec.py: new[virtualBuffers] findHistoryfeature flag(BoolFlag, default enabled).
gui/settingsDialogs.py: added the "Keep search history"FeatureFlagCombotothe Browse Mode panel, wired to the
BrowseModeSettingsSearchHistoryhelp anchor,and saved in
onSave.note on the Find dialog field behaviour.
tests/unit/test_cursorManager.py.Testing strategy:
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:
controls) is intentionally deferred to a follow-up, as agreed in Introduce search history in NvDA Find dialog #8482.
addressed here; the opt-out setting is provided for affected users.
Code Review Checklist: