To: vim_dev@googlegroups.com Subject: Patch 8.2.3992 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.2.3992 Problem: Wrong local-additions in the help with language mix. Solution: Adjust how the local additions list is generated. (Hirohito Higashi, closes #9464) Files: src/help.c, src/testdir/test_help.vim *** ../vim-8.2.3991/src/help.c 2022-01-02 20:20:41.377033186 +0000 --- src/help.c 2022-01-03 12:52:12.158852025 +0000 *************** *** 818,849 **** // the same directory. for (i1 = 0; i1 < fcount; ++i1) { ! for (i2 = 0; i2 < fcount; ++i2) { - if (i1 == i2) - continue; - if (fnames[i1] == NULL || fnames[i2] == NULL) - continue; - f1 = fnames[i1]; f2 = fnames[i2]; ! t1 = gettail(f1); t2 = gettail(f2); - e1 = vim_strrchr(t1, '.'); e2 = vim_strrchr(t2, '.'); if (e1 == NULL || e2 == NULL) continue; - if (fnamecmp(e1, ".txt") != 0 - && fnamecmp(e1, fname + 4) != 0) - { - // Not .txt and not .abx, remove it. - VIM_CLEAR(fnames[i1]); - continue; - } if (e1 - f1 != e2 - f2 || fnamencmp(f1, f2, e1 - f1) != 0) continue; if (fnamecmp(e1, ".txt") == 0 ! && fnamecmp(e2, fname + 4) == 0) // use .abx instead of .txt VIM_CLEAR(fnames[i1]); } --- 818,848 ---- // the same directory. for (i1 = 0; i1 < fcount; ++i1) { ! f1 = fnames[i1]; ! t1 = gettail(f1); ! e1 = vim_strrchr(t1, '.'); ! if (fnamecmp(e1, ".txt") != 0 ! && fnamecmp(e1, fname + 4) != 0) ! { ! // Not .txt and not .abx, remove it. ! VIM_CLEAR(fnames[i1]); ! continue; ! } ! ! for (i2 = i1 + 1; i2 < fcount; ++i2) { f2 = fnames[i2]; ! if (f2 == NULL) ! continue; t2 = gettail(f2); e2 = vim_strrchr(t2, '.'); if (e1 == NULL || e2 == NULL) continue; if (e1 - f1 != e2 - f2 || fnamencmp(f1, f2, e1 - f1) != 0) continue; if (fnamecmp(e1, ".txt") == 0 ! && fnamecmp(e2, fname + 4) == 0) // use .abx instead of .txt VIM_CLEAR(fnames[i1]); } *** ../vim-8.2.3991/src/testdir/test_help.vim 2021-11-25 10:50:09.178844306 +0000 --- src/testdir/test_help.vim 2022-01-03 12:48:51.651396534 +0000 *************** *** 57,72 **** 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 --- 57,98 ---- call writefile(['*mydoc-ext.txt* my extended awesome doc'], 'Xruntime/doc/mydoc-ext.txt') let rtp_save = &rtp set rtp+=./Xruntime ! help local-additions ! let lines = getline(line(".") + 1, search("^$") - 1) ! call assert_equal([ ! \ '|mydoc-ext.txt| my extended awesome doc', ! \ '|mydoc.txt| my awesome doc' ! \ ], lines) ! call delete('Xruntime/doc/mydoc-ext.txt') ! close ! ! call mkdir('Xruntime-ja/doc', 'p') ! call writefile(["local-additions\thelp.jax\t/*local-additions*"], 'Xruntime-ja/doc/tags-ja') ! call writefile(['*help.txt* This is jax file', '', ! \ 'LOCAL ADDITIONS: *local-additions*', ''], 'Xruntime-ja/doc/help.jax') ! call writefile(['*work.txt* This is jax file'], 'Xruntime-ja/doc/work.jax') ! call writefile(['*work2.txt* This is jax file'], 'Xruntime-ja/doc/work2.jax') ! set rtp+=./Xruntime-ja ! ! help local-additions@en ! let lines = getline(line(".") + 1, search("^$") - 1) ! call assert_equal([ ! \ '|mydoc.txt| my awesome doc' ! \ ], lines) ! close ! ! help local-additions@ja ! let lines = getline(line(".") + 1, search("^$") - 1) ! call assert_equal([ ! \ '|mydoc.txt| my awesome doc', ! \ '|help.txt| This is jax file', ! \ '|work.txt| This is jax file', ! \ '|work2.txt| This is jax file', ! \ ], lines) close call delete('Xruntime', 'rf') + call delete('Xruntime-ja', 'rf') let &rtp = rtp_save endfunc *** ../vim-8.2.3991/src/version.c 2022-01-03 12:27:59.359039951 +0000 --- src/version.c 2022-01-03 12:52:45.886775303 +0000 *************** *** 752,753 **** --- 752,755 ---- { /* Add new patch number below this line */ + /**/ + 3992, /**/ -- Spam seems to be something useful to novices. Later you realize that it's a bunch of indigestable junk that only clogs your system. Applies to both the food and the e-mail! /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// \\\ \\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///