0
0
mirror of https://github.com/vim/vim.git synced 2025-07-25 10:54:51 -04:00

updated for version 7.0217

This commit is contained in:
Bram Moolenaar 2006-03-07 22:38:47 +00:00
parent a203182302
commit 1f35bf9cab
22 changed files with 283 additions and 180 deletions

View File

@ -1,7 +1,7 @@
" Vim completion script " Vim completion script
" Language: C " Language: C
" Maintainer: Bram Moolenaar <Bram@vim.org> " Maintainer: Bram Moolenaar <Bram@vim.org>
" Last Change: 2006 Feb 10 " Last Change: 2006 Mar 07
" This function is used for the 'omnifunc' option. " This function is used for the 'omnifunc' option.
@ -123,7 +123,7 @@ function! ccomplete#Complete(findstart, base)
if match(line, match . '\s*\[') > 0 if match(line, match . '\s*\[') > 0
let match .= '[' let match .= '['
else else
let res = s:Nextitem(strpart(line, 0, col), [''], 0) let res = s:Nextitem(strpart(line, 0, col), [''], 0, 1)
if len(res) > 0 if len(res) > 0
" There are members, thus add "." or "->". " There are members, thus add "." or "->".
if match(line, '\*[ \t(]*' . match . '\>') > 0 if match(line, '\*[ \t(]*' . match . '\>') > 0
@ -136,7 +136,7 @@ function! ccomplete#Complete(findstart, base)
let res = [{'match': match, 'tagline' : ''}] let res = [{'match': match, 'tagline' : ''}]
else else
" Completing "var.", "var.something", etc. " Completing "var.", "var.something", etc.
let res = s:Nextitem(strpart(line, 0, col), items[1:], 0) let res = s:Nextitem(strpart(line, 0, col), items[1:], 0, 1)
endif endif
endif endif
@ -153,7 +153,7 @@ function! ccomplete#Complete(findstart, base)
for i in range(len(diclist)) for i in range(len(diclist))
" New ctags has the "typename" field. " New ctags has the "typename" field.
if has_key(diclist[i], 'typename') if has_key(diclist[i], 'typename')
call extend(res, s:StructMembers(diclist[i]['typename'], items[1:])) call extend(res, s:StructMembers(diclist[i]['typename'], items[1:], 1))
endif endif
" For a variable use the command, which must be a search pattern that " For a variable use the command, which must be a search pattern that
@ -162,7 +162,7 @@ function! ccomplete#Complete(findstart, base)
let line = diclist[i]['cmd'] let line = diclist[i]['cmd']
if line[0] == '/' && line[1] == '^' if line[0] == '/' && line[1] == '^'
let col = match(line, '\<' . items[0] . '\>') let col = match(line, '\<' . items[0] . '\>')
call extend(res, s:Nextitem(strpart(line, 2, col - 2), items[1:], 0)) call extend(res, s:Nextitem(strpart(line, 2, col - 2), items[1:], 0, 1))
endif endif
endif endif
endfor endfor
@ -173,7 +173,7 @@ function! ccomplete#Complete(findstart, base)
" TODO: join previous line if it makes sense " TODO: join previous line if it makes sense
let line = getline('.') let line = getline('.')
let col = col('.') let col = col('.')
let res = s:Nextitem(strpart(line, 0, col), items[1:], 0) let res = s:Nextitem(strpart(line, 0, col), items[1:], 0, 1)
endif endif
" If the last item(s) are [...] they need to be added to the matches. " If the last item(s) are [...] they need to be added to the matches.
@ -197,7 +197,7 @@ function! s:GetAddition(line, match, memarg, bracket)
endif endif
" Check if the item has members. " Check if the item has members.
if len(s:SearchMembers(a:memarg, [''])) > 0 if len(s:SearchMembers(a:memarg, [''], 0)) > 0
" If there is a '*' before the name use "->". " If there is a '*' before the name use "->".
if match(a:line, '\*[ \t(]*' . a:match . '\>') > 0 if match(a:line, '\*[ \t(]*' . a:match . '\>') > 0
return '->' return '->'
@ -248,8 +248,8 @@ endfunction
function! s:Tagcmd2extra(cmd, name, fname) function! s:Tagcmd2extra(cmd, name, fname)
if a:cmd =~ '^/^' if a:cmd =~ '^/^'
" The command is a search command, useful to see what it is. " The command is a search command, useful to see what it is.
let x = matchstr(a:cmd, '^/^\zs.*\ze$/') let x = matchstr(a:cmd, '^/^\s*\zs.*\ze$/')
let x = substitute(x, a:name, '@@', '') let x = substitute(x, '\<' . a:name . '\>', '@@', '')
let x = substitute(x, '\\\(.\)', '\1', 'g') let x = substitute(x, '\\\(.\)', '\1', 'g')
let x = x . ' - ' . a:fname let x = x . ' - ' . a:fname
elseif a:cmd =~ '^\d*$' elseif a:cmd =~ '^\d*$'
@ -266,7 +266,7 @@ endfunction
" Repeat this recursively for items[1], if it's there. " Repeat this recursively for items[1], if it's there.
" When resolving typedefs "depth" is used to avoid infinite recursion. " When resolving typedefs "depth" is used to avoid infinite recursion.
" Return the list of matches. " Return the list of matches.
function! s:Nextitem(lead, items, depth) function! s:Nextitem(lead, items, depth, all)
" Use the text up to the variable name and split it in tokens. " Use the text up to the variable name and split it in tokens.
let tokens = split(a:lead, '\s\+\|\<') let tokens = split(a:lead, '\s\+\|\<')
@ -277,7 +277,7 @@ function! s:Nextitem(lead, items, depth)
" Recognize "struct foobar" and "union foobar". " Recognize "struct foobar" and "union foobar".
if (tokens[tidx] == 'struct' || tokens[tidx] == 'union') && tidx + 1 < len(tokens) if (tokens[tidx] == 'struct' || tokens[tidx] == 'union') && tidx + 1 < len(tokens)
let res = s:StructMembers(tokens[tidx] . ':' . tokens[tidx + 1], a:items) let res = s:StructMembers(tokens[tidx] . ':' . tokens[tidx + 1], a:items, a:all)
break break
endif endif
@ -291,7 +291,7 @@ function! s:Nextitem(lead, items, depth)
for tagidx in range(len(diclist)) for tagidx in range(len(diclist))
" New ctags has the "typename" field. " New ctags has the "typename" field.
if has_key(diclist[tagidx], 'typename') if has_key(diclist[tagidx], 'typename')
call extend(res, s:StructMembers(diclist[tagidx]['typename'], a:items)) call extend(res, s:StructMembers(diclist[tagidx]['typename'], a:items, a:all))
continue continue
endif endif
@ -317,11 +317,11 @@ function! s:Nextitem(lead, items, depth)
endif endif
endfor endfor
if name != '' if name != ''
call extend(res, s:StructMembers(cmdtokens[0] . ':' . name, a:items)) call extend(res, s:StructMembers(cmdtokens[0] . ':' . name, a:items, a:all))
endif endif
elseif a:depth < 10 elseif a:depth < 10
" Could be "typedef other_T some_T". " Could be "typedef other_T some_T".
call extend(res, s:Nextitem(cmdtokens[0], a:items, a:depth + 1)) call extend(res, s:Nextitem(cmdtokens[0], a:items, a:depth + 1, a:all))
endif endif
endif endif
endif endif
@ -338,7 +338,9 @@ endfunction
" Search for members of structure "typename" in tags files. " Search for members of structure "typename" in tags files.
" Return a list with resulting matches. " Return a list with resulting matches.
" Each match is a dictionary with "match" and "tagline" entries. " Each match is a dictionary with "match" and "tagline" entries.
function! s:StructMembers(typename, items) " When "all" is non-zero find all, otherwise just return 1 if there is any
" member.
function! s:StructMembers(typename, items, all)
" Todo: What about local structures? " Todo: What about local structures?
let fnames = join(map(tagfiles(), 'escape(v:val, " \\")')) let fnames = join(map(tagfiles(), 'escape(v:val, " \\")'))
if fnames == '' if fnames == ''
@ -347,8 +349,13 @@ function! s:StructMembers(typename, items)
let typename = a:typename let typename = a:typename
let qflist = [] let qflist = []
if a:all == 0
let n = '1' " stop at first found match
else
let n = ''
endif
while 1 while 1
exe 'silent! vimgrep /\t' . typename . '\(\t\|$\)/j ' . fnames exe 'silent! ' . n . 'vimgrep /\t' . typename . '\(\t\|$\)/j ' . fnames
let qflist = getqflist() let qflist = getqflist()
if len(qflist) > 0 || match(typename, "::") < 0 if len(qflist) > 0 || match(typename, "::") < 0
break break
@ -380,7 +387,7 @@ function! s:StructMembers(typename, items)
" More items following. For each of the possible members find the " More items following. For each of the possible members find the
" matching following members. " matching following members.
return s:SearchMembers(matches, a:items[idx :]) return s:SearchMembers(matches, a:items[idx :], a:all)
endif endif
" Failed to find anything. " Failed to find anything.
@ -388,7 +395,9 @@ function! s:StructMembers(typename, items)
endfunction endfunction
" For matching members, find matches for following items. " For matching members, find matches for following items.
function! s:SearchMembers(matches, items) " When "all" is non-zero find all, otherwise just return 1 if there is any
" member.
function! s:SearchMembers(matches, items, all)
let res = [] let res = []
for i in range(len(a:matches)) for i in range(len(a:matches))
let typename = '' let typename = ''
@ -405,18 +414,22 @@ function! s:SearchMembers(matches, items)
let typename = matchstr(line, '[^\t]*', e) let typename = matchstr(line, '[^\t]*', e)
endif endif
endif endif
if typename != '' if typename != ''
call extend(res, s:StructMembers(typename, a:items)) call extend(res, s:StructMembers(typename, a:items, a:all))
else else
" Use the search command (the declaration itself). " Use the search command (the declaration itself).
let s = match(line, '\t\zs/^') let s = match(line, '\t\zs/^')
if s > 0 if s > 0
let e = match(line, '\<' . a:matches[i]['match'] . '\>', s) let e = match(line, '\<' . a:matches[i]['match'] . '\>', s)
if e > 0 if e > 0
call extend(res, s:Nextitem(strpart(line, s, e - s), a:items, 0)) call extend(res, s:Nextitem(strpart(line, s, e - s), a:items, 0, a:all))
endif endif
endif endif
endif endif
if a:all == 0 && len(res) > 0
break
endif
endfor endfor
return res return res
endfunc endfunc

View File

@ -1,4 +1,4 @@
*autocmd.txt* For Vim version 7.0aa. Last change: 2006 Feb 27 *autocmd.txt* For Vim version 7.0aa. Last change: 2006 Mar 07
VIM REFERENCE MANUAL by Bram Moolenaar VIM REFERENCE MANUAL by Bram Moolenaar
@ -274,6 +274,7 @@ Name triggered by ~
|FuncUndefined| a user function is used but it isn't defined |FuncUndefined| a user function is used but it isn't defined
|SpellFileMissing| a spell file is used but it can't be found |SpellFileMissing| a spell file is used but it can't be found
|SourcePre| before sourcing a Vim script
|FocusGained| Vim got input focus |FocusGained| Vim got input focus
|FocusLost| Vim lost input focus |FocusLost| Vim lost input focus
@ -666,6 +667,8 @@ RemoteReply When a reply from a Vim that functions as
*SessionLoadPost* *SessionLoadPost*
SessionLoadPost After loading the session file created using SessionLoadPost After loading the session file created using
the |:mksession| command. the |:mksession| command.
*SourcePre*
SourcePre Before sourcing a Vim script. |:source|
*SpellFileMissing* *SpellFileMissing*
SpellFileMissing When trying to load a spell checking file and SpellFileMissing When trying to load a spell checking file and
it can't be found. <amatch> is the language, it can't be found. <amatch> is the language,

View File

@ -1,4 +1,4 @@
*eval.txt* For Vim version 7.0aa. Last change: 2006 Mar 06 *eval.txt* For Vim version 7.0aa. Last change: 2006 Mar 07
VIM REFERENCE MANUAL by Bram Moolenaar VIM REFERENCE MANUAL by Bram Moolenaar
@ -1429,6 +1429,7 @@ v:swapcommand Normal mode command to be executed after a file has been
opened. Can be used for a |SwapExists| autocommand to have opened. Can be used for a |SwapExists| autocommand to have
another Vim open the file and jump to the right place. For another Vim open the file and jump to the right place. For
example, when jumping to a tag the value is ":tag tagname\r". example, when jumping to a tag the value is ":tag tagname\r".
For ":edit +cmd file" the value is ":cmd\r".
*v:termresponse* *termresponse-variable* *v:termresponse* *termresponse-variable*
v:termresponse The escape sequence returned by the terminal for the |t_RV| v:termresponse The escape sequence returned by the terminal for the |t_RV|

View File

@ -1,4 +1,4 @@
*quickfix.txt* For Vim version 7.0aa. Last change: 2006 Feb 04 *quickfix.txt* For Vim version 7.0aa. Last change: 2006 Mar 07
VIM REFERENCE MANUAL by Bram Moolenaar VIM REFERENCE MANUAL by Bram Moolenaar
@ -499,6 +499,12 @@ advantages are:
pattern to ignore case or |/\C| to match case. pattern to ignore case or |/\C| to match case.
'smartcase' is not used. 'smartcase' is not used.
When a number is put before the command this is used
as the maximum number of matches to find. Use
":1vimgrep pattern file" to find only the first.
Useful if you only want to check if there is a match
and quit quickly when it's found.
Without the 'j' flag Vim jumps to the first match. Without the 'j' flag Vim jumps to the first match.
With 'j' only the quickfix list is updated. With 'j' only the quickfix list is updated.
With the [!] any changes in the current buffer are With the [!] any changes in the current buffer are

View File

@ -1,4 +1,4 @@
*repeat.txt* For Vim version 7.0aa. Last change: 2005 Jun 26 *repeat.txt* For Vim version 7.0aa. Last change: 2006 Mar 07
VIM REFERENCE MANUAL by Bram Moolenaar VIM REFERENCE MANUAL by Bram Moolenaar
@ -144,6 +144,7 @@ For writing a Vim script, see chapter 41 of the user manual |usr_41.txt|.
*:so* *:source* *load-vim-script* *:so* *:source* *load-vim-script*
:so[urce] {file} Read Ex commands from {file}. These are commands that :so[urce] {file} Read Ex commands from {file}. These are commands that
start with a ":". start with a ":".
Triggers the |SourcePre| autocommand.
:so[urce]! {file} Read Vim commands from {file}. These are commands :so[urce]! {file} Read Vim commands from {file}. These are commands
that are executed from Normal mode, like you type that are executed from Normal mode, like you type

View File

@ -4123,6 +4123,7 @@ Select-mode-mapping visual.txt /*Select-mode-mapping*
Session starting.txt /*Session* Session starting.txt /*Session*
SessionLoad-variable starting.txt /*SessionLoad-variable* SessionLoad-variable starting.txt /*SessionLoad-variable*
SessionLoadPost autocmd.txt /*SessionLoadPost* SessionLoadPost autocmd.txt /*SessionLoadPost*
SourcePre autocmd.txt /*SourcePre*
SpellFileMissing autocmd.txt /*SpellFileMissing* SpellFileMissing autocmd.txt /*SpellFileMissing*
StdinReadPost autocmd.txt /*StdinReadPost* StdinReadPost autocmd.txt /*StdinReadPost*
StdinReadPre autocmd.txt /*StdinReadPre* StdinReadPre autocmd.txt /*StdinReadPre*
@ -5483,7 +5484,6 @@ hebrew hebrew.txt /*hebrew*
hebrew.txt hebrew.txt /*hebrew.txt* hebrew.txt hebrew.txt /*hebrew.txt*
help various.txt /*help* help various.txt /*help*
help-context help.txt /*help-context* help-context help.txt /*help-context*
help-tags tags 1
help-translated various.txt /*help-translated* help-translated various.txt /*help-translated*
help-xterm-window various.txt /*help-xterm-window* help-xterm-window various.txt /*help-xterm-window*
help.txt help.txt /*help.txt* help.txt help.txt /*help.txt*

View File

@ -1,4 +1,4 @@
*todo.txt* For Vim version 7.0aa. Last change: 2006 Mar 06 *todo.txt* For Vim version 7.0aa. Last change: 2006 Mar 07
VIM REFERENCE MANUAL by Bram Moolenaar VIM REFERENCE MANUAL by Bram Moolenaar
@ -30,47 +30,30 @@ be worked on, but only if you sponsor Vim development. See |sponsor|.
*known-bugs* *known-bugs*
-------------------- Known bugs and current work ----------------------- -------------------- Known bugs and current work -----------------------
When expanding on the command line, recognize shell commands, such as ":!cmd".
Move from ExpandFromContext() to separate function.
Check for file being executable. EW_EXEC
Escape special characters ";&<>(){}". Also in file names. (Adri Verhoef)
Autoload:
- Add a Vim script in $VIMRUNTIME/tools that takes a file with a list of
script names and a help file and produces a script that can be sourced to
install the scripts in the user's directories.
Use findfile(), so that only file names need to be given:
script plugin/myscript.vim
script autoload/mylib.vim
script autoload/yourlib.vim
helpfile doc/myscript.txt
For the "helpfile" item ":helptags" is run.
Win32: Describe how to do debugging and describe it. (George Reilly) Win32: Describe how to do debugging and describe it. (George Reilly)
Are there more commands where v:swapcommand can be set to something useful?
Mac unicode patch (Da Woon Jung): Mac unicode patch (Da Woon Jung):
- Mac: Unicode input and display (Eckehard Berns, 2004 June 27) - Mac: Unicode input and display (Eckehard Berns, 2004 June 27)
Other patch from Da Woon Jung, 2005 Jan 16. Other patch from Da Woon Jung, 2005 Jan 16.
8 Add patch from Muraoka Taro (Mar 16) to support input method on Mac? 8 Add patch from Muraoka Taro (Mar 16) to support input method on Mac?
New patch 2004 Jun 16 New patch 2004 Jun 16
- Add default key mappings for the command key (Alan Schmitt)
use http://macvim.org/OSX/files/gvimrc
- selecting proportional font breaks display - selecting proportional font breaks display
- UTF-8 text causes display problems. Font replacement causes this. - UTF-8 text causes display problems. Font replacement causes this.
- Command-key mappings do not work. (Alan Schmitt) - Command-key mappings do not work. (Alan Schmitt)
- Add default key mappings for the command key (Alan Schmitt)
use http://macvim.org/OSX/files/gvimrc
- With 'nopaste' pasting is wrong, with 'paste' Command-V doesn't work. - With 'nopaste' pasting is wrong, with 'paste' Command-V doesn't work.
(Alan Schmitt) (Alan Schmitt)
Bug in Netbeans interface. (Xavier de Gaye, 2006 Mar 7)
CONSIDERED FOR VERSION 7.0: CONSIDERED FOR VERSION 7.0:
Omni completion: Omni completion:
ccomplete: ccomplete:
- Finding out if an item has members (to add '.' or '->') requires a grep - Finding out if an item has members (to add '.' or '->') requires a grep
in the tags files, that is very slow. Is there another solution? At in the tags files, that is very slow. Is there another solution?
least stop at the first match. Check what happens when taglist() is called.
Could build the list of items for each structure in memory. Is that Could build the list of items for each structure in memory. Is that
faster? Not using too much memory? faster? Not using too much memory?
- For C add tag "kind" field to each match? - For C add tag "kind" field to each match?
@ -1625,6 +1608,15 @@ Syntax highlighting:
Built-in script language: Built-in script language:
9 Autoload: Add a Vim script in $VIMRUNTIME/tools that takes a file with a
list of script names and a help file and produces a script that can be
sourced to install the scripts in the user's directories.
Use findfile(), so that only file names need to be given:
script plugin/myscript.vim
script autoload/mylib.vim
script autoload/yourlib.vim
helpfile doc/myscript.txt
For the "helpfile" item ":helptags" is run.
7 Execute a function with standard option values. No need to save and 7 Execute a function with standard option values. No need to save and
restore option values. Especially useful for new options. Problem: how restore option values. Especially useful for new options. Problem: how
to avoid a performance penalty (esp. for string options)? to avoid a performance penalty (esp. for string options)?

View File

@ -1,4 +1,4 @@
*version7.txt* For Vim version 7.0aa. Last change: 2006 Mar 06 *version7.txt* For Vim version 7.0aa. Last change: 2006 Mar 07
VIM REFERENCE MANUAL by Bram Moolenaar VIM REFERENCE MANUAL by Bram Moolenaar
@ -647,6 +647,8 @@ New autocommand events: ~
|SpellFileMissing| when a spell file can't be found |SpellFileMissing| when a spell file can't be found
|SourcePre| before sourcing a Vim script
|CursorHoldI| the user doesn't press a key for a while in Insert mode |CursorHoldI| the user doesn't press a key for a while in Insert mode
|CursorMoved| the cursor was moved in Normal mode |CursorMoved| the cursor was moved in Normal mode
|CursorMovedI| the cursor was moved in Insert mode |CursorMovedI| the cursor was moved in Insert mode
@ -725,6 +727,9 @@ Vietnamese message translations and menu. (Phan Vinh Thinh)
Others: ~ Others: ~
The Netbeans interface was updated for Sun Studio 10. The protocol number
goes from 2.2 to 2.3. (Gordon Prieur)
Mac: Add the selection type to the clipboard, so that Block, line and Mac: Add the selection type to the clipboard, so that Block, line and
character selections can be used between two Vims. (Eckehard Berns) character selections can be used between two Vims. (Eckehard Berns)
Also fixes the problem that setting 'clipboard' to "unnamed" breaks using Also fixes the problem that setting 'clipboard' to "unnamed" breaks using
@ -792,6 +797,9 @@ IMPROVEMENTS *improvements-7*
Move the help for printing to a separate help file. It's quite a lot now. Move the help for printing to a separate help file. It's quite a lot now.
When doing completion for ":!cmd", ":r !cmd" or ":w !cmd" executable files are
found in $PATH instead of looking for ordinary files in the current directlry.
When ":silent" is used and a backwards range is given for an Ex command the When ":silent" is used and a backwards range is given for an Ex command the
range is swapped automatically instead of asking if that is OK. range is swapped automatically instead of asking if that is OK.
@ -1862,4 +1870,7 @@ MS-DOS, Win32: When 'encoding' defaults to "latin1" then the value for
'iskeyword' was still for CPxxx. And when 'nocompatible' was set 'isprint' 'iskeyword' was still for CPxxx. And when 'nocompatible' was set 'isprint'
would also be the wrong value. would also be the wrong value.
When a command was defined not to take arguments and no '|' no warning message
would be given for using a '|'. Also with ":loadkeymap".
vim:tw=78:ts=8:ft=help:norl: vim:tw=78:ts=8:ft=help:norl:

2
src/auto/configure vendored
View File

@ -2930,7 +2930,7 @@ sed 's/^/| /' conftest.$ac_ext >&5
echo "$as_me:$LINENO: result: not found" >&5 echo "$as_me:$LINENO: result: not found" >&5
echo "${ECHO_T}not found" >&6 echo "${ECHO_T}not found" >&6
CFLAGS="save_cflags" CFLAGS="$save_cflags"
echo "$as_me:$LINENO: checking if Intel architecture is supported" >&5 echo "$as_me:$LINENO: checking if Intel architecture is supported" >&5
echo $ECHO_N "checking if Intel architecture is supported... $ECHO_C" >&6 echo $ECHO_N "checking if Intel architecture is supported... $ECHO_C" >&6
CPPFLAGS="$CPPFLAGS -arch i386" CPPFLAGS="$CPPFLAGS -arch i386"

View File

@ -123,7 +123,7 @@ if test "`(uname) 2>/dev/null`" = Darwin; then
AC_MSG_RESULT(found, will make universal binary), AC_MSG_RESULT(found, will make universal binary),
AC_MSG_RESULT(not found) AC_MSG_RESULT(not found)
CFLAGS="save_cflags" CFLAGS="$save_cflags"
AC_MSG_CHECKING(if Intel architecture is supported) AC_MSG_CHECKING(if Intel architecture is supported)
CPPFLAGS="$CPPFLAGS -arch i386" CPPFLAGS="$CPPFLAGS -arch i386"
LDFLAGS="$save_ldflags -arch i386" LDFLAGS="$save_ldflags -arch i386"

View File

@ -111,7 +111,7 @@ static int compl_matches = 0;
static char_u *compl_pattern = NULL; static char_u *compl_pattern = NULL;
static int compl_direction = FORWARD; static int compl_direction = FORWARD;
static int compl_shows_dir = FORWARD; static int compl_shows_dir = FORWARD;
static int compl_pending = FALSE; static int compl_pending = 0; /* > 1 for postponed CTRL-N */
static pos_T compl_startpos; static pos_T compl_startpos;
static colnr_T compl_col = 0; /* column where the text starts static colnr_T compl_col = 0; /* column where the text starts
* that is being completed */ * that is being completed */
@ -2466,6 +2466,12 @@ ins_compl_show_pum()
if (compl == compl_shown_match) if (compl == compl_shown_match)
{ {
did_find_shown_match = TRUE; did_find_shown_match = TRUE;
/* When the original text is the shown match don't set
* compl_shown_match. */
if (compl->cp_flags & ORIGINAL_TEXT)
shown_match_ok = TRUE;
if (!shown_match_ok && shown_compl != NULL) if (!shown_match_ok && shown_compl != NULL)
{ {
/* The shown match isn't displayed, set it to the /* The shown match isn't displayed, set it to the
@ -3837,14 +3843,14 @@ ins_compl_next(allow_get_expansion, count, insert_match)
/* Delete old text to be replaced */ /* Delete old text to be replaced */
ins_compl_delete(); ins_compl_delete();
compl_pending = FALSE;
/* Repeat this for when <PageUp> or <PageDown> is typed. But don't wrap /* Repeat this for when <PageUp> or <PageDown> is typed. But don't wrap
* around. */ * around. */
while (--todo >= 0) while (--todo >= 0)
{ {
if (compl_shows_dir == FORWARD && compl_shown_match->cp_next != NULL) if (compl_shows_dir == FORWARD && compl_shown_match->cp_next != NULL)
{ {
if (compl_pending != 0)
--compl_pending;
compl_shown_match = compl_shown_match->cp_next; compl_shown_match = compl_shown_match->cp_next;
found_end = (compl_first_match != NULL found_end = (compl_first_match != NULL
&& (compl_shown_match->cp_next == compl_first_match && (compl_shown_match->cp_next == compl_first_match
@ -3853,18 +3859,23 @@ ins_compl_next(allow_get_expansion, count, insert_match)
else if (compl_shows_dir == BACKWARD else if (compl_shows_dir == BACKWARD
&& compl_shown_match->cp_prev != NULL) && compl_shown_match->cp_prev != NULL)
{ {
if (compl_pending != 0)
++compl_pending;
found_end = (compl_shown_match == compl_first_match); found_end = (compl_shown_match == compl_first_match);
compl_shown_match = compl_shown_match->cp_prev; compl_shown_match = compl_shown_match->cp_prev;
found_end |= (compl_shown_match == compl_first_match); found_end |= (compl_shown_match == compl_first_match);
} }
else else
{ {
compl_pending = TRUE; if (compl_shows_dir == BACKWARD)
--compl_pending;
else
++compl_pending;
if (!allow_get_expansion) if (!allow_get_expansion)
return -1; return -1;
num_matches = ins_compl_get_exp(&compl_startpos); num_matches = ins_compl_get_exp(&compl_startpos);
if (compl_pending && compl_direction == compl_shows_dir) if (compl_pending != 0 && compl_direction == compl_shows_dir)
compl_shown_match = compl_curr_match; compl_shown_match = compl_curr_match;
found_end = FALSE; found_end = FALSE;
} }
@ -3939,7 +3950,7 @@ ins_compl_next(allow_get_expansion, count, insert_match)
/* /*
* Call this while finding completions, to check whether the user has hit a key * Call this while finding completions, to check whether the user has hit a key
* that should change the currently displayed completion, or exit completion * that should change the currently displayed completion, or exit completion
* mode. Also, when compl_pending is TRUE, show a completion as soon as * mode. Also, when compl_pending is not zero, show a completion as soon as
* possible. -- webb * possible. -- webb
* "frequency" specifies out of how many calls we actually check. * "frequency" specifies out of how many calls we actually check.
*/ */
@ -3976,8 +3987,9 @@ ins_compl_check_keys(frequency)
else if (c != Ctrl_R) else if (c != Ctrl_R)
compl_interrupted = TRUE; compl_interrupted = TRUE;
} }
if (compl_pending && !got_int) if (compl_pending != 0 && !got_int)
(void)ins_compl_next(FALSE, 1, TRUE); (void)ins_compl_next(FALSE, compl_pending > 0
? compl_pending : -compl_pending, TRUE);
} }
/* /*
@ -4081,6 +4093,7 @@ ins_complete(c)
line = ml_get(curwin->w_cursor.lnum); line = ml_get(curwin->w_cursor.lnum);
curs_col = curwin->w_cursor.col; curs_col = curwin->w_cursor.col;
compl_pending = 0;
/* if this same ctrl_x_mode has been interrupted use the text from /* if this same ctrl_x_mode has been interrupted use the text from
* "compl_startpos" to the cursor as a pattern to add a new word * "compl_startpos" to the cursor as a pattern to add a new word

View File

@ -931,7 +931,7 @@ var_redir_start(name, append)
else else
set_var_lval(redir_lval, redir_endp, &tv, TRUE, (char_u *)"="); set_var_lval(redir_lval, redir_endp, &tv, TRUE, (char_u *)"=");
err = did_emsg; err = did_emsg;
did_emsg += save_emsg; did_emsg |= save_emsg;
if (err) if (err)
{ {
var_redir_stop(); var_redir_stop();
@ -979,7 +979,7 @@ var_redir_str(value, len)
did_emsg = FALSE; did_emsg = FALSE;
set_var_lval(redir_lval, redir_endp, &tv, FALSE, (char_u *)"."); set_var_lval(redir_lval, redir_endp, &tv, FALSE, (char_u *)".");
err = did_emsg; err = did_emsg;
did_emsg += save_emsg; did_emsg |= save_emsg;
if (err) if (err)
var_redir_stop(); var_redir_stop();
@ -8961,7 +8961,7 @@ filter_map(argvars, rettv, map)
int rem; int rem;
int todo; int todo;
char_u *msg = map ? (char_u *)"map()" : (char_u *)"filter()"; char_u *msg = map ? (char_u *)"map()" : (char_u *)"filter()";
int save_called_emsg; int save_did_emsg;
rettv->vval.v_number = 0; rettv->vval.v_number = 0;
if (argvars[0].v_type == VAR_LIST) if (argvars[0].v_type == VAR_LIST)
@ -8991,11 +8991,10 @@ filter_map(argvars, rettv, map)
prepare_vimvar(VV_VAL, &save_val); prepare_vimvar(VV_VAL, &save_val);
expr = skipwhite(expr); expr = skipwhite(expr);
/* We reset "called_emsg" to be able to detect whether an error /* We reset "did_emsg" to be able to detect whether an error
* occurred during evaluation of the expression. "did_emsg" can't be * occurred during evaluation of the expression. */
* used, because it is reset when calling a function. */ save_did_emsg = did_emsg;
save_called_emsg = called_emsg; did_emsg = FALSE;
called_emsg = FALSE;
if (argvars[0].v_type == VAR_DICT) if (argvars[0].v_type == VAR_DICT)
{ {
@ -9015,7 +9014,7 @@ filter_map(argvars, rettv, map)
break; break;
vimvars[VV_KEY].vv_str = vim_strsave(di->di_key); vimvars[VV_KEY].vv_str = vim_strsave(di->di_key);
if (filter_map_one(&di->di_tv, expr, map, &rem) == FAIL if (filter_map_one(&di->di_tv, expr, map, &rem) == FAIL
|| called_emsg) || did_emsg)
break; break;
if (!map && rem) if (!map && rem)
dictitem_remove(d, di); dictitem_remove(d, di);
@ -9034,7 +9033,7 @@ filter_map(argvars, rettv, map)
break; break;
nli = li->li_next; nli = li->li_next;
if (filter_map_one(&li->li_tv, expr, map, &rem) == FAIL if (filter_map_one(&li->li_tv, expr, map, &rem) == FAIL
|| called_emsg) || did_emsg)
break; break;
if (!map && rem) if (!map && rem)
listitem_remove(l, li); listitem_remove(l, li);
@ -9043,7 +9042,7 @@ filter_map(argvars, rettv, map)
restore_vimvar(VV_VAL, &save_val); restore_vimvar(VV_VAL, &save_val);
called_emsg |= save_called_emsg; did_emsg |= save_did_emsg;
} }
copy_tv(&argvars[0], rettv); copy_tv(&argvars[0], rettv);
@ -17830,6 +17829,7 @@ ex_function(eap)
else else
eap->skip = TRUE; eap->skip = TRUE;
} }
/* An error in a function call during evaluation of an expression in magic /* An error in a function call during evaluation of an expression in magic
* braces should not cause the function not to be defined. */ * braces should not cause the function not to be defined. */
saved_did_emsg = did_emsg; saved_did_emsg = did_emsg;

View File

@ -2962,6 +2962,7 @@ do_ecmd(fnum, ffname, sfname, eap, newlnum, flags)
int auto_buf = FALSE; /* TRUE if autocommands brought us int auto_buf = FALSE; /* TRUE if autocommands brought us
into the buffer unexpectedly */ into the buffer unexpectedly */
char_u *new_name = NULL; char_u *new_name = NULL;
int did_set_swapcommand = FALSE;
#endif #endif
buf_T *buf; buf_T *buf;
#if defined(FEAT_AUTOCMD) || defined(FEAT_GUI_DIALOG) || defined(FEAT_CON_DIALOG) #if defined(FEAT_AUTOCMD) || defined(FEAT_GUI_DIALOG) || defined(FEAT_CON_DIALOG)
@ -3082,6 +3083,32 @@ do_ecmd(fnum, ffname, sfname, eap, newlnum, flags)
reset_VIsual(); reset_VIsual();
#endif #endif
#ifdef FEAT_AUTOCMD
if ((command != NULL || newlnum > (linenr_T)0)
&& *get_vim_var_str(VV_SWAPCOMMAND) == NUL)
{
int len;
char_u *p;
/* Set v:swapcommand for the SwapExists autocommands. */
if (command != NULL)
len = STRLEN(command) + 3;
else
len = 30;
p = alloc((unsigned)len);
if (p != NULL)
{
if (command != NULL)
vim_snprintf((char *)p, len, ":%s\r", command);
else
vim_snprintf((char *)p, len, "%ldG", (long)newlnum);
set_vim_var_string(VV_SWAPCOMMAND, p, -1);
did_set_swapcommand = TRUE;
vim_free(p);
}
}
#endif
/* /*
* If we are starting to edit another file, open a (new) buffer. * If we are starting to edit another file, open a (new) buffer.
* Otherwise we re-use the current buffer. * Otherwise we re-use the current buffer.
@ -3619,6 +3646,10 @@ do_ecmd(fnum, ffname, sfname, eap, newlnum, flags)
#endif #endif
theend: theend:
#ifdef FEAT_AUTOCMD
if (did_set_swapcommand)
set_vim_var_string(VV_SWAPCOMMAND, NULL, -1);
#endif
#ifdef FEAT_BROWSE #ifdef FEAT_BROWSE
vim_free(browse_file); vim_free(browse_file);
#endif #endif

View File

@ -402,9 +402,9 @@ EX(CMD_global, "global", ex_global,
EX(CMD_goto, "goto", ex_goto, EX(CMD_goto, "goto", ex_goto,
RANGE|NOTADR|COUNT|TRLBAR|SBOXOK|CMDWIN), RANGE|NOTADR|COUNT|TRLBAR|SBOXOK|CMDWIN),
EX(CMD_grep, "grep", ex_make, EX(CMD_grep, "grep", ex_make,
BANG|NEEDARG|EXTRA|NOTRLCOM|TRLBAR|XFILE), RANGE|NOTADR|BANG|NEEDARG|EXTRA|NOTRLCOM|TRLBAR|XFILE),
EX(CMD_grepadd, "grepadd", ex_make, EX(CMD_grepadd, "grepadd", ex_make,
BANG|NEEDARG|EXTRA|NOTRLCOM|TRLBAR|XFILE), RANGE|NOTADR|BANG|NEEDARG|EXTRA|NOTRLCOM|TRLBAR|XFILE),
EX(CMD_gui, "gui", ex_gui, EX(CMD_gui, "gui", ex_gui,
BANG|FILES|EDITCMD|ARGOPT|TRLBAR|CMDWIN), BANG|FILES|EDITCMD|ARGOPT|TRLBAR|CMDWIN),
EX(CMD_gvim, "gvim", ex_gui, EX(CMD_gvim, "gvim", ex_gui,
@ -514,9 +514,9 @@ EX(CMD_lfirst, "lfirst", ex_cc,
EX(CMD_lgetfile, "lgetfile", ex_cfile, EX(CMD_lgetfile, "lgetfile", ex_cfile,
TRLBAR|FILE1|BANG), TRLBAR|FILE1|BANG),
EX(CMD_lgrep, "lgrep", ex_make, EX(CMD_lgrep, "lgrep", ex_make,
BANG|NEEDARG|EXTRA|NOTRLCOM|TRLBAR|XFILE), RANGE|NOTADR|BANG|NEEDARG|EXTRA|NOTRLCOM|TRLBAR|XFILE),
EX(CMD_lgrepadd, "lgrepadd", ex_make, EX(CMD_lgrepadd, "lgrepadd", ex_make,
BANG|NEEDARG|EXTRA|NOTRLCOM|TRLBAR|XFILE), RANGE|NOTADR|BANG|NEEDARG|EXTRA|NOTRLCOM|TRLBAR|XFILE),
EX(CMD_lhelpgrep, "lhelpgrep", ex_helpgrep, EX(CMD_lhelpgrep, "lhelpgrep", ex_helpgrep,
EXTRA|NOTRLCOM|NEEDARG), EXTRA|NOTRLCOM|NEEDARG),
EX(CMD_ll, "ll", ex_cc, EX(CMD_ll, "ll", ex_cc,
@ -562,9 +562,9 @@ EX(CMD_ltag, "ltag", ex_tag,
EX(CMD_lunmap, "lunmap", ex_unmap, EX(CMD_lunmap, "lunmap", ex_unmap,
EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN), EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN),
EX(CMD_lvimgrep, "lvimgrep", ex_vimgrep, EX(CMD_lvimgrep, "lvimgrep", ex_vimgrep,
BANG|NEEDARG|EXTRA|NOTRLCOM|TRLBAR|XFILE), RANGE|NOTADR|BANG|NEEDARG|EXTRA|NOTRLCOM|TRLBAR|XFILE),
EX(CMD_lvimgrepadd, "lvimgrepadd", ex_vimgrep, EX(CMD_lvimgrepadd, "lvimgrepadd", ex_vimgrep,
BANG|NEEDARG|EXTRA|NOTRLCOM|TRLBAR|XFILE), RANGE|NOTADR|BANG|NEEDARG|EXTRA|NOTRLCOM|TRLBAR|XFILE),
EX(CMD_lwindow, "lwindow", ex_cwindow, EX(CMD_lwindow, "lwindow", ex_cwindow,
RANGE|NOTADR|COUNT|TRLBAR), RANGE|NOTADR|COUNT|TRLBAR),
EX(CMD_ls, "ls", buflist_list, EX(CMD_ls, "ls", buflist_list,
@ -974,9 +974,9 @@ EX(CMD_visual, "visual", ex_edit,
EX(CMD_view, "view", ex_edit, EX(CMD_view, "view", ex_edit,
BANG|FILE1|EDITCMD|ARGOPT|TRLBAR), BANG|FILE1|EDITCMD|ARGOPT|TRLBAR),
EX(CMD_vimgrep, "vimgrep", ex_vimgrep, EX(CMD_vimgrep, "vimgrep", ex_vimgrep,
BANG|NEEDARG|EXTRA|NOTRLCOM|TRLBAR|XFILE), RANGE|NOTADR|BANG|NEEDARG|EXTRA|NOTRLCOM|TRLBAR|XFILE),
EX(CMD_vimgrepadd, "vimgrepadd", ex_vimgrep, EX(CMD_vimgrepadd, "vimgrepadd", ex_vimgrep,
BANG|NEEDARG|EXTRA|NOTRLCOM|TRLBAR|XFILE), RANGE|NOTADR|BANG|NEEDARG|EXTRA|NOTRLCOM|TRLBAR|XFILE),
EX(CMD_viusage, "viusage", ex_viusage, EX(CMD_viusage, "viusage", ex_viusage,
TRLBAR), TRLBAR),
EX(CMD_vmap, "vmap", ex_map, EX(CMD_vmap, "vmap", ex_map,

View File

@ -2612,9 +2612,10 @@ cmd_source(fname, eap)
if (*fname == NUL) if (*fname == NUL)
EMSG(_(e_argreq)); EMSG(_(e_argreq));
/* ":source!" read vi commands */
else if (eap != NULL && eap->forceit) else if (eap != NULL && eap->forceit)
/* Need to execute the commands directly when: /* ":source!": read Normal mdoe commands
* Need to execute the commands directly. This is required at least
* for:
* - ":g" command busy * - ":g" command busy
* - after ":argdo", ":windo" or ":bufdo" * - after ":argdo", ":windo" or ":bufdo"
* - another command follows * - another command follows
@ -2768,6 +2769,10 @@ do_source(fname, check_other, is_vimrc)
goto theend; goto theend;
} }
#ifdef FEAT_AUTOCMD
apply_autocmds(EVENT_SOURCEPRE, fname_exp, fname_exp, FALSE, curbuf);
#endif
#if defined(WIN32) && defined(FEAT_CSCOPE) #if defined(WIN32) && defined(FEAT_CSCOPE)
cookie.fp = fopen_noinh_readbin((char *)fname_exp); cookie.fp = fopen_noinh_readbin((char *)fname_exp);
#else #else

View File

@ -103,6 +103,7 @@ static void set_expand_context __ARGS((expand_T *xp));
static int ExpandFromContext __ARGS((expand_T *xp, char_u *, int *, char_u ***, int)); static int ExpandFromContext __ARGS((expand_T *xp, char_u *, int *, char_u ***, int));
static int expand_showtail __ARGS((expand_T *xp)); static int expand_showtail __ARGS((expand_T *xp));
#ifdef FEAT_CMDL_COMPL #ifdef FEAT_CMDL_COMPL
static int expand_shellcmd __ARGS((char_u *filepat, int *num_file, char_u ***file, int flagsarg));
static int ExpandRTDir __ARGS((char_u *pat, int *num_file, char_u ***file, char *dirname)); static int ExpandRTDir __ARGS((char_u *pat, int *num_file, char_u ***file, char *dirname));
# if defined(FEAT_USR_CMDS) && defined(FEAT_EVAL) # if defined(FEAT_USR_CMDS) && defined(FEAT_EVAL)
static int ExpandUserDefined __ARGS((expand_T *xp, regmatch_T *regmatch, int *num_file, char_u ***file)); static int ExpandUserDefined __ARGS((expand_T *xp, regmatch_T *regmatch, int *num_file, char_u ***file));
@ -4180,93 +4181,6 @@ ExpandFromContext(xp, pat, num_file, file, options)
return ret; return ret;
} }
if (xp->xp_context == EXPAND_SHELLCMD)
{
/*
* Expand shell command.
*/
int i;
char_u *path;
int mustfree = FALSE;
garray_T ga;
char_u *buf = alloc(MAXPATHL);
int l;
char_u *s, *e;
if (buf == NULL)
return FAIL;
/* for ":set path=" and ":set tags=" halve backslashes for escaped
* space */
pat = vim_strsave(pat);
for (i = 0; pat[i]; ++i)
if (pat[i] == '\\' && pat[i + 1] == ' ')
STRCPY(pat + i, pat + i + 1);
flags |= EW_FILE | EW_EXEC;
/* For an absolute name we don't use $PATH. */
if ((pat[0] == '.' && (vim_ispathsep(pat[1])
|| (pat[1] == '.' && vim_ispathsep(pat[2])))))
path = (char_u *)".";
else
path = vim_getenv((char_u *)"PATH", &mustfree);
ga_init2(&ga, (int)sizeof(char *), 10);
for (s = path; *s != NUL; s = e)
{
#if defined(MSDOS) || defined(MSWIN) || defined(OS2)
e = vim_strchr(s, ';');
#else
e = vim_strchr(s, ':');
#endif
if (e == NULL)
e = s + STRLEN(s);
l = e - s;
if (l > MAXPATHL - 5)
break;
vim_strncpy(buf, s, l);
add_pathsep(buf);
l = STRLEN(buf);
vim_strncpy(buf + l, pat, MAXPATHL - 1 - l);
/* Expand matches in one directory of $PATH. */
ret = expand_wildcards(1, &buf, num_file, file, flags);
if (ret == OK)
{
if (ga_grow(&ga, *num_file) == FAIL)
FreeWild(*num_file, *file);
else
{
for (i = 0; i < *num_file; ++i)
{
s = (*file)[i];
if (STRLEN(s) > l)
{
/* Remove the path again. */
mch_memmove(s, s + l, STRLEN(s + l) + 1);
((char_u **)ga.ga_data)[ga.ga_len] = s;
++ga.ga_len;
}
else
vim_free(s);
}
vim_free(*file);
}
}
if (*e != NUL)
++e;
}
*file = ga.ga_data;
*num_file = ga.ga_len;
vim_free(buf);
vim_free(pat);
if (mustfree)
vim_free(path);
return ret;
}
*file = (char_u **)""; *file = (char_u **)"";
*num_file = 0; *num_file = 0;
if (xp->xp_context == EXPAND_HELP) if (xp->xp_context == EXPAND_HELP)
@ -4284,6 +4198,8 @@ ExpandFromContext(xp, pat, num_file, file, options)
#ifndef FEAT_CMDL_COMPL #ifndef FEAT_CMDL_COMPL
return FAIL; return FAIL;
#else #else
if (xp->xp_context == EXPAND_SHELLCMD)
return expand_shellcmd(pat, num_file, file, flags);
if (xp->xp_context == EXPAND_OLD_SETTING) if (xp->xp_context == EXPAND_OLD_SETTING)
return ExpandOldSetting(num_file, file); return ExpandOldSetting(num_file, file);
if (xp->xp_context == EXPAND_BUFFERS) if (xp->xp_context == EXPAND_BUFFERS)
@ -4457,6 +4373,107 @@ ExpandGeneric(xp, regmatch, num_file, file, func)
return OK; return OK;
} }
/*
* Complete a shell command.
* Returns FAIL or OK;
*/
static int
expand_shellcmd(filepat, num_file, file, flagsarg)
char_u *filepat; /* pattern to match with command names */
int *num_file; /* return: number of matches */
char_u ***file; /* return: array with matches */
int flagsarg; /* EW_ flags */
{
char_u *pat;
int i;
char_u *path;
int mustfree = FALSE;
garray_T ga;
char_u *buf = alloc(MAXPATHL);
size_t l;
char_u *s, *e;
int flags = flagsarg;
int ret;
if (buf == NULL)
return FAIL;
/* for ":set path=" and ":set tags=" halve backslashes for escaped
* space */
pat = vim_strsave(filepat);
for (i = 0; pat[i]; ++i)
if (pat[i] == '\\' && pat[i + 1] == ' ')
STRCPY(pat + i, pat + i + 1);
flags |= EW_FILE | EW_EXEC;
/* For an absolute name we don't use $PATH. */
if ((pat[0] == '.' && (vim_ispathsep(pat[1])
|| (pat[1] == '.' && vim_ispathsep(pat[2])))))
path = (char_u *)".";
else
path = vim_getenv((char_u *)"PATH", &mustfree);
/*
* Go over all directories in $PATH. Expand matches in that directory and
* collect them in "ga".
*/
ga_init2(&ga, (int)sizeof(char *), 10);
for (s = path; *s != NUL; s = e)
{
#if defined(MSDOS) || defined(MSWIN) || defined(OS2)
e = vim_strchr(s, ';');
#else
e = vim_strchr(s, ':');
#endif
if (e == NULL)
e = s + STRLEN(s);
l = e - s;
if (l > MAXPATHL - 5)
break;
vim_strncpy(buf, s, l);
add_pathsep(buf);
l = STRLEN(buf);
vim_strncpy(buf + l, pat, MAXPATHL - 1 - l);
/* Expand matches in one directory of $PATH. */
ret = expand_wildcards(1, &buf, num_file, file, flags);
if (ret == OK)
{
if (ga_grow(&ga, *num_file) == FAIL)
FreeWild(*num_file, *file);
else
{
for (i = 0; i < *num_file; ++i)
{
s = (*file)[i];
if (STRLEN(s) > l)
{
/* Remove the path again. */
mch_memmove(s, s + l, STRLEN(s + l) + 1);
((char_u **)ga.ga_data)[ga.ga_len++] = s;
}
else
vim_free(s);
}
vim_free(*file);
}
}
if (*e != NUL)
++e;
}
*file = ga.ga_data;
*num_file = ga.ga_len;
vim_free(buf);
vim_free(pat);
if (mustfree)
vim_free(path);
return OK;
}
# if defined(FEAT_USR_CMDS) && defined(FEAT_EVAL) # if defined(FEAT_USR_CMDS) && defined(FEAT_EVAL)
static void * call_user_expand_func __ARGS((void *(*user_expand_func) __ARGS((char_u *, int, char_u **, int)), expand_T *xp, int *num_file, char_u ***file)); static void * call_user_expand_func __ARGS((void *(*user_expand_func) __ARGS((char_u *, int, char_u **, int)), expand_T *xp, int *num_file, char_u ***file));

View File

@ -8938,6 +8938,7 @@ expand_backtick(gap, pat, flags)
* Add a file to a file list. Accepted flags: * Add a file to a file list. Accepted flags:
* EW_DIR add directories * EW_DIR add directories
* EW_FILE add files * EW_FILE add files
* EW_EXEC add executable files
* EW_NOTFOUND add even when it doesn't exist * EW_NOTFOUND add even when it doesn't exist
* EW_ADDSLASH add slash after directory name * EW_ADDSLASH add slash after directory name
*/ */
@ -8964,6 +8965,10 @@ addfile(gap, f, flags)
if ((isdir && !(flags & EW_DIR)) || (!isdir && !(flags & EW_FILE))) if ((isdir && !(flags & EW_DIR)) || (!isdir && !(flags & EW_FILE)))
return; return;
/* If the file isn't executable, may not add it. Do accept directories. */
if (!isdir && (flags & EW_EXEC) && !mch_can_exe(f))
return;
/* Make room for another item in the file list. */ /* Make room for another item in the file list. */
if (ga_grow(gap, 1) == FAIL) if (ga_grow(gap, 1) == FAIL)
return; return;

View File

@ -810,7 +810,6 @@ mch_mkdir(name)
UnLock(lock); UnLock(lock);
} }
#if defined(FEAT_EVAL) || defined(PROTO)
/* /*
* Return 1 if "name" can be executed, 0 if not. * Return 1 if "name" can be executed, 0 if not.
* Return -1 if unknown. * Return -1 if unknown.
@ -822,7 +821,6 @@ mch_can_exe(name)
/* TODO */ /* TODO */
return -1; return -1;
} }
#endif
/* /*
* Check what "name" is: * Check what "name" is:

View File

@ -2938,7 +2938,6 @@ mch_isdir(char_u *name)
return TRUE; return TRUE;
} }
#if defined(FEAT_EVAL) || defined(PROTO)
/* /*
* Return 1 if "name" can be executed, 0 if not. * Return 1 if "name" can be executed, 0 if not.
* Return -1 if unknown. * Return -1 if unknown.
@ -2954,7 +2953,6 @@ mch_can_exe(name)
return FALSE; return FALSE;
return TRUE; return TRUE;
} }
#endif
/* /*
* Check what "name" is: * Check what "name" is:

View File

@ -40,7 +40,8 @@ static int pum_col; /* left column of pum */
pum_display(array, size, selected, row, height, col) pum_display(array, size, selected, row, height, col)
pumitem_T *array; pumitem_T *array;
int size; int size;
int selected; /* index of initially selected item */ int selected; /* index of initially selected item, none if
out of range */
int row; int row;
int height; int height;
int col; int col;
@ -256,7 +257,7 @@ pum_get_selected()
/* /*
* Set the index of the currently selected item. The menu will scroll when * Set the index of the currently selected item. The menu will scroll when
* necessary. * necessary. When "n" is out of range don't scroll.
*/ */
void void
pum_set_selected(n) pum_set_selected(n)
@ -264,7 +265,7 @@ pum_set_selected(n)
{ {
pum_selected = n; pum_selected = n;
if (pum_selected >= 0) if (pum_selected >= 0 && pum_selected < pum_size)
{ {
if (pum_first > pum_selected - 4) if (pum_first > pum_selected - 4)
{ {

View File

@ -2905,6 +2905,7 @@ ex_vimgrep(eap)
char_u *au_name = NULL; char_u *au_name = NULL;
int flags = 0; int flags = 0;
colnr_T col; colnr_T col;
long tomatch;
switch (eap->cmdidx) switch (eap->cmdidx)
{ {
@ -2933,6 +2934,11 @@ ex_vimgrep(eap)
return; return;
} }
if (eap->addr_count > 0)
tomatch = eap->line2;
else
tomatch = MAXLNUM;
/* Get the search pattern: either white-separated or enclosed in // */ /* Get the search pattern: either white-separated or enclosed in // */
regmatch.regprog = NULL; regmatch.regprog = NULL;
p = skip_vimgrep_pat(eap->arg, &s, &flags); p = skip_vimgrep_pat(eap->arg, &s, &flags);
@ -2975,7 +2981,7 @@ ex_vimgrep(eap)
} }
seconds = (time_t)0; seconds = (time_t)0;
for (fi = 0; fi < fcount && !got_int; ++fi) for (fi = 0; fi < fcount && !got_int && tomatch > 0; ++fi)
{ {
if (time(NULL) > seconds) if (time(NULL) > seconds)
{ {
@ -3035,7 +3041,8 @@ ex_vimgrep(eap)
{ {
found_match = FALSE; found_match = FALSE;
/* Try for a match in all lines of the buffer. */ /* Try for a match in all lines of the buffer. */
for (lnum = 1; lnum <= buf->b_ml.ml_line_count; ++lnum) for (lnum = 1; lnum <= buf->b_ml.ml_line_count && tomatch > 0;
++lnum)
{ {
/* For ":1vimgrep" look for multiple matches. */ /* For ":1vimgrep" look for multiple matches. */
col = 0; col = 0;
@ -3059,8 +3066,9 @@ ex_vimgrep(eap)
got_int = TRUE; got_int = TRUE;
break; break;
} }
else found_match = TRUE;
found_match = TRUE; if (--tomatch == 0)
break;
if ((flags & VGR_GLOBAL) == 0 if ((flags & VGR_GLOBAL) == 0
|| regmatch.endpos[0].lnum > 0) || regmatch.endpos[0].lnum > 0)
break; break;

View File

@ -36,5 +36,5 @@
#define VIM_VERSION_NODOT "vim70aa" #define VIM_VERSION_NODOT "vim70aa"
#define VIM_VERSION_SHORT "7.0aa" #define VIM_VERSION_SHORT "7.0aa"
#define VIM_VERSION_MEDIUM "7.0aa ALPHA" #define VIM_VERSION_MEDIUM "7.0aa ALPHA"
#define VIM_VERSION_LONG "VIM - Vi IMproved 7.0aa ALPHA (2006 Mar 6)" #define VIM_VERSION_LONG "VIM - Vi IMproved 7.0aa ALPHA (2006 Mar 7)"
#define VIM_VERSION_LONG_DATE "VIM - Vi IMproved 7.0aa ALPHA (2006 Mar 6, compiled " #define VIM_VERSION_LONG_DATE "VIM - Vi IMproved 7.0aa ALPHA (2006 Mar 7, compiled "