Lagrange [work/v1.7]

InputWidget: Fixed hang if widget is very narrrow

=> c1001c3ab6e6b0aa42cb4dfeec501845a0091e99

diff --git a/src/ui/inputwidget.c b/src/ui/inputwidget.c
index 9261da0c..aa55f3f0 100644
--- a/src/ui/inputwidget.c
+++ b/src/ui/inputwidget.c
@@ -742,15 +742,17 @@ static void startOrStopCursorTimer_InputWidget_(iInputWidget *d, int doStart) {
 #else /* using a system-provided text control */
 
 static void updateAllLinesAndResizeHeight_InputWidget_(iInputWidget *d) {
-    /* Rewrap the buffered text and resize accordingly. */
-    iWrapText wt = wrap_InputWidget_(d, 0);
-    /* TODO: Set max lines limit for WrapText. */
-    const int height = measure_WrapText(&wt, d->font).bounds.size.y;
-    /* We use this to store the number wrapped lines for determining widget height. */
-    d->visWrapLines.start = 0;
-    d->visWrapLines.end = iMax(d->minWrapLines,
-                               iMin(d->maxWrapLines, height / lineHeight_Text(d->font)));
-    updateMetrics_InputWidget_(d);
+    if (width_Widget(d) >= minWidth_InputWidget_) {
+        /* Rewrap the buffered text and resize accordingly. */
+        iWrapText wt = wrap_InputWidget_(d, 0);
+        /* TODO: Set max lines limit for WrapText. */
+        const int height = measure_WrapText(&wt, d->font).bounds.size.y;
+        /* We use this to store the number wrapped lines for determining widget height. */
+        d->visWrapLines.start = 0;
+        d->visWrapLines.end = iMax(d->minWrapLines,
+                                   iMin(d->maxWrapLines, height / lineHeight_Text(d->font)));
+        updateMetrics_InputWidget_(d);
+    }
 }
 
 #endif
Proxy Information
Original URL
gemini://git.skyjake.fi/lagrange/work%2Fv1.7/cdiff/c1001c3ab6e6b0aa42cb4dfeec501845a0091e99
Status Code
Success (20)
Meta
text/gemini; charset=utf-8
Capsule Response Time
373.304921 milliseconds
Gemini-to-HTML Time
0.153301 milliseconds

This content has been proxied by September (ba2dc).