mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
vim-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 vim/vim#9464)
0e2508d9e6
Co-authored-by: h-east <h.east.727@gmail.com>
This commit is contained in:
parent
e7a2ae829a
commit
b69c581761
@ -743,28 +743,26 @@ void fix_help_buffer(void)
|
||||
// If foo.abx is found use it instead of foo.txt in
|
||||
// the same directory.
|
||||
for (int i1 = 0; i1 < fcount; i1++) {
|
||||
for (int i2 = 0; i2 < fcount; i2++) {
|
||||
if (i1 == i2) {
|
||||
continue;
|
||||
}
|
||||
if (fnames[i1] == NULL || fnames[i2] == NULL) {
|
||||
continue;
|
||||
}
|
||||
const char *const f1 = fnames[i1];
|
||||
const char *const f1 = fnames[i1];
|
||||
const char *const t1 = path_tail(f1);
|
||||
const char *const e1 = strrchr(t1, '.');
|
||||
if (path_fnamecmp(e1, ".txt") != 0
|
||||
&& path_fnamecmp(e1, fname + 4) != 0) {
|
||||
// Not .txt and not .abx, remove it.
|
||||
XFREE_CLEAR(fnames[i1]);
|
||||
continue;
|
||||
}
|
||||
|
||||
for (int i2 = i1 + 1; i2 < fcount; i2++) {
|
||||
const char *const f2 = fnames[i2];
|
||||
const char *const t1 = path_tail(f1);
|
||||
if (f2 == NULL) {
|
||||
continue;
|
||||
}
|
||||
const char *const t2 = path_tail(f2);
|
||||
const char *const e1 = strrchr(t1, '.');
|
||||
const char *const e2 = strrchr(t2, '.');
|
||||
if (e1 == NULL || e2 == NULL) {
|
||||
continue;
|
||||
}
|
||||
if (path_fnamecmp(e1, ".txt") != 0
|
||||
&& path_fnamecmp(e1, fname + 4) != 0) {
|
||||
// Not .txt and not .abx, remove it.
|
||||
XFREE_CLEAR(fnames[i1]);
|
||||
continue;
|
||||
}
|
||||
if (e1 - f1 != e2 - f2
|
||||
|| path_fnamencmp(f1, f2, (size_t)(e1 - f1)) != 0) {
|
||||
continue;
|
||||
|
@ -96,16 +96,42 @@ func Test_help_local_additions()
|
||||
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('.'))
|
||||
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
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user