From 2ca49b58adf161233160491a9d376b869acb319c Mon Sep 17 00:00:00 2001
From: Rob <rob@synchro.net>
Date: Thu, 17 Sep 2020 20:58:53 -0700
Subject: [PATCH] Fix an off-by-one line bug in the "local side" of the
 split-screen-chat.

This bug would cause the split-screen separator to repeat when the local
side scrolled (if the terminal was 24 rows, bug didn't happen when local
screen was 25 rows).

This bug appears to have "always" been there. The split-screen separator is
80 columns, so that forced a line wrap on the subsequent CRLF and the local_y
value was "off-by-one". Just use ansi_gotoxy() instead and put the cursor
where you think it is.

Also, support > 24 row terminals for longer chat history (bottom half only).
---
 src/sbbs3/chat.cpp | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/sbbs3/chat.cpp b/src/sbbs3/chat.cpp
index aabbee78c8..ce9ed96bbc 100644
--- a/src/sbbs3/chat.cpp
+++ b/src/sbbs3/chat.cpp
@@ -964,7 +964,7 @@ void sbbs_t::privchat(bool forced, int node_num)
 			,thisnode.misc&NODE_MSGW ? 'T':' '
 			,sectostr(timeleft,tmp)
 			,thisnode.misc&NODE_NMSG ? 'M':' ');
-		CRLF;
+		ansi_gotoxy(1,14);
 		local_y=14; 
 	}
 
@@ -1016,7 +1016,7 @@ void sbbs_t::privchat(bool forced, int node_num)
 						,thisnode.misc&NODE_MSGW ? 'T':' '
 						,sectostr(timeleft,tmp)
 						,thisnode.misc&NODE_NMSG ? 'M':' ');
-					CRLF;
+					ansi_gotoxy(1,14);
 					attr(cfg.color[clr_chatlocal]);
 					localbuf[localline][localchar]=0;
 					for(i=0;i<=localline;i++) {
@@ -1040,7 +1040,7 @@ void sbbs_t::privchat(bool forced, int node_num)
 					localbuf[localline][localchar]=0;
 					localchar=0;
 
-					if(sys_status&SS_SPLITP && local_y==24) {
+					if(sys_status&SS_SPLITP && local_y >= rows) {
 						ansi_gotoxy(1,13);
 						bprintf(forced ? local_sep : sep
 							,thisnode.misc&NODE_MSGW ? 'T':' '
-- 
GitLab