mirror of
https://github.com/vivier/EMILE.git
synced 2024-06-26 09:29:30 +00:00
Manage VT100 get_cursor_position command
This commit is contained in:
parent
981121e8fa
commit
245acc3c4c
|
@ -364,3 +364,8 @@ int keyboard_getchar()
|
|||
|
||||
return buffer_get();
|
||||
}
|
||||
|
||||
void keyboard_inject(char *s)
|
||||
{
|
||||
buffer_putstring(s);
|
||||
}
|
||||
|
|
|
@ -126,3 +126,4 @@ extern void keyboard_get_scancode(int *modifiers, int *code);
|
|||
extern int keyboard_convert_scancode(int modifiers, int scancode);
|
||||
extern int keyboard_keypressed(void);
|
||||
extern int keyboard_getchar();
|
||||
extern void keyboard_inject(char *s);
|
||||
|
|
23
second/vga.c
23
second/vga.c
|
@ -14,6 +14,7 @@
|
|||
|
||||
#include "misc.h"
|
||||
#include "vga.h"
|
||||
#include "keyboard.h"
|
||||
|
||||
QDGlobals qd;
|
||||
|
||||
|
@ -676,13 +677,21 @@ vga_put(char c)
|
|||
|
||||
case 'H': /* set cursor position */
|
||||
tmp_y = strtol(vga.escape_stack + 1, &end, 10);
|
||||
if (tmp_y > vga.siz_h)
|
||||
tmp_y = vga.siz_h;
|
||||
else if (tmp_y < 1)
|
||||
tmp_y = 1;
|
||||
if (*end == ';')
|
||||
{
|
||||
tmp_x = strtol(end + 1, &end, 10);
|
||||
if (tmp_x > vga.siz_w)
|
||||
tmp_x = vga.siz_w;
|
||||
else if (tmp_x < 1)
|
||||
tmp_x = 1;
|
||||
if (*end == 'H')
|
||||
{
|
||||
vga.pos_x = tmp_x;
|
||||
vga.pos_y = tmp_y;
|
||||
vga.pos_x = tmp_x - 1;
|
||||
vga.pos_y = tmp_y - 1;
|
||||
goto exit_escape;
|
||||
}
|
||||
}
|
||||
|
@ -703,6 +712,16 @@ vga_put(char c)
|
|||
}
|
||||
break;
|
||||
|
||||
case 'n': /* get cursor position */
|
||||
if(strcmp("[6n", vga.escape_stack) == 0)
|
||||
{
|
||||
char buf[16];
|
||||
|
||||
sprintf(buf, "\033[%ld;%ldR", vga.pos_y + 1, vga.pos_x + 1);
|
||||
keyboard_inject(buf);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
goto exit;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user