File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -118,7 +118,10 @@ export function TerminalView(props: TerminalViewProps) {
118118 } ) ;
119119
120120 term . attachCustomKeyEventHandler ( ( e : KeyboardEvent ) => {
121- if ( e . type !== 'keydown' ) return true ;
121+ if ( e . type !== 'keydown' ) {
122+ if ( e . key === 'Enter' && e . shiftKey ) return false ;
123+ return true ;
124+ }
122125
123126 // Let global app shortcuts pass through to the window handler
124127 if ( matchesGlobalShortcut ( e ) ) return false ;
@@ -144,6 +147,25 @@ export function TerminalView(props: TerminalViewProps) {
144147 return false ;
145148 }
146149
150+ // Shift+Enter → send as Alt+Enter (newline in CLI agents like Claude Code)
151+ if ( e . key === 'Enter' && e . shiftKey ) {
152+ e . preventDefault ( ) ;
153+ enqueueInput ( '\x1b\r' ) ;
154+ return false ;
155+ }
156+
157+ // macOS: Cmd+Left/Right → Home/End escape sequences
158+ if ( isMac && e . metaKey && ! e . altKey && ! e . ctrlKey ) {
159+ if ( e . key === 'ArrowLeft' ) {
160+ enqueueInput ( '\x1b[H' ) ; // Home
161+ return false ;
162+ }
163+ if ( e . key === 'ArrowRight' ) {
164+ enqueueInput ( '\x1b[F' ) ; // End
165+ return false ;
166+ }
167+ }
168+
147169 return true ;
148170 } ) ;
149171
You can’t perform that action at this time.
0 commit comments