mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
vim-patch:7.4.1820
Problem: Removing language from help tags too often.
Solution: Only remove @en when not needed. (Hirohito Higashi)
9ccaae04c6
This commit is contained in:
parent
641d424290
commit
9114790c4c
@ -3688,10 +3688,7 @@ static void cleanup_help_tags(int num_file, char_u **file)
|
|||||||
if (len <= 0) {
|
if (len <= 0) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (STRCMP(file[i] + len, buf) == 0) {
|
if (STRCMP(file[i] + len, "@en") == 0) {
|
||||||
// remove the default language
|
|
||||||
file[i][len] = NUL;
|
|
||||||
} else if (STRCMP(file[i] + len, "@en") == 0) {
|
|
||||||
// Sorting on priority means the same item in another language may
|
// Sorting on priority means the same item in another language may
|
||||||
// be anywhere. Search all items for a match up to the "@en".
|
// be anywhere. Search all items for a match up to the "@en".
|
||||||
int j;
|
int j;
|
||||||
@ -3708,6 +3705,19 @@ static void cleanup_help_tags(int num_file, char_u **file)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (*buf != NUL) {
|
||||||
|
for (int i = 0; i < num_file; i++) {
|
||||||
|
int len = (int)STRLEN(file[i]) - 3;
|
||||||
|
if (len <= 0) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (STRCMP(file[i] + len, buf) == 0) {
|
||||||
|
// remove the default language
|
||||||
|
file[i][len] = NUL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -48,3 +48,118 @@ func Test_help_tagjump()
|
|||||||
call assert_true(getline('.') =~ '\*{address}\*')
|
call assert_true(getline('.') =~ '\*{address}\*')
|
||||||
helpclose
|
helpclose
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
|
let s:langs = ['en', 'ab', 'ja']
|
||||||
|
|
||||||
|
func s:doc_config_setup()
|
||||||
|
let s:helpfile_save = &helpfile
|
||||||
|
let &helpfile="Xdir1/doc-en/doc/testdoc.txt"
|
||||||
|
let s:rtp_save = &rtp
|
||||||
|
let &rtp="Xdir1/doc-en"
|
||||||
|
if has('multi_lang')
|
||||||
|
let s:helplang_save=&helplang
|
||||||
|
endif
|
||||||
|
|
||||||
|
call delete('Xdir1', 'rf')
|
||||||
|
|
||||||
|
for lang in s:langs
|
||||||
|
if lang ==# 'en'
|
||||||
|
let tagfname = 'tags'
|
||||||
|
let docfname = 'testdoc.txt'
|
||||||
|
else
|
||||||
|
let tagfname = 'tags-' . lang
|
||||||
|
let docfname = 'testdoc.' . lang . 'x'
|
||||||
|
endif
|
||||||
|
let docdir = "Xdir1/doc-" . lang . "/doc"
|
||||||
|
call mkdir(docdir, "p")
|
||||||
|
call writefile(["\t*test-char*", "\t*test-col*"], docdir . '/' . docfname)
|
||||||
|
call writefile(["test-char\t" . docfname . "\t/*test-char*",
|
||||||
|
\ "test-col\t" . docfname . "\t/*test-col*"],
|
||||||
|
\ docdir . '/' . tagfname)
|
||||||
|
endfor
|
||||||
|
endfunc
|
||||||
|
|
||||||
|
func s:doc_config_teardown()
|
||||||
|
call delete('Xdir1', 'rf')
|
||||||
|
|
||||||
|
let &helpfile = s:helpfile_save
|
||||||
|
let &rtp = s:rtp_save
|
||||||
|
if has('multi_lang')
|
||||||
|
let &helplang = s:helplang_save
|
||||||
|
endif
|
||||||
|
endfunc
|
||||||
|
|
||||||
|
func s:get_cmd_compl_list(cmd)
|
||||||
|
let list = []
|
||||||
|
let str = ''
|
||||||
|
for cnt in range(1, 999)
|
||||||
|
call feedkeys(a:cmd . repeat("\<Tab>", cnt) . "'\<C-B>let str='\<CR>", 'tx')
|
||||||
|
if str ==# a:cmd[1:]
|
||||||
|
break
|
||||||
|
endif
|
||||||
|
call add(list, str)
|
||||||
|
endfor
|
||||||
|
return list
|
||||||
|
endfunc
|
||||||
|
|
||||||
|
func Test_help_complete()
|
||||||
|
try
|
||||||
|
let list = []
|
||||||
|
call s:doc_config_setup()
|
||||||
|
|
||||||
|
" 'helplang=' and help file lang is 'en'
|
||||||
|
if has('multi_lang')
|
||||||
|
set helplang=
|
||||||
|
endif
|
||||||
|
let list = s:get_cmd_compl_list(":h test")
|
||||||
|
call assert_equal(['h test-col', 'h test-char'], list)
|
||||||
|
|
||||||
|
if has('multi_lang')
|
||||||
|
" 'helplang=ab' and help file lang is 'en'
|
||||||
|
set helplang=ab
|
||||||
|
let list = s:get_cmd_compl_list(":h test")
|
||||||
|
call assert_equal(['h test-col', 'h test-char'], list)
|
||||||
|
|
||||||
|
" 'helplang=' and help file lang is 'en' and 'ab'
|
||||||
|
set rtp+=Xdir1/doc-ab
|
||||||
|
set helplang=
|
||||||
|
let list = s:get_cmd_compl_list(":h test")
|
||||||
|
call assert_equal(['h test-col@en', 'h test-col@ab',
|
||||||
|
\ 'h test-char@en', 'h test-char@ab'], list)
|
||||||
|
|
||||||
|
" 'helplang=ab' and help file lang is 'en' and 'ab'
|
||||||
|
set helplang=ab
|
||||||
|
let list = s:get_cmd_compl_list(":h test")
|
||||||
|
call assert_equal(['h test-col', 'h test-col@en',
|
||||||
|
\ 'h test-char', 'h test-char@en'], list)
|
||||||
|
|
||||||
|
" 'helplang=' and help file lang is 'en', 'ab' and 'ja'
|
||||||
|
set rtp+=Xdir1/doc-ja
|
||||||
|
set helplang=
|
||||||
|
let list = s:get_cmd_compl_list(":h test")
|
||||||
|
call assert_equal(['h test-col@en', 'h test-col@ab',
|
||||||
|
\ 'h test-col@ja', 'h test-char@en',
|
||||||
|
\ 'h test-char@ab', 'h test-char@ja'], list)
|
||||||
|
|
||||||
|
" 'helplang=ab' and help file lang is 'en', 'ab' and 'ja'
|
||||||
|
set helplang=ab
|
||||||
|
let list = s:get_cmd_compl_list(":h test")
|
||||||
|
call assert_equal(['h test-col', 'h test-col@en',
|
||||||
|
\ 'h test-col@ja', 'h test-char',
|
||||||
|
\ 'h test-char@en', 'h test-char@ja'], list)
|
||||||
|
|
||||||
|
" 'helplang=ab,ja' and help file lang is 'en', 'ab' and 'ja'
|
||||||
|
set helplang=ab,ja
|
||||||
|
let list = s:get_cmd_compl_list(":h test")
|
||||||
|
call assert_equal(['h test-col', 'h test-col@ja',
|
||||||
|
\ 'h test-col@en', 'h test-char',
|
||||||
|
\ 'h test-char@ja', 'h test-char@en'], list)
|
||||||
|
endif
|
||||||
|
catch
|
||||||
|
call assert_exception('X')
|
||||||
|
finally
|
||||||
|
call s:doc_config_teardown()
|
||||||
|
endtry
|
||||||
|
endfunc
|
||||||
|
|
||||||
|
" vim: et sw=2:
|
||||||
|
@ -621,7 +621,7 @@ static int included_patches[] = {
|
|||||||
// 1823,
|
// 1823,
|
||||||
// 1822 NA
|
// 1822 NA
|
||||||
// 1821,
|
// 1821,
|
||||||
// 1820,
|
1820,
|
||||||
// 1819 NA
|
// 1819 NA
|
||||||
1818,
|
1818,
|
||||||
// 1817 NA
|
// 1817 NA
|
||||||
|
Loading…
Reference in New Issue
Block a user