ui/console: add escape sequence \e[5,6n
PATCH 1/1 ui/console: add escape sequence \e[5,6n
This patch add support of escape sequence "\e[5,6n". This implementation similar to that of linux tty driver.
--- ui/console.c | 32 +++++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-)
ui/console.c +31 -1
@@ -757,6 +757,25 @@ static void console_clear_xy(QemuConsole *s, int x, int y)update_xy (s, x, y); } +static void console_respond_str (QemuConsole *s,const char *buf) +{ +TextCell *c; +int y1; +while (*buf) { +if (s->x >= s->width) { + s->x =0 ; +console_put_lf (s); + } + y1 = (s->y_base + s->y) % s->total_height; + c = &s->cells[y1 * s->width + s->x]; + c->ch = *buf; + c->t_attrib = s->t_attrib; +update_xy (s, s->x, s->y); + s->x++; + buf++; + } +} +/* set cursor, checking bounds */ static void set_cursor (QemuConsole *s,int x,int y) {
@@ -782,6 +801,7 @@ static void console_putchar(QemuConsole *s, int ch)TextCell *c;int y1, i;int x, y; +char response[40 ];switch (s->state) {case TTY_STATE_NORM :
@@ -957,7 +977,17 @@ static void console_putchar(QemuConsole *s, int ch)break ;case 'n' :/* report cursor position */ -/* TODO: send ESC[row;colR */ +switch (s->esc_params[0 ]) { +case 5 : +console_respond_str (s,"\033[0n" ); +break ; +case 6 : +sprintf (response,"\033[%d;%dR" , + (s->y_base + s->y) % s->total_height +1 , + s->x +1 ); +console_respond_str (s, response); +break ; + }break ;case 's' :/* save cursor position */
Signature · 1 line
2.5.0
Quoted 2 lines · Ren Kimura
This patch add support of escape sequence "\e[5,6n". This implementation similar to that of linux tty driver.
Could you describe what the escape sequences do, please? (both in the commit message and in a comment in the code).
thanks
-- PMM
Oh OK. I'll send version2 of this patch that contains comment about these.
2016-03-06 18:49 GMT+09:00 Peter Maydell <[email protected]>:
Quoted 10 lines · Ren Kimura
Quoted 2 lines
This patch add support of escape sequence "\e[5,6n". This implementation similar to that of linux tty driver.
Could you describe what the escape sequences do, please? (both in the commit message and in a comment in the code).
thanks
-- PMM