From e399562033d03ba702ed73c0608a50f1338febe6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Andr=C3=A9=20Tanner?= Date: Sat, 7 May 2016 14:47:39 +0200 Subject: text: fix bug in line break caching logic --- text.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/text.c b/text.c index ef561d5..a7354af 100644 --- 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; } -- cgit v1.2.3