Skip to content

Commit cdc64a7

Browse files
koki-developclaude
andcommitted
fix: Correct backspace key handling in input field
- Fix backspace key detection by handling both key.backspace and key.delete - Ink's useInput treats both as backspace events for terminal compatibility - Separate Ctrl+d for delete-at-cursor functionality 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
1 parent cc35651 commit cdc64a7

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/components/InputField.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,8 @@ export const InputField: React.FC<InputFieldProps> = ({
5353
return;
5454
}
5555

56-
if (key.backspace) {
56+
// Backspace - delete character before cursor
57+
if (key.backspace || key.delete) {
5758
if (cursorPosition > 0) {
5859
const newValue =
5960
value.slice(0, cursorPosition - 1) + value.slice(cursorPosition);
@@ -62,8 +63,8 @@ export const InputField: React.FC<InputFieldProps> = ({
6263
return;
6364
}
6465

65-
// Delete character at cursor position (Delete key and Ctrl+d)
66-
if (key.delete || (key.ctrl && input === "d")) {
66+
// Delete character at cursor position (Ctrl+d)
67+
if (key.ctrl && input === "d") {
6768
if (cursorPosition < value.length) {
6869
const newValue =
6970
value.slice(0, cursorPosition) + value.slice(cursorPosition + 1);

0 commit comments

Comments
 (0)