Re: [PATCH] Add support for ANSI.SYS SCP/RCP escape codes
Hello, James Clarke, le Sat 12 Sep 2015 00:42:05 +0100, a écrit : > This adds support for CSI s and u, which are equivalent to ESC 7 and 8, > saving/restoring the cursor position. Just curious: in which case did you see it a problem, or is it just for completeness? (which can always become convenient anyway) > +case 's':/* ANSI.SYS: Save cursor and attributes. */ > + /* Save cursor position: . */ Why scp? AIUI from terminfo(5), scp is the capname for set_color_pair, the tcap code for save cursor position is sc. > + display->cursor.saved_x = user->cursor.col; > + display->cursor.saved_y = user->cursor.row; > + break; > +case 'u':/* ANSI.SYS: Restore cursor and attributes. */ > + /* Restore cursor position: . */ > + user->cursor.col = display->cursor.saved_x; > + user->cursor.row = display->cursor.saved_y; > + /* In case the screen was larger before: */ > + limit_cursor (display); > + break; > case 'l': >/* Reset mode. */ >for (i = 0; i < parse->nparams; i++) > -- > 2.5.1 > >
Re: [PATCH] Add support for ANSI.SYS SCP/RCP escape codes
Currently the new "apt" command-line tool relies on them (when it installs packages, it keeps a progress bar at the bottom, but shows a log above), although they've recently patched it to use the more widely-available ESC 7/8 (though the patch is not yet in sid). I chose SCP/RCP, because ANSI.SYS called them Save/Restore Cursor Position, and everywhere seems to refer to them by that acronym (they're even listed on Wikipedia in the table of codes, despite not being in ECMA-48, nor being implemented by the VT100). James > On 12 Sep 2015, at 10:15, Samuel Thibaultwrote: > > Hello, > > James Clarke, le Sat 12 Sep 2015 00:42:05 +0100, a écrit : >> This adds support for CSI s and u, which are equivalent to ESC 7 and 8, >> saving/restoring the cursor position. > > Just curious: in which case did you see it a problem, or is it just for > completeness? (which can always become convenient anyway) > >> +case 's':/* ANSI.SYS: Save cursor and attributes. */ >> + /* Save cursor position: . */ > > Why scp? AIUI from terminfo(5), scp is the capname for set_color_pair, > the tcap code for save cursor position is sc. > >> + display->cursor.saved_x = user->cursor.col; >> + display->cursor.saved_y = user->cursor.row; >> + break; >> +case 'u':/* ANSI.SYS: Restore cursor and attributes. */ >> + /* Restore cursor position: . */ >> + user->cursor.col = display->cursor.saved_x; >> + user->cursor.row = display->cursor.saved_y; >> + /* In case the screen was larger before: */ >> + limit_cursor (display); >> + break; >> case 'l': >> /* Reset mode. */ >> for (i = 0; i < parse->nparams; i++) >> -- >> 2.5.1 >> >>
Re: [PATCH] Add support for ANSI.SYS SCP/RCP escape codes
James Clarke, le Sat 12 Sep 2015 00:42:05 +0100, a écrit : > This adds support for CSI s and u, which are equivalent to ESC 7 and 8, > saving/restoring the cursor position. Applied, thanks! Samuel
Re: [PATCH] Add support for ANSI.SYS SCP/RCP escape codes
James Clarke, le Sat 12 Sep 2015 10:50:37 +0100, a écrit : > Currently the new "apt" command-line tool relies on them (when it installs > packages, it keeps a progress bar at the bottom, but shows a log above), > although they've recently patched it to use the more widely-available ESC 7/8 > (though the patch is not yet in sid). Ok. They should just use terminfo to know which code they should emit, but well... > I chose SCP/RCP, because ANSI.SYS called them Save/Restore Cursor Position, > and everywhere seems to refer to them by that acronym (they're even listed on > Wikipedia in the table of codes, despite not being in ECMA-48, nor being > implemented by the VT100). Ok :) Samuel
[PATCH] Add support for ANSI.SYS SCP/RCP escape codes
This adds support for CSI s and u, which are equivalent to ESC 7 and 8, saving/restoring the cursor position. * console/display.c (handle_esc_bracket): Added support for CSI s and u. --- console/display.c | 12 1 file changed, 12 insertions(+) diff --git a/console/display.c b/console/display.c index eb420fd..98c70f5 100644 --- a/console/display.c +++ b/console/display.c @@ -1210,6 +1210,18 @@ handle_esc_bracket (display_t display, char op) user->cursor.col -= (parse->params[0] ?: 1); limit_cursor (display); break; +case 's': /* ANSI.SYS: Save cursor and attributes. */ + /* Save cursor position: . */ + display->cursor.saved_x = user->cursor.col; + display->cursor.saved_y = user->cursor.row; + break; +case 'u': /* ANSI.SYS: Restore cursor and attributes. */ + /* Restore cursor position: . */ + user->cursor.col = display->cursor.saved_x; + user->cursor.row = display->cursor.saved_y; + /* In case the screen was larger before: */ + limit_cursor (display); + break; case 'l': /* Reset mode. */ for (i = 0; i < parse->nparams; i++) -- 2.5.1