termptyesc: support DECBI
This commit is contained in:
parent
6f1e3ea077
commit
090f6a64f2
|
@ -2793,6 +2793,51 @@ _handle_decaln(Termpty *ty)
|
|||
}
|
||||
}
|
||||
|
||||
static void
|
||||
_handle_decbi(Termpty *ty)
|
||||
{
|
||||
DBG("DECBI - Back Index");
|
||||
if (ty->cursor_state.cx == ty->termstate.left_margin)
|
||||
{
|
||||
Eina_Unicode blank[1] = { ' ' };
|
||||
int old_insert = ty->termstate.insert;
|
||||
int old_cx = ty->cursor_state.cx;
|
||||
int old_cy = ty->cursor_state.cy;
|
||||
int y;
|
||||
int max = ty->h;
|
||||
|
||||
if (((ty->termstate.lr_margins != 0) && (ty->cursor_state.cx == 0))
|
||||
|| ((ty->termstate.top_margin != 0)
|
||||
&& (ty->cursor_state.cy < ty->termstate.top_margin))
|
||||
|| ((ty->termstate.bottom_margin != 0)
|
||||
&& (ty->cursor_state.cy >= ty->termstate.bottom_margin)))
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (ty->termstate.bottom_margin != 0)
|
||||
max = ty->termstate.bottom_margin;
|
||||
ty->termstate.insert = 1;
|
||||
for (y = ty->termstate.top_margin; y < max; y++)
|
||||
{
|
||||
/* Insert a left column */
|
||||
ty->cursor_state.cy = y;
|
||||
ty->cursor_state.cx = old_cx;
|
||||
ty->termstate.wrapnext = 0;
|
||||
termpty_text_append(ty, blank, 1);
|
||||
}
|
||||
ty->termstate.insert = old_insert;
|
||||
ty->cursor_state.cx = old_cx;
|
||||
ty->cursor_state.cy = old_cy;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((ty->cursor_state.cx == 0) && (ty->termstate.lr_margins != 0))
|
||||
return;
|
||||
/* cursor backward */
|
||||
ty->cursor_state.cx--;
|
||||
}
|
||||
}
|
||||
|
||||
static int
|
||||
_handle_esc(Termpty *ty, const Eina_Unicode *c, const Eina_Unicode *ce)
|
||||
{
|
||||
|
@ -2887,6 +2932,9 @@ _handle_esc(Termpty *ty, const Eina_Unicode *c, const Eina_Unicode *ce)
|
|||
case '@': // just consume this plus next char
|
||||
if (len < 2) return 0;
|
||||
return 2;
|
||||
case '6':
|
||||
_handle_decbi(ty);
|
||||
return 1;
|
||||
case '7': // save cursor pos
|
||||
termpty_cursor_copy(ty, EINA_TRUE);
|
||||
return 1;
|
||||
|
|
|
@ -0,0 +1,88 @@
|
|||
#!/bin/sh
|
||||
|
||||
# move to 0; 0
|
||||
printf '\033[H'
|
||||
# fill space
|
||||
for _ in $(seq 0 23); do
|
||||
for _ in $(seq 0 7); do
|
||||
printf '\-/|\\~_>^<'
|
||||
done
|
||||
done
|
||||
# move to 0; 0
|
||||
printf '\033[H'
|
||||
|
||||
# move to 0; 0
|
||||
printf '\033[H'
|
||||
|
||||
#set color
|
||||
printf '\033[46;31;3m'
|
||||
|
||||
printf 'format is:\n\-/|\\~_>^<'
|
||||
|
||||
# move to
|
||||
printf '\033[3;0H'
|
||||
# decbi, insert column
|
||||
printf '\033\066a'
|
||||
|
||||
# set top/bottom margins:
|
||||
printf '\033[5;22r'
|
||||
|
||||
# move to
|
||||
printf '\033[4;0H'
|
||||
# decbi, not within top/right margin, do nothing
|
||||
printf '\033\066b'
|
||||
# move to 3; 0
|
||||
printf '\033[6;0H'
|
||||
# decbi, insert column within margins
|
||||
printf '\033\066c'
|
||||
|
||||
|
||||
# set top/bottom margins:
|
||||
printf '\033[10;20r'
|
||||
# allow left/right margins
|
||||
printf '\033[?69h'
|
||||
|
||||
# move
|
||||
printf '\033[7;0H'
|
||||
# decbi, do nothing
|
||||
printf '\033\066d'
|
||||
|
||||
# set right margin only
|
||||
printf '\033[;14s'
|
||||
|
||||
# move
|
||||
printf '\033[8;0H'
|
||||
# decbi, do nothing
|
||||
printf '\033\066e'
|
||||
|
||||
|
||||
# set left/right margins:
|
||||
printf '\033[5;14s'
|
||||
# move to 0; 0
|
||||
printf '\033[10;5H'
|
||||
# fill space
|
||||
for Y in $(seq 10 20); do
|
||||
# move to 0; 0
|
||||
printf '\033[%s;5H' "$Y"
|
||||
printf '\-/|\\~_>^<'
|
||||
done
|
||||
|
||||
# move
|
||||
printf '\033[11;0H'
|
||||
#decbi, outside left margin, cursor back
|
||||
printf 'f\033\066g'
|
||||
|
||||
# move
|
||||
printf '\033[12;12H'
|
||||
#decbi, outside left margin, cursor back
|
||||
printf 'h\033\066i'
|
||||
|
||||
# move
|
||||
printf '\033[13;3H'
|
||||
#decbi, outside left margin, cursor back
|
||||
printf '\033\066j'
|
||||
|
||||
# move
|
||||
printf '\033[14;5H'
|
||||
#decbi, on left margin, insert column
|
||||
printf '\033\066k'
|
|
@ -37,3 +37,4 @@ cpl.sh 9145c88adb762a6a59c5bf69191b949e
|
|||
cup.sh 11f5939a6cc990f6a7b9d1730ab3a8bf
|
||||
decaln.sh 9c0cf4de336193bcdaed6ba6c0d6f590
|
||||
decawm.sh 84321e76f07b40cf9462238ec0919dc0
|
||||
decbi.sh 8153bff12a0d529cb8ba0dbff036a1ee
|
||||
|
|
Loading…
Reference in New Issue