[PATCH 2/4] WINGs: fix cursor position in wtextfield

0 views
Skip to first unread message

david.m...@gmail.com

unread,
Jan 22, 2026, 5:30:27 PM (11 days ago) Jan 22
to Window Maker Development
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);
 }
 
--
2.43.0

0002-WINGs-fix-cursor-position-in-wtextfield.patch
Reply all
Reply to author
Forward
0 new messages