tvi: fix cursor position at start up - neatvi - [fork] simple vi-type editor with UTF-8 support (HTM) git clone git://src.adamsgaard.dk/neatvi (DIR) Log (DIR) Files (DIR) Refs (DIR) README --- (DIR) commit 666a00bba9a47618652e7506425c865fabe8e365 (DIR) parent 2460d9a6808b950d1e83db81c2e9e983dd608b79 (HTM) Author: Ali Gholami Rudi <ali@rudi.ir> Date: Mon, 29 Jun 2015 18:47:32 +0430 vi: fix cursor position at start up Reported by Christian Neukirchen <chneukirchen@gmail.com>. Diffstat: M vi.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- (DIR) diff --git a/vi.c b/vi.c t@@ -1000,11 +1000,11 @@ static void vi(void) int mark; char *ln; char *kmap = NULL; - xtop = xrow; + xtop = MAX(0, xrow - xrows / 2); xoff = 0; xcol = vi_off2col(xb, xrow, xoff); vi_draw(xcol); - term_pos(xrow, led_pos(lbuf_get(xb, xrow), xcol)); + term_pos(xrow - xtop, led_pos(lbuf_get(xb, xrow), xcol)); while (!xquit) { int redraw = 0; int nrow = xrow;