]> granicus.if.org Git - vim/commitdiff
patch 8.0.1383: local additions in help skips some files v8.0.1383
authorBram Moolenaar <Bram@vim.org>
Sat, 9 Dec 2017 20:10:13 +0000 (21:10 +0100)
committerBram Moolenaar <Bram@vim.org>
Sat, 9 Dec 2017 20:10:13 +0000 (21:10 +0100)
Problem:    Local additions in help skips some files. (joshklod)
Solution:   Check the base file name length equals.

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

index cd8b0c3f57349add47bb4d20404f559b25fa1314..91f5124de907e1c5d2669ebb2822fbd7d08d7cfa 100644 (file)
@@ -6934,13 +6934,10 @@ fix_help_buffer(void)
                            && fcount > 0)
                    {
 #ifdef FEAT_MULTI_LANG
-                       int     i1;
-                       int     i2;
-                       char_u  *f1;
-                       char_u  *f2;
-                       char_u  *t1;
-                       char_u  *e1;
-                       char_u  *e2;
+                       int     i1, i2;
+                       char_u  *f1, *f2;
+                       char_u  *t1, *t2;
+                       char_u  *e1, *e2;
 
                        /* If foo.abx is found use it instead of foo.txt in
                         * the same directory. */
@@ -6955,10 +6952,9 @@ fix_help_buffer(void)
                                f1 = fnames[i1];
                                f2 = fnames[i2];
                                t1 = gettail(f1);
-                               if (fnamencmp(f1, f2, t1 - f1) != 0)
-                                   continue;
+                               t2 = gettail(f2);
                                e1 = vim_strrchr(t1, '.');
-                               e2 = vim_strrchr(gettail(f2), '.');
+                               e2 = vim_strrchr(t2, '.');
                                if (e1 == NULL || e2 == NULL)
                                    continue;
                                if (fnamecmp(e1, ".txt") != 0
@@ -6969,7 +6965,8 @@ fix_help_buffer(void)
                                    fnames[i1] = NULL;
                                    continue;
                                }
-                               if (fnamencmp(f1, f2, e1 - f1) != 0)
+                               if (e1 - f1 != e2 - f2
+                                           || fnamencmp(f1, f2, e1 - f1) != 0)
                                    continue;
                                if (fnamecmp(e1, ".txt") == 0
                                    && fnamecmp(e2, fname + 4) == 0)
index 85c12962866c86a4f533ebe8c16e0b25c204c619..c550ff09e2f915c975420b88a3794fcacf9af46a 100644 (file)
@@ -30,3 +30,22 @@ func Test_help_keyword()
   close
   bwipe!
 endfunc
+
+func Test_help_local_additions()
+  call mkdir('Xruntime/doc', 'p')
+  call writefile(['*mydoc.txt* my awesome doc'], 'Xruntime/doc/mydoc.txt')
+  call writefile(['*mydoc-ext.txt* my extended awesome doc'], 'Xruntime/doc/mydoc-ext.txt')
+  let rtp_save = &rtp
+  set rtp+=./Xruntime
+  help
+  1
+  call search('mydoc.txt')
+  call assert_equal('|mydoc.txt| my awesome doc', getline('.'))
+  1
+  call search('mydoc-ext.txt')
+  call assert_equal('|mydoc-ext.txt| my extended awesome doc', getline('.'))
+  close
+
+  call delete('Xruntime', 'rf')
+  let &rtp = rtp_save
+endfunc
index 3c24cf92d5690125e0d54bdd1334e1b7cb54fc1c..05b1a4033460528b286b23f705e375d1c17d6c0b 100644 (file)
@@ -771,6 +771,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1383,
 /**/
     1382,
 /**/