Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 21 additions & 1 deletion src/renderer/src/components/TerminalPane.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -841,8 +841,28 @@ export default function TerminalPane({
}
}

// Ctrl+Backspace → send \x17 (backward-kill-word) to PTY.
// Most terminal emulators map this shortcut but xterm.js/Restty does not
// by default, so we intercept at the capture phase and forward manually.
const onCtrlBackspace = (e: KeyboardEvent): void => {
if (!e.ctrlKey || e.metaKey || e.altKey || e.shiftKey) return
if (e.key !== 'Backspace') return

const restty = resttyRef.current
if (!restty) return

e.preventDefault()
e.stopPropagation()
const pane = restty.getActivePane() ?? restty.getPanes()[0]
pane?.app.sendKeyInput('\x17')
}

window.addEventListener('keydown', onKeyDown, { capture: true })
return () => window.removeEventListener('keydown', onKeyDown, { capture: true })
window.addEventListener('keydown', onCtrlBackspace, { capture: true })
return () => {
window.removeEventListener('keydown', onKeyDown, { capture: true })
window.removeEventListener('keydown', onCtrlBackspace, { capture: true })
}
}, [isActive])

const resolveMenuPane = () => {
Expand Down