1
0
mirror of https://github.com/gryf/wmaker.git synced 2026-03-19 09:13:33 +01:00

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.
This commit is contained in:
David Maciejak
2026-01-20 18:48:17 -05:00
committed by Carlos R. Mafra
parent d37a3162e0
commit d2b2c3238b

View File

@@ -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);
}