vte: implement basic cursor movement CSI
The A, B, C and D CSIs are used to move the cursor in the scroll-region without scrolling the buffer when reaching the margins. Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
This commit is contained in:
parent
dcfbbc3e1d
commit
5f0d151bb7
25
src/vte.c
25
src/vte.c
@ -198,6 +198,7 @@ static void parse_control(struct kmscon_vte *vte, uint32_t ctrl)
|
|||||||
static void parse_csi(struct kmscon_vte *vte, uint32_t val)
|
static void parse_csi(struct kmscon_vte *vte, uint32_t val)
|
||||||
{
|
{
|
||||||
int new;
|
int new;
|
||||||
|
unsigned int num;
|
||||||
|
|
||||||
if (vte->parser.csi_flags & CSI_START) {
|
if (vte->parser.csi_flags & CSI_START) {
|
||||||
switch (val) {
|
switch (val) {
|
||||||
@ -237,6 +238,30 @@ static void parse_csi(struct kmscon_vte *vte, uint32_t val)
|
|||||||
vte->parser.state = STATE_NORMAL;
|
vte->parser.state = STATE_NORMAL;
|
||||||
|
|
||||||
switch (val) {
|
switch (val) {
|
||||||
|
case 'A':
|
||||||
|
num = vte->parser.csi_argv[0];
|
||||||
|
if (!num)
|
||||||
|
num = 1;
|
||||||
|
kmscon_console_move_up(vte->con, num, false);
|
||||||
|
break;
|
||||||
|
case 'B':
|
||||||
|
num = vte->parser.csi_argv[0];
|
||||||
|
if (!num)
|
||||||
|
num = 1;
|
||||||
|
kmscon_console_move_down(vte->con, num, false);
|
||||||
|
break;
|
||||||
|
case 'C':
|
||||||
|
num = vte->parser.csi_argv[0];
|
||||||
|
if (!num)
|
||||||
|
num = 1;
|
||||||
|
kmscon_console_move_right(vte->con, num);
|
||||||
|
break;
|
||||||
|
case 'D':
|
||||||
|
num = vte->parser.csi_argv[0];
|
||||||
|
if (!num)
|
||||||
|
num = 1;
|
||||||
|
kmscon_console_move_left(vte->con, num);
|
||||||
|
break;
|
||||||
case 'J':
|
case 'J':
|
||||||
if (vte->parser.csi_argc < 1 ||
|
if (vte->parser.csi_argc < 1 ||
|
||||||
vte->parser.csi_argv[0] == 0)
|
vte->parser.csi_argv[0] == 0)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user