Mercurial > vim
comparison src/memline.c @ 6925:30c9301f33ed v7.4.781
patch 7.4.781
Problem: line2byte() returns one less when 'bin' and 'noeol' are set.
Solution: Only adjust the size for the last line. (Rob Wu)
author | Bram Moolenaar <bram@vim.org> |
---|---|
date | Sun, 12 Jul 2015 17:52:57 +0200 |
parents | cd47def2214a |
children | 62ba356c2d4e |
comparison
equal
deleted
inserted
replaced
6924:4b0a26cbea81 | 6925:30c9301f33ed |
---|---|
5360 /* Count extra CR characters. */ | 5360 /* Count extra CR characters. */ |
5361 if (ffdos) | 5361 if (ffdos) |
5362 size += lnum - 1; | 5362 size += lnum - 1; |
5363 | 5363 |
5364 /* Don't count the last line break if 'bin' and 'noeol'. */ | 5364 /* Don't count the last line break if 'bin' and 'noeol'. */ |
5365 if (buf->b_p_bin && !buf->b_p_eol) | 5365 if (buf->b_p_bin && !buf->b_p_eol && buf->b_ml.ml_line_count == lnum) |
5366 size -= ffdos + 1; | 5366 size -= ffdos + 1; |
5367 } | 5367 } |
5368 | 5368 |
5369 return size; | 5369 return size; |
5370 } | 5370 } |