From 7aff3d36088bd5b5eb0cd8cb85f052fe799acc62 Mon Sep 17 00:00:00 2001
From: rswindell <>
Date: Fri, 16 Jan 2009 03:51:46 +0000
Subject: [PATCH] Define and use new input function mode bit (K_ANSI_CPR) that
 indicates we are expecting an ANSI cursor position report and we will use
 this value to determine the user's screen dimensions (currently, lines only).

---
 src/sbbs3/ansiterm.cpp | 4 ++--
 src/sbbs3/inkey.cpp    | 4 ++--
 src/sbbs3/sbbsdefs.h   | 3 ++-
 3 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/src/sbbs3/ansiterm.cpp b/src/sbbs3/ansiterm.cpp
index 5e776200ce..f8a6a91658 100644
--- a/src/sbbs3/ansiterm.cpp
+++ b/src/sbbs3/ansiterm.cpp
@@ -8,7 +8,7 @@
  * @format.tab-size 4		(Plain Text/Source Code File Header)			*
  * @format.use-tabs true	(see http://www.synchro.net/ptsc_hdr.html)		*
  *																			*
- * Copyright 2006 Rob Swindell - http://www.synchro.net/copyright.html		*
+ * Copyright 2009 Rob Swindell - http://www.synchro.net/copyright.html		*
  *																			*
  * This program is free software; you can redistribute it and/or			*
  * modify it under the terms of the GNU General Public License				*
@@ -103,7 +103,7 @@ void sbbs_t::ansi_getlines()
 		&& online==ON_REMOTE) {									/* Remote */
 		SYNC;
 		putcom("\x1b[s\x1b[99B\x1b[6n\x1b[u");
-		inkey(K_NONE,TIMEOUT_ANSI_GETXY*1000); 
+		inkey(K_ANSI_CPR,TIMEOUT_ANSI_GETXY*1000); 
 	}
 }
 
diff --git a/src/sbbs3/inkey.cpp b/src/sbbs3/inkey.cpp
index 4934b050b4..9d7bdac6f1 100644
--- a/src/sbbs3/inkey.cpp
+++ b/src/sbbs3/inkey.cpp
@@ -8,7 +8,7 @@
  * @format.tab-size 4		(Plain Text/Source Code File Header)			*
  * @format.use-tabs true	(see http://www.synchro.net/ptsc_hdr.html)		*
  *																			*
- * Copyright 2007 Rob Swindell - http://www.synchro.net/copyright.html		*
+ * Copyright 2009 Rob Swindell - http://www.synchro.net/copyright.html		*
  *																			*
  * This program is free software; you can redistribute it and/or			*
  * modify it under the terms of the GNU General Public License				*
@@ -312,7 +312,7 @@ char sbbs_t::handle_ctrlkey(char ch, long mode)
 					return(ESC); 
 				}
 				if(ch=='R') {       /* cursor position report */
-					if(i && !(useron.rows)) {	/* auto-detect rows */
+					if(mode&K_ANSI_CPR && i && !(useron.rows)) {	/* auto-detect rows */
 						str[i]=0;
 						rows=atoi(str);
 						lprintf(LOG_DEBUG,"Node %d ANSI cursor position report: %u rows"
diff --git a/src/sbbs3/sbbsdefs.h b/src/sbbs3/sbbsdefs.h
index 5fdb2a8f0d..caec2ea26a 100644
--- a/src/sbbs3/sbbsdefs.h
+++ b/src/sbbs3/sbbsdefs.h
@@ -8,7 +8,7 @@
  * @format.tab-size 4		(Plain Text/Source Code File Header)			*
  * @format.use-tabs true	(see http://www.synchro.net/ptsc_hdr.html)		*
  *																			*
- * Copyright 2008 Rob Swindell - http://www.synchro.net/copyright.html		*
+ * Copyright 2009 Rob Swindell - http://www.synchro.net/copyright.html		*
  *																			*
  * This program is free software; you can redistribute it and/or			*
  * modify it under the terms of the GNU General Public License				*
@@ -679,6 +679,7 @@ typedef enum {						/* Values for xtrn_t.event				*/
 #define K_LEFTEXIT	(1L<<19)	/* Allow exit by backspacing/arrowing left	*/
 #define K_USEOFFSET	(1L<<20)	/* Use getstr_offset for cursor	position	*/
 #define K_NOSPIN	(1L<<21)	/* Do not honor the user's spinning cursor	*/
+#define K_ANSI_CPR	(1L<<22)	/* Expect ANSI Cursor Position Report		*/
 
 								/* Bits in 'mode' for putmsg and printfile  */
 #define P_NOABORT  	(1<<0)		/* Disallows abortion of a message          */
-- 
GitLab