Support ctrl-C and Ctrl-D correctly Refactor so InputPrompt has priority over AppContainer for input handling. (#17993)

This commit is contained in:
Jacob Richman
2026-01-30 16:11:14 -08:00
committed by GitHub
parent 0fe8492569
commit 00fdb30211
6 changed files with 193 additions and 62 deletions

View File

@@ -2930,6 +2930,13 @@ export function useTextBuffer({
move('end');
return true;
}
if (keyMatchers[Command.CLEAR_INPUT](key)) {
if (text.length > 0) {
setText('');
return true;
}
return false;
}
if (keyMatchers[Command.DELETE_WORD_BACKWARD](key)) {
deleteWordLeft();
return true;
@@ -2943,6 +2950,13 @@ export function useTextBuffer({
return true;
}
if (keyMatchers[Command.DELETE_CHAR_RIGHT](key)) {
const lastLineIdx = lines.length - 1;
if (
cursorRow === lastLineIdx &&
cursorCol === cpLen(lines[lastLineIdx] ?? '')
) {
return false;
}
del();
return true;
}
@@ -2974,6 +2988,8 @@ export function useTextBuffer({
cursorCol,
lines,
singleLine,
setText,
text,
],
);