Merge remote-tracking branch 'vim/master'

This commit is contained in:
Kazuki Sakamoto
2016-11-12 20:23:57 -08:00
17 changed files with 219 additions and 244 deletions
+1 -1
View File
@@ -207,7 +207,7 @@ SRC_UNIX = \
src/config.mk.dist \
src/config.mk.in \
src/configure \
src/configure.in \
src/configure.ac \
src/gui_at_fs.c \
src/gui_at_sb.c \
src/gui_at_sb.h \
+2 -2
View File
@@ -221,8 +221,8 @@ diffs or instructions to the address given in the `README' so they can
be considered for the next release. If at some point `config.cache'
contains results you don't want to keep, you may remove or edit it.
The file `configure.in' is used to create `configure' by a program
called `autoconf'. You only need `configure.in' if you want to change
The file `configure.ac' is used to create `configure' by a program
called `autoconf'. You only need `configure.ac' if you want to change
it or regenerate `configure' using a newer version of `autoconf'.
The simplest way to compile this package is:
+3 -3
View File
@@ -690,8 +690,8 @@ SANITIZER_LIBS = $(SANITIZER_CFLAGS)
#####################################################
### Uncomment things here only if the values chosen by configure are wrong.
### It's better to adjust configure.in and "make autoconf", if you can!
### Then send the required changes to configure.in to the bugs list.
### It's better to adjust configure.ac and "make autoconf", if you can!
### Then send the required changes to configure.ac to the bugs list.
### (1) BSD/OS 2.0.1, 2.1 or 3.0 using shared libraries
###
@@ -1849,7 +1849,7 @@ reconfig: scratch clean
# - DO NOT RUN autoconf MANUALLY! It will overwrite ./configure instead of
# producing auto/configure.
# - autoconf is not run automatically, because a patch usually changes both
# configure.in and auto/configure but can't update the timestamps. People
# configure.ac and auto/configure but can't update the timestamps. People
# who do not have (the correct version of) autoconf would run into trouble.
#
# Two tricks are required to make autoconf put its output in the "auto" dir:
+1 -1
View File
@@ -38,7 +38,7 @@ typedef union {
/* MS-Windows is always little endian */
#else
# ifdef HAVE_CONFIG_H
/* in configure.in AC_C_BIGENDIAN() defines WORDS_BIGENDIAN when needed */
/* in configure.ac AC_C_BIGENDIAN() defines WORDS_BIGENDIAN when needed */
# else
error!
Please change this code to define WORDS_BIGENDIAN for big-endian machines.
+1 -1
View File
@@ -19,7 +19,7 @@
# define CH_HAS_GUI (gui.in_use || gui.starting)
#endif
/* Note: when making changes here also adjust configure.in. */
/* Note: when making changes here also adjust configure.ac. */
#ifdef WIN32
/* WinSock API is separated from C API, thus we can't use read(), write(),
* errno... */
+2 -2
View File
@@ -1,6 +1,6 @@
/*
* config.h.in. Generated automatically from configure.in by autoheader, and
* manually changed after that.
* config.h.in. Originally generated automatically from configure.ac by
* autoheader and manually changed after that.
*/
/* Define if we have EBCDIC code */
+1 -1
View File
@@ -1,4 +1,4 @@
dnl configure.in: autoconf script for Vim
dnl configure.ac: autoconf script for Vim
dnl Process this file with autoconf 2.12 or 2.13 to produce "configure".
dnl Should also work with autoconf 2.54 and later.
+4 -4
View File
@@ -391,10 +391,10 @@ EX(CMD_cquit, "cquit", ex_cquit,
EX(CMD_crewind, "crewind", ex_cc,
RANGE|NOTADR|COUNT|TRLBAR|BANG,
ADDR_LINES),
EX(CMD_cscope, "cscope", do_cscope,
EX(CMD_cscope, "cscope", ex_cscope,
EXTRA|NOTRLCOM|XFILE,
ADDR_LINES),
EX(CMD_cstag, "cstag", do_cstag,
EX(CMD_cstag, "cstag", ex_cstag,
BANG|TRLBAR|WORD1,
ADDR_LINES),
EX(CMD_cunmap, "cunmap", ex_unmap,
@@ -745,7 +745,7 @@ EX(CMD_lchdir, "lchdir", ex_cd,
EX(CMD_lclose, "lclose", ex_cclose,
RANGE|NOTADR|COUNT|TRLBAR,
ADDR_LINES),
EX(CMD_lcscope, "lcscope", do_cscope,
EX(CMD_lcscope, "lcscope", ex_cscope,
EXTRA|NOTRLCOM|XFILE,
ADDR_LINES),
EX(CMD_ldo, "ldo", ex_listdo,
@@ -1255,7 +1255,7 @@ EX(CMD_scriptnames, "scriptnames", ex_scriptnames,
EX(CMD_scriptencoding, "scriptencoding", ex_scriptencoding,
WORD1|TRLBAR|CMDWIN,
ADDR_LINES),
EX(CMD_scscope, "scscope", do_scscope,
EX(CMD_scscope, "scscope", ex_scscope,
EXTRA|NOTRLCOM,
ADDR_LINES),
EX(CMD_set, "set", ex_set,
+4 -4
View File
@@ -245,9 +245,9 @@ static void ex_popup(exarg_T *eap);
# define ex_helpfind ex_ni
#endif
#ifndef FEAT_CSCOPE
# define do_cscope ex_ni
# define do_scscope ex_ni
# define do_cstag ex_ni
# define ex_cscope ex_ni
# define ex_scscope ex_ni
# define ex_cstag ex_ni
#endif
#ifndef FEAT_SYN_HL
# define ex_syntax ex_ni
@@ -10454,7 +10454,7 @@ ex_tag_cmd(exarg_T *eap, char_u *name)
#ifdef FEAT_CSCOPE
if (p_cst && *eap->arg != NUL)
{
do_cstag(eap);
ex_cstag(eap);
return;
}
#endif
+33 -96
View File
@@ -201,8 +201,6 @@ set_context_in_cscope_cmd(
#endif /* FEAT_CMDL_COMPL */
/*
* PRIVATE: do_cscope_general
*
* Find the command, print help if invalid, and then call the corresponding
* command function.
*/
@@ -242,31 +240,28 @@ do_cscope_general(
}
/*
* PUBLIC: do_cscope
* Implementation of ":cscope" and ":lcscope"
*/
void
do_cscope(exarg_T *eap)
ex_cscope(exarg_T *eap)
{
do_cscope_general(eap, FALSE);
}
/*
* PUBLIC: do_scscope
*
* same as do_cscope, but splits window, too.
* Implementation of ":scscope". Same as ex_cscope(), but splits window, too.
*/
void
do_scscope(exarg_T *eap)
ex_scscope(exarg_T *eap)
{
do_cscope_general(eap, TRUE);
}
/*
* PUBLIC: do_cstag
*
* Implementation of ":cstag"
*/
void
do_cstag(exarg_T *eap)
ex_cstag(exarg_T *eap)
{
int ret = FALSE;
@@ -336,13 +331,11 @@ do_cstag(exarg_T *eap)
#endif
}
} /* do_cscope */
}
/*
* PUBLIC: cs_find
*
* this simulates a vim_fgets(), but for cscope, returns the next line
* This simulates a vim_fgets(), but for cscope, returns the next line
* from the cscope output. should only be called from find_tags()
*
* returns TRUE if eof, FALSE otherwise
@@ -361,9 +354,7 @@ cs_fgets(char_u *buf, int size)
/*
* PUBLIC: cs_free_tags
*
* called only from do_tag(), when popping the tag stack
* Called only from do_tag(), when popping the tag stack.
*/
void
cs_free_tags(void)
@@ -373,9 +364,7 @@ cs_free_tags(void)
/*
* PUBLIC: cs_print_tags
*
* called from do_tag()
* Called from do_tag().
*/
void
cs_print_tags(void)
@@ -467,12 +456,8 @@ cs_connection(int num, char_u *dbpath, char_u *ppath)
****************************************************************************/
/*
* PRIVATE: cs_add
*
* add cscope database or a directory name (to look for cscope.out)
* to the cscope connection list
*
* MAXPATHL 256
* Add cscope database or a directory name (to look for cscope.out)
* to the cscope connection list.
*/
static int
cs_add(exarg_T *eap UNUSED)
@@ -508,10 +493,8 @@ cs_stat_emsg(char *fname)
/*
* PRIVATE: cs_add_common
*
* the common routine to add a new cscope connection. called by
* cs_add() and cs_reset(). i really don't like to do this, but this
* The common routine to add a new cscope connection. Called by
* cs_add() and cs_reset(). I really don't like to do this, but this
* routine uses a number of goto statements.
*/
static int
@@ -666,9 +649,7 @@ cs_check_for_tags(void)
/*
* PRIVATE: cs_cnt_connections
*
* count the number of cscope connections
* Count the number of cscope connections.
*/
static int
cs_cnt_connections(void)
@@ -693,9 +674,7 @@ cs_reading_emsg(
#define CSREAD_BUFSIZE 2048
/*
* PRIVATE: cs_cnt_matches
*
* count the number of matches for a given cscope connection.
* Count the number of matches for a given cscope connection.
*/
static int
cs_cnt_matches(int idx)
@@ -754,8 +733,6 @@ cs_cnt_matches(int idx)
/*
* PRIVATE: cs_create_cmd
*
* Creates the actual cscope command query from what the user entered.
*/
static char *
@@ -817,8 +794,6 @@ cs_create_cmd(char *csoption, char *pattern)
/*
* PRIVATE: cs_create_connection
*
* This piece of code was taken/adapted from nvi. do we need to add
* the BSD license notice?
*/
@@ -1056,8 +1031,6 @@ err_closing:
/*
* PRIVATE: cs_find
*
* Query cscope using command line interface. Parse the output and use tselect
* to allow choices. Like Nvi, creates a pipe to send to/from query/cscope.
*
@@ -1102,9 +1075,7 @@ cs_find(exarg_T *eap)
/*
* PRIVATE: cs_find_common
*
* common code for cscope find, shared by cs_find() and do_cstag()
* Common code for cscope find, shared by cs_find() and ex_cstag().
*/
static int
cs_find_common(
@@ -1323,9 +1294,7 @@ cs_find_common(
} /* cs_find_common */
/*
* PRIVATE: cs_help
*
* print help
* Print help.
*/
static int
cs_help(exarg_T *eap UNUSED)
@@ -1408,9 +1377,7 @@ GetWin32Error(void)
#endif
/*
* PRIVATE: cs_insert_filelist
*
* insert a new cscope database filename into the filelist
* Insert a new cscope database filename into the filelist.
*/
static int
cs_insert_filelist(
@@ -1551,9 +1518,7 @@ cs_insert_filelist(
/*
* PRIVATE: cs_lookup_cmd
*
* find cscope command in command table
* Find cscope command in command table.
*/
static cscmd_T *
cs_lookup_cmd(exarg_T *eap)
@@ -1582,9 +1547,7 @@ cs_lookup_cmd(exarg_T *eap)
/*
* PRIVATE: cs_kill
*
* nuke em
* Nuke em.
*/
static int
cs_kill(exarg_T *eap UNUSED)
@@ -1639,8 +1602,6 @@ cs_kill(exarg_T *eap UNUSED)
/*
* PRIVATE: cs_kill_execute
*
* Actually kills a specific cscope connection.
*/
static void
@@ -1659,22 +1620,20 @@ cs_kill_execute(
/*
* PRIVATE: cs_make_vim_style_matches
*
* convert the cscope output into a ctags style entry (as might be found
* Convert the cscope output into a ctags style entry (as might be found
* in a ctags tags file). there's one catch though: cscope doesn't tell you
* the type of the tag you are looking for. for example, in Darren Hiebert's
* ctags (the one that comes with vim), #define's use a line number to find the
* tag in a file while function definitions use a regexp search pattern.
*
* i'm going to always use the line number because cscope does something
* I'm going to always use the line number because cscope does something
* quirky (and probably other things i don't know about):
*
* if you have "# define" in your source file, which is
* perfectly legal, cscope thinks you have "#define". this
* will result in a failed regexp search. :(
*
* besides, even if this particular case didn't happen, the search pattern
* Besides, even if this particular case didn't happen, the search pattern
* would still have to be modified to escape all the special regular expression
* characters to comply with ctags formatting.
*/
@@ -1721,9 +1680,7 @@ cs_make_vim_style_matches(
/*
* PRIVATE: cs_manage_matches
*
* this is kind of hokey, but i don't see an easy way round this..
* This is kind of hokey, but i don't see an easy way round this.
*
* Store: keep a ptr to the (malloc'd) memory of matches originally
* generated from cs_find(). the matches are originally lines directly
@@ -1801,9 +1758,7 @@ cs_manage_matches(
/*
* PRIVATE: cs_parse_results
*
* parse cscope output
* Parse cscope output.
*/
static char *
cs_parse_results(
@@ -1864,9 +1819,7 @@ cs_parse_results(
#ifdef FEAT_QUICKFIX
/*
* PRIVATE: cs_file_results
*
* write cscope find results to file
* Write cscope find results to file.
*/
static void
cs_file_results(FILE *f, int *nummatches_a)
@@ -1919,10 +1872,8 @@ cs_file_results(FILE *f, int *nummatches_a)
#endif
/*
* PRIVATE: cs_fill_results
*
* get parsed cscope output and calls cs_make_vim_style_matches to convert
* into ctags format
* Get parsed cscope output and calls cs_make_vim_style_matches to convert
* into ctags format.
* When there are no matches sets "*matches_p" to NULL.
*/
static void
@@ -2032,9 +1983,7 @@ cs_pathcomponents(char *path)
}
/*
* PRIVATE: cs_print_tags_priv
*
* called from cs_manage_matches()
* Called from cs_manage_matches().
*/
static void
cs_print_tags_priv(char **matches, char **cntxts, int num_matches)
@@ -2182,9 +2131,7 @@ cs_print_tags_priv(char **matches, char **cntxts, int num_matches)
/*
* PRIVATE: cs_read_prompt
*
* read a cscope prompt (basically, skip over the ">> ")
* Read a cscope prompt (basically, skip over the ">> ").
*/
static int
cs_read_prompt(int i)
@@ -2280,8 +2227,6 @@ sig_handler SIGDEFARG(sigarg)
#endif
/*
* PRIVATE: cs_release_csp
*
* Does the actual free'ing for the cs ptr with an optional flag of whether
* or not to free the filename. Called by cs_kill and cs_reset.
*/
@@ -2408,9 +2353,7 @@ cs_release_csp(int i, int freefnpp)
/*
* PRIVATE: cs_reset
*
* calls cs_kill on all cscope connections then reinits
* Calls cs_kill on all cscope connections then reinits.
*/
static int
cs_reset(exarg_T *eap UNUSED)
@@ -2474,8 +2417,6 @@ cs_reset(exarg_T *eap UNUSED)
/*
* PRIVATE: cs_resolve_file
*
* Construct the full pathname to a file found in the cscope database.
* (Prepends ppath, if there is one and if it's not already prepended,
* otherwise just uses the name found.)
@@ -2544,9 +2485,7 @@ cs_resolve_file(int i, char *name)
/*
* PRIVATE: cs_show
*
* show all cscope connections
* Show all cscope connections.
*/
static int
cs_show(exarg_T *eap UNUSED)
@@ -2579,8 +2518,6 @@ cs_show(exarg_T *eap UNUSED)
/*
* PUBLIC: cs_end
*
* Only called when VIM exits to quit any cscope sessions.
*/
void
+2 -2
View File
@@ -22,11 +22,11 @@
# A U T O C O N F
#
# Run autoconf when configure.in has been changed since it was last run.
# Run autoconf when configure.ac has been changed since it was last run.
# This is skipped when the signatures in "mysign" are up-to-date. When
# there is no autoconf program skip this (the signature is often the only
# thing that's outdated)
auto/configure {signfile = mysign} : configure.in
auto/configure {signfile = mysign} : configure.ac
@if not program_path("autoconf"):
:print Can't find autoconf, using existing configure script.
@else:
+1 -1
View File
@@ -1 +1 @@
=auto/configure-lastupdate=1178970549.78-@buildcheck=dfc15c059b7ce88a951584995c49a201=configure.in@md5=e0d6e9a7d7b986d63ce4e8e7362fd0b9
=auto/configure-lastupdate=1178970549.78-@buildcheck=dfc15c059b7ce88a951584995c49a201=configure.ac@md5=e0d6e9a7d7b986d63ce4e8e7362fd0b9
+1 -1
View File
@@ -265,7 +265,7 @@ static xsmp_config_T xsmp;
* that describe the signals. That is nearly what we want here. But
* autoconf does only check for sys_siglist (without the underscore), I
* do not want to change everything today.... jw.
* This is why AC_DECL_SYS_SIGLIST is commented out in configure.in
* This is why AC_DECL_SYS_SIGLIST is commented out in configure.ac.
*/
#endif
+3 -3
View File
@@ -1,9 +1,9 @@
/* if_cscope.c */
char_u *get_cscope_name(expand_T *xp, int idx);
void set_context_in_cscope_cmd(expand_T *xp, char_u *arg, cmdidx_T cmdidx);
void do_cscope(exarg_T *eap);
void do_scscope(exarg_T *eap);
void do_cstag(exarg_T *eap);
void ex_cscope(exarg_T *eap);
void ex_scscope(exarg_T *eap);
void ex_cstag(exarg_T *eap);
int cs_fgets(char_u *buf, int size);
void cs_free_tags(void);
void cs_print_tags(void);
+12 -5
View File
@@ -114,6 +114,8 @@ struct efm_S
int conthere; /* %> used */
};
static efm_T *fmt_start = NULL; /* cached across qf_parse_line() calls */
static int qf_init_ext(qf_info_T *qi, char_u *efile, buf_T *buf, typval_T *tv, char_u *errorformat, int newlist, linenr_T lnumfirst, linenr_T lnumlast, char_u *qf_title);
static void qf_store_title(qf_info_T *qi, char_u *title);
static void qf_new_list(qf_info_T *qi, char_u *qf_title);
@@ -389,6 +391,7 @@ free_efm_list(efm_T **efm_first)
vim_regfree(efm_ptr->prog);
vim_free(efm_ptr);
}
fmt_start = NULL;
}
/* Parse 'errorformat' option */
@@ -786,7 +789,6 @@ qf_parse_line(
qffields_T *fields)
{
efm_T *fmt_ptr;
static efm_T *fmt_start = NULL; /* cached across calls */
char_u *ptr;
int len;
int i;
@@ -1110,6 +1112,7 @@ qf_init_ext(
qffields_T fields = {NULL, NULL, 0, 0L, 0, FALSE, NULL, 0, 0, 0};
#ifdef FEAT_WINDOWS
qfline_T *old_last = NULL;
int adding = FALSE;
#endif
static efm_T *fmt_first = NULL;
char_u *efm;
@@ -1138,6 +1141,7 @@ qf_init_ext(
else if (qi->qf_lists[qi->qf_curlist].qf_count > 0)
{
/* Adding to existing list, use last entry. */
adding = TRUE;
old_last = qi->qf_lists[qi->qf_curlist].qf_last;
}
#endif
@@ -1264,10 +1268,13 @@ qf_init_ext(
}
EMSG(_(e_readerrf));
error2:
qf_free(qi, qi->qf_curlist);
qi->qf_listcount--;
if (qi->qf_curlist > 0)
--qi->qf_curlist;
if (!adding)
{
qf_free(qi, qi->qf_curlist);
qi->qf_listcount--;
if (qi->qf_curlist > 0)
--qi->qf_curlist;
}
qf_init_end:
if (state.fd != NULL)
fclose(state.fd);
+138 -117
View File
@@ -6,7 +6,7 @@ endif
set encoding=utf-8
function! s:setup_commands(cchar)
func s:setup_commands(cchar)
if a:cchar == 'c'
command! -nargs=* -bang Xlist <mods>clist<bang> <args>
command! -nargs=* Xgetexpr <mods>cgetexpr <args>
@@ -68,10 +68,10 @@ function! s:setup_commands(cchar)
let g:Xgetlist = function('getloclist', [0])
let g:Xsetlist = function('setloclist', [0])
endif
endfunction
endfunc
" Tests for the :clist and :llist commands
function XlistTests(cchar)
func XlistTests(cchar)
call s:setup_commands(a:cchar)
" With an empty list, command should return error
@@ -128,17 +128,17 @@ function XlistTests(cchar)
let l = split(result, "\n")
call assert_equal([' 2 Xtestfile1:1 col 3: Line1',
\ ' 3: non-error 2', ' 4 Xtestfile2:2 col 2: Line2'], l)
endfunction
endfunc
function Test_clist()
func Test_clist()
call XlistTests('c')
call XlistTests('l')
endfunction
endfunc
" Tests for the :colder, :cnewer, :lolder and :lnewer commands
" Note that this test assumes that a quickfix/location list is
" already set by the caller.
function XageTests(cchar)
func XageTests(cchar)
call s:setup_commands(a:cchar)
" Jumping to a non existent list should return error
@@ -171,20 +171,20 @@ function XageTests(cchar)
Xnewer 2
let l = g:Xgetlist()
call assert_equal('Line3', l[0].text)
endfunction
endfunc
function Test_cage()
func Test_cage()
let list = [{'bufnr': 1, 'lnum': 1}]
call setqflist(list)
call XageTests('c')
call setloclist(0, list)
call XageTests('l')
endfunction
endfunc
" Tests for the :cwindow, :lwindow :cclose, :lclose, :copen and :lopen
" commands
function XwindowTests(cchar)
func XwindowTests(cchar)
call s:setup_commands(a:cchar)
" Create a list with no valid entries
@@ -227,16 +227,16 @@ function XwindowTests(cchar)
" Calling cwindow should close the quickfix window with no valid errors
Xwindow
call assert_true(winnr('$') == 1)
endfunction
endfunc
function Test_cwindow()
func Test_cwindow()
call XwindowTests('c')
call XwindowTests('l')
endfunction
endfunc
" Tests for the :cfile, :lfile, :caddfile, :laddfile, :cgetfile and :lgetfile
" commands.
function XfileTests(cchar)
func XfileTests(cchar)
call s:setup_commands(a:cchar)
call writefile(['Xtestfile1:700:10:Line 700',
@@ -275,16 +275,16 @@ function XfileTests(cchar)
\ l[1].lnum == 333 && l[1].col == 88 && l[1].text ==# 'Line 333')
call delete('Xqftestfile1')
endfunction
endfunc
function Test_cfile()
func Test_cfile()
call XfileTests('c')
call XfileTests('l')
endfunction
endfunc
" Tests for the :cbuffer, :lbuffer, :caddbuffer, :laddbuffer, :cgetbuffer and
" :lgetbuffer commands.
function XbufferTests(cchar)
func XbufferTests(cchar)
call s:setup_commands(a:cchar)
enew!
@@ -316,26 +316,26 @@ function XbufferTests(cchar)
\ l[3].lnum == 750 && l[3].col == 25 && l[3].text ==# 'Line 750')
enew!
endfunction
endfunc
function Test_cbuffer()
func Test_cbuffer()
call XbufferTests('c')
call XbufferTests('l')
endfunction
endfunc
function XexprTests(cchar)
func XexprTests(cchar)
call s:setup_commands(a:cchar)
call assert_fails('Xexpr 10', 'E777:')
endfunction
endfunc
function Test_cexpr()
func Test_cexpr()
call XexprTests('c')
call XexprTests('l')
endfunction
endfunc
" Tests for :cnext, :cprev, :cfirst, :clast commands
function Xtest_browse(cchar)
func Xtest_browse(cchar)
call s:setup_commands(a:cchar)
call s:create_test_file('Xqftestfile1')
@@ -366,14 +366,14 @@ function Xtest_browse(cchar)
call delete('Xqftestfile1')
call delete('Xqftestfile2')
endfunction
endfunc
function Test_browse()
func Test_browse()
call Xtest_browse('c')
call Xtest_browse('l')
endfunction
endfunc
function Test_nomem()
func Test_nomem()
call test_alloc_fail(GetAllocId('qf_dirname_start'), 0, 0)
call assert_fails('vimgrep vim runtest.vim', 'E342:')
@@ -391,7 +391,7 @@ function Test_nomem()
endfunc
function! s:test_xhelpgrep(cchar)
func s:test_xhelpgrep(cchar)
call s:setup_commands(a:cchar)
Xhelpgrep quickfix
Xopen
@@ -403,9 +403,9 @@ function! s:test_xhelpgrep(cchar)
call assert_true(w:quickfix_title =~ title_text, w:quickfix_title)
" This wipes out the buffer, make sure that doesn't cause trouble.
Xclose
endfunction
endfunc
function Test_helpgrep()
func Test_helpgrep()
call s:test_xhelpgrep('c')
helpclose
call s:test_xhelpgrep('l')
@@ -443,7 +443,7 @@ func Test_vimgreptitle()
augroup! QfBufWinEnter
endfunc
function XqfTitleTests(cchar)
func XqfTitleTests(cchar)
call s:setup_commands(a:cchar)
Xgetexpr ['file:1:1:message']
@@ -462,16 +462,16 @@ function XqfTitleTests(cchar)
endif
call assert_equal(title, w:quickfix_title)
Xclose
endfunction
endfunc
" Tests for quickfix window's title
function Test_qf_title()
func Test_qf_title()
call XqfTitleTests('c')
call XqfTitleTests('l')
endfunction
endfunc
" Tests for 'errorformat'
function Test_efm()
func Test_efm()
let save_efm = &efm
set efm=%EEEE%m,%WWWW%m,%+CCCC%.%#,%-GGGG%.%#
cgetexpr ['WWWW', 'EEEE', 'CCCC']
@@ -484,7 +484,7 @@ function Test_efm()
let l = strtrans(string(map(getqflist(), '[v:val.text, v:val.valid]')))
call assert_equal("[['W', 1], ['ZZZZ', 0], ['E^@CCCC', 1], ['YYYY', 0]]", l)
let &efm = save_efm
endfunction
endfunc
" This will test for problems in quickfix:
" A. incorrectly copying location lists which caused the location list to show
@@ -495,7 +495,7 @@ endfunction
" window it belongs to.
"
" Set up the test environment:
function! ReadTestProtocol(name)
func ReadTestProtocol(name)
let base = substitute(a:name, '\v^test://(.*)%(\.[^.]+)?', '\1', '')
let word = substitute(base, '\v(.*)\..*', '\1', '')
@@ -514,9 +514,9 @@ function! ReadTestProtocol(name)
setl nomodifiable
setl readonly
exe 'doautocmd BufRead ' . substitute(a:name, '\v^test://(.*)', '\1', '')
endfunction
endfunc
function Test_locationlist()
func Test_locationlist()
enew
augroup testgroup
@@ -596,15 +596,15 @@ function Test_locationlist()
wincmd n | only
augroup! testgroup
endfunction
endfunc
function Test_locationlist_curwin_was_closed()
func Test_locationlist_curwin_was_closed()
augroup testgroup
au!
autocmd BufReadCmd test_curwin.txt call R(expand("<amatch>"))
augroup END
function! R(n)
func! R(n)
quit
endfunc
@@ -615,9 +615,9 @@ function Test_locationlist_curwin_was_closed()
call assert_fails('lrewind', 'E924:')
augroup! testgroup
endfunction
endfunc
function Test_locationlist_cross_tab_jump()
func Test_locationlist_cross_tab_jump()
call writefile(['loclistfoo'], 'loclistfoo')
call writefile(['loclistbar'], 'loclistbar')
set switchbuf=usetab
@@ -631,10 +631,10 @@ function Test_locationlist_cross_tab_jump()
set switchbuf&vim
call delete('loclistfoo')
call delete('loclistbar')
endfunction
endfunc
" More tests for 'errorformat'
function! Test_efm1()
func Test_efm1()
if !has('unix')
" The 'errorformat' setting is different on non-Unix systems.
" This test works only on Unix-like systems.
@@ -752,10 +752,10 @@ function! Test_efm1()
call delete('Xerrorfile1')
call delete('Xerrorfile2')
call delete('Xtestfile')
endfunction
endfunc
" Test for quickfix directory stack support
function! s:dir_stack_tests(cchar)
func s:dir_stack_tests(cchar)
call s:setup_commands(a:cchar)
let save_efm=&efm
@@ -797,10 +797,10 @@ function! s:dir_stack_tests(cchar)
call assert_equal(5, qf[11].lnum)
let &efm=save_efm
endfunction
endfunc
" Tests for %D and %X errorformat options
function! Test_efm_dirstack()
func Test_efm_dirstack()
" Create the directory stack and files
call mkdir('dir1')
call mkdir('dir1/a')
@@ -832,10 +832,10 @@ function! Test_efm_dirstack()
call delete('dir1', 'rf')
call delete('dir2', 'rf')
call delete('habits1.txt')
endfunction
endfunc
" Test for resync after continuing an ignored message
function! Xefm_ignore_continuations(cchar)
func Xefm_ignore_continuations(cchar)
call s:setup_commands(a:cchar)
let save_efm = &efm
@@ -850,15 +850,15 @@ function! Xefm_ignore_continuations(cchar)
call assert_equal([['resync', 1, 4, 'E']], l)
let &efm = save_efm
endfunction
endfunc
function! Test_efm_ignore_continuations()
func Test_efm_ignore_continuations()
call Xefm_ignore_continuations('c')
call Xefm_ignore_continuations('l')
endfunction
endfunc
" Tests for invalid error format specifies
function Xinvalid_efm_Tests(cchar)
func Xinvalid_efm_Tests(cchar)
call s:setup_commands(a:cchar)
let save_efm = &efm
@@ -891,17 +891,17 @@ function Xinvalid_efm_Tests(cchar)
call assert_fails('Xexpr ["Entering dir abc", "abc.txt:1:Hello world"]', 'E379:')
let &efm = save_efm
endfunction
endfunc
function Test_invalid_efm()
func Test_invalid_efm()
call Xinvalid_efm_Tests('c')
call Xinvalid_efm_Tests('l')
endfunction
endfunc
" TODO:
" Add tests for the following formats in 'errorformat'
" %r %O
function! Test_efm2()
func Test_efm2()
let save_efm = &efm
" Test for %s format in efm
@@ -987,19 +987,19 @@ function! Test_efm2()
call assert_equal('unittests/dbfacadeTest.py', bufname(l[4].bufnr))
let &efm = save_efm
endfunction
endfunc
function XquickfixChangedByAutocmd(cchar)
func XquickfixChangedByAutocmd(cchar)
call s:setup_commands(a:cchar)
if a:cchar == 'c'
let ErrorNr = 'E925'
function! ReadFunc()
func! ReadFunc()
colder
cgetexpr []
endfunc
else
let ErrorNr = 'E926'
function! ReadFunc()
func! ReadFunc()
lolder
lgetexpr []
endfunc
@@ -1022,10 +1022,10 @@ function XquickfixChangedByAutocmd(cchar)
augroup! testgroup
endfunc
function Test_quickfix_was_changed_by_autocmd()
func Test_quickfix_was_changed_by_autocmd()
call XquickfixChangedByAutocmd('c')
call XquickfixChangedByAutocmd('l')
endfunction
endfunc
func Test_caddbuffer_to_empty()
helpgr quickfix
@@ -1047,7 +1047,7 @@ func Test_cgetexpr_works()
endfunc
" Tests for the setqflist() and setloclist() functions
function SetXlistTests(cchar, bnum)
func SetXlistTests(cchar, bnum)
call s:setup_commands(a:cchar)
call g:Xsetlist([{'bufnr': a:bnum, 'lnum': 1},
@@ -1082,9 +1082,9 @@ function SetXlistTests(cchar, bnum)
call g:Xsetlist([])
let l = g:Xgetlist()
call assert_equal(0, len(l))
endfunction
endfunc
function Test_setqflist()
func Test_setqflist()
new Xtestfile | only
let bnum = bufnr('%')
call setline(1, range(1,5))
@@ -1094,9 +1094,9 @@ function Test_setqflist()
enew!
call delete('Xtestfile')
endfunction
endfunc
function Xlist_empty_middle(cchar)
func Xlist_empty_middle(cchar)
call s:setup_commands(a:cchar)
" create three quickfix lists
@@ -1119,12 +1119,12 @@ function Xlist_empty_middle(cchar)
call assert_equal(matchlen, len(g:Xgetlist()))
endfunc
function Test_setqflist_empty_middle()
func Test_setqflist_empty_middle()
call Xlist_empty_middle('c')
call Xlist_empty_middle('l')
endfunction
endfunc
function Xlist_empty_older(cchar)
func Xlist_empty_older(cchar)
call s:setup_commands(a:cchar)
" create three quickfix lists
@@ -1145,14 +1145,14 @@ function Xlist_empty_older(cchar)
call assert_equal(twolen, len(g:Xgetlist()))
Xnewer
call assert_equal(threelen, len(g:Xgetlist()))
endfunction
endfunc
function Test_setqflist_empty_older()
func Test_setqflist_empty_older()
call Xlist_empty_older('c')
call Xlist_empty_older('l')
endfunction
endfunc
function! XquickfixSetListWithAct(cchar)
func XquickfixSetListWithAct(cchar)
call s:setup_commands(a:cchar)
let list1 = [{'filename': 'fnameA', 'text': 'A'},
@@ -1226,12 +1226,12 @@ function! XquickfixSetListWithAct(cchar)
call assert_fails("call g:Xsetlist(list1, 0)", 'E928:')
endfunc
function Test_quickfix_set_list_with_act()
func Test_quickfix_set_list_with_act()
call XquickfixSetListWithAct('c')
call XquickfixSetListWithAct('l')
endfunction
endfunc
function XLongLinesTests(cchar)
func XLongLinesTests(cchar)
let l = g:Xgetlist()
call assert_equal(4, len(l))
@@ -1249,9 +1249,9 @@ function XLongLinesTests(cchar)
call assert_equal(10, len(l[3].text))
call g:Xsetlist([], 'r')
endfunction
endfunc
function s:long_lines_tests(cchar)
func s:long_lines_tests(cchar)
call s:setup_commands(a:cchar)
let testfile = 'samples/quickfix.txt'
@@ -1272,22 +1272,22 @@ function s:long_lines_tests(cchar)
exe 'edit' testfile
exe 'Xbuffer' bufnr('%')
call XLongLinesTests(a:cchar)
endfunction
endfunc
function Test_long_lines()
func Test_long_lines()
call s:long_lines_tests('c')
call s:long_lines_tests('l')
endfunction
endfunc
function! s:create_test_file(filename)
func s:create_test_file(filename)
let l = []
for i in range(1, 20)
call add(l, 'Line' . i)
endfor
call writefile(l, a:filename)
endfunction
endfunc
function! Test_switchbuf()
func Test_switchbuf()
call s:create_test_file('Xqftestfile1')
call s:create_test_file('Xqftestfile2')
call s:create_test_file('Xqftestfile3')
@@ -1374,9 +1374,9 @@ function! Test_switchbuf()
call delete('Xqftestfile1')
call delete('Xqftestfile2')
call delete('Xqftestfile3')
endfunction
endfunc
function! Xadjust_qflnum(cchar)
func Xadjust_qflnum(cchar)
call s:setup_commands(a:cchar)
enew | only
@@ -1401,17 +1401,17 @@ function! Xadjust_qflnum(cchar)
enew!
call delete(fname)
endfunction
endfunc
function! Test_adjust_lnum()
func Test_adjust_lnum()
call setloclist(0, [])
call Xadjust_qflnum('c')
call setqflist([])
call Xadjust_qflnum('l')
endfunction
endfunc
" Tests for the :grep/:lgrep and :grepadd/:lgrepadd commands
function! s:test_xgrep(cchar)
func s:test_xgrep(cchar)
call s:setup_commands(a:cchar)
" The following lines are used for the grep test. Don't remove.
@@ -1430,9 +1430,9 @@ function! s:test_xgrep(cchar)
set makeef=Temp_File_##
silent Xgrepadd GrepAdd_Test_Text: test_quickfix.vim
call assert_true(len(g:Xgetlist()) == 6)
endfunction
endfunc
function! Test_grep()
func Test_grep()
if !has('unix')
" The grepprg may not be set on non-Unix systems
return
@@ -1440,9 +1440,9 @@ function! Test_grep()
call s:test_xgrep('c')
call s:test_xgrep('l')
endfunction
endfunc
function! Test_two_windows()
func Test_two_windows()
" Use one 'errorformat' for two windows. Add an expression to each of them,
" make sure they each keep their own state.
set efm=%DEntering\ dir\ '%f',%f:%l:%m,%XLeaving\ dir\ '%f'
@@ -1483,7 +1483,7 @@ function! Test_two_windows()
call delete('Xtwo', 'rf')
endfunc
function XbottomTests(cchar)
func XbottomTests(cchar)
call s:setup_commands(a:cchar)
call g:Xsetlist([{'filename': 'foo', 'lnum': 42}])
@@ -1499,12 +1499,12 @@ function XbottomTests(cchar)
endfunc
" Tests for the :cbottom and :lbottom commands
function Test_cbottom()
func Test_cbottom()
call XbottomTests('c')
call XbottomTests('l')
endfunction
endfunc
function HistoryTest(cchar)
func HistoryTest(cchar)
call s:setup_commands(a:cchar)
call assert_fails(a:cchar . 'older 99', 'E380:')
@@ -1544,7 +1544,7 @@ func Test_duplicate_buf()
endfunc
" Quickfix/Location list set/get properties tests
function Xproperty_tests(cchar)
func Xproperty_tests(cchar)
call s:setup_commands(a:cchar)
" Error cases
@@ -1590,19 +1590,19 @@ function Xproperty_tests(cchar)
if a:cchar == 'l'
call assert_equal({}, getloclist(99, {'title': 1}))
endif
endfunction
endfunc
function Test_qf_property()
func Test_qf_property()
call Xproperty_tests('c')
call Xproperty_tests('l')
endfunction
endfunc
" Tests for the QuickFixCmdPre/QuickFixCmdPost autocommands
function QfAutoCmdHandler(loc, cmd)
func QfAutoCmdHandler(loc, cmd)
call add(g:acmds, a:loc . a:cmd)
endfunction
endfunc
function Test_Autocmd()
func Test_Autocmd()
autocmd QuickFixCmdPre * call QfAutoCmdHandler('pre', expand('<amatch>'))
autocmd QuickFixCmdPost * call QfAutoCmdHandler('post', expand('<amatch>'))
@@ -1630,9 +1630,9 @@ function Test_Autocmd()
\ 'precaddbuffer',
\ 'postcaddbuffer']
call assert_equal(l, g:acmds)
endfunction
endfunc
function! Test_Autocmd_Exception()
func Test_Autocmd_Exception()
set efm=%m
lgetexpr '?'
@@ -1647,4 +1647,25 @@ function! Test_Autocmd_Exception()
call assert_equal('1', getloclist(0)[0].text)
set efm&vim
endfunction
endfunc
func Test_caddbuffer_wrong()
" This used to cause a memory access in freed memory.
let save_efm = &efm
set efm=%EEEE%m,%WWWW,%+CCCC%>%#,%GGGG%.#
cgetexpr ['WWWW', 'EEEE', 'CCCC']
let &efm = save_efm
caddbuffer
bwipe!
endfunc
func Test_caddexpr_wrong()
" This used to cause a memory access in freed memory.
cbuffer
cbuffer
copen
let save_efm = &efm
set efm=%
call assert_fails('caddexpr ""', 'E376:')
let &efm = save_efm
endfunc
+10
View File
@@ -779,6 +779,16 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
82,
/**/
81,
/**/
80,
/**/
79,
/**/
78,
/**/
77,
/**/