forked from enlightenment/terminology
termptyesc: CHA and HPA are the same
This commit is contained in:
parent
5abb8b0eb3
commit
a0738339dd
|
@ -2467,14 +2467,22 @@ _handle_esc_csi_cub(Termpty *ty, Eina_Unicode **ptr)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_handle_esc_csi_cha(Termpty *ty, Eina_Unicode **ptr)
|
_handle_esc_csi_cha(Termpty *ty, Eina_Unicode **ptr,
|
||||||
|
const Eina_Unicode *cc)
|
||||||
{
|
{
|
||||||
Eina_Unicode *b = *ptr;
|
Eina_Unicode *b = *ptr;
|
||||||
int arg = _csi_arg_get(ty, &b);
|
int arg = _csi_arg_get(ty, &b);
|
||||||
int min = 0;
|
int min = 0;
|
||||||
int max = ty->w;
|
int max = ty->w;
|
||||||
|
|
||||||
|
if (*cc == '`')
|
||||||
|
{
|
||||||
|
DBG("HPA - Horizontal Position Absolute: %d", arg);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
DBG("CHA - Cursor Horizontal Absolute: %d", arg);
|
DBG("CHA - Cursor Horizontal Absolute: %d", arg);
|
||||||
|
}
|
||||||
if (arg == -CSI_ARG_ERROR)
|
if (arg == -CSI_ARG_ERROR)
|
||||||
return;
|
return;
|
||||||
if (arg < 1)
|
if (arg < 1)
|
||||||
|
@ -2882,7 +2890,7 @@ _handle_esc_csi(Termpty *ty, const Eina_Unicode *c, const Eina_Unicode *ce)
|
||||||
_handle_esc_csi_cpl(ty, &b);
|
_handle_esc_csi_cpl(ty, &b);
|
||||||
break;
|
break;
|
||||||
case 'G':
|
case 'G':
|
||||||
_handle_esc_csi_cha(ty, &b);
|
_handle_esc_csi_cha(ty, &b, cc);
|
||||||
break;
|
break;
|
||||||
case 'H':
|
case 'H':
|
||||||
_handle_esc_csi_cursor_pos_set(ty, &b, cc);
|
_handle_esc_csi_cursor_pos_set(ty, &b, cc);
|
||||||
|
@ -2935,30 +2943,8 @@ _handle_esc_csi(Termpty *ty, const Eina_Unicode *c, const Eina_Unicode *ce)
|
||||||
case 'Z':
|
case 'Z':
|
||||||
_handle_esc_csi_cbt(ty, &b);
|
_handle_esc_csi_cbt(ty, &b);
|
||||||
break;
|
break;
|
||||||
case '`': // HPA
|
case '`':
|
||||||
arg = _csi_arg_get(ty, &b);
|
_handle_esc_csi_cha(ty, &b, cc);
|
||||||
if (arg == -CSI_ARG_ERROR)
|
|
||||||
goto error;
|
|
||||||
DBG("Horizontal Position Absolute (HPA): %d", arg);
|
|
||||||
arg--;
|
|
||||||
if (arg < 0)
|
|
||||||
arg = 0;
|
|
||||||
ty->termstate.wrapnext = 0;
|
|
||||||
ty->cursor_state.cx = arg;
|
|
||||||
TERMPTY_RESTRICT_FIELD(ty->cursor_state.cx, 0, ty->w);
|
|
||||||
if (ty->termstate.restrict_cursor)
|
|
||||||
{
|
|
||||||
if ((ty->termstate.right_margin != 0)
|
|
||||||
&& (ty->cursor_state.cx >= ty->termstate.right_margin))
|
|
||||||
{
|
|
||||||
ty->cursor_state.cx = ty->termstate.right_margin - 1;
|
|
||||||
}
|
|
||||||
if ((ty->termstate.left_margin != 0)
|
|
||||||
&& (ty->cursor_state.cx < ty->termstate.left_margin))
|
|
||||||
{
|
|
||||||
ty->cursor_state.cx = ty->termstate.left_margin;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case 'a': // cursor right N (HPR)
|
case 'a': // cursor right N (HPR)
|
||||||
_handle_esc_csi_cuf(ty, &b);
|
_handle_esc_csi_cuf(ty, &b);
|
||||||
|
|
|
@ -0,0 +1,43 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
# fill space with E
|
||||||
|
printf '\033[69;1;1;25;80\044x'
|
||||||
|
|
||||||
|
#set color
|
||||||
|
printf '\033[46;31;3m'
|
||||||
|
|
||||||
|
# arg = 3
|
||||||
|
printf '\033[1;10H1\033[3`1'
|
||||||
|
|
||||||
|
# no arg
|
||||||
|
printf '\033[2;10H2\033[`2'
|
||||||
|
|
||||||
|
# go too far
|
||||||
|
printf '\033[3;10H3\033[3333`3'
|
||||||
|
|
||||||
|
# arg == 0
|
||||||
|
printf '\033[4;10H4\033[0`4'
|
||||||
|
|
||||||
|
# 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\044x'
|
||||||
|
|
||||||
|
# From inside to outside
|
||||||
|
printf '\033[12;12HA\033[20`A'
|
||||||
|
|
||||||
|
# From outside (on the left) to outside (on the right)
|
||||||
|
printf '\033[12;2HB\033[40`B'
|
||||||
|
|
||||||
|
# restrict cursor
|
||||||
|
printf '\033[?6h'
|
||||||
|
|
||||||
|
# From inside to inside
|
||||||
|
printf '\033[4;4HC\033[6`C'
|
||||||
|
|
||||||
|
# From inside to outside
|
||||||
|
printf '\033[5;2HD\033[40`D'
|
|
@ -68,3 +68,4 @@ tbc.sh d0216e4056e5ab1cb4d411b6d6074785
|
||||||
ech.sh 57a3ff127abbb3efa4082fab7de59970
|
ech.sh 57a3ff127abbb3efa4082fab7de59970
|
||||||
text_append_after_right_margin.sh 26b334188d39e2b12538a6ca91ca168c
|
text_append_after_right_margin.sh 26b334188d39e2b12538a6ca91ca168c
|
||||||
cbt.sh 417cd352d3eba45d6016df67a0314444
|
cbt.sh 417cd352d3eba45d6016df67a0314444
|
||||||
|
hpa.sh 0f86ca83e072d41b89dd1a012f0749a7
|
||||||
|
|
Loading…
Reference in New Issue