From 3f47dd397d0abd43020b46dfb3de3ca56d23c6dc Mon Sep 17 00:00:00 2001
From: rswindell <>
Date: Sat, 25 Apr 2020 09:22:01 +0000
Subject: [PATCH] Resolve perform issue (> 1 second lag after key-press and
 screen update on rPi3) by using Frame.home() and Frame.cleartoeol() rather
 than Frame.clear().

---
 exec/ftn-setup.js  | 49 +++++++++++++++++++++++++++++++++++++++-------
 exec/xtrn-setup.js | 48 ++++++++++++++++++++++++++++++++++++++-------
 2 files changed, 83 insertions(+), 14 deletions(-)

diff --git a/exec/ftn-setup.js b/exec/ftn-setup.js
index 0b0824a89e..2b18eb0572 100644
--- a/exec/ftn-setup.js
+++ b/exec/ftn-setup.js
@@ -62,6 +62,7 @@ frame.cycle();
 
 var key;
 var zone;
+var high_water = 0;
 console.ungetstr(KEY_UP);
 while (!js.terminated) {
     key = console.getkey();
@@ -69,15 +70,49 @@ while (!js.terminated) {
     tree.getcmd(key);
     if (key == KEY_UP || key == KEY_DOWN || key == KEY_HOME || key == KEY_END) {
         zone = tree.currentItem.__ftn_setup;
-        info_frame.clear();
-        info_frame.putmsg('\1h\1w' + zone.name + '\r\n');
-        if (zone.desc) info_frame.putmsg('\1n\1w' + zone.desc + '\r\n\r\n');
-        if (zone.info) info_frame.putmsg('\1h\1cInformation\1w:\r\n\1n' + zone.info + '\r\n\r\n');
-        if (zone.coord) info_frame.putmsg('\1h\1cCoordinator\1w:\r\n\1n' + zone.coord + '\r\n\r\n');
-        if (zone.email) info_frame.putmsg('\1h\1cEmail\1w:\r\n\1n' + zone.email + '\r\n\r\n');
+	function crlf() {
+		info_frame.cleartoeol();
+		info_frame.crlf();
+	}
+        info_frame.home();
+        info_frame.putmsg('\1h\1w' + zone.name);
+	crlf();
+        if (zone.desc) {
+		info_frame.putmsg('\1n\1w' + zone.desc);
+		crlf();
+		crlf();
+	}
+        if (zone.info) {
+		info_frame.putmsg('\1h\1cInformation\1w:');
+		crlf();
+		info_frame.putmsg('\1n' + zone.info);
+		crlf();
+		crlf();
+	}
+        if (zone.coord) {
+		info_frame.putmsg('\1h\1cCoordinator\1w:');
+		crlf();
+		info_frame.putmsg('\1n' + zone.coord);
+		crlf();
+		crlf();
+	}
+        if (zone.email) {
+		info_frame.putmsg('\1h\1cEmail\1w:');
+		crlf();
+		info_frame.putmsg('\1n' + zone.email);
+		crlf();
+		crlf();
+	}
         if (addrs[zone._zone_number]) {
-            info_frame.putmsg('\1h\1rExisting address found: ' + addrs[zone._zone_number]);
+		info_frame.putmsg('\1h\1rExisting address found: ' + addrs[zone._zone_number]);
+		crlf();
         }
+	var y = info_frame.cursor.y;
+	while(high_water > y) {
+		crlf();
+		high_water--;
+	}
+	high_water = y;
     }
     if (frame.cycle()) console.gotoxy(console.screen_columns, console.screen_rows);
 }
diff --git a/exec/xtrn-setup.js b/exec/xtrn-setup.js
index 2f57fc6987..76fcc47f12 100644
--- a/exec/xtrn-setup.js
+++ b/exec/xtrn-setup.js
@@ -1,4 +1,5 @@
 // $Id$
+// vi: tabstop=4
 
 load('sbbsdefs.js');
 load('frame.js');
@@ -62,20 +63,53 @@ frame.cycle();
 
 var key;
 var xtrn;
+var high_water = 0;
 console.ungetstr(KEY_UP);
 while (!js.terminated) {
     key = console.getkey();
     if (key.toLowerCase() == 'q') break;
     tree.getcmd(key);
+    function crlf() {
+		info_frame.cleartoeol();
+		info_frame.crlf();
+    }
     if (key == KEY_UP || key == KEY_DOWN || key == KEY_HOME || key == KEY_END) {
         xtrn = tree.currentItem.__xtrn_setup;
-        info_frame.clear();
-        info_frame.putmsg('\x01h\x01w' + xtrn.Name + '\r\n');
-        if (xtrn.Desc) info_frame.putmsg('\x01n\x01w' + xtrn.Desc + '\r\n');
-		info_frame.putmsg('\r\n');
-        if (xtrn.By) info_frame.putmsg('\x01h\x01cBy\x01w:\r\n\x01w' + xtrn.By + '\r\n\r\n');
-        if (xtrn.Cats) info_frame.putmsg('\x01h\x01cCategories\x01w:\r\n\x01n' + xtrn.Cats + '\r\n\r\n');
-        if (xtrn.Subs) info_frame.putmsg('\x01h\x01cSubcategories\x01w:\r\n\x01n' + xtrn.Subs + '\r\n\r\n');
+        info_frame.home();
+        info_frame.putmsg('\x01h\x01w' + xtrn.Name);
+		crlf();
+        if (xtrn.Desc) {
+			info_frame.cleartoeol();
+			info_frame.putmsg('\x01n\x01w' + xtrn.Desc);
+			crlf();
+		}
+		crlf();
+        if (xtrn.By) {
+			info_frame.putmsg('\x01h\x01cBy\x01w:');
+			crlf();
+			info_frame.putmsg('\x01w' + xtrn.By);
+			crlf();
+			crlf();
+		}
+        if (xtrn.Cats) {
+			info_frame.putmsg('\x01h\x01cCategories\x01w:');
+			crlf();
+			info_frame.putmsg('\x01n' + xtrn.Cats);
+			crlf();
+			crlf();
+		}
+        if (xtrn.Subs) {
+			info_frame.putmsg('\x01h\x01cSubcategories\x01w:');
+			crlf();
+			info_frame.putmsg('\x01n' + xtrn.Subs);
+			crlf();
+		}
+		var y = info_frame.cursor.y;
+		while(high_water > y) {
+			crlf();
+			high_water--;
+		}
+		high_water = y;
     }
     if (frame.cycle()) console.gotoxy(console.screen_columns, console.screen_rows);
 }
-- 
GitLab