]> granicus.if.org Git - vim/commitdiff
patch 7.4.2262 v7.4.2262
authorBram Moolenaar <Bram@vim.org>
Fri, 26 Aug 2016 18:41:16 +0000 (20:41 +0200)
committerBram Moolenaar <Bram@vim.org>
Fri, 26 Aug 2016 18:41:16 +0000 (20:41 +0200)
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)

src/ex_cmds.c
src/testdir/test_viminfo.vim
src/version.c

index 72d480cc973dfb1bf5a3b3a15545b81716908944..64d14aedd2a566199d99d4c14a746b9fc8bd6e0b 100644 (file)
@@ -2526,7 +2526,7 @@ barline_writestring(FILE *fd, char_u *s, int remaining_start)
        else
            ++len;
     }
-    if (len > remaining)
+    if (len > remaining - 2)
     {
        fprintf(fd, ">%d\n|<", len);
        remaining = LSIZE - 20;
index 264baa1745551f6a56f6e64ba74bd1cb7a3dd439..97fd7f7a60220f734e49c0e6aa4eaaa8713368a8 100644 (file)
@@ -214,6 +214,19 @@ func Test_viminfo_registers()
   call assert_equal(l, getreg('d', 1, 1))
   call assert_equal("V", getregtype('d'))
 
+  " Length around 440 switches to line continuation.
+  let len = 434
+  while len < 445
+    let s = repeat('a', len)
+    call setreg('"', s)
+    wviminfo Xviminfo
+    call setreg('"', '')
+    rviminfo Xviminfo
+    call assert_equal(s, getreg('"'), 'wrong register at length: ' . len)
+
+    let len += 1
+  endwhile
+
   call delete('Xviminfo')
 endfunc
 
index 9684a3ee1a143e94b06cbad9b7b02ac1e3110c2c..a46e74830d62db831d941fb8496c21944a80e9d6 100644 (file)
@@ -763,6 +763,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    2262,
 /**/
     2261,
 /**/