From a8c1a58784e016cb10e6cfb7b42e8a37b3260e36 Mon Sep 17 00:00:00 2001
From: deuce <>
Date: Wed, 11 Aug 2004 00:44:13 +0000
Subject: [PATCH] Remove tight input loop in ugetstr().  Block on getch()
 instead.

---
 src/uifc/uifc32.c | 25 ++++++++++---------------
 1 file changed, 10 insertions(+), 15 deletions(-)

diff --git a/src/uifc/uifc32.c b/src/uifc/uifc32.c
index 3d486f0b17..8a4330e50c 100644
--- a/src/uifc/uifc32.c
+++ b/src/uifc/uifc32.c
@@ -1613,27 +1613,24 @@ int ugetstr(int left, int top, int width, char *outstr, int max, long mode, int
 		if(i>j) j=i;
 		str[j]=0;
 		getstrupd(left, top, width, str, i, &soffset);
-		if(f || kbwait())
+		if(f || (ch=inkey()))
 		{
 			if(f)
 				ch=f;
-			else {
-				ch=inkey();
-				if(ch==CIO_KEY_MOUSE) {
-					if((ch=uifc_getmouse(&mevnt))==0) {
-						if(mevnt.x>=left-1
-								&& mevnt.x<=left+width-1
-								&& mevnt.button==1) {
-							i=mevnt.x-left+soffset+1;
-							if(i>j)
-								i=j;
-						}
+			f=0;
+			if(ch==CIO_KEY_MOUSE) {
+				if((ch=uifc_getmouse(&mevnt))==0) {
+					if(mevnt.x>=left-1
+							&& mevnt.x<=left+width-1
+							&& mevnt.button==1) {
+						i=mevnt.x-left+soffset+1;
+						if(i>j)
+							i=j;
 					}
 				}
 			}
 			if(lastkey != NULL)
 				*lastkey=ch;
-			f=0;
 			switch(ch)
 			{
 				case CIO_KEY_F(1):	/* F1 Help */
@@ -1763,8 +1760,6 @@ int ugetstr(int left, int top, int width, char *outstr, int max, long mode, int
 				str[i++]=ch; 
 			}
 		}
-		else
-			mswait(1);
 	}
 
 
-- 
GitLab