From 1fbbf3965775648f188e191e9230e0921d7b37e3 Mon Sep 17 00:00:00 2001 From: Jesse Luehrs Date: Wed, 31 May 2017 23:07:32 -0400 Subject: implement origin mode --- src/screen.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'src/screen.c') diff --git a/src/screen.c b/src/screen.c index b909cfb..e031e3e 100644 --- a/src/screen.c +++ b/src/screen.c @@ -261,6 +261,13 @@ void vt100_screen_move_to(VT100Screen *vt, int row, int col) : col >= vt->grid->max.col ? vt->grid->max.col - 1 : col; + if (vt->origin_mode) { + row += vt->grid->scroll_top; + if (row > vt->grid->scroll_bottom) { + row = vt->grid->scroll_bottom; + } + } + vt->grid->cur.row = row; vt->grid->cur.col = col; } @@ -835,6 +842,16 @@ void vt100_screen_reset_bracketed_paste(VT100Screen *vt) vt->bracketed_paste = 0; } +void vt100_screen_set_origin_mode(VT100Screen *vt) +{ + vt->origin_mode = 1; +} + +void vt100_screen_reset_origin_mode(VT100Screen *vt) +{ + vt->origin_mode = 0; +} + void vt100_screen_set_window_title(VT100Screen *vt, char *buf, size_t len) { free(vt->title); -- cgit v1.2.3-54-g00ecf