Skip to content

feat(search): keep 100 past queries instead of 30 - #822

Merged
got3nks merged 1 commit into
amule-org:masterfrom
got3nks:feat/search-history-100
Aug 6, 2026
Merged

feat(search): keep 100 past queries instead of 30#822
got3nks merged 1 commit into
amule-org:masterfrom
got3nks:feat/search-history-100

Conversation

@got3nks

@got3nks got3nks commented Aug 6, 2026

Copy link
Copy Markdown

Addresses the first half of #755.

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.

Eviction is LRU and stays that way: ApplySearchHistoryEntry moves a searched term to the front and drops any earlier case-insensitive copy, so the tail that falls off is the least recently searched, not the least recently added. Terms you actually reuse stay near the front regardless of the cap, and the extra 70 slots buy depth for the long tail. (Selecting an entry from the dropdown does not refresh it — only running the search does.)

The constant moves

It goes from an anonymous namespace in SearchDlg.cpp to SearchHistory.h, beside the function that consumes it. That closes a quiet gap in the tests: CapIsExactlyThirtyByProjectConvention claimed to lock "the constant CSearchDlg actually passes in", but hardcoded 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 and cannot drift from it.

Dropdown length, checked on all three platforms

The obvious worry is that a longer history makes #755's other complaint worse — the dropdown overlapping other UI. Tried with a staged 100-entry history on each platform:

platform result
Windows 11 (ARM64 VM) best of the three
Linux (Ubuntu, GNOME/Wayland) fine
macOS 15 (M2 Max) large, but stays within the screen

No platform runs the list off the display, so this does not make that complaint worse. It does not fix it either — capping the visible entries needs a different widget, since wxWidgets exposes no dropdown-height control on plain wxComboBox (SetPopupMaxHeight() is wxComboCtrl/wxOwnerDrawnComboBox only). That is left on the issue, which stays open.

33/33 unit tests pass; clang-format 18 and both clang-tidy tiers clean on the diff.

The Search tab's Name-field history held 30 entries, eMule's
CCustomAutoComplete default. 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 amule-project#754, so there is
no longer much cost to keeping more of it around. Raised to 100 on request
(amule-project#755).

The constant moves from an anonymous namespace in SearchDlg.cpp to
SearchHistory.h, next to the function that consumes it. The test 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 and cannot
drift from it.
@got3nks
got3nks merged commit 82f85b2 into amule-org:master Aug 6, 2026
15 checks passed
@got3nks
got3nks deleted the feat/search-history-100 branch August 6, 2026 10:45
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