Skip to content

SidebarSystem migration: SC panel — TUI backend #339

Description

@JDonaghy

Summary

Wire the TUI backend to use the SC panel's SidebarSystem (added in the engine layer commit on #321).

What changes

Rendering (tui_main/panels.rs)

Replace the source_control_to_tree_view() + draw_tree() call in render_source_control() with:

  • engine.sc_sidebar_body_rect.set(q_rect)
  • render::populate_sc_sidebar_system(engine, theme)
  • engine.sc_sidebar_system.borrow().render(b, q_rect)

Header, commit input, and button rows remain unchanged.

Key routing (tui_main/mod.rs)

Replace the ~80-line manual key mapping block (lines 2865–2948) with:

let result = engine.dispatch_sc_sidebar_key_unified(key_str, ctrl, unicode);
if matches!(result, ScKeyResult::Unfocused) {
    sidebar.has_focus = false;
}

Mouse handling (tui_main/mouse.rs)

  • Scroll (~line 1234): Replace sc_selected ± 3 with scroll UiEvent through handle_cached.
  • Click (~line 2478): Replace manual sc_visual_row_to_flat + sc_selected assignment with click UiEvent through handle_cached + dispatch_sc_sidebar_event(). Keep header/commit/button hit-testing.

Key files

  • src/tui_main/panels.rs — SC render
  • src/tui_main/mod.rs — SC key routing
  • src/tui_main/mouse.rs — SC scroll + click

Prereqs

  • Engine + render layer (this branch)

Testing

  • cargo test --no-default-features — all tests pass
  • Smoke test TUI: navigate j/k, Tab collapse, s/S stage, d discard, c commit, Enter open, q/Esc unfocus, mouse scroll/click, branch picker b/B

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

    enhancementNew feature or requestinfrastructureBuild, CI, distributionuiUI/rendering

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions