From bbe43336310bf8287b2805d7e6ff7956a5056ee6 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Deuc=D0=B5?= <shurd@sasktel.net>
Date: Thu, 18 Mar 2021 13:16:42 -0400
Subject: [PATCH] Fix menu draw when returning to dialing list from comment

Also note the spectacularily poorly named WIN_REDRAW and WIN_NODRAW
flags.  WIN_REDRAW indicates that this *is* a redraw of the menu,
which indicates that you don't need to redraw the menu (because it's
already correct on screen).  Weird, but not insane... WIN_NODRAW on
the other hand indicates this is *not* a redraw, and that the window
is incorrect on screen and you therefore *must* redraw the menu.

That is to say:
WIN_REDRAW prevents the window from being redrawn
WIN_NODRAW forces the window to be redrawn
---
 src/syncterm/bbslist.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/src/syncterm/bbslist.c b/src/syncterm/bbslist.c
index e754d8a3c7..73f57d0790 100644
--- a/src/syncterm/bbslist.c
+++ b/src/syncterm/bbslist.c
@@ -2109,6 +2109,7 @@ struct bbslist *show_bbslist(char *current, int connected)
     struct bbslist defaults;
     char    shared_list[MAX_PATH+1];
     char list_title[30];
+    int redraw = 0;
 
     glob_sbar = &sbar;
     glob_sopt = &sopt;
@@ -2184,8 +2185,9 @@ struct bbslist *show_bbslist(char *current, int connected)
 			uifc.list_height = uifc.scrn_len - 4;
                 val=uifc.list((listcount<MAX_OPTS?WIN_XTR:0)
                     |WIN_ACT|WIN_INSACT|WIN_DELACT|WIN_UNGETMOUSE|WIN_SAV|WIN_ESC
-                    |WIN_INS|WIN_DEL|WIN_EDIT|WIN_EXTKEYS|WIN_DYN|WIN_FIXEDHEIGHT
+                    |WIN_INS|WIN_DEL|WIN_EDIT|WIN_EXTKEYS|WIN_DYN|WIN_FIXEDHEIGHT|(redraw?WIN_NODRAW:0)
                     ,0,(uifc.scrn_len-(uifc.list_height)+1)/2-4,0,&opt,&bar,list_title,(char **)list);
+                redraw = 0;
                 if(val==listcount)
                     val=listcount|MSK_INS;
                 if(val==-7) { /* CTRL-E */
@@ -2221,8 +2223,10 @@ struct bbslist *show_bbslist(char *current, int connected)
                                     |WIN_INS|WIN_DEL|WIN_EDIT|WIN_EXTKEYS|WIN_DYN
                                     |WIN_SEL|WIN_FIXEDHEIGHT
                                     ,0,(uifc.scrn_len-(uifc.list_height)+1)/2-4,0,&opt,&bar,list_title,(char **)list);
-				if (edit_comment(list[opt], settings.list_path))
+				if (edit_comment(list[opt], settings.list_path)) {
+                                    redraw = 1;
 				    break;
+                                }
                                 at_settings=!at_settings;
                                 break;
                             }
-- 
GitLab