From be6c019bca7549a234ffb71be8fe9e6c6763c3be Mon Sep 17 00:00:00 2001 From: Jarrio Date: Thu, 28 Aug 2025 11:31:40 +0100 Subject: [PATCH 1/2] Add the ability to delete text with the delete key --- runtime/src/ceramic/EditText.hx | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/runtime/src/ceramic/EditText.hx b/runtime/src/ceramic/EditText.hx index 57337c3cc..cdcc9597d 100644 --- a/runtime/src/ceramic/EditText.hx +++ b/runtime/src/ceramic/EditText.hx @@ -601,6 +601,28 @@ class EditText extends Entity implements Component implements TextInputDelegate emitUpdate(newText); }); + keyBindings.bind([KEY(KeyCode.DELETE)], function() { + // Delete key + if (screen.focusedVisual != entity) + return; + + var newText = ''; + if (selectText.selectionStart != selectText.selectionEnd) { + newText = entity.content.substring(0, selectText.selectionStart) + entity.content.substring(selectText.selectionEnd); + selectText.selectionEnd = selectText.selectionStart; + } else { + if (selectText.selectionStart < entity.content.length) { + newText = entity.content.substring(0, selectText.selectionStart) + entity.content.substring(selectText.selectionStart + 1); + } else { + return; + } + } + + // Update text content + entity.content = newText; + emitUpdate(newText); + }); + onDestroy(keyBindings, function(_) { keyBindings.destroy(); keyBindings = null; From 84a40468610db8103bbf1d058f835407110c14bd Mon Sep 17 00:00:00 2001 From: Jarrio Date: Thu, 28 Aug 2025 11:42:23 +0100 Subject: [PATCH 2/2] update app textinput state after deleting a key --- runtime/src/ceramic/EditText.hx | 1 + 1 file changed, 1 insertion(+) diff --git a/runtime/src/ceramic/EditText.hx b/runtime/src/ceramic/EditText.hx index cdcc9597d..6b49e0fb4 100644 --- a/runtime/src/ceramic/EditText.hx +++ b/runtime/src/ceramic/EditText.hx @@ -620,6 +620,7 @@ class EditText extends Entity implements Component implements TextInputDelegate // Update text content entity.content = newText; + app.textInput.text = newText; emitUpdate(newText); });