feat(input): add undo/redo shortcuts with Ctrl+Z and Ctrl+R (#4625)

Co-authored-by: Jacob Richman <jacob314@gmail.com>
Co-authored-by: matt korwel <matt.korwel@gmail.com>
This commit is contained in:
masiaf
2025-09-12 16:07:34 -05:00
committed by GitHub
parent 21826010ef
commit 811a2e90d9
3 changed files with 25 additions and 3 deletions

View File

@@ -1924,11 +1924,23 @@ export function useTextBuffer({
)
backspace();
else if (key.name === 'delete' || (key.ctrl && key.name === 'd')) del();
else if (key.ctrl && !key.shift && key.name === 'z') undo();
else if (key.ctrl && key.shift && key.name === 'z') redo();
else if (input && !key.ctrl && !key.meta) {
insert(input, { paste: key.paste });
}
},
[newline, move, deleteWordLeft, deleteWordRight, backspace, del, insert],
[
newline,
move,
deleteWordLeft,
deleteWordRight,
backspace,
del,
insert,
undo,
redo,
],
);
const renderedVisualLines = useMemo(