Skip to content

fix(ui): restore log search option selection highlight - #3005

Open
sjuxax wants to merge 3 commits into
gitui-org:masterfrom
sjuxax:fix/log-search-selection-highlight
Open

fix(ui): restore log search option selection highlight#3005
sjuxax wants to merge 3 commits into
gitui-org:masterfrom
sjuxax:fix/log-search-selection-highlight

Conversation

@sjuxax

@sjuxax sjuxax commented Jul 21, 2026

Copy link
Copy Markdown

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:

  • I added unittests
  • I ran make check without errors
  • I tested the overall application
  • I added an appropriate item to the changelog

sjuxax added 3 commits July 20, 2026 19:30
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 CAOShurong left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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:

  1. 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.
  2. 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.

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.

Search options no longer highlight as cursor moves.

2 participants