mirror of
https://github.com/vim/vim.git
synced 2025-09-26 04:04:07 -04:00
patch 8.2.3992: wrong local-additions in the help with language mix
Problem: Wrong local-additions in the help with language mix. Solution: Adjust how the local additions list is generated. (Hirohito Higashi, closes #9464)
This commit is contained in:
31
src/help.c
31
src/help.c
@@ -818,32 +818,31 @@ fix_help_buffer(void)
|
|||||||
// the same directory.
|
// the same directory.
|
||||||
for (i1 = 0; i1 < fcount; ++i1)
|
for (i1 = 0; i1 < fcount; ++i1)
|
||||||
{
|
{
|
||||||
for (i2 = 0; i2 < fcount; ++i2)
|
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)
|
||||||
{
|
{
|
||||||
if (i1 == i2)
|
|
||||||
continue;
|
|
||||||
if (fnames[i1] == NULL || fnames[i2] == NULL)
|
|
||||||
continue;
|
|
||||||
f1 = fnames[i1];
|
|
||||||
f2 = fnames[i2];
|
f2 = fnames[i2];
|
||||||
t1 = gettail(f1);
|
if (f2 == NULL)
|
||||||
|
continue;
|
||||||
t2 = gettail(f2);
|
t2 = gettail(f2);
|
||||||
e1 = vim_strrchr(t1, '.');
|
|
||||||
e2 = vim_strrchr(t2, '.');
|
e2 = vim_strrchr(t2, '.');
|
||||||
if (e1 == NULL || e2 == NULL)
|
if (e1 == NULL || e2 == NULL)
|
||||||
continue;
|
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
|
if (e1 - f1 != e2 - f2
|
||||||
|| fnamencmp(f1, f2, e1 - f1) != 0)
|
|| fnamencmp(f1, f2, e1 - f1) != 0)
|
||||||
continue;
|
continue;
|
||||||
if (fnamecmp(e1, ".txt") == 0
|
if (fnamecmp(e1, ".txt") == 0
|
||||||
&& fnamecmp(e2, fname + 4) == 0)
|
&& fnamecmp(e2, fname + 4) == 0)
|
||||||
// use .abx instead of .txt
|
// use .abx instead of .txt
|
||||||
VIM_CLEAR(fnames[i1]);
|
VIM_CLEAR(fnames[i1]);
|
||||||
}
|
}
|
||||||
|
@@ -57,16 +57,42 @@ func Test_help_local_additions()
|
|||||||
call writefile(['*mydoc-ext.txt* my extended awesome doc'], 'Xruntime/doc/mydoc-ext.txt')
|
call writefile(['*mydoc-ext.txt* my extended awesome doc'], 'Xruntime/doc/mydoc-ext.txt')
|
||||||
let rtp_save = &rtp
|
let rtp_save = &rtp
|
||||||
set rtp+=./Xruntime
|
set rtp+=./Xruntime
|
||||||
help
|
help local-additions
|
||||||
1
|
let lines = getline(line(".") + 1, search("^$") - 1)
|
||||||
call search('mydoc.txt')
|
call assert_equal([
|
||||||
call assert_equal('|mydoc.txt| my awesome doc', getline('.'))
|
\ '|mydoc-ext.txt| my extended awesome doc',
|
||||||
1
|
\ '|mydoc.txt| my awesome doc'
|
||||||
call search('mydoc-ext.txt')
|
\ ], lines)
|
||||||
call assert_equal('|mydoc-ext.txt| my extended awesome doc', getline('.'))
|
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
|
close
|
||||||
|
|
||||||
call delete('Xruntime', 'rf')
|
call delete('Xruntime', 'rf')
|
||||||
|
call delete('Xruntime-ja', 'rf')
|
||||||
let &rtp = rtp_save
|
let &rtp = rtp_save
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
|
@@ -750,6 +750,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
3992,
|
||||||
/**/
|
/**/
|
||||||
3991,
|
3991,
|
||||||
/**/
|
/**/
|
||||||
|
Reference in New Issue
Block a user