Skip to content

Fix Shift key propagation and focused-pane Cmd routing#18

Merged
galz10 merged 2 commits intomainfrom
codex/shift-modifier-propagation
Mar 31, 2026
Merged

Fix Shift key propagation and focused-pane Cmd routing#18
galz10 merged 2 commits intomainfrom
codex/shift-modifier-propagation

Conversation

@galz10
Copy link
Copy Markdown
Owner

@galz10 galz10 commented Mar 31, 2026

Summary

Fixes terminal key propagation so Shift-modified control keys are delivered correctly, and fixes focused-pane command routing so clipboard shortcuts target the pane the user actually focused.

Details

  • Updated GhosttyNativeView keyboard handling to preserve Shift for control-text input paths (for example Shift+Enter and Shift+Tab) while still consuming modifiers for printable text when appropriate.
  • Added GhosttyKeyEventTranslator helpers to centralize:
    • consumed modifier calculation by flags + emitted text
    • flagsChanged press/release action derivation from keycode + modifier state
  • Updated non-text key emission to use consumed_mods = GHOSTTY_MODS_NONE.
  • Updated SessionService.setFocusedPane(sessionID:controllerID) to:
    • mark terminal as the last focused surface
    • synchronize AppKit focus for the selected session (ensurePaneController(...).focus()), improving Cmd+C / Cmd+V / Cmd+A routing in split panes.
  • Added tests:
    • ShortcutRegistryTests coverage for consumed-mod behavior and flagsChanged press/release behavior.
    • SessionServiceTests coverage for focused-pane terminal intent updates.

Related Issues

Related to terminal modifier propagation and focused-pane clipboard routing regressions.

How to Validate

  1. Run tests:
    • xcodebuild test -project idx0.xcodeproj -scheme idx0 -destination 'platform=macOS' -only-testing:idx0Tests/SessionServiceTests -only-testing:idx0Tests/ShortcutRegistryTests
    • Expected: TEST SUCCEEDED.
  2. In the app, create a split-pane terminal session and verify:
    • Shift+Enter and Shift+Tab are delivered reliably to the active terminal.
  3. Change pane focus (including via pane UI/sidebar), then verify:
    • Cmd+C, Cmd+V, and Cmd+A apply to the currently focused pane.

Pre-Merge Checklist

  • lint-docs check is green
  • tests check is green
  • maintainability result reviewed (phase 1 report-only)
  • Added/updated tests (if needed)
  • Updated relevant documentation and README (if needed)
  • Noted breaking changes (if any)
  • Tested on macOS

@galz10 galz10 merged commit 3190e15 into main Mar 31, 2026
3 checks passed
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.

1 participant