From 2a32934f864a156b69639ae2be3e86b2ca83ec07 Mon Sep 17 00:00:00 2001 From: daboe01 Date: Sat, 19 Jul 2025 09:40:14 +0200 Subject: [PATCH] fixed: ipad backspace issue --- AppKit/CPTextView/CPTextView.j | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/AppKit/CPTextView/CPTextView.j b/AppKit/CPTextView/CPTextView.j index c0e54f77e..1719695df 100644 --- a/AppKit/CPTextView/CPTextView.j +++ b/AppKit/CPTextView/CPTextView.j @@ -2680,12 +2680,21 @@ var _CPCopyPlaceholder = '-'; // Fires for simple key presses (a, b, 1, 2) _CPNativeInputField.addEventListener('input', function(e) { - // If we are in a composition (e.g., IME), we do nothing. + // If we are in a composition (e.g., IME), do nothing. // We wait for 'compositionend' to get the final, complete text. - if (_isComposing) { + if (_isComposing) + return; + + // The 'input' event fires for deletions too. On iPad, repeatedly + // backspacing on an empty field can insert strange content (like
). + // We only want to handle this event for actual insertions. + // Deletions are handled by the standard key binding mechanism (deleteBackward:). + if (e.inputType && e.inputType.startsWith('delete')) + { + _CPNativeInputField.innerHTML = ''; return; } - // If not composing, this is a simple character. Handle it immediately. + handleInput(e.target.innerHTML); });