Merge remote-tracking branch 'vim/master'

This commit is contained in:
Kazuki Sakamoto
2017-02-09 18:54:34 -08:00
11 changed files with 163 additions and 28 deletions
+3 -1
View File
@@ -1,3 +1,5 @@
" Load the matchit package.
" For those users who were loading the matchit plugin from here.
packadd matchit
if 1
packadd matchit
endif
+30 -14
View File
@@ -1,7 +1,7 @@
" Set options and add mapping such that Vim behaves a lot like MS-Windows
"
" Maintainer: Bram Moolenaar <Bram@vim.org>
" Last change: 2012 Jul 25
" Last change: 2017 Feb 09
" bail out if this isn't wanted (mrsvim.vim uses this).
if exists("g:skip_loading_mswin") && g:skip_loading_mswin
@@ -23,20 +23,22 @@ set backspace=indent,eol,start whichwrap+=<,>,[,]
" backspace in Visual mode deletes selection
vnoremap <BS> d
" CTRL-X and SHIFT-Del are Cut
vnoremap <C-X> "+x
vnoremap <S-Del> "+x
if has("clipboard")
" CTRL-X and SHIFT-Del are Cut
vnoremap <C-X> "+x
vnoremap <S-Del> "+x
" CTRL-C and CTRL-Insert are Copy
vnoremap <C-C> "+y
vnoremap <C-Insert> "+y
" CTRL-C and CTRL-Insert are Copy
vnoremap <C-C> "+y
vnoremap <C-Insert> "+y
" CTRL-V and SHIFT-Insert are Paste
map <C-V> "+gP
map <S-Insert> "+gP
" CTRL-V and SHIFT-Insert are Paste
map <C-V> "+gP
map <S-Insert> "+gP
cmap <C-V> <C-R>+
cmap <S-Insert> <C-R>+
cmap <C-V> <C-R>+
cmap <S-Insert> <C-R>+
endif
" Pasting blockwise and linewise selections is not possible in Insert and
" Visual mode without the +virtualedit feature. They are pasted as if they
@@ -44,8 +46,10 @@ cmap <S-Insert> <C-R>+
" Uses the paste.vim autoload script.
" Use CTRL-G u to have CTRL-Z only undo the paste.
exe 'inoremap <script> <C-V> <C-G>u' . paste#paste_cmd['i']
exe 'vnoremap <script> <C-V> ' . paste#paste_cmd['v']
if 1
exe 'inoremap <script> <C-V> <C-G>u' . paste#paste_cmd['i']
exe 'vnoremap <script> <C-V> ' . paste#paste_cmd['v']
endif
imap <S-Insert> <C-V>
vmap <S-Insert> <C-V>
@@ -99,6 +103,18 @@ inoremap <C-F4> <C-O><C-W>c
cnoremap <C-F4> <C-C><C-W>c
onoremap <C-F4> <C-C><C-W>c
if has("gui")
" CTRL-F is the search dialog
noremap <C-F> :promptfind<CR>
inoremap <C-F> <C-\><C-O>:promptfind<CR>
cnoremap <C-F> <C-\><C-C>:promptfind<CR>
" CTRL-H is the replace dialog
noremap <C-H> :promptrepl<CR>
inoremap <C-H> <C-\><C-O>:promptrepl<CR>
cnoremap <C-H> <C-\><C-C>:promptrepl<CR>
endif
" restore 'cpoptions'
set cpo&
if 1
+5 -2
View File
@@ -3476,10 +3476,13 @@ ins_compl_bs(void)
mb_ptr_back(line, p);
/* Stop completion when the whole word was deleted. For Omni completion
* allow the word to be deleted, we won't match everything. */
* allow the word to be deleted, we won't match everything.
* Respect the 'backspace' option. */
if ((int)(p - line) - (int)compl_col < 0
|| ((int)(p - line) - (int)compl_col == 0
&& ctrl_x_mode != CTRL_X_OMNI) || ctrl_x_mode == CTRL_X_EVAL)
&& ctrl_x_mode != CTRL_X_OMNI) || ctrl_x_mode == CTRL_X_EVAL
|| (!can_bs(BS_START) && (int)(p - line) - (int)compl_col
- compl_length < 0))
return K_BS;
/* Deleted more than what was used to find matches or didn't finish
+6 -4
View File
@@ -6503,18 +6503,20 @@ find_help_tags(
static char *(mtable[]) = {"*", "g*", "[*", "]*", ":*",
"/*", "/\\*", "\"*", "**",
"cpo-*", "/\\(\\)", "/\\%(\\)",
"?", ":?", "?<CR>", "g?", "g?g?", "g??", "z?",
"?", ":?", "?<CR>", "g?", "g?g?", "g??",
"/\\?", "/\\z(\\)", "\\=", ":s\\=",
"[count]", "[quotex]", "[range]",
"[count]", "[quotex]",
"[range]", ":[range]",
"[pattern]", "\\|", "\\%$",
"s/\\~", "s/\\U", "s/\\L",
"s/\\1", "s/\\2", "s/\\3", "s/\\9"};
static char *(rtable[]) = {"star", "gstar", "[star", "]star", ":star",
"/star", "/\\\\star", "quotestar", "starstar",
"cpo-star", "/\\\\(\\\\)", "/\\\\%(\\\\)",
"?", ":?", "?<CR>", "g?", "g?g?", "g??", "z?",
"?", ":?", "?<CR>", "g?", "g?g?", "g??",
"/\\\\?", "/\\\\z(\\\\)", "\\\\=", ":s\\\\=",
"\\[count]", "\\[quotex]", "\\[range]",
"\\[count]", "\\[quotex]",
"\\[range]", ":\\[range]",
"\\[pattern]", "\\\\bar", "/\\\\%\\$",
"s/\\\\\\~", "s/\\\\U", "s/\\\\L",
"s/\\\\1", "s/\\\\2", "s/\\\\3", "s/\\\\9"};
+2 -2
View File
@@ -2302,8 +2302,8 @@ do_one_cmd(
if (!ea.skip)
{
curwin->w_cursor.lnum = ea.line2;
/* don't leave the cursor on an illegal line */
check_cursor_lnum();
/* don't leave the cursor on an illegal line or column */
check_cursor();
}
}
else if (*ea.cmd != ',')
+1 -2
View File
@@ -212,8 +212,7 @@ getcmdline(
#endif
expand_T xpc;
long *b_im_ptr = NULL;
#if defined(FEAT_WILDMENU) || defined(FEAT_EVAL) \
|| defined(FEAT_SEARCH_EXTRA) || defined(FEAT_CMDWIN)
#if defined(FEAT_WILDMENU) || defined(FEAT_EVAL) || defined(FEAT_SEARCH_EXTRA)
/* Everything that may work recursively should save and restore the
* current command line in save_ccline. That includes update_screen(), a
* custom status line may invoke ":normal". */
+3
View File
@@ -1595,6 +1595,9 @@ spell_read_tree(
len = get4c(fd);
if (len < 0)
return SP_TRUNCERROR;
if (len >= 0x3ffffff)
/* Invalid length, multiply with sizeof(int) would overflow. */
return SP_FORMERROR;
if (len > 0)
{
/* Allocate the byte array. */
+13 -2
View File
@@ -289,13 +289,24 @@ func Test_remove_char_in_cmdline()
call assert_equal('"def', @:)
endfunc
func Test_illegal_address()
func Test_illegal_address1()
new
2;'(
2;')
quit
endfunc
func Test_illegal_address2()
call writefile(['c', 'x', ' x', '.', '1;y'], 'Xtest.vim')
new
source Xtest.vim
" Trigger calling validate_cursor()
diffsp Xtest.vim
quit!
bwipe!
call delete('Xtest.vim')
endfunc
func Test_cmdline_complete_wildoptions()
help
call feedkeys(":tag /\<c-a>\<c-b>\"\<cr>", 'tx')
@@ -353,7 +364,7 @@ func Test_getcmdtype()
call feedkeys("?MyCmd a\<C-R>=Check_cmdline('?')\<CR>\<Esc>", "xt")
call feedkeys(":call input('Answer?')\<CR>", "t")
call feedkeys("MyCmd a\<C-R>=Check_cmdline('@')\<CR>\<Esc>", "xt")
call feedkeys("MyCmd a\<C-R>=Check_cmdline('@')\<CR>\<C-C>", "xt")
call feedkeys(":insert\<CR>MyCmd a\<C-R>=Check_cmdline('-')\<CR>\<Esc>", "xt")
+60 -1
View File
@@ -41,7 +41,7 @@ func Test_getfontname_with_arg()
call assert_equal('', getfontname('notexist'))
" Valid font name. This is usually the real name of 7x13 by default.
let l:fname = '-Misc-Fixed-Medium-R-Normal--13-120-75-75-C-70-ISO10646-1'
let l:fname = '-misc-fixed-medium-r-normal--13-120-75-75-c-70-iso8859-1'
call assert_equal(l:fname, getfontname(l:fname))
elseif has('gui_gtk2') || has('gui_gnome') || has('gui_gtk3')
@@ -72,6 +72,65 @@ func Test_getfontname_without_arg()
endif
endfunc
func Test_set_guifont()
let l:guifont_saved = &guifont
if has('xfontset')
" Prevent 'guifontset' from canceling 'guifont'.
let l:guifontset_saved = &guifontset
set guifontset=
endif
let skipped = 0
if has('gui_athena') || has('gui_motif')
" Non-empty font list with invalid font names.
"
" This test is twofold: (1) It checks if the command fails as expected
" when there are no loadable fonts found in the list. (2) It checks if
" 'guifont' remains the same after the command loads none of the fonts
" listed.
let l:flist = &guifont
call assert_fails('set guifont=-notexist1-*,-notexist2-*')
call assert_equal(l:flist, &guifont)
" Non-empty font list with a valid font name. Should pick up the first
" valid font.
set guifont=-notexist1-*,fixed,-notexist2-*
call assert_equal('fixed', getfontname())
" Empty list. Should fallback to the built-in default.
set guifont=
call assert_equal('7x13', getfontname())
elseif has('gui_gtk2') || has('gui_gnome') || has('gui_gtk3')
" For GTK, what we refer to as 'font names' in our manual are actually
" 'initial font patterns'. A valid font which matches the 'canonical font
" pattern' constructed from a given 'initial pattern' is to be looked up
" and loaded. That explains why the GTK GUIs appear to accept 'invalid
" font names'.
"
" Non-empty list. Should always pick up the first element, no matter how
" strange it is, as explained above.
set guifont=(´・ω・`)\ 12,Courier\ 12
call assert_equal('(´・ω・`) 12', getfontname())
" Empty list. Should fallback to the built-in default.
set guifont=
call assert_equal('Monospace 10', getfontname())
else
let skipped = 1
endif
if has('xfontset')
let &guifontset = l:guifontset_saved
endif
let &guifont = l:guifont_saved
if skipped
throw "Skipped: Test not implemented yet for this GUI"
endif
endfunc
func Test_getwinpos()
call assert_match('Window position: X \d\+, Y \d\+', execute('winpos'))
call assert_true(getwinposx() >= 0)
+20
View File
@@ -511,4 +511,24 @@ func Test_completion_clear_candidate_list()
bw!
endfunc
func Test_completion_respect_bs_option()
new
let li = ["aaa", "aaa12345", "aaaabcdef", "aaaABC"]
set bs=indent,eol
call setline(1, li)
1
call feedkeys("A\<C-X>\<C-N>\<C-P>\<BS>\<BS>\<BS>\<Esc>", "tx")
call assert_equal('aaa', getline(1))
%d
set bs=indent,eol,start
call setline(1, li)
1
call feedkeys("A\<C-X>\<C-N>\<C-P>\<BS>\<BS>\<BS>\<Esc>", "tx")
call assert_equal('', getline(1))
bw!
endfunc
" vim: shiftwidth=2 sts=2 expandtab
+20
View File
@@ -779,6 +779,26 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
324,
/**/
323,
/**/
322,
/**/
321,
/**/
320,
/**/
319,
/**/
318,
/**/
317,
/**/
316,
/**/
315,
/**/
314,
/**/