Skip to content

fix: correct split view tab bar positioning, redraw, and focus#94

Closed
hybridmachine wants to merge 2 commits intomacos-portfrom
fix/split-view-bugs
Closed

fix: correct split view tab bar positioning, redraw, and focus#94
hybridmachine wants to merge 2 commits intomacos-portfrom
fix/split-view-bugs

Conversation

@hybridmachine
Copy link
Copy Markdown
Owner

Summary

  • Fix tab bar coordinates in split mode to use contentView coordinates instead of splitView-local coordinates, preventing misalignment when panels (file browser, function list) are visible
  • Force Scintilla redraw via SCI_COLOURISE after unsplit reparenting so the editor content is displayed
  • Remove redundant layoutSplitTopTabBars() call that ran before relayoutPanels() with stale frame data
  • Add ScintillaBridge_focus() after unsplit to restore keyboard focus to the remaining editor

Test plan

  • Split with no panels → both tab bars aligned with their editor panes
  • Unsplit → remaining editor shows content and accepts keyboard input
  • Split with file browser enabled → tab bars offset correctly (not overlapping panel)
  • Split with function list enabled → tab bars positioned correctly
  • Split with both panels → correct tab bar alignment
  • Unsplit from right pane active → left pane gets focus, shows content
  • Resize window while split with panels → tab bars follow correctly
  • Drag split divider with panels → tab bars reposition correctly

🤖 Generated with Claude Code

Four bugs fixed in split_view.mm:

- Tab bar coordinates used splitView-local origin instead of
  contentView coordinates, misaligning tabs when panels are visible
- doUnsplit() never forced Scintilla to redraw after reparenting
  editorContainer, leaving the editor blank
- Redundant layoutSplitTopTabBars() call in doUnsplit() ran before
  relayoutPanels() with stale frame data
- Missing ScintillaBridge_focus() after unsplit left the editor
  without keyboard focus

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings March 31, 2026 05:25
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Fixes split/unsplit UI correctness on macOS by ensuring tab bars are positioned in the correct coordinate space, and by restoring editor rendering/focus when collapsing back to a single view.

Changes:

  • Compute split tab bar X positions using splitView’s offset within contentView to avoid misalignment when side panels are visible.
  • Force a Scintilla re-colourise after unsplit reparenting to ensure editor content redraws.
  • Remove a pre-relayoutPanels() tab layout call and restore focus to the remaining Scintilla view after unsplitting.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

bindDocumentMapToActiveView();
updateDocumentMapViewport();
bindFunctionListToActiveView();
ScintillaBridge_focus(ctx().scintillaView);
Copy link

Copilot AI Mar 31, 2026

Choose a reason for hiding this comment

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

doUnsplit() now always calls ScintillaBridge_focus(ctx().scintillaView) at the end. If the incremental search bar is visible, this will steal keyboard focus from the search field (showIncrementalSearch explicitly makes the search field first responder, and document switching keeps that focus). Consider only focusing Scintilla when incremental search is not visible, or explicitly restoring focus to the search field when isIncrementalSearchVisible() is true (or when the previous first responder was the closing right-hand Scintilla view).

Suggested change
ScintillaBridge_focus(ctx().scintillaView);
if (!isIncrementalSearchVisible())
ScintillaBridge_focus(ctx().scintillaView);

Copilot uses AI. Check for mistakes.
Prevent ScintillaBridge_focus from stealing keyboard focus from the
incremental search field during unsplit.

Co-Authored-By: Claude Opus 4.6 (1M context) <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.

2 participants