Skip to content

When using SlyEdit CTRL-Space on a MAC sends a 0x0 NUL character causing execution in the timeout logic

So when iTerm on a MAC and accidently pressing CTRL-Space, Slyedit thinks a timeout has occurred, when indeed it received a 0x0 character.

With the addition of K_NUL (8b8ed215), this patch changes SlyEdit so that it no longer thinks a 0x0 is a timeout:

root@alterant:/opt/sbbs# diff -urw exec/SlyEdit.js mods/SlyEdit.js
--- exec/SlyEdit.js     2021-01-22 14:48:50.000000000 +1100
+++ mods/SlyEdit.js     2021-01-24 13:20:10.799585877 +1100
@@ -1084,7 +1084,7 @@
        var continueOn = true;
        while (continueOn)
        {
-               userInput = getKeyWithESCChars(K_NOCRLF|K_NOSPIN, gConfigSettings);
+               userInput = getKeyWithESCChars(K_NOCRLF|K_NOSPIN|K_NUL, gConfigSettings);

                // If the cursor is at the end of the last line and the user
                // pressed the DEL key, then treat it as a backspace.  Some
@@ -1105,7 +1105,7 @@
                }
                // If userInput is blank, then the input timeout was probably
                // reached, so abort.
-               else if (userInput == "")
+               else if (userInput == null)
                {
                        returnCode = 1; // Aborted
                        continueOn = false;
Edited by Deon George