aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarc André Tanner <mat@brain-dump.org>2016-05-07 14:47:39 +0200
committerMarc André Tanner <mat@brain-dump.org>2016-05-07 15:16:18 +0200
commite399562033d03ba702ed73c0608a50f1338febe6 (patch)
tree8d6699669afeb64b327d6812057cbc8e2f2cdac4
parentb0343e1c79d21b340d22b4f4ff061a063baef66e (diff)
downloadvis-e399562033d03ba702ed73c0608a50f1338febe6.tar.gz
vis-e399562033d03ba702ed73c0608a50f1338febe6.tar.xz
text: fix bug in line break caching logic
-rw-r--r--text.c3
1 files changed, 2 insertions, 1 deletions
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;
}