From ae61f6654faeeb7b85bbc50dc640a7ce9c65fcdd Mon Sep 17 00:00:00 2001
From: rswindell <>
Date: Fri, 10 Apr 2020 09:09:01 +0000
Subject: [PATCH] Don't set the API "changes" flag when just searching for text
 and editing the find-text string.

---
 src/uifc/uifc.h   | 1 +
 src/uifc/uifc32.c | 6 +++---
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/uifc/uifc.h b/src/uifc/uifc.h
index e2c7d39d75..ca12d2b4a1 100644
--- a/src/uifc/uifc.h
+++ b/src/uifc/uifc.h
@@ -205,6 +205,7 @@
 								/* Input area (NOT outside of window!)		*/
 								/* And ungets the mouse event.				*/
 #define K_PASSWORD	(1L<<16)	/* Does not display text while editing		*/
+#define K_FIND		(1L<<17)	/* Don't set the "changes" flag				*/
 
 
 						/* Extra exit flags */
diff --git a/src/uifc/uifc32.c b/src/uifc/uifc32.c
index 33a2d280af..add21770a4 100644
--- a/src/uifc/uifc32.c
+++ b/src/uifc/uifc32.c
@@ -1714,7 +1714,7 @@ int ulist(int mode, int left, int top, int width, int *cur, int *bar
 						case CTRL_F:			/* find */
 						case CTRL_G:
 							if(/*!(api->mode&UIFC_NOCTRL)*/1) { // No no, *this* control key is fine!
-								if (gotkey == CTRL_G || api->input(WIN_MID|WIN_SAV, 0, 0, "Find", search, sizeof(search), K_EDIT) > 0) {
+								if (gotkey == CTRL_G || api->input(WIN_MID|WIN_SAV, 0, 0, "Find", search, sizeof(search), K_EDIT|K_FIND) > 0) {
 									for (j = (*cur) + 1; j != *cur; j++, j = (j >= opts) ? 0 : j) {
 										if (strcasestr(option[j], search) != NULL) {
 											// Copy/pasted from search above.
@@ -2370,12 +2370,12 @@ int ugetstr(int left, int top, int width, char *outstr, int max, long mode, int
 	if(mode&K_EDIT)
 	{
 		truncspctrl(str);
-		if(strcmp(outstr,str))
+		if(!(mode&K_FIND) && strcmp(outstr,str))
 			api->changes=1;
 	}
 	else
 	{
-		if(j)
+		if(!(mode&K_FIND) && j)
 			api->changes=1;
 	}
 	strcpy(outstr,str);
-- 
GitLab