From 21c0d87a242a50e09445ece0fdef8780394f6457 Mon Sep 17 00:00:00 2001 From: Marco Hinz Date: Tue, 21 Jul 2015 14:29:08 +0200 Subject: [PATCH] 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 --- src/nvim/memline.c | 3 ++- src/nvim/version.c | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/nvim/memline.c b/src/nvim/memline.c index 53f9a544b4..d90e91be5d 100644 --- a/src/nvim/memline.c +++ b/src/nvim/memline.c @@ -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; diff --git a/src/nvim/version.c b/src/nvim/version.c index 4b9142323d..1f8aaf6e69 100644 --- a/src/nvim/version.c +++ b/src/nvim/version.c @@ -80,7 +80,7 @@ static int included_patches[] = { 784, //783, //782, - //781, + 781, //780, //779, //778,