Skip to content
Snippets Groups Projects
Commit a96b9402 authored by rswindell's avatar rswindell
Browse files

As part of the rev 1.147 (add mouse hot sport support) commit, I made what I...

As part of the rev 1.147 (add mouse hot sport support) commit, I made what I thought was a harmless change to the JS console.clear() implementation, I changed the call to sbbs->CLS to sbbs->clearscreen(). The sbbs->CLS macro calls outchar(FF) which check the line-counter and does the auto-pause before screen-clear. A direct call to sbbs->clearscreen() does not.
Just in case someone actually wants the new (but unexpected behavior), I added an optional boolean parameter to console.clear(), autopause (default to true). Pass false if you want to defeat the autopause functionality. This should be effectively the same as setting the console.line_counter = 0 before calling console.clear(), but it also totally bypasses sbbs_t::outchar,
so there could be other differences I'm not thinking of.
Anyway, this fixes the lack of auto-screen pauses in JS mods recently introduced.
parent 1e551bd2
Branches
Tags
No related merge requests found
...@@ -1059,6 +1059,7 @@ js_clear(JSContext *cx, uintN argc, jsval *arglist) ...@@ -1059,6 +1059,7 @@ js_clear(JSContext *cx, uintN argc, jsval *arglist)
{ {
jsval *argv=JS_ARGV(cx, arglist); jsval *argv=JS_ARGV(cx, arglist);
sbbs_t* sbbs; sbbs_t* sbbs;
bool autopause = true;
jsrefcount rc; jsrefcount rc;
if((sbbs=(sbbs_t*)js_GetClassPrivate(cx, JS_THIS_OBJECT(cx, arglist), &js_console_class))==NULL) if((sbbs=(sbbs_t*)js_GetClassPrivate(cx, JS_THIS_OBJECT(cx, arglist), &js_console_class))==NULL)
...@@ -1066,12 +1067,20 @@ js_clear(JSContext *cx, uintN argc, jsval *arglist) ...@@ -1066,12 +1067,20 @@ js_clear(JSContext *cx, uintN argc, jsval *arglist)
JS_SET_RVAL(cx, arglist, JSVAL_VOID); JS_SET_RVAL(cx, arglist, JSVAL_VOID);
if(argc) { uintN argn = 0;
if(!js_set_attr(cx, sbbs, argv[0])) if(argc > argn && !JSVAL_IS_BOOLEAN(argv[argn])) {
if(!js_set_attr(cx, sbbs, argv[argn]))
return JS_FALSE; return JS_FALSE;
argn++;
}
if(argc > argn && JSVAL_IS_BOOLEAN(argv[argn])) {
autopause = JSVAL_TO_BOOLEAN(argv[argn]);
argn++;
} }
rc=JS_SUSPENDREQUEST(cx); rc=JS_SUSPENDREQUEST(cx);
if(autopause)
sbbs->CLS;
else
sbbs->clearscreen(sbbs->term_supports()); sbbs->clearscreen(sbbs->term_supports());
JS_RESUMEREQUEST(cx, rc); JS_RESUMEREQUEST(cx, rc);
return(JS_TRUE); return(JS_TRUE);
...@@ -2121,7 +2130,7 @@ static jsSyncMethodSpec js_console_functions[] = { ...@@ -2121,7 +2130,7 @@ static jsSyncMethodSpec js_console_functions[] = {
,JSDOCSTR("print a mnemonics string, command keys highlighted with tilde (~) characters") ,JSDOCSTR("print a mnemonics string, command keys highlighted with tilde (~) characters")
,310 ,310
}, },
{"clear", js_clear, 0, JSTYPE_VOID, JSDOCSTR("[attribute]") {"clear", js_clear, 0, JSTYPE_VOID, JSDOCSTR("[attribute] [,autopause=<tt>true</tt>]")
,JSDOCSTR("clear screen and home cursor, " ,JSDOCSTR("clear screen and home cursor, "
"optionally (in v3.13b+) setting current attribute first") "optionally (in v3.13b+) setting current attribute first")
,310 ,310
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment