fix(ui): restore log search option selection highlight - #3005
Conversation
Option rows used theme.text(focused, false), which only dimmed non-focused lines and never applied selection_bg. TextInputComponent::enabled also stopped updating textarea styles after the tui-textarea migration, so the cursor stayed visible when navigating checkboxes. Use theme.text(true, selected) for option focus, refresh textarea style/cursor on enabled(), and keep jump-to-SHA field focused (invalid SHA still uses block danger styling).
Satisfies clippy::missing_const_for_fn under nursery.
CAOShurong
left a comment
There was a problem hiding this comment.
Code-grounded verification against the regression mechanism (couldn't build locally on Windows — openssl-sys wants a source build with perl/VC; CI covers the build).
I traced the regression independently of the issue text: since the tui-textarea migration (b9a2e13, first shipped in v0.25.0), TextInputComponent's TextArea is built once in show_inner_textarea() with the style captured at build time, and enabled() only flipped self.selected without touching the cached widget — so the input kept its "active" style and block cursor forever, and the option rows only ever had a default-vs-DarkGray foreground difference (theme.text(x, false) never hits the selection_bg branch). That matches the reported "no visible highlight while moving through options".
This PR addresses both halves of that mechanism:
- enabled() now calls apply_enabled_style(), which mutates the cached textarea in place (set_style / set_placeholder_style / set_cursor_style REVERSED-vs-none), and show_inner_textarea() applies it after (re)builds — the focus state is finally visible on the input itself, not just the flag.
- option_line() uses theme.text(true, selected), so the focused option gets the real selection_bg instead of relying on the fg-only cue. Nice side effect: the seven duplicated blocks collapse into one helper.
The new unit test asserting cursor_style REVERSED toggling covers the core of (1).
One deliberate behavior change worth a maintainer's explicit eye (not a defect): in the JumpCommitSha path, find_text.enabled(false) becomes enabled(true) with the comment "Field stays focused; invalid SHA is shown via block style" — the field now stays visually focused in that mode where it was dimmed before. If that's the intended UX for SHA jump mode, this is fine; just making sure it's a conscious choice rather than fallout from the refactor.
Test result on the head: not run locally (build blocker above); CI on this PR is the runtime evidence.
Fixes #3004 .
Option rows used theme.text(focused, false), which only dimmed non-focused lines and never applied selection_bg.
Use theme.text(true, selected) for option focus, refresh textarea style/cursor on enabled(), and keep jump-to-SHA field focused (invalid SHA still uses block danger styling).
This code was written by Grok 4.5.
Followed the checklist:
make checkwithout errors