tvi: do not reset xrow in vi() - neatvi - [fork] simple vi-type editor with UTF-8 support
git clone git://src.adamsgaard.dk/neatvi
Log
Files
Refs
README
---
commit 2460d9a6808b950d1e83db81c2e9e983dd608b79
parent 5da6bb0629bff3c69de6f99671fde70a29ba0ca9
Author: Ali Gholami Rudi 
Date:   Sun, 28 Jun 2015 23:47:49 +0430

vi: do not reset xrow in vi()

Reported by Christian Neukirchen .

Diffstat:
  M ex.c                                |       2 +-
  M vi.c                                |       3 +--

2 files changed, 2 insertions(+), 3 deletions(-)
---
diff --git a/ex.c b/ex.c
t@@ -339,7 +339,7 @@ static int ec_edit(char *ec)
                                 ex_path(), lbuf_len(xb));
                 ex_show(msg);
         }
-        xrow = MAX(0, MIN(xrow, lbuf_len(xb) - 1));
+        xrow = xvis ? 0 : MAX(0, MIN(xrow, lbuf_len(xb) - 1));
         lbuf_saved(xb, path[0] != '\0');
         return 0;
 }
diff --git a/vi.c b/vi.c
t@@ -1000,8 +1000,7 @@ static void vi(void)
         int mark;
         char *ln;
         char *kmap = NULL;
-        xtop = 0;
-        xrow = 0;
+        xtop = xrow;
         xoff = 0;
         xcol = vi_off2col(xb, xrow, xoff);
         vi_draw(xcol);