forked from enlightenment/terminology
termptyesc: support DECFI
Introduce different behaviour from xterm as I don't see why it behaves like that when outside of left/right margin and on right border. Xterm does not wrap.
This commit is contained in:
parent
fd92428c57
commit
19a99dadff
|
@ -2827,7 +2827,7 @@ _handle_decbi(Termpty *ty)
|
||||||
ty->cursor_state.cx = old_cx;
|
ty->cursor_state.cx = old_cx;
|
||||||
ty->cursor_state.cy = old_cy;
|
ty->cursor_state.cy = old_cy;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if ((ty->cursor_state.cx == 0) && (ty->termstate.lr_margins != 0))
|
if ((ty->cursor_state.cx == 0) && (ty->termstate.lr_margins != 0))
|
||||||
return;
|
return;
|
||||||
|
@ -2836,6 +2836,65 @@ _handle_decbi(Termpty *ty)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_handle_decfi(Termpty *ty)
|
||||||
|
{
|
||||||
|
DBG("DECFI - Forward Index");
|
||||||
|
if ((ty->cursor_state.cx == ty->w - 1)
|
||||||
|
|| ((ty->termstate.right_margin > 0)
|
||||||
|
&& (ty->cursor_state.cx == ty->termstate.right_margin - 1)))
|
||||||
|
{
|
||||||
|
int y;
|
||||||
|
int max_x = ty->w - 1;
|
||||||
|
int max_y = ty->h;
|
||||||
|
|
||||||
|
if (((ty->termstate.lr_margins != 0)
|
||||||
|
&& (ty->cursor_state.cx == ty->w - 1))
|
||||||
|
|| ((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_y = ty->termstate.bottom_margin;
|
||||||
|
if (ty->termstate.right_margin != 0)
|
||||||
|
max_x = ty->termstate.right_margin - 1;
|
||||||
|
|
||||||
|
for (y = ty->termstate.top_margin; y < max_y; y++)
|
||||||
|
{
|
||||||
|
int x;
|
||||||
|
Termcell *cells = &(TERMPTY_SCREEN(ty, 0, y));
|
||||||
|
|
||||||
|
for (x = ty->termstate.left_margin; x <= max_x; x++)
|
||||||
|
{
|
||||||
|
if (x < max_x)
|
||||||
|
TERMPTY_CELL_COPY(ty, &(cells[x + 1]), &(cells[x]), 1);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
cells[x].codepoint = ' ';
|
||||||
|
if (EINA_UNLIKELY(cells[x].att.link_id))
|
||||||
|
term_link_refcount_dec(ty, cells[x].att.link_id, 1);
|
||||||
|
cells[x].att = ty->termstate.att;
|
||||||
|
cells[x].att.link_id = 0;
|
||||||
|
cells[x].att.dblwidth = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if ((ty->cursor_state.cx == ty->w - 1)
|
||||||
|
&& (ty->termstate.lr_margins != 0))
|
||||||
|
return;
|
||||||
|
ERR("ty->cursor_state.cx=%d", ty->cursor_state.cx);
|
||||||
|
ERR("ty->cursor_state.cy=%d", ty->cursor_state.cy);
|
||||||
|
/* cursor forward */
|
||||||
|
ty->cursor_state.cx++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
_handle_esc(Termpty *ty, const Eina_Unicode *c, const Eina_Unicode *ce)
|
_handle_esc(Termpty *ty, const Eina_Unicode *c, const Eina_Unicode *ce)
|
||||||
{
|
{
|
||||||
|
@ -2939,6 +2998,9 @@ _handle_esc(Termpty *ty, const Eina_Unicode *c, const Eina_Unicode *ce)
|
||||||
case '8': // restore cursor pos
|
case '8': // restore cursor pos
|
||||||
termpty_cursor_copy(ty, EINA_FALSE);
|
termpty_cursor_copy(ty, EINA_FALSE);
|
||||||
return 1;
|
return 1;
|
||||||
|
case '9':
|
||||||
|
_handle_decfi(ty);
|
||||||
|
return 1;
|
||||||
case 'H': // set tab at current column
|
case 'H': // set tab at current column
|
||||||
DBG("Character Tabulation Set (HTS) at x:%d", ty->cursor_state.cx);
|
DBG("Character Tabulation Set (HTS) at x:%d", ty->cursor_state.cx);
|
||||||
TAB_SET(ty, ty->cursor_state.cx);
|
TAB_SET(ty, ty->cursor_state.cx);
|
||||||
|
|
|
@ -29,7 +29,7 @@ printf '\033[5;22r'
|
||||||
|
|
||||||
# move to
|
# move to
|
||||||
printf '\033[4;0H'
|
printf '\033[4;0H'
|
||||||
# decbi, not within top/right margin, do nothing
|
# decbi, not within top/bottom margin, do nothing
|
||||||
printf '\033\066b'
|
printf '\033\066b'
|
||||||
# move to 3; 0
|
# move to 3; 0
|
||||||
printf '\033[6;0H'
|
printf '\033[6;0H'
|
||||||
|
|
|
@ -0,0 +1,86 @@
|
||||||
|
#!/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'
|
||||||
|
|
||||||
|
#set color
|
||||||
|
printf '\033[46;31;3m'
|
||||||
|
|
||||||
|
printf ' format is:\n \-/|\\~_>^<'
|
||||||
|
|
||||||
|
# move to
|
||||||
|
printf '\033[3;81H'
|
||||||
|
# decfi, insert column
|
||||||
|
printf '\033\071a'
|
||||||
|
|
||||||
|
# set top/bottom margins:
|
||||||
|
printf '\033[5;22r'
|
||||||
|
|
||||||
|
# move to
|
||||||
|
printf '\033[4;81H'
|
||||||
|
# decfi, not within top/bottom margin, do nothing
|
||||||
|
printf '\033\071b'
|
||||||
|
# move to 3; 0
|
||||||
|
printf '\033[6;81H'
|
||||||
|
# decfi, insert column within margins
|
||||||
|
printf 'C\033\071c'
|
||||||
|
|
||||||
|
|
||||||
|
# set top/bottom margins:
|
||||||
|
printf '\033[10;20r'
|
||||||
|
# allow left/right margins
|
||||||
|
printf '\033[?69h'
|
||||||
|
|
||||||
|
# move
|
||||||
|
printf '\033[7;81H'
|
||||||
|
# decfi, do nothing
|
||||||
|
printf 'D\033\071d'
|
||||||
|
|
||||||
|
# set right margin only
|
||||||
|
printf '\033[;14s'
|
||||||
|
|
||||||
|
# move
|
||||||
|
printf '\033[8;81H'
|
||||||
|
# decfi, do nothing. Xterm seems change wrapping here. I don't see why
|
||||||
|
printf 'E\033\071e'
|
||||||
|
|
||||||
|
|
||||||
|
# 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;81H'
|
||||||
|
# decfi, do nothing. Xterm seems change wrapping here. I don't see why
|
||||||
|
printf 'f\033\071g'
|
||||||
|
|
||||||
|
# move
|
||||||
|
printf '\033[12;12H'
|
||||||
|
#decfi, outside right margin, cursor forward
|
||||||
|
printf 'h\033\071i'
|
||||||
|
|
||||||
|
# move
|
||||||
|
printf '\033[13;3H'
|
||||||
|
#decfi, outside right margin, cursor forward
|
||||||
|
printf '\033\071j'
|
||||||
|
|
||||||
|
# move
|
||||||
|
printf '\033[14;14H'
|
||||||
|
#decfi, on left margin, insert column
|
||||||
|
printf '\033\071k'
|
|
@ -38,3 +38,4 @@ cup.sh 11f5939a6cc990f6a7b9d1730ab3a8bf
|
||||||
decaln.sh 9c0cf4de336193bcdaed6ba6c0d6f590
|
decaln.sh 9c0cf4de336193bcdaed6ba6c0d6f590
|
||||||
decawm.sh 84321e76f07b40cf9462238ec0919dc0
|
decawm.sh 84321e76f07b40cf9462238ec0919dc0
|
||||||
decbi.sh 8153bff12a0d529cb8ba0dbff036a1ee
|
decbi.sh 8153bff12a0d529cb8ba0dbff036a1ee
|
||||||
|
decfi.sh e93690447902b923d3d9d2ae72a31de4
|
||||||
|
|
Loading…
Reference in New Issue