aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Eklöf <daniel@ekloef.se>2019-07-03 19:16:41 +0000
committerDaniel Eklöf <daniel@ekloef.se>2019-07-03 19:16:41 +0000
commit90dadfcc228d890fb95cc7c210b24cd024f096ac (patch)
treefd3929dbf7e6fb9393125abf10d7a07e221bb52f
parentlogging: disable debug logging by default (diff)
vt: implement (untested!) insert mode
\E4l is not horizontal index, but disable INSERT mode
-rw-r--r--csi.c14
-rw-r--r--terminal.h4
-rw-r--r--vt.c9
3 files changed, 19 insertions, 8 deletions
diff --git a/csi.c b/csi.c
index 4be35c60..6fca2c24 100644
--- a/csi.c
+++ b/csi.c
@@ -484,16 +484,16 @@ csi_dispatch(struct terminal *term, uint8_t final)
break;
}
- case 'l': {
- /* Horizontal index */
+ case 'h':
+ /* smir - insert mode enable */
assert(false && "untested");
- int param = param_get(term, 0, 1);
- int col = term->cursor.col;
+ term->insert_mode = true;
+ break;
- col = (col + param * 8) / 8 * 8;
- term_cursor_right(term, col - term->cursor.col);
+ case 'l':
+ /* rmir - insert mode disable */
+ term->insert_mode = false;
break;
- }
case 'r': {
int start = param_get(term, 0, 1);
diff --git a/terminal.h b/terminal.h
index a96b1b70..f48158e5 100644
--- a/terminal.h
+++ b/terminal.h
@@ -131,9 +131,11 @@ struct terminal {
pid_t slave;
int ptmx;
- bool hide_cursor;
enum decckm decckm;
enum keypad_mode keypad_mode;
+ bool hide_cursor;
+ bool auto_margin;
+ bool insert_mode;
bool bracketed_paste;
struct vt vt;
diff --git a/vt.c b/vt.c
index c5786b2f..b00b840d 100644
--- a/vt.c
+++ b/vt.c
@@ -701,6 +701,15 @@ action(struct terminal *term, enum action action, uint8_t c)
struct cell *cell = &term->grid->cur_line[term->cursor.col];
term_damage_update(term, term->cursor.linear, 1);
+ if (term->insert_mode) {
+ assert(false && "untested");
+ grid_memmove(
+ term->grid, term->cursor.linear + 1, term->cursor.linear,
+ term->cols - term->cursor.col - 1);
+ term_damage_update(
+ term, term->cursor.linear + 1, term->cols - term->cursor.col - 1);
+ }
+
if (term->vt.utf8.idx > 0) {
//LOG_DBG("print: UTF8: %.*s", (int)term->vt.utf8.idx, term->vt.utf8.data);
memcpy(cell->c, term->vt.utf8.data, term->vt.utf8.idx);