Merge remote-tracking branch 'vim/master'

This commit is contained in:
Kazuki Sakamoto
2016-08-27 19:08:42 -07:00
30 changed files with 1540 additions and 1038 deletions
+6 -3
View File
@@ -1,4 +1,4 @@
*channel.txt* For Vim version 7.4. Last change: 2016 Aug 26
*channel.txt* For Vim version 7.4. Last change: 2016 Aug 27
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -395,6 +395,9 @@ This {string} can also be JSON, use |json_encode()| to create it and
It is not possible to use |ch_evalexpr()| or |ch_sendexpr()| on a raw channel.
A String in Vim cannot contain NUL bytes. To send or receive NUL bytes read
or write from a buffer. See |in_io-buffer| and |out_io-buffer|.
==============================================================================
7. More channel functions *channel-more*
@@ -480,7 +483,7 @@ For example, to start a job and write its output in buffer "dummy": >
Job input from a buffer ~
*in_io-buffer*
To run a job that reads from a buffer: >
let job = job_start({command},
\ {'in_io': 'buffer', 'in_name': 'mybuffer'})
@@ -654,7 +657,7 @@ See |job_setoptions()| and |ch_setoptions()|.
Writing to a buffer ~
*out_io-buffer*
When the out_io or err_io mode is "buffer" and there is a callback, the text
is appended to the buffer before invoking the callback.
+14 -9
View File
@@ -1,4 +1,4 @@
*cmdline.txt* For Vim version 7.4. Last change: 2015 Dec 17
*cmdline.txt* For Vim version 7.4. Last change: 2016 Aug 27
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -409,19 +409,11 @@ CTRL-D List names that match the pattern in front of the cursor.
*c_CTRL-N*
CTRL-N After using 'wildchar' which got multiple matches, go to next
match. Otherwise recall more recent command-line from history.
*/_CTRL-N*
When 'incsearch' is set, entering a search pattern for "/" or
"?" and the current match is displayed then CTRL-N will move
to the next match (does not take |search-offset| into account)
<S-Tab> *c_CTRL-P* *c_<S-Tab>*
CTRL-P After using 'wildchar' which got multiple matches, go to
previous match. Otherwise recall older command-line from
history. <S-Tab> only works with the GUI, on the Amiga and
with MS-DOS.
*/_CTRL-P*
When 'incsearch' is set, entering a search pattern for "/" or
"?" and the current match is displayed then CTRL-P will move
to the previous match (does not take |search-offset| into account).
*c_CTRL-A*
CTRL-A All names that match the pattern in front of the cursor are
inserted.
@@ -438,6 +430,19 @@ CTRL-L A match is done on the pattern in front of the cursor. If
'ignorecase' and 'smartcase' are set and the command line has
no uppercase characters, the added character is converted to
lowercase.
*c_CTRL-G* */_CTRL-G*
CTRL-G When 'incsearch' is set, entering a search pattern for "/" or
"?" and the current match is displayed then CTRL-G will move
to the next match (does not take |search-offset| into account)
Use CTRL-T to move to the previous match. Hint: on a regular
keyboard T is above G.
*c_CTRL-T* */_CTRL-T*
CTRL-T When 'incsearch' is set, entering a search pattern for "/" or
"?" and the current match is displayed then CTRL-T will move
to the previous match (does not take |search-offset| into
account).
Use CTRL-G to move to the next match. Hint: on a regular
keyboard T is above G.
The 'wildchar' option defaults to <Tab> (CTRL-E when in Vi compatible mode; in
a previous version <Esc> was used). In the pattern standard wildcards '*' and
+37 -11
View File
@@ -1,4 +1,4 @@
*eval.txt* For Vim version 7.4. Last change: 2016 Aug 21
*eval.txt* For Vim version 7.4. Last change: 2016 Aug 27
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -3272,6 +3272,7 @@ delete({fname} [, {flags}]) *delete()*
When {flags} is "rf": Deletes the directory by the name
{fname} and everything in it, recursively. BE CAREFUL!
A symbolic link itself is deleted, not what it points to.
The result is a Number, which is 0 if the delete operation was
@@ -4014,25 +4015,30 @@ getbufinfo([{dict}])
lnum current line number in buffer.
loaded TRUE if the buffer is loaded.
name full path to the file in the buffer.
options dictionary of buffer local options.
signs list of signs placed in the buffer.
Each list item is a dictionary with
the following fields:
id sign identifier
lnum line number
name sign name
variables dictionary of buffer local variables.
windows list of |window-ID|s with this buffer
variables a reference to the dictionary with
buffer-local variables.
windows list of |window-ID|s that display this
buffer
Examples: >
for buf in getbufinfo()
echo buf.name
endfor
for buf in getbufinfo({'buflisted':1})
if buf.options.filetype == 'java'
if buf.changed
....
endif
endfor
<
To get buffer-local options use: >
getbufvar({bufnr}, '&')
<
*getbufline()*
getbufline({expr}, {lnum} [, {end}])
@@ -4065,6 +4071,10 @@ getbufvar({expr}, {varname} [, {def}]) *getbufvar()*
must be used.
When {varname} is empty returns a dictionary with all the
buffer-local variables.
When {varname} is equal to "&" returns a dictionary with all
the buffer-local options.
Otherwise, when {varname} starts with "&" returns the value of
a buffer-local option.
This also works for a global or buffer-local option, but it
doesn't work for a global variable, window-local variable or
window-local option.
@@ -4532,7 +4542,8 @@ gettabinfo([{arg}]) *gettabinfo()*
Each List item is a Dictionary with the following entries:
tabnr tab page number.
variables dictionary of tabpage local variables.
variables a reference to the dictionary with
tabpage-local variables
windows List of |window-ID|s in the tag page.
gettabvar({tabnr}, {varname} [, {def}]) *gettabvar()*
@@ -4548,10 +4559,12 @@ gettabvar({tabnr}, {varname} [, {def}]) *gettabvar()*
gettabwinvar({tabnr}, {winnr}, {varname} [, {def}]) *gettabwinvar()*
Get the value of window-local variable {varname} in window
{winnr} in tab page {tabnr}.
When {varname} starts with "&" get the value of a window-local
option.
When {varname} is empty a dictionary with all window-local
variables is returned.
When {varname} is equal to "&" get the values of all
window-local options in a Dictionary.
Otherwise, when {varname} starts with "&" get the value of a
window-local option.
Note that {varname} must be the name without "w:".
Tabs are numbered starting with one. For the current tabpage
use |getwinvar()|.
@@ -4591,15 +4604,18 @@ getwininfo([{winid}]) *getwininfo()*
height window height
loclist 1 if showing a location list
{only with the +quickfix feature}
options dictionary of window local options
quickfix 1 if quickfix or location list window
{only with the +quickfix feature}
tabnr tab page number
variables dictionary of window local variables
variables a reference to the dictionary with
window-local variables
width window width
winid |window-ID|
winnr window number
To obtain all window-local variables use: >
gettabwinvar({tabnr}, {winnr}, '&')
getwinvar({winnr}, {varname} [, {def}]) *getwinvar()*
Like |gettabwinvar()| for the current tabpage.
Examples: >
@@ -5987,6 +6003,16 @@ printf({fmt}, {expr1} ...) *printf()*
cause truncation of a numeric field; if the result of
a conversion is wider than the field width, the field
is expanded to contain the conversion result.
The 'h' modifier indicates the argument is 16 bits.
The 'l' modifier indicates the argument is 32 bits.
The 'L' modifier indicates the argument is 64 bits.
Generally, these modifiers are not useful. They are
ignored when type is known from the argument.
i alias for d
D alias for ld
U alias for lu
O alias for lo
*printf-c*
c The Number argument is converted to a byte, and the
@@ -6006,7 +6032,7 @@ printf({fmt}, {expr1} ...) *printf()*
feature works just like 's'.
*printf-f* *E807*
f The Float argument is converted into a string of the
f F The Float argument is converted into a string of the
form 123.456. The precision specifies the number of
digits after the decimal point. When the precision is
zero the decimal point is omitted. When the precision
+3 -3
View File
@@ -1,4 +1,4 @@
*index.txt* For Vim version 7.4. Last change: 2016 Aug 24
*index.txt* For Vim version 7.4. Last change: 2016 Aug 27
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -984,7 +984,7 @@ tag command action in Command-line editing mode ~
|c_CTRL-E| CTRL-E cursor to end of command-line
|'cedit'| CTRL-F default value for 'cedit': opens the
command-line window; otherwise not used
CTRL-G not used
|c_CTRL-G| CTRL-G next match when 'incsearch' is active
|c_<BS>| <BS> delete the character in front of the cursor
|c_digraph| {char1} <BS> {char2}
enter digraph when 'digraph' is on
@@ -1017,7 +1017,7 @@ tag command action in Command-line editing mode ~
insert the contents of a register or object
under the cursor literally
CTRL-S (used for terminal control flow)
CTRL-T not used
|c_CTRL-T| CTRL-T previous match when 'incsearch' is active
|c_CTRL-U| CTRL-U remove all characters
|c_CTRL-V| CTRL-V insert next non-digit literally, insert three
digit decimal number as a single byte.
+8 -1
View File
@@ -1,4 +1,4 @@
*map.txt* For Vim version 7.4. Last change: 2016 Jul 30
*map.txt* For Vim version 7.4. Last change: 2016 Aug 26
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -431,6 +431,9 @@ with a space.
Note: When using mappings for Visual mode, you can use the "'<" mark, which
is the start of the last selected Visual area in the current buffer |'<|.
The |:filter| command can be used to select what mappings to list. The
pattern is matched against the {lhs} and {rhs} in the raw form.
*:map-verbose*
When 'verbose' is non-zero, listing a key map will also display where it was
last defined. Example: >
@@ -1177,6 +1180,10 @@ scripts.
" Command has the -register attribute
b Command is local to current buffer
(see below for details on attributes)
The list can be filtered on command name with
|:filter|, e.g., to list all commands with "Pyth" in
the name: >
filter Pyth command
:com[mand] {cmd} List the user-defined commands that start with {cmd}
+2 -2
View File
@@ -1,4 +1,4 @@
*starting.txt* For Vim version 7.4. Last change: 2016 Aug 23
*starting.txt* For Vim version 7.4. Last change: 2016 Aug 26
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -1633,7 +1633,7 @@ most of the information will be restored).
afterwards with `:rviminfo!`. Also see |v:oldfiles|.
The number can be used with |c_#<|.
The output can be filtered with |:filter|, e.g.: >
filter /\\.vim/ oldfiles
filter /\.vim/ oldfiles
< The filtering happens on the file name.
{not in Vi, only when compiled with the |+eval|
feature}
+6 -2
View File
@@ -1616,9 +1616,9 @@ $VIM_POSIX vi_diff.txt /*$VIM_POSIX*
/\{- pattern.txt /*\/\\{-*
/\~ pattern.txt /*\/\\~*
/^ pattern.txt /*\/^*
/_CTRL-G cmdline.txt /*\/_CTRL-G*
/_CTRL-L cmdline.txt /*\/_CTRL-L*
/_CTRL-N cmdline.txt /*\/_CTRL-N*
/_CTRL-P cmdline.txt /*\/_CTRL-P*
/_CTRL-T cmdline.txt /*\/_CTRL-T*
/atom pattern.txt /*\/atom*
/bar pattern.txt /*\/bar*
/branch pattern.txt /*\/branch*
@@ -5228,6 +5228,7 @@ c_CTRL-C cmdline.txt /*c_CTRL-C*
c_CTRL-D cmdline.txt /*c_CTRL-D*
c_CTRL-E cmdline.txt /*c_CTRL-E*
c_CTRL-F cmdline.txt /*c_CTRL-F*
c_CTRL-G cmdline.txt /*c_CTRL-G*
c_CTRL-H cmdline.txt /*c_CTRL-H*
c_CTRL-I cmdline.txt /*c_CTRL-I*
c_CTRL-J cmdline.txt /*c_CTRL-J*
@@ -5244,6 +5245,7 @@ c_CTRL-R_CTRL-O cmdline.txt /*c_CTRL-R_CTRL-O*
c_CTRL-R_CTRL-P cmdline.txt /*c_CTRL-R_CTRL-P*
c_CTRL-R_CTRL-R cmdline.txt /*c_CTRL-R_CTRL-R*
c_CTRL-R_CTRL-W cmdline.txt /*c_CTRL-R_CTRL-W*
c_CTRL-T cmdline.txt /*c_CTRL-T*
c_CTRL-U cmdline.txt /*c_CTRL-U*
c_CTRL-V cmdline.txt /*c_CTRL-V*
c_CTRL-W cmdline.txt /*c_CTRL-W*
@@ -6922,6 +6924,7 @@ improvements-7 version7.txt /*improvements-7*
improvements-8 version8.txt /*improvements-8*
in_bot channel.txt /*in_bot*
in_buf channel.txt /*in_buf*
in_io-buffer channel.txt /*in_io-buffer*
in_mode channel.txt /*in_mode*
in_name channel.txt /*in_name*
in_top channel.txt /*in_top*
@@ -7787,6 +7790,7 @@ os_win32.txt os_win32.txt /*os_win32.txt*
other-features vi_diff.txt /*other-features*
out_buf channel.txt /*out_buf*
out_cb channel.txt /*out_cb*
out_io-buffer channel.txt /*out_io-buffer*
out_mode channel.txt /*out_mode*
out_name channel.txt /*out_name*
out_timeout channel.txt /*out_timeout*
+8 -15
View File
@@ -1,4 +1,4 @@
*todo.txt* For Vim version 7.4. Last change: 2016 Aug 26
*todo.txt* For Vim version 7.4. Last change: 2016 Aug 27
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -35,15 +35,9 @@ not be repeated below, unless there is extra information.
-------------------- Known bugs and current work -----------------------
Make ":filter" work with more commands.
C highlighting: modern C allows /* comment */ #ifdef
Ramel Eshed: system() is much slower than job_start(), why? (Aug 26)
Error in viminfo. (John Chen, 2016 Aug 26, #1010)
Search for: msg_putchar('\n')
+channel:
- Check that raw mode does NL-NUL conversion.
- Implement |job-term| ?
- Channel test fails with Motif. Sometimes kills the X11 server.
- When a message in the queue but there is no callback, drop it after a while?
@@ -111,9 +105,6 @@ Regexp problems:
- Search for /\%d0\+ causes error E363 in a file with consecutive NUL
characters. (Christian Brabandt, 2016 Jun 7)
getbufinfo() may return a lot of data. Select what to return?
remove variables, does that help?
json_encode(): should convert to utf-8. (Nikolai Pavlov, 2016 Jan 23)
What if there is an invalid character?
@@ -126,10 +117,6 @@ Once .exe with updated installer is available: Add remark to download page
about /S and /D options (Ken Takata, 2016 Apr 13)
Or point to nightly builds: https://github.com/vim/vim-win32-installer/releases
Problem with completion on "**/" in $path. (issue #932)
Happens in uniquefy_paths() ? More info Jul 22.
Fix for this (Harm te Hennepe, 2016 Jul 21, #939)
Cursor positioned in the wrong place when editing src/testdir/test_viml.vim.
Javascript indent wrong after /* in single quoted string:
@@ -194,6 +181,8 @@ Patch for restoring wide characters in the console buffer.
We can use '. to go to the last change in the current buffer, but how about
the last change in any buffer? Can we use ', (, is next to .)?
Ramel Eshed: system() is much slower than job_start(), why? (Aug 26)
Patch for Python: #622. (Roland Puntaier, 2016 Feb 2)
What does it change?
@@ -405,6 +394,10 @@ inconsistent with the documentation.
Can we cache the syntax attributes, so that updates for 'relativenumber' and
'cursorline'/'cursorcolumn' are a lot faster?
C highlighting: modern C allows: /* comment */ #ifdef
and also line continuation after #include.
I can't recommend it though.
Build with Python on Mac does not always use the right library.
(Kazunobu Kuriyama, 2015 Mar 28)
+6 -2
View File
@@ -1,4 +1,4 @@
*various.txt* For Vim version 7.4. Last change: 2016 Aug 23
*various.txt* For Vim version 7.4. Last change: 2016 Aug 26
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -91,6 +91,8 @@ g8 Print the hex values of the bytes used in the
on paper see |:hardcopy|. In the GUI you can use the
File.Print menu entry.
See |ex-flags| for [flags].
The |:filter| command can be used to only show lines
matching a pattern.
:[range]p[rint] {count} [flags]
Print {count} lines, starting with [range] (default
@@ -531,7 +533,9 @@ N *+X11* Unix only: can restore window title |X11|
:filt[er] {pat} {command}
:filt[er] /{pat}/ {command}
Restrict the output of {command} to matches with {pat}.
For example, to list only xml files: >
:filter /\.xml$/ oldfiles
<
{pat} is a Vim search pattern. Instead of enclosing
it in / any non-ID character (see |'isident'|) can be
used, so long as it does not appear in {pat}. Without
+3 -3
View File
@@ -2,8 +2,8 @@
" Language: shell (sh) Korn shell (ksh) bash (sh)
" Maintainer: Charles E. Campbell <NdrOchipS@PcampbellAfamily.Mbiz>
" Previous Maintainer: Lennart Schultz <Lennart.Schultz@ecmwf.int>
" Last Change: Aug 23, 2016
" Version: 161
" Last Change: Aug 26, 2016
" Version: 162
" URL: http://www.drchip.org/astronaut/vim/index.html#SYNTAX_SH
" For options and settings, please use: :help ft-sh-syntax
" This file includes many ideas from Eric Brunet (eric.brunet@ens.fr)
@@ -500,7 +500,7 @@ syn match shDerefString contained "\\["']" nextgroup=shDerefPattern
if exists("b:is_bash")
" bash : ${parameter:offset}
" bash : ${parameter:offset:length}
syn region shDerefOff contained start=':' end='\ze:' end='\ze}' contains=shDeref,shDerefSimple,shDerefEscape nextgroup=shDerefLen,shDeref,shDerefSimple
syn region shDerefOff contained start=':\ze[^-=?+]' end='\ze:' end='\ze}' contains=shDeref,shDerefSimple,shDerefEscape nextgroup=shDerefLen,shDeref,shDerefSimple
syn region shDerefOff contained start=':\s-' end='\ze:' end='\ze}' contains=shDeref,shDerefSimple,shDerefEscape nextgroup=shDerefLen,shDeref,shDerefSimple
syn match shDerefLen contained ":[^}]\+" contains=shDeref,shDerefSimple
+6 -2
View File
@@ -1236,10 +1236,14 @@ ex_diffoff(exarg_T *eap)
: wp->w_p_fen_save;
foldUpdateAll(wp);
/* make sure topline is not halfway a fold */
changed_window_setting_win(wp);
#endif
}
/* remove filler lines */
wp->w_topfill = 0;
/* make sure topline is not halfway a fold and cursor is
* invalidated */
changed_window_setting_win(wp);
/* Note: 'sbo' is not restored, it's a global option. */
diff_buf_adjust(wp);
+16 -2
View File
@@ -8470,9 +8470,23 @@ getwinvar(
|| switch_win(&oldcurwin, &oldtabpage, win, tp, TRUE) == OK)
#endif
{
if (*varname == '&') /* window-local-option */
if (*varname == '&')
{
if (get_option_tv(&varname, rettv, 1) == OK)
if (varname[1] == NUL)
{
/* get all window-local options in a dict */
dict_T *opts = get_winbuf_options(FALSE);
if (opts != NULL)
{
rettv->v_type = VAR_DICT;
rettv->vval.v_dict = opts;
++opts->dv_refcount;
done = TRUE;
}
}
else if (get_option_tv(&varname, rettv, 1) == OK)
/* window-local-option */
done = TRUE;
}
else
+22 -29
View File
@@ -3921,8 +3921,6 @@ get_buffer_signs(buf_T *buf, list_T *l)
get_buffer_info(buf_T *buf)
{
dict_T *dict;
dict_T *opts;
dict_T *vars;
tabpage_T *tp;
win_T *wp;
list_T *windows;
@@ -3943,15 +3941,8 @@ get_buffer_info(buf_T *buf)
buf->b_ml.ml_mfp != NULL && buf->b_nwindows == 0,
NULL);
/* Copy buffer variables */
vars = dict_copy(buf->b_vars, TRUE, 0);
if (vars != NULL)
dict_add_dict(dict, "variables", vars);
/* Copy buffer options */
opts = get_winbuf_options(TRUE);
if (opts != NULL)
dict_add_dict(dict, "options", opts);
/* Get a reference to buffer variables */
dict_add_dict(dict, "variables", buf->b_vars);
/* List of windows displaying this buffer */
windows = list_alloc();
@@ -4159,9 +4150,23 @@ f_getbufvar(typval_T *argvars, typval_T *rettv)
save_curbuf = curbuf;
curbuf = buf;
if (*varname == '&') /* buffer-local-option */
if (*varname == '&')
{
if (get_option_tv(&varname, rettv, TRUE) == OK)
if (varname[1] == NUL)
{
/* get all buffer-local options in a dict */
dict_T *opts = get_winbuf_options(TRUE);
if (opts != NULL)
{
rettv->v_type = VAR_DICT;
rettv->vval.v_dict = opts;
++opts->dv_refcount;
done = TRUE;
}
}
else if (get_option_tv(&varname, rettv, TRUE) == OK)
/* buffer-local-option */
done = TRUE;
}
else if (STRCMP(varname, "changedtick") == 0)
@@ -5001,7 +5006,6 @@ get_tabpage_info(tabpage_T *tp, int tp_idx)
{
win_T *wp;
dict_T *dict;
dict_T *vars;
list_T *l;
dict = dict_alloc();
@@ -5019,10 +5023,8 @@ get_tabpage_info(tabpage_T *tp, int tp_idx)
dict_add_list(dict, "windows", l);
}
/* Copy tabpage variables */
vars = dict_copy(tp->tp_vars, TRUE, 0);
if (vars != NULL)
dict_add_dict(dict, "variables", vars);
/* Make a reference to tabpage variables */
dict_add_dict(dict, "variables", tp->tp_vars);
return dict;
}
@@ -5125,8 +5127,6 @@ f_gettabwinvar(typval_T *argvars, typval_T *rettv)
get_win_info(win_T *wp, short tpnr, short winnr)
{
dict_T *dict;
dict_T *vars;
dict_T *opts;
dict = dict_alloc();
if (dict == NULL)
@@ -5145,15 +5145,8 @@ get_win_info(win_T *wp, short tpnr, short winnr)
(bt_quickfix(wp->w_buffer) && wp->w_llist_ref != NULL), NULL);
#endif
/* Copy window variables */
vars = dict_copy(wp->w_vars, TRUE, 0);
if (vars != NULL)
dict_add_dict(dict, "variables", vars);
/* Copy window options */
opts = get_winbuf_options(FALSE);
if (opts != NULL)
dict_add_dict(dict, "options", opts);
/* Add a reference to window variables */
dict_add_dict(dict, "variables", wp->w_vars);
return dict;
}
+73 -70
View File
@@ -1511,82 +1511,14 @@ getcmdline(
case Ctrl_N: /* next match */
case Ctrl_P: /* previous match */
#ifdef FEAT_SEARCH_EXTRA
if (p_is && !cmd_silent && (firstc == '/' || firstc == '?'))
{
pos_T t;
int search_flags = SEARCH_KEEP + SEARCH_NOOF
+ SEARCH_PEEK;
if (char_avail())
continue;
cursor_off();
out_flush();
if (c == Ctrl_N)
{
t = match_end;
search_flags += SEARCH_COL;
}
else
t = match_start;
++emsg_off;
i = searchit(curwin, curbuf, &t,
c == Ctrl_N ? FORWARD : BACKWARD,
ccline.cmdbuff, count, search_flags,
RE_SEARCH, 0, NULL);
--emsg_off;
if (i)
{
old_cursor = match_start;
match_end = t;
match_start = t;
if (c == Ctrl_P && firstc == '/')
{
/* move just before the current match, so that
* when nv_search finishes the cursor will be
* put back on the match */
old_cursor = t;
(void)decl(&old_cursor);
}
if (lt(t, old_cursor) && c == Ctrl_N)
{
/* wrap around */
old_cursor = t;
if (firstc == '?')
(void)incl(&old_cursor);
else
(void)decl(&old_cursor);
}
set_search_match(&match_end);
curwin->w_cursor = match_start;
changed_cline_bef_curs();
update_topline();
validate_cursor();
highlight_match = TRUE;
old_curswant = curwin->w_curswant;
old_leftcol = curwin->w_leftcol;
old_topline = curwin->w_topline;
# ifdef FEAT_DIFF
old_topfill = curwin->w_topfill;
# endif
old_botline = curwin->w_botline;
update_screen(NOT_VALID);
redrawcmdline();
}
else
vim_beep(BO_ERROR);
goto cmdline_not_changed;
}
else
#endif
if (xpc.xp_numfiles > 0)
{
if (nextwild(&xpc, (c == Ctrl_P) ? WILD_PREV : WILD_NEXT,
0, firstc != '@') == FAIL)
break;
goto cmdline_changed;
goto cmdline_not_changed;
}
/* FALLTHROUGH */
#ifdef FEAT_CMDHIST
case K_UP:
@@ -1730,6 +1662,77 @@ getcmdline(
goto cmdline_changed;
}
beep_flush();
#endif
goto cmdline_not_changed;
case Ctrl_G: /* next match */
case Ctrl_T: /* previous match */
#ifdef FEAT_SEARCH_EXTRA
if (p_is && !cmd_silent && (firstc == '/' || firstc == '?'))
{
pos_T t;
int search_flags = SEARCH_KEEP + SEARCH_NOOF
+ SEARCH_PEEK;
if (char_avail())
continue;
cursor_off();
out_flush();
if (c == Ctrl_G)
{
t = match_end;
search_flags += SEARCH_COL;
}
else
t = match_start;
++emsg_off;
i = searchit(curwin, curbuf, &t,
c == Ctrl_G ? FORWARD : BACKWARD,
ccline.cmdbuff, count, search_flags,
RE_SEARCH, 0, NULL);
--emsg_off;
if (i)
{
old_cursor = match_start;
match_end = t;
match_start = t;
if (c == Ctrl_T && firstc == '/')
{
/* move just before the current match, so that
* when nv_search finishes the cursor will be
* put back on the match */
old_cursor = t;
(void)decl(&old_cursor);
}
if (lt(t, old_cursor) && c == Ctrl_G)
{
/* wrap around */
old_cursor = t;
if (firstc == '?')
(void)incl(&old_cursor);
else
(void)decl(&old_cursor);
}
set_search_match(&match_end);
curwin->w_cursor = match_start;
changed_cline_bef_curs();
update_topline();
validate_cursor();
highlight_match = TRUE;
old_curswant = curwin->w_curswant;
old_leftcol = curwin->w_leftcol;
old_topline = curwin->w_topline;
# ifdef FEAT_DIFF
old_topfill = curwin->w_topfill;
# endif
old_botline = curwin->w_botline;
update_screen(NOT_VALID);
redrawcmdline();
}
else
vim_beep(BO_ERROR);
}
goto cmdline_not_changed;
#endif
+28 -2
View File
@@ -12,6 +12,7 @@
*/
#define MESSAGE_FILE /* don't include prototype for smsg() */
#define USING_FLOAT_STUFF
#include "vim.h"
@@ -4705,6 +4706,7 @@ vim_vsnprintf(
char format[40];
int l;
int remove_trailing_zeroes = FALSE;
char *s;
f =
# if defined(FEAT_EVAL)
@@ -4734,8 +4736,16 @@ vim_vsnprintf(
)
{
/* Avoid a buffer overflow */
strcpy(tmp, "inf");
str_arg_l = 3;
if (f < 0)
{
strcpy(tmp, "-inf");
str_arg_l = 4;
}
else
{
strcpy(tmp, "inf");
str_arg_l = 3;
}
}
else
{
@@ -4757,6 +4767,22 @@ vim_vsnprintf(
format[l + 1] = NUL;
str_arg_l = sprintf(tmp, format, f);
/* Be consistent: Change "1.#IND" to "nan" and
* "1.#INF" to "inf". */
s = *tmp == '-' ? tmp + 1 : tmp;
if (STRNCMP(s, "1.#INF", 6) == 0)
STRCPY(s, "inf");
else if (STRNCMP(s, "1.#IND", 6) == 0)
STRCPY(s, "nan");
/* Remove sign before "nan". */
if (STRNCMP(tmp, "-nan", 4) == 0)
STRCPY(tmp, "nan");
/* Add sign before "inf" if needed. */
if (isinf(f) == -1 && STRNCMP(tmp, "inf", 3) == 0)
STRCPY(tmp, "-inf");
if (remove_trailing_zeroes)
{
int i;
+27 -11
View File
@@ -10520,18 +10520,34 @@ uniquefy_paths(garray_T *gap, char_u *pattern)
/* Shorten the filename while maintaining its uniqueness */
path_cutoff = get_path_cutoff(path, &path_ga);
/* we start at the end of the path */
pathsep_p = path + len - 1;
/* Don't assume all files can be reached without path when search
* pattern starts with star star slash, so only remove path_cutoff
* when possible. */
if (pattern[0] == '*' && pattern[1] == '*'
&& vim_ispathsep_nocolon(pattern[2])
&& path_cutoff != NULL
&& vim_regexec(&regmatch, path_cutoff, (colnr_T)0)
&& is_unique(path_cutoff, gap, i))
{
sort_again = TRUE;
mch_memmove(path, path_cutoff, STRLEN(path_cutoff) + 1);
}
else
{
/* Here all files can be reached without path, so get shortest
* unique path. We start at the end of the path. */
pathsep_p = path + len - 1;
while (find_previous_pathsep(path, &pathsep_p))
if (vim_regexec(&regmatch, pathsep_p + 1, (colnr_T)0)
&& is_unique(pathsep_p + 1, gap, i)
&& path_cutoff != NULL && pathsep_p + 1 >= path_cutoff)
{
sort_again = TRUE;
mch_memmove(path, pathsep_p + 1, STRLEN(pathsep_p));
break;
}
while (find_previous_pathsep(path, &pathsep_p))
if (vim_regexec(&regmatch, pathsep_p + 1, (colnr_T)0)
&& is_unique(pathsep_p + 1, gap, i)
&& path_cutoff != NULL && pathsep_p + 1 >= path_cutoff)
{
sort_again = TRUE;
mch_memmove(path, pathsep_p + 1, STRLEN(pathsep_p));
break;
}
}
if (mch_isFullName(path))
{
+471 -390
View File
File diff suppressed because it is too large Load Diff
+509 -430
View File
File diff suppressed because it is too large Load Diff
+13 -2
View File
@@ -4753,11 +4753,15 @@ qf_add_entries(
}
static int
qf_set_properties(qf_info_T *qi, dict_T *what)
qf_set_properties(qf_info_T *qi, dict_T *what, int action)
{
dictitem_T *di;
int retval = FAIL;
int qf_idx;
int newlist = FALSE;
if (action == ' ' || qi->qf_curlist == qi->qf_listcount)
newlist = TRUE;
qf_idx = qi->qf_curlist; /* default is the current list */
if ((di = dict_find(what, (char_u *)"nr", -1)) != NULL)
@@ -4771,6 +4775,13 @@ qf_set_properties(qf_info_T *qi, dict_T *what)
}
else
return FAIL;
newlist = FALSE; /* use the specified list */
}
if (newlist)
{
qf_new_list(qi, NULL);
qf_idx = qi->qf_curlist;
}
if ((di = dict_find(what, (char_u *)"title", -1)) != NULL)
@@ -4813,7 +4824,7 @@ set_errorlist(
}
if (what != NULL)
retval = qf_set_properties(qi, what);
retval = qf_set_properties(qi, what, action);
else
retval = qf_add_entries(qi, list, title, action);
+6 -3
View File
@@ -3546,7 +3546,8 @@ win_line(
v = (long)(ptr - line);
if (cur != NULL)
cur->pos.cur = 0;
next_search_hl(wp, shl, lnum, (colnr_T)v, cur);
next_search_hl(wp, shl, lnum, (colnr_T)v,
shl == &search_hl ? NULL : cur);
/* Need to get the line again, a multi-line regexp may have made it
* invalid. */
@@ -3980,7 +3981,8 @@ win_line(
#ifdef FEAT_CONCEAL
prev_syntax_id = 0;
#endif
next_search_hl(wp, shl, lnum, (colnr_T)v, cur);
next_search_hl(wp, shl, lnum, (colnr_T)v,
shl == &search_hl ? NULL : cur);
pos_inprogress = cur == NULL || cur->pos.cur == 0
? FALSE : TRUE;
@@ -7620,7 +7622,8 @@ prepare_search_hl(win_T *wp, linenr_T lnum)
while (shl->first_lnum < lnum && (shl->rm.regprog != NULL
|| (cur != NULL && pos_inprogress)))
{
next_search_hl(wp, shl, shl->first_lnum, (colnr_T)n, cur);
next_search_hl(wp, shl, shl->first_lnum, (colnr_T)n,
shl == &search_hl ? NULL : cur);
pos_inprogress = cur == NULL || cur->pos.cur == 0
? FALSE : TRUE;
if (shl->lnum != 0)
+22 -4
View File
@@ -18,7 +18,6 @@ function Test_getbufwintabinfo()
let b:editor = 'vim'
let l = getbufinfo('%')
call assert_equal(bufnr('%'), l[0].bufnr)
call assert_equal(8, l[0].options.tabstop)
call assert_equal('vim', l[0].variables.editor)
call assert_notequal(-1, index(l[0].windows, bufwinid('%')))
@@ -49,9 +48,6 @@ function Test_getbufwintabinfo()
call assert_equal(winbufnr(2), winlist[1].bufnr)
call assert_equal(winheight(2), winlist[1].height)
call assert_equal(1, winlist[2].winnr)
if has('signs')
call assert_equal('auto', winlist[0].options.signcolumn)
endif
call assert_equal(2, winlist[3].tabnr)
call assert_equal('green', winlist[2].variables.signal)
call assert_equal(winwidth(1), winlist[0].width)
@@ -83,3 +79,25 @@ function Test_getbufwintabinfo()
call assert_false(winlist[2].loclist)
wincmd t | only
endfunction
function Test_get_buf_options()
let opts = getbufvar(bufnr('%'), '&')
call assert_equal(v:t_dict, type(opts))
call assert_equal(8, opts.tabstop)
endfunc
function Test_get_win_options()
let opts = getwinvar(1, '&')
call assert_equal(v:t_dict, type(opts))
call assert_equal(0, opts.linebreak)
if has('signs')
call assert_equal('auto', opts.signcolumn)
endif
let opts = gettabwinvar(1, 1, '&')
call assert_equal(v:t_dict, type(opts))
call assert_equal(0, opts.linebreak)
if has('signs')
call assert_equal('auto', opts.signcolumn)
endif
endfunc
+37 -1
View File
@@ -1321,7 +1321,7 @@ func Test_using_freed_memory()
endfunc
func Test_collapse_buffers()
if !executable('cat')
if !executable('cat') || !has('job')
return
endif
sp test_channel.vim
@@ -1335,6 +1335,42 @@ func Test_collapse_buffers()
bwipe!
endfunc
func Test_raw_passes_nul()
if !executable('cat') || !has('job')
return
endif
" Test lines from the job containing NUL are stored correctly in a buffer.
new
call setline(1, ["asdf\nasdf", "xxx\n", "\nyyy"])
w! Xtestread
bwipe!
split testout
1,$delete
call job_start('cat Xtestread', {'out_io': 'buffer', 'out_name': 'testout'})
call WaitFor('line("$") > 2')
call assert_equal("asdf\nasdf", getline(2))
call assert_equal("xxx\n", getline(3))
call assert_equal("\nyyy", getline(4))
call delete('Xtestread')
bwipe!
" Test lines from a buffer with NUL bytes are written correctly to the job.
new mybuffer
call setline(1, ["asdf\nasdf", "xxx\n", "\nyyy"])
let g:Ch_job = job_start('cat', {'in_io': 'buffer', 'in_name': 'mybuffer', 'out_io': 'file', 'out_name': 'Xtestwrite'})
call WaitFor('"dead" == job_status(g:Ch_job)')
bwipe!
split Xtestwrite
call assert_equal("asdf\nasdf", getline(1))
call assert_equal("xxx\n", getline(2))
call assert_equal("\nyyy", getline(3))
call delete('Xtestwrite')
bwipe!
endfunc
function Ch_test_close_lambda(port)
let handle = ch_open('localhost:' . a:port, s:chopt)
if ch_status(handle) == "fail"
+8
View File
@@ -180,3 +180,11 @@ func Test_getcompletion()
call assert_fails('call getcompletion("", "burp")', 'E475:')
endfunc
func Test_expand_star_star()
call mkdir('a/b', 'p')
call writefile(['asdfasdf'], 'a/b/fileXname')
call feedkeys(":find **/fileXname\<Tab>\<CR>", 'xt')
call assert_equal('find a/b/fileXname', getreg(':'))
call delete('a', 'rf')
endfunc
+16
View File
@@ -202,3 +202,19 @@ func Test_diffget_diffput()
bwipe!
enew!
endfunc
func Test_diffoff()
enew!
call setline(1, ['Two', 'Three'])
let normattr = screenattr(1, 1)
diffthis
botright vert new
call setline(1, ['One', '', 'Two', 'Three'])
diffthis
redraw
diffoff!
redraw
call assert_equal(normattr, screenattr(1, 1))
bwipe!
bwipe!
endfunc
+91
View File
@@ -130,6 +130,97 @@ func Test_option_value()
set cpo&vim
endfunc
function Test_printf_misc()
call assert_equal('123', printf('%d', 123))
call assert_equal('123', printf('%i', 123))
call assert_equal('123', printf('%D', 123))
call assert_equal('123', printf('%U', 123))
call assert_equal('173', printf('%o', 123))
call assert_equal('173', printf('%O', 123))
call assert_equal('7b', printf('%x', 123))
call assert_equal('7B', printf('%X', 123))
if has('ebcdic')
call assert_equal('#', printf('%c', 123))
else
call assert_equal('{', printf('%c', 123))
endif
call assert_equal('abc', printf('%s', 'abc'))
call assert_equal('abc', printf('%S', 'abc'))
call assert_equal('+123', printf('%+d', 123))
call assert_equal('-123', printf('%+d', -123))
call assert_equal('+123', printf('%+ d', 123))
call assert_equal(' 123', printf('% d', 123))
call assert_equal(' 123', printf('% d', 123))
call assert_equal('-123', printf('% d', -123))
call assert_equal('00123', printf('%.*d', 5, 123))
call assert_equal(' 123', printf('% *d', 5, 123))
call assert_equal(' +123', printf('%+ *d', 5, 123))
call assert_equal('123', printf('%2d', 123))
call assert_equal(' 123', printf('%5d', 123))
call assert_equal('00123', printf('%05d', 123))
call assert_equal('123 ', printf('%-5d', 123))
call assert_equal('0x7b', printf('%#x', 123))
call assert_equal('0X7B', printf('%#X', 123))
call assert_equal('0173', printf('%#o', 123))
call assert_equal('0173', printf('%#O', 123))
call assert_equal('abc', printf('%#s', 'abc'))
call assert_equal('abc', printf('%#S', 'abc'))
call assert_equal(' 00123', printf('%6.5d', 123))
call assert_equal(' 0007b', printf('%6.5x', 123))
call assert_equal('abc', printf('%2s', 'abc'))
call assert_equal('abc', printf('%2S', 'abc'))
call assert_equal('abc', printf('%.4s', 'abc'))
call assert_equal('abc', printf('%.4S', 'abc'))
call assert_equal('ab', printf('%.2s', 'abc'))
call assert_equal('ab', printf('%.2S', 'abc'))
call assert_equal('', printf('%.0s', 'abc'))
call assert_equal('', printf('%.s', 'abc'))
call assert_equal(' abc', printf('%4s', 'abc'))
call assert_equal(' abc', printf('%4S', 'abc'))
call assert_equal('0abc', printf('%04s', 'abc'))
call assert_equal('0abc', printf('%04S', 'abc'))
call assert_equal('abc ', printf('%-4s', 'abc'))
call assert_equal('abc ', printf('%-4S', 'abc'))
call assert_equal('1%', printf('%d%%', 1))
endfunc
function Test_printf_float()
if has('float')
call assert_equal('1.230000', printf('%f', 1.23))
call assert_equal('1.230000', printf('%F', 1.23))
call assert_equal('1.23', printf('%g', 1.23))
call assert_equal('1.23', printf('%G', 1.23))
call assert_equal('1.230000e+00', printf('%e', 1.23))
call assert_equal('1.230000E+00', printf('%E', 1.23))
call assert_equal('1.200000e-02', printf('%e', 0.012))
call assert_equal('-1.200000e-02', printf('%e', -0.012))
call assert_equal('1.2', printf('%.1f', 1.23))
call assert_equal('inf', printf('%f', 1.0/0.0))
call assert_match('^-inf$', printf('%f', -1.0/0.0))
call assert_match('^nan$', printf('%f', sqrt(-1.0)))
call assert_match('^nan$', printf('%f', 0.0/0.0))
call assert_fails('echo printf("%f", "a")', 'E807:')
endif
endfunc
function Test_printf_errors()
call assert_fails('echo printf("%d", {})', 'E728:')
call assert_fails('echo printf("%d", [])', 'E745:')
call assert_fails('echo printf("%d", 1, 2)', 'E767:')
call assert_fails('echo printf("%*d", 1)', 'E766:')
call assert_fails('echo printf("%d", 1.2)', 'E805:')
endfunc
function Test_printf_64bit()
if has('num64')
call assert_equal("123456789012345", printf('%d', 123456789012345))
+27
View File
@@ -186,4 +186,31 @@ func Test_matchaddpos()
set hlsearch&
endfunc
func Test_matchaddpos_using_negative_priority()
set hlsearch
call clearmatches()
call setline(1, 'x')
let @/='x'
redraw!
let search_attr = screenattr(1,1)
let @/=''
call matchaddpos('Error', [1], 10)
redraw!
let error_attr = screenattr(1,1)
call setline(2, '-1 match priority')
call matchaddpos('Error', [2], -1)
redraw!
let negative_match_priority_attr = screenattr(2,1)
call assert_notequal(negative_match_priority_attr, search_attr, "Match with negative priority is incorrectly highlighted with Search highlight.")
call assert_equal(negative_match_priority_attr, error_attr)
nohl
set hlsearch&
endfunc
" vim: shiftwidth=2 sts=2 expandtab
+1 -1
View File
@@ -59,7 +59,7 @@ func Nb_file_auth(port)
call assert_fails('nbstart =Xnbauth', 'E668:')
endif
call setfperm('Xnbauth', "rw-------")
exe 'nbstart :localhost:' . a:port . ':bunny'
exe 'nbstart =Xnbauth'
call assert_true(has("netbeans_enabled"))
call WaitFor('len(readfile("Xnetbeans")) > 2')
+10
View File
@@ -1527,6 +1527,16 @@ function Xproperty_tests(cchar)
call assert_equal('Sample', w:quickfix_title)
Xclose
" Tests for action argument
silent! Xolder 999
let qfnr = g:Xgetlist({'all':1}).nr
call g:Xsetlist([], 'r', {'title' : 'N1'})
call assert_equal('N1', g:Xgetlist({'all':1}).title)
call g:Xsetlist([], ' ', {'title' : 'N2'})
call assert_equal(qfnr + 1, g:Xgetlist({'all':1}).nr)
call g:Xsetlist([], ' ', {'title' : 'N3'})
call assert_equal('N2', g:Xgetlist({'nr':2, 'title':1}).title)
" Invalid arguments
call assert_fails('call g:Xgetlist([])', 'E715')
call assert_fails('call g:Xsetlist([], "a", [])', 'E715')
+40 -40
View File
@@ -16,11 +16,11 @@ func Test_search_cmdline()
call feedkeys("/foobar\<cr>", 'tx')
call feedkeys("/the\<cr>",'tx')
call assert_equal('the', @/)
call feedkeys("/thes\<c-p>\<c-p>\<cr>",'tx')
call feedkeys("/thes\<C-P>\<C-P>\<cr>",'tx')
call assert_equal('foobar', @/)
" Test 2
" Ctrl-N goes from one match to the next
" Ctrl-G goes from one match to the next
" until the end of the buffer
set incsearch nowrapscan
:1
@@ -29,39 +29,39 @@ func Test_search_cmdline()
call assert_equal(' 2 these', getline('.'))
:1
" second match
call feedkeys("/the\<c-n>\<cr>", 'tx')
call feedkeys("/the\<C-G>\<cr>", 'tx')
call assert_equal(' 3 the', getline('.'))
:1
" third match
call feedkeys("/the".repeat("\<c-n>", 2)."\<cr>", 'tx')
call feedkeys("/the".repeat("\<C-G>", 2)."\<cr>", 'tx')
call assert_equal(' 4 their', getline('.'))
:1
" fourth match
call feedkeys("/the".repeat("\<c-n>", 3)."\<cr>", 'tx')
call feedkeys("/the".repeat("\<C-G>", 3)."\<cr>", 'tx')
call assert_equal(' 5 there', getline('.'))
:1
" fifth match
call feedkeys("/the".repeat("\<c-n>", 4)."\<cr>", 'tx')
call feedkeys("/the".repeat("\<C-G>", 4)."\<cr>", 'tx')
call assert_equal(' 6 their', getline('.'))
:1
" sixth match
call feedkeys("/the".repeat("\<c-n>", 5)."\<cr>", 'tx')
call feedkeys("/the".repeat("\<C-G>", 5)."\<cr>", 'tx')
call assert_equal(' 7 the', getline('.'))
:1
" seventh match
call feedkeys("/the".repeat("\<c-n>", 6)."\<cr>", 'tx')
call feedkeys("/the".repeat("\<C-G>", 6)."\<cr>", 'tx')
call assert_equal(' 8 them', getline('.'))
:1
" eigth match
call feedkeys("/the".repeat("\<c-n>", 7)."\<cr>", 'tx')
call feedkeys("/the".repeat("\<C-G>", 7)."\<cr>", 'tx')
call assert_equal(' 9 these', getline('.'))
:1
" no further match
call feedkeys("/the".repeat("\<c-n>", 8)."\<cr>", 'tx')
call feedkeys("/the".repeat("\<C-G>", 8)."\<cr>", 'tx')
call assert_equal(' 9 these', getline('.'))
" Test 3
" Ctrl-N goes from one match to the next
" Ctrl-G goes from one match to the next
" and continues back at the top
set incsearch wrapscan
:1
@@ -70,39 +70,39 @@ func Test_search_cmdline()
call assert_equal(' 2 these', getline('.'))
:1
" second match
call feedkeys("/the\<c-n>\<cr>", 'tx')
call feedkeys("/the\<C-G>\<cr>", 'tx')
call assert_equal(' 3 the', getline('.'))
:1
" third match
call feedkeys("/the".repeat("\<c-n>", 2)."\<cr>", 'tx')
call feedkeys("/the".repeat("\<C-G>", 2)."\<cr>", 'tx')
call assert_equal(' 4 their', getline('.'))
:1
" fourth match
call feedkeys("/the".repeat("\<c-n>", 3)."\<cr>", 'tx')
call feedkeys("/the".repeat("\<C-G>", 3)."\<cr>", 'tx')
call assert_equal(' 5 there', getline('.'))
:1
" fifth match
call feedkeys("/the".repeat("\<c-n>", 4)."\<cr>", 'tx')
call feedkeys("/the".repeat("\<C-G>", 4)."\<cr>", 'tx')
call assert_equal(' 6 their', getline('.'))
:1
" sixth match
call feedkeys("/the".repeat("\<c-n>", 5)."\<cr>", 'tx')
call feedkeys("/the".repeat("\<C-G>", 5)."\<cr>", 'tx')
call assert_equal(' 7 the', getline('.'))
:1
" seventh match
call feedkeys("/the".repeat("\<c-n>", 6)."\<cr>", 'tx')
call feedkeys("/the".repeat("\<C-G>", 6)."\<cr>", 'tx')
call assert_equal(' 8 them', getline('.'))
:1
" eigth match
call feedkeys("/the".repeat("\<c-n>", 7)."\<cr>", 'tx')
call feedkeys("/the".repeat("\<C-G>", 7)."\<cr>", 'tx')
call assert_equal(' 9 these', getline('.'))
:1
" back at first match
call feedkeys("/the".repeat("\<c-n>", 8)."\<cr>", 'tx')
call feedkeys("/the".repeat("\<C-G>", 8)."\<cr>", 'tx')
call assert_equal(' 2 these', getline('.'))
" Test 4
" CTRL-P goes to the previous match
" CTRL-T goes to the previous match
set incsearch nowrapscan
$
" first match
@@ -110,23 +110,23 @@ func Test_search_cmdline()
call assert_equal(' 9 these', getline('.'))
$
" first match
call feedkeys("?the\<c-n>\<cr>", 'tx')
call feedkeys("?the\<C-G>\<cr>", 'tx')
call assert_equal(' 9 these', getline('.'))
$
" second match
call feedkeys("?the".repeat("\<c-p>", 1)."\<cr>", 'tx')
call feedkeys("?the".repeat("\<C-T>", 1)."\<cr>", 'tx')
call assert_equal(' 8 them', getline('.'))
$
" last match
call feedkeys("?the".repeat("\<c-p>", 7)."\<cr>", 'tx')
call feedkeys("?the".repeat("\<C-T>", 7)."\<cr>", 'tx')
call assert_equal(' 2 these', getline('.'))
$
" last match
call feedkeys("?the".repeat("\<c-p>", 8)."\<cr>", 'tx')
call feedkeys("?the".repeat("\<C-T>", 8)."\<cr>", 'tx')
call assert_equal(' 2 these', getline('.'))
" Test 5
" CTRL-P goes to the previous match
" CTRL-T goes to the previous match
set incsearch wrapscan
$
" first match
@@ -134,19 +134,19 @@ func Test_search_cmdline()
call assert_equal(' 9 these', getline('.'))
$
" first match at the top
call feedkeys("?the\<c-n>\<cr>", 'tx')
call feedkeys("?the\<C-G>\<cr>", 'tx')
call assert_equal(' 2 these', getline('.'))
$
" second match
call feedkeys("?the".repeat("\<c-p>", 1)."\<cr>", 'tx')
call feedkeys("?the".repeat("\<C-T>", 1)."\<cr>", 'tx')
call assert_equal(' 8 them', getline('.'))
$
" last match
call feedkeys("?the".repeat("\<c-p>", 7)."\<cr>", 'tx')
call feedkeys("?the".repeat("\<C-T>", 7)."\<cr>", 'tx')
call assert_equal(' 2 these', getline('.'))
$
" back at the bottom of the buffer
call feedkeys("?the".repeat("\<c-p>", 8)."\<cr>", 'tx')
call feedkeys("?the".repeat("\<C-T>", 8)."\<cr>", 'tx')
call assert_equal(' 9 these', getline('.'))
" Test 6
@@ -158,16 +158,16 @@ func Test_search_cmdline()
call assert_equal(' 2 these', getline('.'))
1
" go to next match of 'thes'
call feedkeys("/the\<c-l>\<c-n>\<cr>", 'tx')
call feedkeys("/the\<c-l>\<C-G>\<cr>", 'tx')
call assert_equal(' 9 these', getline('.'))
1
" wrap around
call feedkeys("/the\<c-l>\<c-n>\<c-n>\<cr>", 'tx')
call feedkeys("/the\<c-l>\<C-G>\<C-G>\<cr>", 'tx')
call assert_equal(' 2 these', getline('.'))
1
" wrap around
set nowrapscan
call feedkeys("/the\<c-l>\<c-n>\<c-n>\<cr>", 'tx')
call feedkeys("/the\<c-l>\<C-G>\<C-G>\<cr>", 'tx')
call assert_equal(' 9 these', getline('.'))
" Test 7
@@ -183,7 +183,7 @@ func Test_search_cmdline()
call assert_equal(' 9 these', getline('.'))
1
" delete one char, add another, go to previous match, add one char
call feedkeys("/thei\<bs>s\<bs>\<c-p>\<c-l>\<cr>", 'tx')
call feedkeys("/thei\<bs>s\<bs>\<C-T>\<c-l>\<cr>", 'tx')
call assert_equal(' 8 them', getline('.'))
1
" delete all chars, start from the beginning again
@@ -205,7 +205,7 @@ func Test_search_cmdline2()
new
call setline(1, [' 1', ' 2 these', ' 3 the theother'])
" Test 1
" Ctrl-P goes correctly back and forth
" Ctrl-T goes correctly back and forth
set incsearch
1
" first match
@@ -213,27 +213,27 @@ func Test_search_cmdline2()
call assert_equal(' 2 these', getline('.'))
1
" go to next match (on next line)
call feedkeys("/the\<c-n>\<cr>", 'tx')
call feedkeys("/the\<C-G>\<cr>", 'tx')
call assert_equal(' 3 the theother', getline('.'))
1
" go to next match (still on line 3)
call feedkeys("/the\<c-n>\<c-n>\<cr>", 'tx')
call feedkeys("/the\<C-G>\<C-G>\<cr>", 'tx')
call assert_equal(' 3 the theother', getline('.'))
1
" go to next match (still on line 3)
call feedkeys("/the\<c-n>\<c-n>\<c-n>\<cr>", 'tx')
call feedkeys("/the\<C-G>\<C-G>\<C-G>\<cr>", 'tx')
call assert_equal(' 3 the theother', getline('.'))
1
" go to previous match (on line 3)
call feedkeys("/the\<c-n>\<c-n>\<c-n>\<c-p>\<cr>", 'tx')
call feedkeys("/the\<C-G>\<C-G>\<C-G>\<C-T>\<cr>", 'tx')
call assert_equal(' 3 the theother', getline('.'))
1
" go to previous match (on line 3)
call feedkeys("/the\<c-n>\<c-n>\<c-n>\<c-p>\<c-p>\<cr>", 'tx')
call feedkeys("/the\<C-G>\<C-G>\<C-G>\<C-T>\<C-T>\<cr>", 'tx')
call assert_equal(' 3 the theother', getline('.'))
1
" go to previous match (on line 2)
call feedkeys("/the\<c-n>\<c-n>\<c-n>\<c-p>\<c-p>\<c-p>\<cr>", 'tx')
call feedkeys("/the\<C-G>\<C-G>\<C-G>\<C-T>\<C-T>\<C-T>\<cr>", 'tx')
call assert_equal(' 2 these', getline('.'))
" clean up
+24
View File
@@ -778,6 +778,30 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
2275,
/**/
2274,
/**/
2273,
/**/
2272,
/**/
2271,
/**/
2270,
/**/
2269,
/**/
2268,
/**/
2267,
/**/
2266,
/**/
2265,
/**/
2264,
/**/
2263,
/**/