Summary
Follow-up from #547. While fixing the breadcrumb-bar regression, the same shape of duplication was found in the tab-bar draw loops of both backends — the fix used there (a shared render::breadcrumb_draw_targets() helper) applies cleanly here too, but was deliberately left out of #547 to keep that PR scoped to the reported regression.
Where the duplication lives
Both backends branch on if let Some(split) = screen.editor_group_split { ... } else { /* single group */ ... } and, in each arm, independently:
- skip drawing when the group's tab bar is hidden (
engine.is_tab_bar_hidden(group_id))
- compute the tab bar's
Rect from gtb.bounds / screen.tab_bar_primitive
- push
Surface::TabBar and draw
- recover hit-test geometry from the draw call and cache it
Concretely:
src/gtk/mod.rs — ShellApp::render_content, the if let Some(ref split) = screen.editor_group_split { ... } else if !engine.is_tab_bar_hidden(...) { ... } block (currently just below the Draw tab bar(s) comment).
src/tui_main/render_impl.rs — draw_frame, the equivalent split/single-group tab-bar blocks.
Proposed fix
Add a render::tab_bar_draw_targets() (or similar) shared helper, analogous to render::breadcrumb_draw_targets() added in #547, that:
Each backend keeps its own draw call + hit-test-geometry recovery (that part isn't shareable — GTK caches pixel hit-tests into Rc<RefCell<...>> maps, TUI doesn't need to), but the skip-condition + rect math collapses into one function, same as breadcrumbs.
Why this wasn't done in #547
#515 (immediately prior work on this branch) just rewrote tab-bar hit-test pixel geometry in both backends. Touching the tab-bar draw loop again right after that risks colliding with or subtly undoing that work, and it wasn't what #547 reported as broken. Low risk, but better as its own reviewable change.
Acceptance criteria
Parent context: Platform-Neutral milestone (#7), same as #515/#547.
Summary
Follow-up from #547. While fixing the breadcrumb-bar regression, the same shape of duplication was found in the tab-bar draw loops of both backends — the fix used there (a shared
render::breadcrumb_draw_targets()helper) applies cleanly here too, but was deliberately left out of #547 to keep that PR scoped to the reported regression.Where the duplication lives
Both backends branch on
if let Some(split) = screen.editor_group_split { ... } else { /* single group */ ... }and, in each arm, independently:engine.is_tab_bar_hidden(group_id))Rectfromgtb.bounds/screen.tab_bar_primitiveSurface::TabBarand drawConcretely:
src/gtk/mod.rs—ShellApp::render_content, theif let Some(ref split) = screen.editor_group_split { ... } else if !engine.is_tab_bar_hidden(...) { ... }block (currently just below theDraw tab bar(s)comment).src/tui_main/render_impl.rs—draw_frame, the equivalent split/single-group tab-bar blocks.Proposed fix
Add a
render::tab_bar_draw_targets()(or similar) shared helper, analogous torender::breadcrumb_draw_targets()added in #547, that:(Rect, &TabBar, group_id)targets to draw this frame, filtering hidden tab barsorigin_offsetparameterbreadcrumb_draw_targetsdoes, since GTK's window rects are absolute and TUI's are content-area-relative (see GTK regressions from #515: editor breadcrumbs broken + explorer treeview icons don't use Nerd Fonts (converge on quadraui; fix quadraui gaps first) #547 and the coordinate-convention issue below)Each backend keeps its own draw call + hit-test-geometry recovery (that part isn't shareable — GTK caches pixel hit-tests into
Rc<RefCell<...>>maps, TUI doesn't need to), but the skip-condition + rect math collapses into one function, same as breadcrumbs.Why this wasn't done in #547
#515 (immediately prior work on this branch) just rewrote tab-bar hit-test pixel geometry in both backends. Touching the tab-bar draw loop again right after that risks colliding with or subtly undoing that work, and it wasn't what #547 reported as broken. Low risk, but better as its own reviewable change.
Acceptance criteria
render::tab_bar_draw_targets()(or equivalent) added tosrc/render.rs, covering the skip-condition + rect-math duplication described above.src/gtk/mod.rs::render_contentandsrc/tui_main/render_impl.rs::draw_frameuse it for both split-group and single-group tab bar drawing.Parent context:
Platform-Neutralmilestone (#7), same as #515/#547.