Skip to content
Snippets Groups Projects
Commit 2e7fbd3d authored by Deucе's avatar Deucе :ok_hand_tone4:
Browse files

Move cursor when console.current_row/current_column is set

Closes issue #896

These are zero-based like the properties, not 1-based like gotoxy()
parent 667c51a7
No related branches found
No related tags found
No related merge requests found
Pipeline #8800 passed
......@@ -367,6 +367,11 @@ bool ANSI_Terminal::gotoxy(unsigned x, unsigned y)
return true;
}
/*
* TODO: gotox()/gotoy() can be done but aren't part of ANSI.SYS
* We need to auto-detect support before we can use them.
*/
// Was ansi_save
bool ANSI_Terminal::save_cursor_pos()
{
......
......@@ -284,7 +284,7 @@ static JSBool js_console_set(JSContext *cx, JSObject *obj, jsid id, JSBool stric
sbbs->term->lncntr = val;
break;
case CON_PROP_COLUMN:
sbbs->term->column = val;
sbbs->term->gotox(val);
break;
case CON_PROP_LASTLINELEN:
sbbs->term->lastcrcol = val;
......@@ -306,7 +306,7 @@ static JSBool js_console_set(JSContext *cx, JSObject *obj, jsid id, JSBool stric
break;
case CON_PROP_ROW:
if (val >= 0 && val < TERM_ROWS_MAX)
sbbs->term->row = val;
sbbs->term->gotoy(val);
break;
case CON_PROP_ROWS:
if (val >= TERM_ROWS_MIN && val <= TERM_ROWS_MAX)
......@@ -456,8 +456,8 @@ static const char* con_prop_desc[] = {
, "Mouse mode bit-field (see <tt>MOUSE_MODE_*</tt> in <tt>sbbsdefs.js</tt> for bit definitions, "
"set to <tt>true</tt> for default enabled mode, <tt>false</tt> to disable)"
, "Current 0-based line counter (used for automatic screen pause)"
, "Current 0-based row counter"
, "Current 0-based column counter (used to auto-increment <i>line_counter</i> when screen wraps)"
, "Current 0-based row position, set to move cursor"
, "Current 0-based column position, set to move cursor"
, "Column the cursor was on when last CR was sent to terminal or the line wrapped"
, "Obsolete alias for last_cr_column"
, "Duration of delay (in milliseconds) before each line-feed character is sent to the terminal"
......
......@@ -212,6 +212,17 @@ public:
return false;
}
/*
* TODO: These start at zero, but gotoxy starts at 1
*/
virtual bool gotox(unsigned x) {
return gotoxy(x + 1, row + 1);
}
virtual bool gotoy(unsigned y) {
return gotoxy(column + 1, y + 1);
}
// Was ansi_save
virtual bool save_cursor_pos() {
return false;
......
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