From f61e7d93ac3d48d4c64f4282b2da14d4d67aeee0 Mon Sep 17 00:00:00 2001
From: rswindell <>
Date: Wed, 15 Aug 2018 19:38:06 +0000
Subject: [PATCH] This is a bit of a hack for Nelgin, who noticed that novice
 menu mode would not always auto-redisplay menu files when the user hits 'Q'
 (or 'N' or Ctrl-C) at auto-pause prompts:

When displaying a "message" (e.g. file), if the console abort flag is set
before a single line has been displayed, clear the abort flag. This most
likely means a pause (hit a key) prompt was automatically displayed due to
a clear screen code in the message/file and the user hit 'Q' or 'N' or
Ctrl-C at the prompt. In this special case, don't treat that as an
"abort message" command and keep displaying the message/file.

Once one or more lines in the message/file have been displayed, then the
behavior is the same as before: a console abort (even as a result of an
auto-pause prompt key) will stop the display of the current message/file.
---
 src/sbbs3/putmsg.cpp | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/src/sbbs3/putmsg.cpp b/src/sbbs3/putmsg.cpp
index 86288566ef..c6213fd768 100644
--- a/src/sbbs3/putmsg.cpp
+++ b/src/sbbs3/putmsg.cpp
@@ -55,6 +55,7 @@ char sbbs_t::putmsg(const char *buf, long mode)
 	int 	orgcon=console,i;
 	ulong	l=0,sys_status_sav=sys_status;
 	int		defered_pause=FALSE;
+	uint	lines_printed = 0;
 
 	attr_sp=0;	/* clear any saved attributes */
 	tmpatr=curatr;	/* was lclatr(-1) */
@@ -91,7 +92,9 @@ char sbbs_t::putmsg(const char *buf, long mode)
 				break;
 			else {
 				ctrl_a(str[l+1]);
-				l+=2; 
+				if((sys_status&SS_ABORT) && !lines_printed)	/* Aborted at (auto) pause prompt (e.g. due to CLS)? */
+					sys_status &= ~SS_ABORT;				/* Clear the abort flag (keep displaying the msg/file) */
+				l+=2;
 			} 
 		}
 		else if((str[l]=='`' || str[l]=='รบ') && str[l+1]=='[') {   
@@ -227,6 +230,7 @@ char sbbs_t::putmsg(const char *buf, long mode)
 					attr(LIGHTGRAY);
 				if(l==0 || str[l-1]!='\r')	/* expand sole LF to CR/LF */
 					outchar('\r');
+				lines_printed++;
 			}
 
 			/* ansi escape sequence */
@@ -259,6 +263,8 @@ char sbbs_t::putmsg(const char *buf, long mode)
 				}
 				i=show_atcode((char *)str+l);	/* returns 0 if not valid @ code */
 				l+=i;					/* i is length of code string */
+				if((sys_status&SS_ABORT) && !lines_printed)	/* Aborted at (auto) pause prompt (e.g. due to CLS)? */
+					sys_status &= ~SS_ABORT;				/* Clear the abort flag (keep displaying the msg/file) */
 				if(i)					/* if valid string, go to top */
 					continue; 
 			}
-- 
GitLab