vis

a vi-like editor based on Plan 9's structural regular expressions

git clone https://9o.is/git/vis.git

commit e3b20ff5f92aaf55f70949b21bc22122cdd26a7a
parent 82b177c6ad3333ac73f73c3d58ccc75d218c692e
Author: Marc André Tanner <mat@brain-dump.org>
Date:   Sat,  7 May 2016 14:47:39 +0200

text: fix bug in line break caching logic

Diffstat:
Mtext.c | 3++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/text.c b/text.c @@ -20,6 +20,7 @@ #include "text.h" #include "text-util.h" +#include "text-motions.h" #include "util.h" /* Allocate buffers holding the actual file content in junks of size: */ @@ -1623,7 +1624,7 @@ size_t text_lineno_by_pos(Text *txt, size_t pos) { } else if (pos > cache->pos) { cache->lineno += lines_count(txt, cache->pos, pos - cache->pos); } - cache->pos = pos; + cache->pos = text_line_begin(txt, pos); return cache->lineno; }