summaryrefslogtreecommitdiffstats
path: root/src/memline.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2018-08-20 22:53:04 +0200
committerBram Moolenaar <Bram@vim.org>2018-08-20 22:53:04 +0200
commitc26f7c60532a37a2bf0a5e69aa81081b440dfc38 (patch)
tree4a717b3db6cc51d60cb286af087ee0e7e1eeba6a /src/memline.c
parentf1883479be91550bc31dd88f593b3012863a2629 (diff)
patch 8.1.0303: line2byte() is wrong for last line with 'noeol'v8.1.0303
Problem: line2byte() is wrong for last line with 'noeol' and 'nofixeol'. Solution: Fix off-by-one error. (Shane Harper, closes #3351)
Diffstat (limited to 'src/memline.c')
-rw-r--r--src/memline.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/memline.c b/src/memline.c
index a2f0b4f626..fb262acef5 100644
--- a/src/memline.c
+++ b/src/memline.c
@@ -5267,7 +5267,7 @@ ml_find_line_or_offset(buf_T *buf, linenr_T lnum, long *offp)
/* Don't count the last line break if 'noeol' and ('bin' or
* 'nofixeol'). */
if ((!buf->b_p_fixeol || buf->b_p_bin) && !buf->b_p_eol
- && buf->b_ml.ml_line_count == lnum)
+ && lnum > buf->b_ml.ml_line_count)
size -= ffdos + 1;
}