From 31a06efcb2a90bb0938d8cc6a843cba53cb4d5b1 Mon Sep 17 00:00:00 2001
From: deuce <>
Date: Tue, 8 Jun 2004 06:44:41 +0000
Subject: [PATCH] Add ALT-S as shotcut to scrollback for *nix (Not sure if
 getch() should work the same way on Win32) Add shotcut key info to online
 menu Many scrollback viewing save/restore the screen

---
 src/syncterm/menu.c | 20 +++++++++++++++++---
 src/syncterm/term.c |  7 +++++++
 2 files changed, 24 insertions(+), 3 deletions(-)

diff --git a/src/syncterm/menu.c b/src/syncterm/menu.c
index 5bbd74ff18..8a3dd0fbae 100644
--- a/src/syncterm/menu.c
+++ b/src/syncterm/menu.c
@@ -9,11 +9,16 @@ void viewscroll(void)
 	int	top;
 	int key;
 	int i;
+	char	*buf;
+	struct	text_info txtinfo;
 
 	uifcbail();
+    gettextinfo(&txtinfo);
+	buf=(char *)malloc(txtinfo.screenheight*txtinfo.screenwidth*2);
+	gettext(1,1,txtinfo.screenwidth,txtinfo.screenheight,buf);
 	drawwin();
 	top=term.backpos-term.height;
-	for(;;) {
+	for(i=0;!i;) {
 		if(top<1)
 			top=1;
 		if(top>term.backpos-term.height)
@@ -42,6 +47,7 @@ void viewscroll(void)
 				top+=term.height;
 				break;
 			case ESC:
+				i=1;
 				return;
 			case KEY_F(1):
 				init_uifc();
@@ -56,12 +62,20 @@ void viewscroll(void)
 				break;
 		}
 	}
+	puttext(1,1,txtinfo.screenwidth,txtinfo.screenheight,buf);
+	free(buf);
+	return;
 }
 
 int syncmenu(void)
 {
-	char	*opts[3]={	 "Scrollback"
-						,"Disconnect"
+	char	*opts[3]={
+#ifdef __unix__
+						 "Scrollback (ALT-S)"
+#else
+						 "Scrollback"
+#endif
+						,"Disconnect (CTRL-Q)"
 						,""};
 	int		opt=0;
 	int		i;
diff --git a/src/syncterm/term.c b/src/syncterm/term.c
index 9fb1564b71..640222aaf6 100644
--- a/src/syncterm/term.c
+++ b/src/syncterm/term.c
@@ -647,6 +647,12 @@ void doterm(void)
 				case KEY_F(4):
 					rlogin_send("\033Ox",3,100);
 					break;
+#ifdef __unix__
+				case 128|'S':	/* Under curses, ALT sets the high bit of the char */
+				case 128|'s':	/* Under curses, ALT sets the high bit of the char */
+					viewscroll();
+					break;
+#endif
 				case KEY_BACKSPACE:
 				case '\b':
 					key='\b';
@@ -656,6 +662,7 @@ void doterm(void)
 						ch[0]=key;
 						rlogin_send(ch,1,100);
 					}
+					
 			}
 		}
 	}
-- 
GitLab