termptyesc: DSR-CPR takes cursor restriction into account + test
This commit is contained in:
parent
479d96e5dc
commit
feb7495fbb
|
@ -956,6 +956,7 @@ _handle_esc_csi_dsr(Termpty *ty, Eina_Unicode *b)
|
|||
{
|
||||
int arg, len;
|
||||
char bf[32];
|
||||
Eina_Bool question_mark = EINA_FALSE;
|
||||
|
||||
if (*b == '>')
|
||||
{
|
||||
|
@ -964,35 +965,42 @@ _handle_esc_csi_dsr(Termpty *ty, Eina_Unicode *b)
|
|||
}
|
||||
if (*b == '?')
|
||||
{
|
||||
question_mark = EINA_TRUE;
|
||||
b++;
|
||||
arg = _csi_arg_get(&b);
|
||||
switch (arg)
|
||||
{
|
||||
case 6:
|
||||
len = snprintf(bf, sizeof(bf), "\033[?%d;%d;1R",
|
||||
ty->cursor_state.cy + 1,
|
||||
ty->cursor_state.cx + 1);
|
||||
termpty_write(ty, bf, len);
|
||||
break;
|
||||
default:
|
||||
WRN("unhandled DSR (dec specific) %d", arg);
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
arg = _csi_arg_get(&b);
|
||||
switch (arg)
|
||||
{
|
||||
arg = _csi_arg_get(&b);
|
||||
switch (arg)
|
||||
{
|
||||
case 6:
|
||||
len = snprintf(bf, sizeof(bf), "\033[%d;%dR",
|
||||
ty->cursor_state.cy + 1, ty->cursor_state.cx + 1);
|
||||
case 6:
|
||||
{
|
||||
int cx = ty->cursor_state.cx,
|
||||
cy = ty->cursor_state.cy;
|
||||
if (ty->termstate.restrict_cursor)
|
||||
{
|
||||
if (ty->termstate.top_margin)
|
||||
cy -= ty->termstate.top_margin;
|
||||
if (ty->termstate.left_margin)
|
||||
cx -= ty->termstate.left_margin;
|
||||
}
|
||||
if (question_mark)
|
||||
{
|
||||
len = snprintf(bf, sizeof(bf), "\033[?%d;%d;1R",
|
||||
cy + 1,
|
||||
cx + 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
len = snprintf(bf, sizeof(bf), "\033[%d;%dR",
|
||||
cy + 1,
|
||||
cx + 1);
|
||||
}
|
||||
termpty_write(ty, bf, len);
|
||||
break;
|
||||
default:
|
||||
WRN("unhandled DSR %d", arg);
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
WRN("unhandled DSR (dec specific: %s) %d",
|
||||
(question_mark)? "yes": "no", arg);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,40 @@
|
|||
#!/bin/sh
|
||||
|
||||
# fill space with E
|
||||
printf '\033#8'
|
||||
#set color
|
||||
printf '\033[46;31;3m'
|
||||
|
||||
# cursor to 7,4
|
||||
printf '\033[7;4H'
|
||||
# Request cursor position
|
||||
printf '\033[6n'
|
||||
# Request cursor position (dec)
|
||||
printf '\033[?6n'
|
||||
|
||||
sleep 1
|
||||
|
||||
# set top/bottom margins:
|
||||
printf '\033[10;20r'
|
||||
# allow left/right margins
|
||||
printf '\033[?69h'
|
||||
# set left/right margins:
|
||||
printf '\033[5;15s'
|
||||
|
||||
# cursor to 17,14
|
||||
printf '\033[17;14H'
|
||||
|
||||
# Request cursor position
|
||||
printf '\033[6n'
|
||||
# Request cursor position (dec)
|
||||
printf '\033[?6n'
|
||||
|
||||
sleep 1
|
||||
|
||||
# restrict cursor
|
||||
printf '\033[?6h'
|
||||
|
||||
# Request cursor position
|
||||
printf '\033[6n'
|
||||
# Request cursor position (dec)
|
||||
printf '\033[?6n'
|
|
@ -17,3 +17,4 @@ tabs.sh 960b74686e23e8e39c3446768b9efc75
|
|||
xterm-osc-0-title-icon.sh cb5080cc1dbc23b553b62fbdc8cbdf68
|
||||
xterm-osc-1-icon.sh 9202db6e81ce810f007035770934fecb
|
||||
xterm-osc-2-title.sh 49a058f1813bdd64faab1cf1af3ebe09
|
||||
dsr-cpr.sh 5a778fd856455475e695e5469e69d227
|
||||
|
|
Loading…
Reference in New Issue