Synchronet now requires the libarchive development package (e.g. libarchive-dev on Debian-based Linux distros, libarchive.org for more info) to build successfully.

Commit 880c8717 authored by rswindell's avatar rswindell

New sbbs_t method: cursor_xy(), works with both PETSCII and ANSI terminals.

JS console.gotoxy() and the GOTOXY @-code now work with PETSCII terminals
(homes the cursor then moves down and right the appropriate number of rows
and columns). Bummer I didn't think of this method sooner.
parent 4849dde9
......@@ -1042,7 +1042,7 @@ const char* sbbs_t::atcode(char* sp, char* str, size_t maxlen, long* pmode)
tp=strchr(sp,',');
if(tp!=NULL) {
tp++;
ansi_gotoxy(atoi(sp+7),atoi(tp));
cursor_xy(atoi(sp+7),atoi(tp));
}
return(nulstr);
}
......
......@@ -912,6 +912,20 @@ void sbbs_t::cursor_left(int count)
column=0;
}
bool sbbs_t::cursor_xy(int x, int y)
{
long term = term_supports();
if(term&ANSI)
return ansi_gotoxy(x, y);
if(term&PETSCII) {
outcom(PETSCII_HOME);
cursor_down(y - 1);
cursor_right(x - 1);
return true;
}
return false;
}
void sbbs_t::cleartoeol(void)
{
int i,j;
......
......@@ -1623,7 +1623,7 @@ js_gotoxy(JSContext *cx, uintN argc, jsval *arglist)
}
rc=JS_SUSPENDREQUEST(cx);
sbbs->ansi_gotoxy(x,y);
sbbs->cursor_xy(x,y);
JS_RESUMEREQUEST(cx, rc);
return(JS_TRUE);
}
......@@ -2096,7 +2096,7 @@ static jsSyncMethodSpec js_console_functions[] = {
},
{"ansi_gotoxy", js_gotoxy, 1, JSTYPE_ALIAS },
{"gotoxy", js_gotoxy, 1, JSTYPE_VOID, JSDOCSTR("[x,y] or [object { x,y }]")
,JSDOCSTR("move cursor to a specific screen coordinate (ANSI, 1-based values), "
,JSDOCSTR("move cursor to a specific screen coordinate (ANSI or PETSCII, 1-based values), "
"arguments can be separate x and y coordinates or an object with x and y properties "
"(like that returned from <tt>console.getxy()</tt>)")
,311
......@@ -2129,7 +2129,7 @@ static jsSyncMethodSpec js_console_functions[] = {
},
{"ansi_getxy", js_getxy, 0, JSTYPE_ALIAS },
{"getxy", js_getxy, 0, JSTYPE_OBJECT, JSDOCSTR("")
,JSDOCSTR("query the current cursor position on the remote terminal "
,JSDOCSTR("query the current cursor position on the remote (ANSI) terminal "
"and returns the coordinates as an object (with x and y properties)")
,311
},
......
......@@ -744,6 +744,7 @@ public:
void cursor_down(int count=1);
void cursor_left(int count=1);
void cursor_right(int count=1);
bool cursor_xy(int x, int y);
void carriage_return(int count=1);
void line_feed(int count=1);
void newline(int count=1);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment