Skip to content

fix(gui): prevent prompt duplication when dragging split pane divider - #12

Merged
tw93 merged 1 commit into
tw93:mainfrom
smile7up:fix/split-pane-resize-garbled-prompt
Feb 11, 2026
Merged

tw93 merged 1 commit into
tw93:mainfrom
smile7up:fix/split-pane-resize-garbled-prompt

Conversation

@smile7up

Copy link
Copy Markdown

Summary

Fixes #10

  • Dragging the split pane divider caused the shell prompt to duplicate/garble because every mouse-move event sent TIOCSWINSZ to the PTY (~60 SIGWINCH/sec)
  • Decoupled terminal state resize from PTY notification during split drag: visual reflow happens in real-time, PTY is notified only once on mouse release
  • Added Pane::resize_visual() trait method with safe default fallback for all pane types

Changes

File Change
mux/src/pane.rs Add resize_visual() default trait method (falls back to resize())
mux/src/localpane.rs Override resize_visual(): only terminal.resize(), skip pty.resize()
mux/src/tab.rs Add resize_split_by_visual(), cascade_size_from_cursor_visual(), flush_pane_pty_sizes()
kaku-gui/src/termwindow/mod.rs Add SplitDragState { tab_id } to track drag lifecycle
kaku-gui/src/termwindow/mouseevent.rs Use visual-only resize during drag; flush PTY on release; pin to captured tab_id with fallback recovery

Test plan

  • Open split panes (left/right), drag divider rapidly — prompt should stay clean
  • Open split panes (top/bottom), drag divider rapidly — prompt should stay clean
  • Verify content reflows smoothly during drag (not just on release)
  • Verify prompt redraws correctly after releasing the divider
  • Close a tab during split drag — should recover gracefully without crash

🤖 Generated with Claude Code

When dragging the split divider between two panes, every mouse move
event triggered resize_split_by() which sent TIOCSWINSZ to the PTY.
The shell received ~60 SIGWINCH signals per second and redrew its
prompt on each one, causing overlapping/garbled prompt text.

Fix by decoupling terminal state resize from PTY notification during
split drag:

- Add Pane::resize_visual() trait method that updates terminal state
  only (no PTY ioctl). LocalPane overrides it to skip pty.resize().
- Add Tab::resize_split_by_visual() that cascades using resize_visual.
- During drag, call resize_split_by_visual() for smooth content reflow
  without SIGWINCH.
- On mouse release, call Tab::flush_pane_pty_sizes() to send one final
  TIOCSWINSZ per pane with correct DPI from get_dimensions().
- Track drag state via SplitDragState { tab_id } to ensure the same
  tab is used from drag start through release, with fallback recovery
  if the tab is closed mid-drag.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

@tw93 tw93 left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@tw93
tw93 merged commit 56e8c5a into tw93:main Feb 11, 2026
1 of 2 checks passed
@tw93

tw93 commented Feb 11, 2026

Copy link
Copy Markdown
Owner

@smile7up Thanks for the fix and verification. Merged in #12.

I also reviewed a follow-up edge case (drag in tab A, tab A closes mid-drag): we now stop the drag instead of retargeting another tab with stale split metadata. This avoids accidental split resize in a different tab.

tw93 added a commit that referenced this pull request Feb 11, 2026
…ompt

fix(gui): prevent prompt duplication when dragging split pane divider
@smile7up

smile7up commented Feb 11, 2026 via email

Copy link
Copy Markdown
Author

tw93 added a commit that referenced this pull request Feb 27, 2026
…ompt

fix(gui): prevent prompt duplication when dragging split pane divider
tw93 added a commit that referenced this pull request May 6, 2026
…ompt

fix(gui): prevent prompt duplication when dragging split pane divider
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.

Split pane divider drag causes garbled/duplicated prompt

2 participants