Skip to content

feat(gui): clearer search-page buttons, and confirm before clearing history - #754

Merged
got3nks merged 1 commit into
amule-org:masterfrom
got3nks:feat/search-clear-buttons
Aug 1, 2026
Merged

feat(gui): clearer search-page buttons, and confirm before clearing history#754
got3nks merged 1 commit into
amule-org:masterfrom
got3nks:feat/search-clear-buttons

Conversation

@got3nks

@got3nks got3nks commented Aug 1, 2026

Copy link
Copy Markdown

Three small changes to the Search page, all about making the two destructive actions distinguishable at a glance.

ClearClear Search Results. On a page that also offers to clear the search history, a bare "Clear" does not say which of the two it means.

Clear search historyClear Search History, moved into the action row directly after "Reset Fields". It is a one-shot command like the buttons it now sits with, not a search parameter, and placing it beside "Clear Search Results" lets the two read as a pair. The row becomes:

Start | Extend | Stop | Download | Reset Fields | Clear Search History | Clear Search Results

The divider preceding it is inserted with it and tracked as a member, so the remember-history preference hides both together instead of leaving a stray separator and a gap.

Clearing the history now asks first. It deletes searchhistory.dat outright with no undo, and the button now sits one position from "Clear Search Results", which is trivially repeatable — a misclick should not silently destroy the stored terms. The prompt defaults to No.

Both routes go through the confirmation: the button, and the search box's right-click menu, whose item is relabelled to match. The menu route defers via CallAfter because its handler runs while PopupMenu() is still unwinding, and a modal dialog raised there misbehaves on wxOSX — the same deferral this file already documents for the EC-reply path, for a different reason. ClearSearchHistory() itself stays unprompted so it remains usable if anything ever needs to clear without asking.

Catalogs regenerated for the three changed msgids; the bare "Clear" msgid survives, still used elsewhere in the tree.

Verified: monolithic amule and aMuleGUI build clean on macOS; the resulting button order was checked against the sizer order, and the confirmation on both routes, the enable/disable state and the preference-driven hide of button + divider were exercised in the running GUI. clang-format 18 and both clang-tidy tiers clean on the diff, 0 compiler errors.

…istory

Three small changes to the Search page, all about making the two destructive
actions distinguishable at a glance.

"Clear" becomes "Clear Search Results". On a page that also offers to clear
the search *history*, a bare "Clear" does not say which of the two it means.

"Clear search history" becomes "Clear Search History" and moves out of the
search-parameter row into the action row, directly after "Reset Fields". It
is a one-shot command like the buttons it now sits with, not a parameter,
and putting it beside "Clear Search Results" lets the two read as a pair.
The divider that precedes it is inserted with it and tracked as a member, so
the remember-history preference hides both together rather than leaving a
stray separator and a gap in the row.

Clearing the history now asks first. It deletes searchhistory.dat outright
with no undo, and the button sits one position away from "Clear Search
Results", which is trivially repeatable -- a misclick should not be able to
silently destroy the stored terms. The prompt defaults to No.

Both routes into clearing go through the confirmation: the button and the
search box's right-click menu, whose item is relabelled to match. The menu
route defers via CallAfter, because its handler runs while PopupMenu() is
still unwinding and a modal dialog raised there misbehaves on wxOSX -- the
same deferral this file already documents for the EC-reply path, for a
different reason. ClearSearchHistory() itself is left unprompted so it stays
usable if anything ever needs to clear without asking.

Catalogs regenerated for the three changed msgids. The bare "Clear" msgid
survives: it is still used elsewhere in the tree.
@got3nks
got3nks merged commit b13c793 into amule-org:master Aug 1, 2026
15 checks passed
@got3nks
got3nks deleted the feat/search-clear-buttons branch August 1, 2026 09:06
got3nks added a commit that referenced this pull request Aug 6, 2026
The Search tab's Name-field history held 30 entries, eMule's CCustomAutoComplete default, adopted in the #643 review rather than chosen for aMule. A history is only useful as far back as it reaches, and 30 queries is a short reach for anyone who searches often; clearing it has been a deliberate, confirmed action since #754, so there is less cost to keeping more of it around. Raised to 100 on request (#755).

Eviction is LRU and stays that way: ApplySearchHistoryEntry moves a searched term to the front and drops any earlier case-insensitive copy, so what falls off the tail is the least recently searched rather than the least recently added. Terms that get reused stay near the front whatever the cap is, which is what makes the extra slots worth having -- they go to the long tail instead of hoarding stale one-offs.

The constant moves from an anonymous namespace in SearchDlg.cpp to SearchHistory.h, beside the function that consumes it. That closes a gap in the tests: the one that claimed to lock "the constant CSearchDlg actually passes in" was hardcoding its own copy of the number, so it would have gone on passing while the GUI used something else entirely. It now reads the same symbol the GUI does.

A longer history could have worsened the other half of #755 -- the dropdown overlapping other UI -- so the list was checked with a full 100 entries on Windows 11, Ubuntu and macOS first. None of the three runs it off the screen. Bounding the visible entries is a separate matter and not addressed here: wxWidgets exposes no dropdown-height control on plain wxComboBox (SetPopupMaxHeight is wxComboCtrl/wxOwnerDrawnComboBox only), so it needs a different widget rather than a setting.
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.

1 participant