From d253a994edb0db291062a8935cf3436c323308bf Mon Sep 17 00:00:00 2001
From: rswindell <>
Date: Mon, 19 Aug 2019 08:33:40 +0000
Subject: [PATCH] Fix for use of save/restoreline() after using rputs() to
 display a prompt. The line counter was never cleared (upon rputs() of "\n")
 and the current attribute was not saved when a new line was being buffered.
 This applies to JS console.write() as well since it uses rputs().

---
 src/sbbs3/con_out.cpp | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/src/sbbs3/con_out.cpp b/src/sbbs3/con_out.cpp
index f738a2f5a1..14e3b2efac 100644
--- a/src/sbbs3/con_out.cpp
+++ b/src/sbbs3/con_out.cpp
@@ -391,8 +391,13 @@ int sbbs_t::rputs(const char *str, size_t len)
 			if((char)ch == (char)TELNET_IAC && !(telnet_mode&TELNET_MODE_OFF))
 				outcom(TELNET_IAC);	/* Must escape Telnet IAC char (255) */
 		}
-		if(lbuflen<LINE_BUFSIZE)
+		if(ch == '\n')
+			lbuflen=0;
+		else if(lbuflen<LINE_BUFSIZE) {
+			if(lbuflen == 0)
+				latr = curatr;
 			lbuf[lbuflen++] = ch;
+		}
 	}
 	return(l);
 }
-- 
GitLab