chore: multiline traversal support (#51)

Co-authored-by: Shubham Naik <shub@memgpt.ai>
This commit is contained in:
Shubham Naik
2025-11-01 10:00:04 -07:00
committed by GitHub
parent 4118d018fe
commit 14e67fa156
7 changed files with 139 additions and 42 deletions

View File

@@ -46,7 +46,7 @@ function TextInput({ value: originalValue, placeholder = '', focus = true, mask,
return;
}
// Treat Escape as a control key (don't insert into value)
if (key.escape || key.upArrow || key.downArrow || (key.ctrl && input === 'c') || key.tab || (key.shift && key.tab)) {
if (key.escape || (key.ctrl && input === 'c') || key.tab || (key.shift && key.tab)) {
return;
}
if (key.return) {
@@ -68,6 +68,11 @@ function TextInput({ value: originalValue, placeholder = '', focus = true, mask,
nextCursorOffset++;
}
}
else if (key.upArrow || key.downArrow) {
// Handle wrapped line navigation - don't handle here, let parent decide
// Parent will check cursor position to determine if at boundary
return;
}
else if (key.backspace || key.delete) {
if (cursorOffset > 0) {
nextValue = originalValue.slice(0, cursorOffset - 1) + originalValue.slice(cursorOffset, originalValue.length);