termptyesc: cpl and margins + tests
This commit is contained in:
parent
3c47cc36e0
commit
e23d78e102
|
@ -1136,6 +1136,31 @@ _handle_esc_csi_cnl(Termpty *ty, Eina_Unicode **ptr)
|
||||||
ty->cursor_state.cx = ty->termstate.left_margin;
|
ty->cursor_state.cx = ty->termstate.left_margin;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_handle_esc_csi_cpl(Termpty *ty, Eina_Unicode **ptr)
|
||||||
|
{
|
||||||
|
Eina_Unicode *b = *ptr;
|
||||||
|
int arg = _csi_arg_get(ty, &b);
|
||||||
|
int max = ty->h;
|
||||||
|
|
||||||
|
if (arg == -CSI_ARG_ERROR)
|
||||||
|
return;
|
||||||
|
if (arg < 1)
|
||||||
|
arg = 1;
|
||||||
|
|
||||||
|
DBG("CPL - Cursor Previous Line: %d", arg);
|
||||||
|
ty->termstate.wrapnext = 0;
|
||||||
|
ty->cursor_state.cy -= arg;
|
||||||
|
if (ty->termstate.bottom_margin)
|
||||||
|
{
|
||||||
|
max = ty->termstate.bottom_margin;
|
||||||
|
}
|
||||||
|
TERMPTY_RESTRICT_FIELD(ty->cursor_state.cy,
|
||||||
|
ty->termstate.top_margin,
|
||||||
|
max);
|
||||||
|
ty->cursor_state.cx = ty->termstate.left_margin;
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_handle_esc_csi_dch(Termpty *ty, Eina_Unicode **ptr,
|
_handle_esc_csi_dch(Termpty *ty, Eina_Unicode **ptr,
|
||||||
const Eina_Unicode * const end)
|
const Eina_Unicode * const end)
|
||||||
|
@ -1740,16 +1765,8 @@ CUF:
|
||||||
case 'E':
|
case 'E':
|
||||||
_handle_esc_csi_cnl(ty, &b);
|
_handle_esc_csi_cnl(ty, &b);
|
||||||
break;
|
break;
|
||||||
case 'F': // up relative N rows, and to col 0
|
case 'F':
|
||||||
arg = _csi_arg_get(ty, &b);
|
_handle_esc_csi_cpl(ty, &b);
|
||||||
if (arg == -CSI_ARG_ERROR)
|
|
||||||
goto error;
|
|
||||||
TERMPTY_RESTRICT_FIELD(arg, 1, ty->h);
|
|
||||||
DBG("CPL - Cursor Previous Line: %d", arg);
|
|
||||||
ty->termstate.wrapnext = 0;
|
|
||||||
ty->cursor_state.cy -= arg;
|
|
||||||
TERMPTY_RESTRICT_FIELD(ty->cursor_state.cy, 0, ty->h);
|
|
||||||
ty->cursor_state.cx = 0;
|
|
||||||
break;
|
break;
|
||||||
case 'G': // to column N
|
case 'G': // to column N
|
||||||
arg = _csi_arg_get(ty, &b);
|
arg = _csi_arg_get(ty, &b);
|
||||||
|
|
|
@ -0,0 +1,36 @@
|
||||||
|
#!/bin/sh
|
||||||
|
# fill space with E
|
||||||
|
printf '\033[69;1;1;25;80$x'
|
||||||
|
#set color
|
||||||
|
printf '\033[46;31;3m'
|
||||||
|
|
||||||
|
# move to 7; 7
|
||||||
|
printf '\033[7;7H'
|
||||||
|
printf 'a\033[Fb'
|
||||||
|
|
||||||
|
printf 'c\033[2Fd'
|
||||||
|
# set top/bottom margins:
|
||||||
|
printf '\033[10;20r'
|
||||||
|
# allow left/right margins
|
||||||
|
printf '\033[?69h'
|
||||||
|
# set left/right margins:
|
||||||
|
printf '\033[5;15s'
|
||||||
|
# fill margin with @
|
||||||
|
printf '\033[64;10;5;20;15$x'
|
||||||
|
|
||||||
|
# move
|
||||||
|
printf '\033[12;19H'
|
||||||
|
printf 'e\033[5Ff'
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# set left/right margins:
|
||||||
|
printf '\033[25;35s'
|
||||||
|
# fill margin with @
|
||||||
|
printf '\033[64;10;25;20;35$x'
|
||||||
|
# restrict cursor
|
||||||
|
printf '\033[?6h'
|
||||||
|
# move
|
||||||
|
printf '\033[2;2H'
|
||||||
|
printf 'g\033[5Fh'
|
|
@ -33,3 +33,4 @@ decsclm.sh 1ffcea3bfc4704d9091272dc59cbb311
|
||||||
cha.sh 04092c42102eb0d71ae700ee47c9ac34
|
cha.sh 04092c42102eb0d71ae700ee47c9ac34
|
||||||
dch.sh 40cf655681c098251f0dc3e7733c4db9
|
dch.sh 40cf655681c098251f0dc3e7733c4db9
|
||||||
cnl.sh 1f1512179c8e47e4bd880142774a3c66
|
cnl.sh 1f1512179c8e47e4bd880142774a3c66
|
||||||
|
cpl.sh 9145c88adb762a6a59c5bf69191b949e
|
||||||
|
|
Loading…
Reference in New Issue