mirror of
https://github.com/QwenLM/qwen-code.git
synced 2025-12-19 09:33:53 +00:00
Implement additional readline-like keybindings, including alt-left arrow and alt-right arrow. (#443)
This change adds keybinding support for: - `Ctrl+B`: Moves the cursor backward one character. - `Ctrl+F`: Moves the cursor forward one character. - `Alt+Left Arrow`: Moves the cursor backward one word. - `Alt+Right Arrow`: Moves the cursor forward one word. Closes b/411469305.
This commit is contained in:
@@ -1104,16 +1104,22 @@ export function useTextBuffer({
|
||||
if (key['return'] || input === '\r' || input === '\n') newline();
|
||||
else if (key['leftArrow'] && !key['meta'] && !key['ctrl'] && !key['alt'])
|
||||
move('left');
|
||||
else if (key['ctrl'] && input === 'b') move('left');
|
||||
else if (key['rightArrow'] && !key['meta'] && !key['ctrl'] && !key['alt'])
|
||||
move('right');
|
||||
else if (key['ctrl'] && input === 'f') move('right');
|
||||
else if (key['upArrow']) move('up');
|
||||
else if (key['downArrow']) move('down');
|
||||
else if ((key['meta'] || key['ctrl'] || key['alt']) && key['leftArrow'])
|
||||
else if ((key['ctrl'] || key['alt']) && key['leftArrow'])
|
||||
move('wordLeft');
|
||||
else if ((key['meta'] || key['ctrl'] || key['alt']) && key['rightArrow'])
|
||||
else if (key['meta'] && input === 'b') move('wordLeft');
|
||||
else if ((key['ctrl'] || key['alt']) && key['rightArrow'])
|
||||
move('wordRight');
|
||||
else if (key['meta'] && input === 'f') move('wordRight');
|
||||
else if (key['home']) move('home');
|
||||
else if (key['ctrl'] && input === 'a') move('home');
|
||||
else if (key['end']) move('end');
|
||||
else if (key['ctrl'] && input === 'e') move('end');
|
||||
else if (
|
||||
(key['meta'] || key['ctrl'] || key['alt']) &&
|
||||
(key['backspace'] || input === '\x7f')
|
||||
|
||||
Reference in New Issue
Block a user