Goal
Lift the find/replace overlay rasterisers — TUI (src/tui_main/quadraui_tui.rs::draw_find_replace, ~280 lines) and GTK (src/gtk/draw.rs::draw_find_replace_popup, ~300 lines) — into quadraui::{tui,gtk}::*, mirroring B5c.5 / #266.
Split out from #266 because it is materially bigger than rich_text_popup / completions: it requires designing a new quadraui::primitives::find_replace (the other two were straight ports against existing primitives + theme fields).
Why bigger than the other lifts in #266
The find/replace rasterisers consume vimcode-private engine types:
core::engine::FindReplaceClickTarget (enum, ~14 variants — Chevron, FindInput(usize), ToggleCase, PrevMatch, Close, ReplaceCurrent, …)
core::engine::FrHitRegion (struct: col, row, width in cells)
core::engine::FR_PANEL_WIDTH
core::engine::compute_find_replace_hit_regions(panel_w, show_replace, match_info) -> (Vec<(FrHitRegion, FindReplaceClickTarget)>, u16)
render::FindReplacePanel (the ScreenLayout field — query / replacement / focus / cursor / sel_anchor / match_info / hit_regions / etc.)
crate::icons::FIND_REPLACE and crate::icons::FIND_REPLACE_ALL (Nerd Font glyph constants)
The two other lifts in #266 (rich_text_popup, completions) consumed only existing quadraui::* primitives + theme fields. find_replace requires inventing a new primitive in quadraui first, then migrating engine + render + both backends to use it.
Scope
- New
quadraui::primitives::find_replace with:
pub enum FindReplaceClickTarget (lifted verbatim from engine).
pub struct FrHitRegion (lifted verbatim).
pub const FR_PANEL_WIDTH: u16.
pub fn compute_hit_regions(panel_w, show_replace, match_info) -> (Vec<(FrHitRegion, FindReplaceClickTarget)>, u16).
pub struct FindReplacePanel { /* the data the rasteriser reads */ }.
- Engine adoption:
core::engine::* re-exports the lifted enum/struct so existing call sites keep working unchanged, OR the engine imports them back from quadraui (preferred).
compute_find_replace_hit_regions either becomes a thin wrapper around the quadraui function, or is replaced at call sites.
- Render adoption:
render::FindReplacePanel → either becomes an alias for quadraui::FindReplacePanel or the engine builds a quadraui::FindReplacePanel directly into ScreenLayout.
- Icon constants: the two
crate::icons::FIND_REPLACE* glyphs need a backend-agnostic representation. Options:
- Pass them in via the
FindReplacePanel data (e.g. replace_one_glyph: char, replace_all_glyph: char). Lets the app choose Nerd Font vs ASCII fallback.
- Keep them in vimcode and add backend-specific glyph fields.
- Lifted rasterisers:
quadraui::tui::draw_find_replace(buf, area, panel, theme, editor_left) — port of the TUI shim body.
quadraui::gtk::draw_find_replace(cr, layout, panel, theme, line_height, char_width, editor_left) — port of the GTK draw.rs body.
- Both backend shims then collapse to thin delegators.
Why defer rather than do this in #266
#266 says "mostly mechanical" lifts. The other two (rich_text_popup + completions) genuinely were. find_replace ends up reshaping engine and render adoption, which is one stage of work in itself, and would have made #266's PR materially harder to review.
Pickup files
src/core/engine/mod.rs lines 1060-1210 (FindReplaceClickTarget, FrHitRegion, FR_PANEL_WIDTH, compute_find_replace_hit_regions).
src/render.rs line 3410+ (FindReplacePanel, the re-export at line 3406).
src/tui_main/quadraui_tui.rs::draw_find_replace (the body the lift will copy).
src/gtk/draw.rs::draw_find_replace_popup (same).
src/core/engine/execute.rs::handle_find_replace_click and similar — engine-side dispatchers that consume the enum.
src/icons.rs — FIND_REPLACE / FIND_REPLACE_ALL.
Surfaced during
#266 — only the rich_text_popup + completions lifts shipped under #266.
Goal
Lift the find/replace overlay rasterisers — TUI (
src/tui_main/quadraui_tui.rs::draw_find_replace, ~280 lines) and GTK (src/gtk/draw.rs::draw_find_replace_popup, ~300 lines) — intoquadraui::{tui,gtk}::*, mirroring B5c.5 / #266.Split out from #266 because it is materially bigger than rich_text_popup / completions: it requires designing a new
quadraui::primitives::find_replace(the other two were straight ports against existing primitives + theme fields).Why bigger than the other lifts in #266
The find/replace rasterisers consume vimcode-private engine types:
core::engine::FindReplaceClickTarget(enum, ~14 variants —Chevron,FindInput(usize),ToggleCase,PrevMatch,Close,ReplaceCurrent, …)core::engine::FrHitRegion(struct:col,row,widthin cells)core::engine::FR_PANEL_WIDTHcore::engine::compute_find_replace_hit_regions(panel_w, show_replace, match_info) -> (Vec<(FrHitRegion, FindReplaceClickTarget)>, u16)render::FindReplacePanel(theScreenLayoutfield — query / replacement / focus / cursor / sel_anchor / match_info / hit_regions / etc.)crate::icons::FIND_REPLACEandcrate::icons::FIND_REPLACE_ALL(Nerd Font glyph constants)The two other lifts in #266 (rich_text_popup, completions) consumed only existing
quadraui::*primitives + theme fields. find_replace requires inventing a new primitive in quadraui first, then migrating engine + render + both backends to use it.Scope
quadraui::primitives::find_replacewith:pub enum FindReplaceClickTarget(lifted verbatim from engine).pub struct FrHitRegion(lifted verbatim).pub const FR_PANEL_WIDTH: u16.pub fn compute_hit_regions(panel_w, show_replace, match_info) -> (Vec<(FrHitRegion, FindReplaceClickTarget)>, u16).pub struct FindReplacePanel { /* the data the rasteriser reads */ }.core::engine::*re-exports the lifted enum/struct so existing call sites keep working unchanged, OR the engine imports them back from quadraui (preferred).compute_find_replace_hit_regionseither becomes a thin wrapper around the quadraui function, or is replaced at call sites.render::FindReplacePanel→ either becomes an alias forquadraui::FindReplacePanelor the engine builds aquadraui::FindReplacePaneldirectly intoScreenLayout.crate::icons::FIND_REPLACE*glyphs need a backend-agnostic representation. Options:FindReplacePaneldata (e.g.replace_one_glyph: char,replace_all_glyph: char). Lets the app choose Nerd Font vs ASCII fallback.quadraui::tui::draw_find_replace(buf, area, panel, theme, editor_left)— port of the TUI shim body.quadraui::gtk::draw_find_replace(cr, layout, panel, theme, line_height, char_width, editor_left)— port of the GTKdraw.rsbody.Why defer rather than do this in #266
#266 says "mostly mechanical" lifts. The other two (rich_text_popup + completions) genuinely were. find_replace ends up reshaping engine and render adoption, which is one stage of work in itself, and would have made #266's PR materially harder to review.
Pickup files
src/core/engine/mod.rslines 1060-1210 (FindReplaceClickTarget,FrHitRegion,FR_PANEL_WIDTH,compute_find_replace_hit_regions).src/render.rsline 3410+ (FindReplacePanel, the re-export at line 3406).src/tui_main/quadraui_tui.rs::draw_find_replace(the body the lift will copy).src/gtk/draw.rs::draw_find_replace_popup(same).src/core/engine/execute.rs::handle_find_replace_clickand similar — engine-side dispatchers that consume the enum.src/icons.rs—FIND_REPLACE/FIND_REPLACE_ALL.Surfaced during
#266 — only the rich_text_popup + completions lifts shipped under #266.