termptyesc: extract SD/SU to their own functions
SD 0 is used for "track mouse" (TODO).
This commit is contained in:
parent
5b16b455ff
commit
ca9616bad8
|
@ -2655,6 +2655,43 @@ _handle_esc_csi_dl(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_su(Termpty *ty, Eina_Unicode **ptr)
|
||||||
|
{
|
||||||
|
Eina_Unicode *b = *ptr;
|
||||||
|
int arg = _csi_arg_get(ty, &b);
|
||||||
|
int i;
|
||||||
|
|
||||||
|
if (arg == -CSI_ARG_ERROR)
|
||||||
|
return;
|
||||||
|
|
||||||
|
TERMPTY_RESTRICT_FIELD(arg, 1, ty->h);
|
||||||
|
DBG("SU - Scroll Up: %d", arg);
|
||||||
|
for (i = 0; i < arg; i++)
|
||||||
|
termpty_text_scroll(ty, EINA_TRUE);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_handle_esc_csi_sd(Termpty *ty, Eina_Unicode **ptr)
|
||||||
|
{
|
||||||
|
Eina_Unicode *b = *ptr;
|
||||||
|
int arg = _csi_arg_get(ty, &b);
|
||||||
|
int i;
|
||||||
|
|
||||||
|
if (arg == -CSI_ARG_ERROR)
|
||||||
|
return;
|
||||||
|
if (arg == 0)
|
||||||
|
{
|
||||||
|
WRN("Track Mouse: TODO");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
TERMPTY_RESTRICT_FIELD(arg, 1, ty->h);
|
||||||
|
DBG("SD - Scroll Down: %d", arg);
|
||||||
|
for (i = 0; i < arg; i++)
|
||||||
|
termpty_text_scroll_rev(ty, EINA_TRUE);
|
||||||
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
_handle_esc_csi(Termpty *ty, const Eina_Unicode *c, const Eina_Unicode *ce)
|
_handle_esc_csi(Termpty *ty, const Eina_Unicode *c, const Eina_Unicode *ce)
|
||||||
{
|
{
|
||||||
|
@ -2735,26 +2772,14 @@ _handle_esc_csi(Termpty *ty, const Eina_Unicode *c, const Eina_Unicode *ce)
|
||||||
case 'M':
|
case 'M':
|
||||||
_handle_esc_csi_dl(ty, &b);
|
_handle_esc_csi_dl(ty, &b);
|
||||||
break;
|
break;
|
||||||
case 'P': // erase and scrollback N chars
|
case 'P':
|
||||||
_handle_esc_csi_dch(ty, &b);
|
_handle_esc_csi_dch(ty, &b);
|
||||||
break;
|
break;
|
||||||
case 'S': // scroll up N lines
|
case 'S':
|
||||||
arg = _csi_arg_get(ty, &b);
|
_handle_esc_csi_su(ty, &b);
|
||||||
if (arg == -CSI_ARG_ERROR)
|
|
||||||
goto error;
|
|
||||||
TERMPTY_RESTRICT_FIELD(arg, 1, ty->h);
|
|
||||||
DBG("scroll up %d lines", arg);
|
|
||||||
for (i = 0; i < arg; i++)
|
|
||||||
termpty_text_scroll(ty, EINA_TRUE);
|
|
||||||
break;
|
break;
|
||||||
case 'T': // scroll down N lines
|
case 'T':
|
||||||
arg = _csi_arg_get(ty, &b);
|
_handle_esc_csi_sd(ty, &b);
|
||||||
if (arg == -CSI_ARG_ERROR)
|
|
||||||
goto error;
|
|
||||||
TERMPTY_RESTRICT_FIELD(arg, 1, ty->h);
|
|
||||||
DBG("scroll down %d lines", arg);
|
|
||||||
for (i = 0; i < arg; i++)
|
|
||||||
termpty_text_scroll_rev(ty, EINA_TRUE);
|
|
||||||
break;
|
break;
|
||||||
case 'X': // erase N chars
|
case 'X': // erase N chars
|
||||||
arg = _csi_arg_get(ty, &b);
|
arg = _csi_arg_get(ty, &b);
|
||||||
|
|
|
@ -0,0 +1,71 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
# fill space
|
||||||
|
PL=1
|
||||||
|
for _ in $(seq 0 23); do
|
||||||
|
PL=$((PL+1))
|
||||||
|
if [ $PL -gt 9 ] ; then
|
||||||
|
PL=1
|
||||||
|
fi
|
||||||
|
printf '%s' "$PL"
|
||||||
|
for _ in $(seq 2 $PL); do
|
||||||
|
printf '#'
|
||||||
|
done
|
||||||
|
PR=$((9 - PL))
|
||||||
|
for _ in $(seq 0 6); do
|
||||||
|
printf '\033[0;1m\-'
|
||||||
|
printf '\033[0;46;1;4m/'
|
||||||
|
printf '\033[0;46;1;4m|'
|
||||||
|
printf '\033[0;1;4;7m\\'
|
||||||
|
printf '\033[0m~'
|
||||||
|
printf '\033[0;1m_'
|
||||||
|
printf '\033[0;31;7m>'
|
||||||
|
printf '\033[0;31;4;7m^'
|
||||||
|
printf '\033[0;1;7m<'
|
||||||
|
done
|
||||||
|
printf '\033[0m'
|
||||||
|
for _ in $(seq 1 $PR); do
|
||||||
|
printf '#'
|
||||||
|
done
|
||||||
|
printf '%s' "$PR"
|
||||||
|
done
|
||||||
|
|
||||||
|
# set color
|
||||||
|
printf '\033[43;34;3m'
|
||||||
|
|
||||||
|
# move
|
||||||
|
printf '\033[1;10H'
|
||||||
|
# SD 0
|
||||||
|
printf '\033[0T1'
|
||||||
|
# move
|
||||||
|
printf '\033[3;10H'
|
||||||
|
# SD default
|
||||||
|
printf '\033[T2'
|
||||||
|
# move
|
||||||
|
printf '\033[5;10H'
|
||||||
|
# SD 2
|
||||||
|
printf '\033[2T3'
|
||||||
|
|
||||||
|
# set top/bottom margins:
|
||||||
|
printf '\033[8;14r'
|
||||||
|
# allow left/right margins
|
||||||
|
printf '\033[?69h'
|
||||||
|
# set left/right margins:
|
||||||
|
printf '\033[5;75s'
|
||||||
|
|
||||||
|
# move
|
||||||
|
printf '\033[7;10H'
|
||||||
|
# outside margins (top)
|
||||||
|
printf '\033[T4'
|
||||||
|
# move
|
||||||
|
printf '\033[8;4H'
|
||||||
|
# outside margins(left)
|
||||||
|
printf '\033[T5'
|
||||||
|
# move
|
||||||
|
printf '\033[15;10H'
|
||||||
|
# outside margins(bottom)
|
||||||
|
printf '\033[T6'
|
||||||
|
# move
|
||||||
|
printf '\033[8;76H'
|
||||||
|
# outside margins(right)
|
||||||
|
printf '\033[T7'
|
|
@ -0,0 +1,71 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
# fill space
|
||||||
|
PL=1
|
||||||
|
for _ in $(seq 0 23); do
|
||||||
|
PL=$((PL+1))
|
||||||
|
if [ $PL -gt 9 ] ; then
|
||||||
|
PL=1
|
||||||
|
fi
|
||||||
|
printf '%s' "$PL"
|
||||||
|
for _ in $(seq 2 $PL); do
|
||||||
|
printf '#'
|
||||||
|
done
|
||||||
|
PR=$((9 - PL))
|
||||||
|
for _ in $(seq 0 6); do
|
||||||
|
printf '\033[0;1m\-'
|
||||||
|
printf '\033[0;46;1;4m/'
|
||||||
|
printf '\033[0;46;1;4m|'
|
||||||
|
printf '\033[0;1;4;7m\\'
|
||||||
|
printf '\033[0m~'
|
||||||
|
printf '\033[0;1m_'
|
||||||
|
printf '\033[0;31;7m>'
|
||||||
|
printf '\033[0;31;4;7m^'
|
||||||
|
printf '\033[0;1;7m<'
|
||||||
|
done
|
||||||
|
printf '\033[0m'
|
||||||
|
for _ in $(seq 1 $PR); do
|
||||||
|
printf '#'
|
||||||
|
done
|
||||||
|
printf '%s' "$PR"
|
||||||
|
done
|
||||||
|
|
||||||
|
# set color
|
||||||
|
printf '\033[43;34;3m'
|
||||||
|
|
||||||
|
# move
|
||||||
|
printf '\033[1;10H'
|
||||||
|
# SU 0
|
||||||
|
printf '\033[0S1'
|
||||||
|
# move
|
||||||
|
printf '\033[3;10H'
|
||||||
|
# SU default
|
||||||
|
printf '\033[S2'
|
||||||
|
# move
|
||||||
|
printf '\033[5;10H'
|
||||||
|
# SU 2
|
||||||
|
printf '\033[2S3'
|
||||||
|
|
||||||
|
# set top/bottom margins:
|
||||||
|
printf '\033[8;14r'
|
||||||
|
# allow left/right margins
|
||||||
|
printf '\033[?69h'
|
||||||
|
# set left/right margins:
|
||||||
|
printf '\033[5;75s'
|
||||||
|
|
||||||
|
# move
|
||||||
|
printf '\033[7;10H'
|
||||||
|
# outside margins (top)
|
||||||
|
printf '\033[S4'
|
||||||
|
# move
|
||||||
|
printf '\033[8;4H'
|
||||||
|
# outside margins(left)
|
||||||
|
printf '\033[S5'
|
||||||
|
# move
|
||||||
|
printf '\033[15;10H'
|
||||||
|
# outside margins(bottom)
|
||||||
|
printf '\033[S6'
|
||||||
|
# move
|
||||||
|
printf '\033[8;76H'
|
||||||
|
# outside margins(right)
|
||||||
|
printf '\033[S7'
|
|
@ -60,3 +60,5 @@ ed-4.sh 574f37ac24ead26ef86c03d7dfae3152
|
||||||
el.sh abca9d5e5990bed6bd72a7ab9f72b849
|
el.sh abca9d5e5990bed6bd72a7ab9f72b849
|
||||||
il.sh 1788258650a94f2568d05f749b6cf578
|
il.sh 1788258650a94f2568d05f749b6cf578
|
||||||
dl.sh e1e0ba19345d2ebf888f5a3e37f27037
|
dl.sh e1e0ba19345d2ebf888f5a3e37f27037
|
||||||
|
su.sh 591185f42b75daa61726217033a17eaf
|
||||||
|
sd.sh 4bfda7ec3e6192acab077de2bc270525
|
||||||
|
|
Loading…
Reference in New Issue