mirror of
https://github.com/neovim/neovim.git
synced 2025-10-02 07:58:35 +00:00
vim-patch:7.4.781 #3065
Problem: line2byte() returns one less when 'bin' and 'noeol' are set. Solution: Only adjust the size for the last line. (Rob Wu) Original patch: https://code.google.com/p/vim/source/detail?r=30c9301f33ed76d0b76b9e22362f5e78e26786da
This commit is contained in:

committed by
Justin M. Keyes

parent
990c0350ab
commit
21c0d87a24
@@ -3934,8 +3934,9 @@ long ml_find_line_or_offset(buf_T *buf, linenr_T lnum, long *offp)
|
||||
size += lnum - 1;
|
||||
|
||||
/* Don't count the last line break if 'bin' and 'noeol'. */
|
||||
if (buf->b_p_bin && !buf->b_p_eol)
|
||||
if (buf->b_p_bin && !buf->b_p_eol && buf->b_ml.ml_line_count == lnum) {
|
||||
size -= ffdos + 1;
|
||||
}
|
||||
}
|
||||
|
||||
return size;
|
||||
|
Reference in New Issue
Block a user