From 0e9be15b06222bbb272d74526425daf3adbc8fc9 Mon Sep 17 00:00:00 2001
From: Eric Oulashin <eric.oulashin@gmail.com>
Date: Sat, 17 Feb 2024 21:50:33 -0800
Subject: [PATCH] SlyEdit: Update for the isPrintableChar() function to allow
 more for UTF-8 (it's a simplistic function).  Also updated the version number
 in slyedcfg.js.

---
 exec/SlyEdit_Misc.js | 27 +++++++++++++++++----------
 exec/slyedcfg.js     |  4 ++--
 2 files changed, 19 insertions(+), 12 deletions(-)

diff --git a/exec/SlyEdit_Misc.js b/exec/SlyEdit_Misc.js
index eb6ebd612a..d9c015c7d3 100644
--- a/exec/SlyEdit_Misc.js
+++ b/exec/SlyEdit_Misc.js
@@ -1769,19 +1769,26 @@ function getCurrentTimeStr()
 	return timeStr;
 }
 
-// Returns whether or not a character is printable.
+// Returns whether or not a character is printable.  This function is fairly simplistic.
 function isPrintableChar(pText)
 {
-   // Make sure pText is valid and is a string.
-   if (typeof(pText) != "string")
-      return false;
-   if (pText.length == 0)
-      return false;
+	// Make sure pText is valid and is a string.
+	if (typeof(pText) != "string")
+		return false;
+	if (pText.length == 0)
+		return false;
 
-   // Make sure the character is a printable ASCII character in the range of 32 to 254,
-   // except for 127 (delete).
-   var charCode = pText.charCodeAt(0);
-   return ((charCode > 31) && (charCode < 255) && (charCode != 127));
+	var charCode = pText.charCodeAt(0);
+	// If K_UTF8 exists, then we use it for input and UTF-8 characters are possible.
+	// Otherwise, just ASCII/CP437 characters are possible.
+	if (g_K_UTF8Exists)
+		return (charCode > 31 && charCode != 127);
+	else // ASCII/CP437
+	{
+		// Make sure the character is a printable ASCII/CP437 character in the range of
+		// 32 to 254, except for 127 (delete).
+		return (charCode > 31 && charCode < 255 && charCode != 127);
+	}
 }
 
 // Removes multiple, leading, and/or trailing spaces
diff --git a/exec/slyedcfg.js b/exec/slyedcfg.js
index 76ab5021c9..ff4025d6b9 100644
--- a/exec/slyedcfg.js
+++ b/exec/slyedcfg.js
@@ -1,7 +1,7 @@
 // SlyEdit configurator: This is a menu-driven configuration program/script for SlyEdit.
 // Any changes are saved to SlyEdit.cfg in sbbs/mods, so that custom changes don't get
 // overridden with SlyEdit.cfg in sbbs/ctrl due to an update.
-// Currently for SlyEdit 1.87.
+// Currently for SlyEdit 1.88d.
 
 "use strict";
 
@@ -10,7 +10,7 @@ require("sbbsdefs.js", "P_NONE");
 require("uifcdefs.js", "UIFC_INMSG");
 
 
-if (!uifc.init("SlyEdit 1.87 Configurator"))
+if (!uifc.init("SlyEdit 1.88d Configurator"))
 {
 	print("Failed to initialize uifc");
 	exit(1);
-- 
GitLab