mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-04-21 18:44:30 -07:00
fix(cli-ui): enable Ctrl+Backspace for word deletion in Windows Terminal (#21447)
This commit is contained in:
@@ -651,8 +651,20 @@ function* emitKeys(
|
||||
// tab
|
||||
name = 'tab';
|
||||
alt = escaped;
|
||||
} else if (ch === '\b' || ch === '\x7f') {
|
||||
// backspace or ctrl+h
|
||||
} else if (ch === '\b') {
|
||||
// ctrl+h / ctrl+backspace (windows terminals send \x08 for ctrl+backspace)
|
||||
name = 'backspace';
|
||||
// In Windows environments, \b is sent for Ctrl+Backspace (standard backspace is translated to \x7f).
|
||||
// We scope this to Windows/WT_SESSION to avoid breaking other unixes where \b is a plain backspace.
|
||||
if (
|
||||
typeof process !== 'undefined' &&
|
||||
(process.env?.['OS'] === 'Windows_NT' || !!process.env?.['WT_SESSION'])
|
||||
) {
|
||||
ctrl = true;
|
||||
}
|
||||
alt = escaped;
|
||||
} else if (ch === '\x7f') {
|
||||
// backspace
|
||||
name = 'backspace';
|
||||
alt = escaped;
|
||||
} else if (ch === ESC) {
|
||||
|
||||
Reference in New Issue
Block a user