Skip to content

SidebarSystem migration: Search panel (results tree) #323

Description

@JDonaghy

Summary

Migrate the Search panel's results tree section from hand-rolled scroll/selection/collapse to quadraui::compose::SidebarSystem.

The Search panel is a hybrid: a Form (query/replace inputs + toggle buttons) sits above a TreeView of file-grouped results. It already uses build_search_panel_msv() which builds a 2-section MSV (Form + Results). The SidebarSystem migration targets the results tree section only — the Form interaction (text input cursors, toggle buttons, Replace All) stays as engine-managed state.

Prereqs

Engine fields replaced by SidebarSystem

Field Purpose SidebarSystem equivalent
project_search_selected flat row index in results per-section selection
search_file_expanded: Vec<bool> per-file collapse state SidebarSystem internal collapse
search_has_focus (partial) keyboard focus for results tree SidebarSystem focus state
search_panel_msv_layout cached MSV layout SidebarSystem layout

Fields that remain (domain-specific): project_search_query, project_search_results, project_search_options, project_search_running, project_search_receiver, project_replace_text, project_replace_running, project_replace_receiver, search_panel_form_focus, search_query_caret, replace_text_caret.

Migration steps

  1. Define a SidebarSectionDef for "results" (single-section SidebarSystem, or 1 section per result file)
  2. Each frame: call sidebar.set_rows("results", rows) from the results tree portion of build_search_panel_msv()
  3. Replace results-tree navigation in handle_search_key() with sidebar.handle() + SidebarEvent::RowSelected
  4. Keep Form-mode interaction (query input, replace input, toggles) separate — intercept before SidebarSystem when form has focus
  5. Remove the 4 engine fields listed above
  6. TUI + GTK: replace bespoke results-tree paint with sidebar.render(backend, rect)
  7. Update tests in search.rs

Design note

The Search panel's Form + Tree hybrid means SidebarSystem manages only the lower half. The form and results tree share a single MSV today — after migration, the form renders independently (via quadraui::Form) and the results tree uses SidebarSystem. This is cleaner than the current monolithic MSV approach.

Key files

  • src/core/engine/mod.rs — remove 4 engine fields
  • src/core/engine/search.rs — replace tree navigation in handle_search_tree_hit(), handle_search_key()
  • src/render.rs — split build_search_panel_msv() into form + SidebarSystem tree
  • src/tui_main/panels.rs — replace search panel render
  • src/main.rs — replace GTK search panel render

Reference

See JDonaghy/quadraui#63 for the complete migration guide with code examples.

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

    blockedBlocked on a prereq (linked in body)enhancementNew feature or requestinfrastructureBuild, CI, distributionuiUI/rendering

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions