Skip to content
Snippets Groups Projects
Commit 80629d44 authored by Eric Oulashin's avatar Eric Oulashin
Browse files

Used js.on_exit() to set console.ctrlkey_passthru back on exit properly...

Used js.on_exit() to set console.ctrlkey_passthru back on exit properly (SlyEdit, DDMsgReader) and bbs.sys_status (SlyEdit)
parent b2f91e77
No related branches found
No related tags found
2 merge requests!463MRC mods by Codefenix (2024-10-20),!206Proper use of js.on_exit() in DDMsgReader and SlyEdit
Pipeline #3204 passed
......@@ -406,15 +406,16 @@ else
gInputFilename = newest_filename;
}
// When exiting this script, make sure to set the bbs.sys_status & ctrl key pasthru values
// back to what they were originally
js.on_exit("bbs.sys_status = " + bbs.sys_status);
js.on_exit("console.ctrlkey_passthru = " + console.ctrlkey_passthru);
// Update the user's status on the BBS
var gOldStatus = bbs.sys_status;
bbs.sys_status &=~SS_PAUSEON;
bbs.sys_status |= SS_PAUSEOFF;
var gOldPassthru = console.ctrlkey_passthru;
// Update the ctrl key passthru to support what SlyEdit needs (only while SlyEdit is running)
console.ctrlkey_passthru = "+ACGKLOPQRTUVWXYZ_";
// Set some on-exit code to ensure that the original ctrl key passthru & system
// status settings are restored upon script exit, even if there is a runtime error.
js.on_exit("console.ctrlkey_passthru = gOldPassthru; bbs.sys_status = gOldStatus;");
// Enable delete line in SyncTERM (Disabling ANSI Music in the process)
console.write("\x1B[=1M"); // 1B (27): ESC
console.clear();
......@@ -886,10 +887,6 @@ function saveMessageToFile()
}
// Set the original ctrlkey_passthru and sys_status settins back.
console.ctrlkey_passthru = gOldPassthru;
bbs.sys_status = gOldStatus;
// Set the end-of-program status message.
var endStatusMessage = "";
if (exitCode == 1)
......
......@@ -513,6 +513,8 @@ if (gDoDDMR)
// Write the user's default twitlist if it doesn't already exist
writeDefaultUserTwitListIfNotExist();
 
// When exiting this script, make sure to set the ctrl key pasthru back to what it was originally
js.on_exit("console.ctrlkey_passthru = " + console.ctrlkey_passthru);
// Set a control key pass-thru so we can capture certain control keys that we normally wouldn't be able to
var gOldCtrlKeyPassthru = console.ctrlkey_passthru; // Backup to be restored later
console.ctrlkey_passthru = "+ACGKLOPQRTUVWXYZ_";
......@@ -644,9 +646,6 @@ if (gDoDDMR)
console.print("\x01n");
if (console.term_supports(USER_ANSI))
console.print("\x01B[0m"); // ESC[0m
// Set the original control key passthru back into the console object
console.ctrlkey_passthru = gOldCtrlKeyPassthru;
}
 
// End of script execution. Functions below:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment