Skip to content

#595: TUI: migrate to quadraui ShellApp + run_with_shell (mirrors #493's GTK migration) - #599

Merged
JDonaghy merged 3 commits into
developfrom
issue-595-tui-migrate-to-quadraui-shellapp-run-wit
Jul 23, 2026
Merged

#595: TUI: migrate to quadraui ShellApp + run_with_shell (mirrors #493's GTK migration)#599
JDonaghy merged 3 commits into
developfrom
issue-595-tui-migrate-to-quadraui-shellapp-run-wit

Conversation

@JDonaghy

Copy link
Copy Markdown
Owner

Closes #595

Automated merge from the coordinator for assignment 363083a6b1cb on issue #595.

Worker branch: issue-595-tui-migrate-to-quadraui-shellapp-run-witdevelop.

JDonaghy and others added 3 commits July 23, 2026 03:20
Adds src/tui_main/shell_app.rs implementing quadraui::ShellApp for a new
TuiShellApp struct, mirroring GTK's #493 App: ShellApp migration. Not
wired into main.rs/tui_bin.rs -- compiles alongside the still-live
tui_main::run()/event_loop(), same coexistence pattern GTK's own #448-B
dormant impl used before its live cutover.

Fully ported (moved, not rewritten) from event_loop():
- setup(): nerd-font sync, panel-key accelerator registration, menu defs.
  Required widening register_panel_accelerators from &mut TuiBackend
  (concrete) to &mut dyn quadraui::Backend, matching GTK's own copy of
  this function.
- tick(): per-frame viewport sync (using backend.viewport() in place of
  terminal.size()) + all idle-loop background work (poll_idle,
  format-on-save deferred quit, sidebar/SC auto-refresh, settings reload,
  pending terminal command, startup message, ext-panel focus request,
  yank-highlight expiry, tab-switcher auto-confirm).
- handle(): panel-key accelerator dispatch + MenuSystem intercept, the
  two dispatch layers that don't need raw Frame/DragState access.

Three structural gaps found while scoping this stage, documented in the
module doc and recorded as pinned coord context notes (#595):
1. render_content only gets &mut dyn Backend, never a raw ratatui::Frame,
   but render_impl.rs + panels.rs (~4,000 lines) call
   backend.enter_frame_scope(frame, ...) at ~30 sites and several bypass
   the Backend trait entirely for free rasteriser calls on
   frame.buffer_mut(). Real painting is blocked on a sweep of those call
   sites (Stage 1, staged in PLAN.md).
2. mouse::handle_mouse (~3,066 lines) needs &mut DragState/&mut
   ModalStack via a concrete-only TuiBackend method the Backend trait
   doesn't expose -- can't be called from ShellApp::handle as-is.
3. quadraui-side gap (not vimcode's to fix): Backend::draw_editor's
   EditorPaintResult::cursor_position has no consumer anywhere in
   quadraui's shell_adapter/tui runner, so render_content has no way to
   apply it. Needs a quadraui fix mirroring how apply_selection_highlight
   already solves the same class of problem.

PLAN.md rewritten with a full staged plan (Stage 1-6) mirroring how GTK's
own B.5/B.5b migration actually shipped, so the next session doesn't
re-derive scope.

cargo build/clippy/fmt/test all clean on both --no-default-features and
the default (gui) feature set; 4 new tests added, 0 regressions.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Files the cursor-placement gap (found while scoping #595 Stage 0) as
JDonaghy/quadraui#466, per the user's request.
Updates PLAN.md and the shell_app.rs module doc to reference the real
issue number instead of "file this."

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…ows_tui

Review of the Stage 0 TuiShellApp scaffold caught a bug in the new
dispatch_panel_accelerator_sizeless wrapper: the ACC_TERMINAL_TOGGLE_MAX
arm fed screen_w into terminal_target_maximize_rows_tui, whose parameter
is documented (and named, in the original dispatch_panel_accelerator)
screen_h. The wrapper had dropped the height dimension entirely when it
replaced `terminal: &Terminal<...>` with a single screen_w: u16.

Add a screen_h: u16 parameter, thread it from handle()'s
backend.viewport().height, and use it in the ACC_TERMINAL_TOGGLE_MAX arm.
Add a regression test that reproduces the terminal-already-open-not-yet-
maximized precondition under which the bug is observable and asserts the
spawned terminal's row count derives from screen_h, not screen_w.

Also note the "#318" Alt+menu-letter reveal shim (mod.rs:1275-1294) as an
explicitly-not-yet-ported piece of key dispatch, both in the module doc
and inline at the handle() call site, so a future session filling in the
KeyPressed TODO doesn't assume menu-key handling is already complete.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

TUI: migrate to quadraui ShellApp + run_with_shell (mirrors #493's GTK migration)

1 participant