Skip to content

TUI: remove duplicate search panel focus state (use engine's search_panel_form_focus) #333

Description

@JDonaghy

Summary

The TUI maintains its own search panel focus flags (TuiSidebar::search_input_mode and TuiSidebar::replace_input_focused) that duplicate the engine's search_panel_form_focus: RefCell<Option<String>>. GTK uses the engine field directly as the single source of truth.

Currently the TUI syncs these flags:

  • To engine: at paint time in render_search_panel() (panels.rs ~764-774)
  • From engine: after handle_search_input_key() calls (mod.rs ~2420-2425)

What needs to change

  • Remove TuiSidebar::search_input_mode and TuiSidebar::replace_input_focused
  • Replace all ~15 read sites with engine.search_panel_form_focus.borrow() checks
  • Remove the paint-time sync in render_search_panel()
  • Remove the post-key-handling sync

Context

Filed during #311 (search panel cursor movement). The handle_search_input_key() consolidation made the duplication more visible — the TUI now delegates key dispatch to the engine but still maintains parallel state for focus routing.

Priority

Low — code quality, no user-facing impact.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions