From d2b2c3238b7875515a0b8e0e492557f088e8a4c0 Mon Sep 17 00:00:00 2001 From: David Maciejak Date: Tue, 20 Jan 2026 18:48:17 -0500 Subject: [PATCH] WINGs: fix cursor position in wtextfield In case the cursor is positioned out of the textfield view after a delete and more chars are entered, wmaker process will reach 100% and become unresponsive. How to reproduce: in the run command window enter an overly long text (longer than the current input field view). Then, press home to go back to the beginning of the string. Then, shift-End to select all the text, then del to delete all the text. At that point the cursor is still out of the view and if you enter more text wmaker process will be stuck. --- WINGs/wtextfield.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/WINGs/wtextfield.c b/WINGs/wtextfield.c index c955e332..f5f6e411 100644 --- a/WINGs/wtextfield.c +++ b/WINGs/wtextfield.c @@ -446,6 +446,13 @@ void WMDeleteTextFieldRange(WMTextField * tPtr, WMRange range) decrToFit(tPtr); + /* Ensure cursor is visible after deletion */ + if (tPtr->cursorPosition < tPtr->viewPosition) { + tPtr->viewPosition = tPtr->cursorPosition; + } else { + incrToFit2(tPtr); + } + paintTextField(tPtr); }