From 889ca800fd693d38cde40713777e561053bf6610 Mon Sep 17 00:00:00 2001 From: "Rob Swindell (on Debian Linux)" <rob@synchro.net> Date: Sun, 3 Dec 2023 17:33:42 -0800 Subject: [PATCH] Use P_NOABORT mode flag for calls to console.putmsg() The Baja PRINT function (used in yesnobar.src/noyesbar.src) calls putmsg() with P_SAVEATR|P_NOABORT. Without P_NOABORT, putmsg() doesn't display anything if the global console abort (SS_ABORT) flag is set. So hitting 'N' or Ctrl-C at one yes/no or no/yes prompt would mean any immediately subsequent yes/no or no/yes prompt would not be displayed. Now that we have to require('sbbsdefs.js') for the P_NOABORT definition, this'll run a little slower. :-( Enable/conform to "use strict" mode. --- exec/noyesbar.js | 7 +++++-- exec/yesnobar.js | 8 ++++++-- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/exec/noyesbar.js b/exec/noyesbar.js index a6daf8c5a2..077058d0e4 100755 --- a/exec/noyesbar.js +++ b/exec/noyesbar.js @@ -1,4 +1,7 @@ // JS version of noyesbar.src +require("sbbsdefs.js", "P_NOABORT"); + +"use strict"; const yes_str = bbs.text(bbs.text.Yes); const yes_key = yes_str[0]; @@ -15,7 +18,7 @@ if(console.question.substring(0, 2) == "\x01\?") { console.question = console.question.substring(2); } -console.putmsg("\x01n\x01b\x01h[\x01c@CHECKMARK@\x01b] \x01y@QUESTION->@? @CLEAR_HOT@"); +console.putmsg("\x01n\x01b\x01h[\x01c@CHECKMARK@\x01b] \x01y@QUESTION->@? @CLEAR_HOT@", P_NOABORT); var affirm = false; while(bbs.online && !js.terminated) { var str; @@ -26,7 +29,7 @@ while(bbs.online && !js.terminated) { console.print(str); var key = console.getkey(0).toUpperCase(); console.backspace(console.strlen(str)); - console.print("\1n\1h\1>"); + console.print("\x01n\x01h\x01>"); if(console.aborted) { affirm = false; break; diff --git a/exec/yesnobar.js b/exec/yesnobar.js index 85a807dee8..1acff35a32 100755 --- a/exec/yesnobar.js +++ b/exec/yesnobar.js @@ -1,5 +1,9 @@ // JS version of yesnobar.src +require("sbbsdefs.js", "P_NOABORT"); + +"use strict"; + const yes_str = bbs.text(bbs.text.Yes); const yes_key = yes_str[0]; const no_str = bbs.text(bbs.text.No); @@ -15,7 +19,7 @@ if(console.question.substring(0, 2) == "\x01\?") { console.question = console.question.substring(2); } -console.putmsg("\x01n\x01b\x01h[\x01c@CHECKMARK@\x01b] \x01y@QUESTION->@? @CLEAR_HOT@"); +console.putmsg("\x01n\x01b\x01h[\x01c@CHECKMARK@\x01b] \x01y@QUESTION->@? @CLEAR_HOT@", P_NOABORT); var affirm = true; while(bbs.online && !js.terminated) { var str; @@ -26,7 +30,7 @@ while(bbs.online && !js.terminated) { console.print(str); var key = console.getkey(0).toUpperCase(); console.backspace(console.strlen(str)); - console.print("\1n\1h\1>"); + console.print("\x01n\x01h\x01>"); if(console.aborted) { affirm = false; break; -- GitLab