Skip to content

Commit 2570957

Browse files
committed
patch 7.4.2262
Problem: Fail to read register content from viminfo if it is 438 characters long. (John Chen) Solution: Adjust the check for line wrapping. (closes #1010)
1 parent 7df0f63 commit 2570957

File tree

3 files changed

+16
-1
lines changed

3 files changed

+16
-1
lines changed

src/ex_cmds.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2526,7 +2526,7 @@ barline_writestring(FILE *fd, char_u *s, int remaining_start)
25262526
else
25272527
++len;
25282528
}
2529-
if (len > remaining)
2529+
if (len > remaining - 2)
25302530
{
25312531
fprintf(fd, ">%d\n|<", len);
25322532
remaining = LSIZE - 20;

src/testdir/test_viminfo.vim

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,19 @@ func Test_viminfo_registers()
214214
call assert_equal(l, getreg('d', 1, 1))
215215
call assert_equal("V", getregtype('d'))
216216

217+
" Length around 440 switches to line continuation.
218+
let len = 434
219+
while len < 445
220+
let s = repeat('a', len)
221+
call setreg('"', s)
222+
wviminfo Xviminfo
223+
call setreg('"', '')
224+
rviminfo Xviminfo
225+
call assert_equal(s, getreg('"'), 'wrong register at length: ' . len)
226+
227+
let len += 1
228+
endwhile
229+
217230
call delete('Xviminfo')
218231
endfunc
219232

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -763,6 +763,8 @@ static char *(features[]) =
763763

764764
static int included_patches[] =
765765
{ /* Add new patch number below this line */
766+
/**/
767+
2262,
766768
/**/
767769
2261,
768770
/**/

0 commit comments

Comments
 (0)