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
- Define a
SidebarSectionDef for "results" (single-section SidebarSystem, or 1 section per result file)
- Each frame: call
sidebar.set_rows("results", rows) from the results tree portion of build_search_panel_msv()
- Replace results-tree navigation in
handle_search_key() with sidebar.handle() + SidebarEvent::RowSelected
- Keep Form-mode interaction (query input, replace input, toggles) separate — intercept before SidebarSystem when form has focus
- Remove the 4 engine fields listed above
- TUI + GTK: replace bespoke results-tree paint with
sidebar.render(backend, rect)
- 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.
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
project_search_selectedsearch_file_expanded: Vec<bool>SidebarSysteminternal collapsesearch_has_focus(partial)SidebarSystemfocus statesearch_panel_msv_layoutSidebarSystemlayoutFields 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
SidebarSectionDeffor"results"(single-section SidebarSystem, or 1 section per result file)sidebar.set_rows("results", rows)from the results tree portion ofbuild_search_panel_msv()handle_search_key()withsidebar.handle()+SidebarEvent::RowSelectedsidebar.render(backend, rect)search.rsDesign 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 fieldssrc/core/engine/search.rs— replace tree navigation inhandle_search_tree_hit(),handle_search_key()src/render.rs— splitbuild_search_panel_msv()into form + SidebarSystem treesrc/tui_main/panels.rs— replace search panel rendersrc/main.rs— replace GTK search panel renderReference
See JDonaghy/quadraui#63 for the complete migration guide with code examples.