aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorBoris Faure <billiob@gmail.com>2018-12-28 21:56:02 +0100
committerBoris Faure <billiob@gmail.com>2018-12-28 21:56:02 +0100
commit090f6a64f25591ffa97891b27663d7d055819efe (patch)
tree3b5c14e41232802ace30d320064a37e25a84ac82 /src
parenttermptyesc: always check return of _csi_truecolor_arg_get() (diff)
downloadterminology-090f6a64f25591ffa97891b27663d7d055819efe.tar.gz
termptyesc: support DECBI
Diffstat (limited to 'src')
-rw-r--r--src/bin/termptyesc.c48
1 files changed, 48 insertions, 0 deletions
diff --git a/src/bin/termptyesc.c b/src/bin/termptyesc.c
index 7f9efeb..656c205 100644
--- a/src/bin/termptyesc.c
+++ b/src/bin/termptyesc.c
@@ -2793,6 +2793,51 @@ _handle_decaln(Termpty *ty)
}
}
+static void
+_handle_decbi(Termpty *ty)
+{
+ DBG("DECBI - Back Index");
+ if (ty->cursor_state.cx == ty->termstate.left_margin)
+ {
+ Eina_Unicode blank[1] = { ' ' };
+ int old_insert = ty->termstate.insert;
+ int old_cx = ty->cursor_state.cx;
+ int old_cy = ty->cursor_state.cy;
+ int y;
+ int max = ty->h;
+
+ if (((ty->termstate.lr_margins != 0) && (ty->cursor_state.cx == 0))
+ || ((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 = ty->termstate.bottom_margin;
+ ty->termstate.insert = 1;
+ for (y = ty->termstate.top_margin; y < max; y++)
+ {
+ /* Insert a left column */
+ ty->cursor_state.cy = y;
+ ty->cursor_state.cx = old_cx;
+ ty->termstate.wrapnext = 0;
+ termpty_text_append(ty, blank, 1);
+ }
+ ty->termstate.insert = old_insert;
+ ty->cursor_state.cx = old_cx;
+ ty->cursor_state.cy = old_cy;
+ }
+ else
+ {
+ if ((ty->cursor_state.cx == 0) && (ty->termstate.lr_margins != 0))
+ return;
+ /* cursor backward */
+ ty->cursor_state.cx--;
+ }
+}
+
static int
_handle_esc(Termpty *ty, const Eina_Unicode *c, const Eina_Unicode *ce)
{
@@ -2887,6 +2932,9 @@ _handle_esc(Termpty *ty, const Eina_Unicode *c, const Eina_Unicode *ce)
case '@': // just consume this plus next char
if (len < 2) return 0;
return 2;
+ case '6':
+ _handle_decbi(ty);
+ return 1;
case '7': // save cursor pos
termpty_cursor_copy(ty, EINA_TRUE);
return 1;