tvi: use ren_noeol() for column number in insert and file commands - 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 a7405155b28f15f29b2171d175e317be66f785e1
(DIR) parent 7ffa4f824373d35bfe780f9d9d50a6e8f83071d3
(HTM) Author: Ali Gholami Rudi <ali@rudi.ir>
Date: Mon, 18 May 2015 12:04:05 +0430
vi: use ren_noeol() for column number in insert and file commands
Diffstat:
M vi.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
---
(DIR) diff --git a/vi.c b/vi.c
t@@ -843,6 +843,7 @@ static int vc_insert(int cmd)
lbuf_eol(xb, &xrow, &xcol, +1);
lbuf_lnnext(xb, &xrow, &xcol, -1);
}
+ xcol = ren_noeol(ln, xcol);
if (cmd == 'o')
xrow += 1;
if (cmd == 'i' || cmd == 'I')
t@@ -970,8 +971,10 @@ static int vi_scrollbackward(int cnt)
static void vc_status(void)
{
+ int pos = ren_noeol(lbuf_get(xb, xrow), xcol);
snprintf(xmsg, sizeof(xmsg), "\"%s\" line %d of %d, col %d\n",
- xpath[0] ? xpath : "unnamed", xrow + 1, lbuf_len(xb), xcol + 1);
+ xpath[0] ? xpath : "unnamed", xrow + 1, lbuf_len(xb),
+ ren_cursor(lbuf_get(xb, xrow), pos) + 1);
}
static int vc_replace(void)