From 95e95e988bc71c3192a8d7fa296a3a3a46f360c7 Mon Sep 17 00:00:00 2001 From: Jage9 Date: Sun, 22 Feb 2026 03:21:58 -0500 Subject: [PATCH] Fix Ctrl+V inserting v and add Delete key text editing --- client/public/version.js | 2 +- client/src/input/textInput.ts | 10 ++++++++++ client/src/main.ts | 8 ++++++++ 3 files changed, 19 insertions(+), 1 deletion(-) diff --git a/client/public/version.js b/client/public/version.js index 0571e20..7954242 100644 --- a/client/public/version.js +++ b/client/public/version.js @@ -1,5 +1,5 @@ // Maintainer-controlled web client version. // Format: YYYY.MM.DD Rn (example: 2026.02.20 R2) -window.CHGRID_WEB_VERSION = "2026.02.22 R142"; +window.CHGRID_WEB_VERSION = "2026.02.22 R143"; // Optional display timezone for timestamps. Falls back to America/Detroit if unset/invalid. window.CHGRID_TIME_ZONE = "America/Detroit"; diff --git a/client/src/input/textInput.ts b/client/src/input/textInput.ts index 4adc78f..7c5d57f 100644 --- a/client/src/input/textInput.ts +++ b/client/src/input/textInput.ts @@ -17,6 +17,10 @@ export function applyTextInput( newString = newString.slice(0, cursorPos - 1) + newString.slice(cursorPos); newCursorPos = cursorPos - 1; } + } else if (lowerKey === 'delete') { + if (cursorPos < newString.length) { + newString = newString.slice(0, cursorPos) + newString.slice(cursorPos + 1); + } } else if (lowerKey === 'home') { newCursorPos = 0; } else if (lowerKey === 'end') { @@ -92,6 +96,7 @@ export function mapTextInputKey(code: string, key: string): string { if (code === 'ArrowLeft') return 'arrowleft'; if (code === 'ArrowRight') return 'arrowright'; if (code === 'Backspace') return 'backspace'; + if (code === 'Delete') return 'delete'; if (code === 'Home') return 'home'; if (code === 'End') return 'end'; return key; @@ -182,3 +187,8 @@ export function describeBackspaceDeletedCharacter(text: string, cursorPos: numbe if (cursorPos <= 0 || cursorPos > text.length) return null; return describeCharacter(text[cursorPos - 1]); } + +export function describeDeleteDeletedCharacter(text: string, cursorPos: number): string | null { + if (cursorPos < 0 || cursorPos >= text.length) return null; + return describeCharacter(text[cursorPos]); +} diff --git a/client/src/main.ts b/client/src/main.ts index 054bd65..6b711a1 100644 --- a/client/src/main.ts +++ b/client/src/main.ts @@ -20,6 +20,7 @@ import { applyPastedText, applyTextInput, describeBackspaceDeletedCharacter, + describeDeleteDeletedCharacter, describeCursorCharacter, describeCursorWordOrCharacter, mapTextInputKey, @@ -682,6 +683,10 @@ function applyTextInputEdit(code: string, key: string, maxLength: number, ctrlKe const spoken = describeBackspaceDeletedCharacter(beforeText, beforeCursor); if (spoken) updateStatus(spoken); } + if (code === 'Delete') { + const spoken = describeDeleteDeletedCharacter(beforeText, beforeCursor); + if (spoken) updateStatus(spoken); + } if (code === 'ArrowLeft' || code === 'ArrowRight' || code === 'Home' || code === 'End') { const spoken = describeCursorCharacter(state.nicknameInput, state.cursorPos); if (spoken) updateStatus(spoken); @@ -2377,6 +2382,9 @@ function setupInputHandlers(): void { } if (event.ctrlKey && isTextEditingMode(state.mode)) { + if (code === 'KeyV') { + return; + } if (code === 'KeyC') { const text = state.nicknameInput; internalClipboardText = text;