bug:
In windows terminals, pressing ctrl+backspace is expected to delete the previous word. Howover this shortcut does not work in gemini clis input prompt, only deletes a single chracter instead of the entire previous word.
solution:
windows terminals sends the code \x08 (ASCII backspace same as CTRL + H) when ctrl+backspace is pressed. Currently /packages/cli/src/ui/contexts/KeypressContext.tsx line 595 treats this as a regular backspace and doesnt set the ctrl flag to true. :
else if (ch === '\b' || ch === '\x7f') {
// backspace or ctrl+h
name = 'backspace';
alt = escaped;
}
by splitting the handling of \b ( \x08 ascii) and \x7f, and explicitly setting ctrl: true for the \b case, the existing DELETE_WORD_BACWARD key binding ({ key: 'backspace', ctrl: true }) is correctly triggered. =>
else if (ch === '\b') {
// ctrl+h or ctrl+backspace (windows terminals send \x08 for ctrl+backspace)
name = 'backspace';
ctrl = true;
alt = escaped;
} else if (ch === '\x7f') {
// backspace
name = 'backspace';
alt = escaped;
}
so
ctrl+backspace => deletes the previous word (like windows terminal)
ctrl +h => also deletes the previous word.
regular backspace (\x7f) => remains unchanged and deletes a singe chracter.
btw, this is my first-ever open source contribution and pull request. be nice :P
bug:
In windows terminals, pressing ctrl+backspace is expected to delete the previous word. Howover this shortcut does not work in gemini clis input prompt, only deletes a single chracter instead of the entire previous word.
solution:
windows terminals sends the code \x08 (ASCII backspace same as CTRL + H) when ctrl+backspace is pressed. Currently /packages/cli/src/ui/contexts/KeypressContext.tsx line 595 treats this as a regular backspace and doesnt set the ctrl flag to true. :
else if (ch === '\b' || ch === '\x7f') {
// backspace or ctrl+h
name = 'backspace';
alt = escaped;
}
by splitting the handling of \b ( \x08 ascii) and \x7f, and explicitly setting ctrl: true for the \b case, the existing DELETE_WORD_BACWARD key binding ({ key: 'backspace', ctrl: true }) is correctly triggered. =>
else if (ch === '\b') {
// ctrl+h or ctrl+backspace (windows terminals send \x08 for ctrl+backspace)
name = 'backspace';
ctrl = true;
alt = escaped;
} else if (ch === '\x7f') {
// backspace
name = 'backspace';
alt = escaped;
}
so
ctrl+backspace => deletes the previous word (like windows terminal)
ctrl +h => also deletes the previous word.
regular backspace (\x7f) => remains unchanged and deletes a singe chracter.
btw, this is my first-ever open source contribution and pull request. be nice :P