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:
Marco Hinz 2015-07-21 14:29:08 +02:00 committed by Justin M. Keyes
parent 990c0350ab
commit 21c0d87a24
2 changed files with 3 additions and 2 deletions

View File

@ -3934,8 +3934,9 @@ long ml_find_line_or_offset(buf_T *buf, linenr_T lnum, long *offp)
size += lnum - 1; size += lnum - 1;
/* Don't count the last line break if 'bin' and 'noeol'. */ /* 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; size -= ffdos + 1;
}
} }
return size; return size;

View File

@ -80,7 +80,7 @@ static int included_patches[] = {
784, 784,
//783, //783,
//782, //782,
//781, 781,
//780, //780,
//779, //779,
//778, //778,