File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -171,7 +171,10 @@ export function TerminalView(props: TerminalViewProps) {
171171 } ) ;
172172
173173 term . attachCustomKeyEventHandler ( ( e : KeyboardEvent ) => {
174- if ( e . type !== 'keydown' ) return true ;
174+ if ( e . type !== 'keydown' ) {
175+ if ( e . key === 'Enter' && e . shiftKey ) return false ;
176+ return true ;
177+ }
175178
176179 // Let global app shortcuts pass through to the window handler
177180 if ( matchesGlobalShortcut ( e ) ) return false ;
@@ -197,6 +200,25 @@ export function TerminalView(props: TerminalViewProps) {
197200 return false ;
198201 }
199202
203+ // Shift+Enter → send as Alt+Enter (newline in CLI agents like Claude Code)
204+ if ( e . key === 'Enter' && e . shiftKey ) {
205+ e . preventDefault ( ) ;
206+ enqueueInput ( '\x1b\r' ) ;
207+ return false ;
208+ }
209+
210+ // CmdOrCtrl+Left/Right → Home/End escape sequences
211+ if ( ( isMac ? e . metaKey : e . ctrlKey ) && ! e . altKey && ! ( isMac ? e . ctrlKey : e . metaKey ) ) {
212+ if ( e . key === 'ArrowLeft' ) {
213+ enqueueInput ( '\x1b[H' ) ; // Home
214+ return false ;
215+ }
216+ if ( e . key === 'ArrowRight' ) {
217+ enqueueInput ( '\x1b[F' ) ; // End
218+ return false ;
219+ }
220+ }
221+
200222 return true ;
201223 } ) ;
202224
You can’t perform that action at this time.
0 commit comments