Mercurial > vim
diff src/memline.c @ 14579:23d6d9e9ae3e v8.1.0303
patch 8.1.0303: line2byte() is wrong for last line with 'noeol'
commit https://github.com/vim/vim/commit/c26f7c60532a37a2bf0a5e69aa81081b440dfc38
Author: Bram Moolenaar <Bram@vim.org>
Date: Mon Aug 20 22:53:04 2018 +0200
patch 8.1.0303: line2byte() is wrong for last line with 'noeol'
Problem: line2byte() is wrong for last line with 'noeol' and 'nofixeol'.
Solution: Fix off-by-one error. (Shane Harper, closes https://github.com/vim/vim/issues/3351)
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Mon, 20 Aug 2018 23:00:06 +0200 |
parents | dddba3937532 |
children | b6b2f7d69c7f |
line wrap: on
line diff
--- a/src/memline.c +++ b/src/memline.c @@ -5267,7 +5267,7 @@ ml_find_line_or_offset(buf_T *buf, linen /* 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; }