tvi: fix cursor position at start up - neatvi - [fork] simple vi-type editor wi… | |
git clone git://src.adamsgaard.dk/neatvi | |
Log | |
Files | |
Refs | |
README | |
--- | |
commit 666a00bba9a47618652e7506425c865fabe8e365 | |
parent 2460d9a6808b950d1e83db81c2e9e983dd608b79 | |
Author: Ali Gholami Rudi <[email protected]> | |
Date: Mon, 29 Jun 2015 18:47:32 +0430 | |
vi: fix cursor position at start up | |
Reported by Christian Neukirchen <[email protected]>. | |
Diffstat: | |
M vi.c | 4 ++-- | |
1 file changed, 2 insertions(+), 2 deletions(-) | |
--- | |
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; |