Compare commits

...

9 Commits

Author SHA1 Message Date
Bram Moolenaar
0b2eef24bc patch 8.0.0682: no test for synIDtrans()
Problem:    No test for synIDtrans().
Solution:   Add a test. (Dominique Pelle, closes #1796)
2017-06-27 15:43:49 +02:00
Bram Moolenaar
18d90b95c4 patch 8.0.0681: unnamed register only contains the last deleted text
Problem:    Unnamed register only contains the last deleted text when
            appending deleted text to a register. (Wolfgang Jeltsch)
Solution:   Only set y_previous when not using y_append. (Christian Brabandt)
2017-06-27 15:39:14 +02:00
Bram Moolenaar
07ecfa64a1 patch 8.0.0680: plugins in start packages are sourced twice
Problem:    Plugins in start packages are sourced twice. (mseplowitz)
Solution:   Use the unmodified runtime path when loading plugins (test by Ingo
            Karkat, closes #1801)
2017-06-27 14:43:55 +02:00
Bram Moolenaar
41cc038ff8 patch 8.0.0679: using freed memory
Problem:    Using freed memory.
Solution:   Get the parent frame pointer earlier.
2017-06-26 09:59:35 +02:00
Bram Moolenaar
8eeeba8c02 patch 8.0.0678: closing a window does not trigger resizing
Problem:    When 'equalalways' is set and closing a window in a separate
            frame, not all window sizes are adjusted. (Glacambre)
Solution:   Resize all windows if the new current window is not in the same
            frame as the closed window. (closes #1707)
2017-06-25 22:45:39 +02:00
Bram Moolenaar
1814183b86 patch 8.0.0677: setting 'filetype' may switch buffers
Problem:    Setting 'filetype' internally may cause the current buffer and
            window to change unexpectedly.
Solution:   Set curbuf_lock. (closes #1734)
2017-06-25 21:17:25 +02:00
Bram Moolenaar
182a17b1e8 patch 8.0.0676: crash when closing quickfix window in autocmd
Problem:    Crash when closing the quickfix window in a FileType autocommand
            that triggers when the quickfix window is opened.
Solution:   Save the new value before triggering the OptionSet autocommand.
            Add the "starting" flag to test_override() to make the text work.
2017-06-25 20:57:18 +02:00
Bram Moolenaar
774e5a9673 patch 8.0.0675: 'colorcolumn' has a higher priority than 'hlsearch'
Problem:    'colorcolumn' has a higher priority than 'hlsearch', it should be
            the other way around. (Nazri Ramliy)
Solution:   Change the priorities. (LemonBoy, closes #1794)
2017-06-25 18:03:37 +02:00
Bram Moolenaar
5d7be4f0fa patch 8.0.0674: cannot build with eval but without timers
Problem:    Cannot build with eval but without timers.
Solution:   Add #ifdef (John Marriott)
2017-06-25 13:40:17 +02:00
19 changed files with 307 additions and 67 deletions

View File

@@ -1,4 +1,4 @@
*eval.txt* For Vim version 8.0. Last change: 2017 Jun 24 *eval.txt* For Vim version 8.0. Last change: 2017 Jun 25
VIM REFERENCE MANUAL by Bram Moolenaar VIM REFERENCE MANUAL by Bram Moolenaar
@@ -7942,8 +7942,19 @@ test_override({name}, {val}) *test_override()*
name effect when {val} is non-zero ~ name effect when {val} is non-zero ~
redraw disable the redrawing() function redraw disable the redrawing() function
char_avail disable the char_avail() function char_avail disable the char_avail() function
starting reset the "starting" variable, see below
ALL clear all overrides ({val} is not used) ALL clear all overrides ({val} is not used)
"starting" is to be used when a test should behave like
startup was done. Since the tests are run by sourcing a
script the "starting" variable is non-zero. This is usually a
good thing (tests run faster), but sometimes changes behavior
in a way that the test doesn't work properly.
When using: >
call test_override('starting', 1)
< The value of "starting" is saved. It is restored by: >
call test_override('starting', 0)
test_settime({expr}) *test_settime()* test_settime({expr}) *test_settime()*
Set the time Vim uses internally. Currently only used for Set the time Vim uses internally. Currently only used for
timestamps in the history, as they are used in viminfo, and timestamps in the history, as they are used in viminfo, and

View File

@@ -3191,7 +3191,11 @@ f_feedkeys(typval_T *argvars, typval_T *rettv UNUSED)
ins_typebuf(keys_esc, (remap ? REMAP_YES : REMAP_NONE), ins_typebuf(keys_esc, (remap ? REMAP_YES : REMAP_NONE),
insert ? 0 : typebuf.tb_len, !typed, FALSE); insert ? 0 : typebuf.tb_len, !typed, FALSE);
vim_free(keys_esc); vim_free(keys_esc);
if (vgetc_busy || timer_busy) if (vgetc_busy
#ifdef FEAT_TIMERS
|| timer_busy
#endif
)
typebuf_was_filled = TRUE; typebuf_was_filled = TRUE;
if (execute) if (execute)
{ {
@@ -12394,6 +12398,7 @@ f_test_override(typval_T *argvars, typval_T *rettv UNUSED)
{ {
char_u *name = (char_u *)""; char_u *name = (char_u *)"";
int val; int val;
static int save_starting = -1;
if (argvars[0].v_type != VAR_STRING if (argvars[0].v_type != VAR_STRING
|| (argvars[1].v_type) != VAR_NUMBER) || (argvars[1].v_type) != VAR_NUMBER)
@@ -12407,10 +12412,29 @@ f_test_override(typval_T *argvars, typval_T *rettv UNUSED)
disable_redraw_for_testing = val; disable_redraw_for_testing = val;
else if (STRCMP(name, (char_u *)"char_avail") == 0) else if (STRCMP(name, (char_u *)"char_avail") == 0)
disable_char_avail_for_testing = val; disable_char_avail_for_testing = val;
else if (STRCMP(name, (char_u *)"starting") == 0)
{
if (val)
{
if (save_starting < 0)
save_starting = starting;
starting = 0;
}
else
{
starting = save_starting;
save_starting = -1;
}
}
else if (STRCMP(name, (char_u *)"ALL") == 0) else if (STRCMP(name, (char_u *)"ALL") == 0)
{ {
disable_char_avail_for_testing = FALSE; disable_char_avail_for_testing = FALSE;
disable_redraw_for_testing = FALSE; disable_redraw_for_testing = FALSE;
if (save_starting >= 0)
{
starting = save_starting;
save_starting = -1;
}
} }
else else
EMSG2(_(e_invarg2), name); EMSG2(_(e_invarg2), name);

View File

@@ -6835,7 +6835,11 @@ fix_help_buffer(void)
#ifdef FEAT_AUTOCMD #ifdef FEAT_AUTOCMD
/* Set filetype to "help" if still needed. */ /* Set filetype to "help" if still needed. */
if (STRCMP(curbuf->b_p_ft, "help") != 0) if (STRCMP(curbuf->b_p_ft, "help") != 0)
{
++curbuf_lock;
set_option_value((char_u *)"ft", 0L, (char_u *)"help", OPT_LOCAL); set_option_value((char_u *)"ft", 0L, (char_u *)"help", OPT_LOCAL);
--curbuf_lock;
}
#endif #endif
#ifdef FEAT_SYN_HL #ifdef FEAT_SYN_HL

View File

@@ -3285,19 +3285,6 @@ source_callback(char_u *fname, void *cookie UNUSED)
(void)do_source(fname, FALSE, DOSO_NONE); (void)do_source(fname, FALSE, DOSO_NONE);
} }
/*
* Source the file "name" from all directories in 'runtimepath'.
* "name" can contain wildcards.
* When "flags" has DIP_ALL: source all files, otherwise only the first one.
*
* return FAIL when no file could be sourced, OK otherwise.
*/
int
source_runtime(char_u *name, int flags)
{
return do_in_runtimepath(name, flags, source_callback, NULL);
}
/* /*
* Find the file "name" in all directories in "path" and invoke * Find the file "name" in all directories in "path" and invoke
* "callback(fname, cookie)". * "callback(fname, cookie)".
@@ -3435,18 +3422,19 @@ do_in_path(
} }
/* /*
* Find "name" in 'runtimepath'. When found, invoke the callback function for * Find "name" in "path". When found, invoke the callback function for
* it: callback(fname, "cookie") * it: callback(fname, "cookie")
* When "flags" has DIP_ALL repeat for all matches, otherwise only the first * When "flags" has DIP_ALL repeat for all matches, otherwise only the first
* one is used. * one is used.
* Returns OK when at least one match found, FAIL otherwise. * Returns OK when at least one match found, FAIL otherwise.
* *
* If "name" is NULL calls callback for each entry in runtimepath. Cookie is * If "name" is NULL calls callback for each entry in "path". Cookie is
* passed by reference in this case, setting it to NULL indicates that callback * passed by reference in this case, setting it to NULL indicates that callback
* has done its job. * has done its job.
*/ */
int static int
do_in_runtimepath( do_in_path_and_pp(
char_u *path,
char_u *name, char_u *name,
int flags, int flags,
void (*callback)(char_u *fname, void *ck), void (*callback)(char_u *fname, void *ck),
@@ -3459,7 +3447,7 @@ do_in_runtimepath(
char *opt_dir = "pack/*/opt/*/%s"; char *opt_dir = "pack/*/opt/*/%s";
if ((flags & DIP_NORTP) == 0) if ((flags & DIP_NORTP) == 0)
done = do_in_path(p_rtp, name, flags, callback, cookie); done = do_in_path(path, name, flags, callback, cookie);
if ((done == FAIL || (flags & DIP_ALL)) && (flags & DIP_START)) if ((done == FAIL || (flags & DIP_ALL)) && (flags & DIP_START))
{ {
@@ -3486,6 +3474,42 @@ do_in_runtimepath(
return done; return done;
} }
/*
* Just like do_in_path_and_pp(), using 'runtimepath' for "path".
*/
int
do_in_runtimepath(
char_u *name,
int flags,
void (*callback)(char_u *fname, void *ck),
void *cookie)
{
return do_in_path_and_pp(p_rtp, name, flags, callback, cookie);
}
/*
* Source the file "name" from all directories in 'runtimepath'.
* "name" can contain wildcards.
* When "flags" has DIP_ALL: source all files, otherwise only the first one.
*
* return FAIL when no file could be sourced, OK otherwise.
*/
int
source_runtime(char_u *name, int flags)
{
return source_in_path(p_rtp, name, flags);
}
/*
* Just like source_runtime(), but use "path" instead of 'runtimepath'.
*/
int
source_in_path(char_u *path, char_u *name, int flags)
{
return do_in_path_and_pp(path, name, flags, source_callback, NULL);
}
/* /*
* Expand wildcards in "pat" and invoke do_source() for each match. * Expand wildcards in "pat" and invoke do_source() for each match.
*/ */

View File

@@ -6878,6 +6878,8 @@ open_cmdwin(void)
# ifdef FEAT_AUTOCMD # ifdef FEAT_AUTOCMD
/* Do execute autocommands for setting the filetype (load syntax). */ /* Do execute autocommands for setting the filetype (load syntax). */
unblock_autocmds(); unblock_autocmds();
/* But don't allow switching to another buffer. */
++curbuf_lock;
# endif # endif
/* Showing the prompt may have set need_wait_return, reset it. */ /* Showing the prompt may have set need_wait_return, reset it. */
@@ -6893,6 +6895,9 @@ open_cmdwin(void)
} }
set_option_value((char_u *)"ft", 0L, (char_u *)"vim", OPT_LOCAL); set_option_value((char_u *)"ft", 0L, (char_u *)"vim", OPT_LOCAL);
} }
# ifdef FEAT_AUTOCMD
--curbuf_lock;
# endif
/* Reset 'textwidth' after setting 'filetype' (the Vim filetype plugin /* Reset 'textwidth' after setting 'filetype' (the Vim filetype plugin
* sets 'textwidth' to 78). */ * sets 'textwidth' to 78). */

View File

@@ -449,18 +449,28 @@ vim_main2(void)
*/ */
if (p_lpl) if (p_lpl)
{ {
char_u *rtp_copy = NULL;
/* First add all package directories to 'runtimepath', so that their /* First add all package directories to 'runtimepath', so that their
* autoload directories can be found. Only if not done already with a * autoload directories can be found. Only if not done already with a
* :packloadall command. */ * :packloadall command.
* Make a copy of 'runtimepath', so that source_runtime does not use
* the pack directories. */
if (!did_source_packages) if (!did_source_packages)
{
rtp_copy = vim_strsave(p_rtp);
add_pack_start_dirs(); add_pack_start_dirs();
}
source_in_path(rtp_copy == NULL ? p_rtp : rtp_copy,
# ifdef VMS /* Somehow VMS doesn't handle the "**". */ # ifdef VMS /* Somehow VMS doesn't handle the "**". */
source_runtime((char_u *)"plugin/*.vim", DIP_ALL | DIP_NOAFTER); (char_u *)"plugin/*.vim",
# else # else
source_runtime((char_u *)"plugin/**/*.vim", DIP_ALL | DIP_NOAFTER); (char_u *)"plugin/**/*.vim",
# endif # endif
DIP_ALL | DIP_NOAFTER);
TIME_MSG("loading plugins"); TIME_MSG("loading plugins");
vim_free(rtp_copy);
/* Only source "start" packages if not done already with a :packloadall /* Only source "start" packages if not done already with a :packloadall
* command. */ * command. */

View File

@@ -1636,7 +1636,9 @@ shift_delete_registers()
free_yank_all(); /* free register nine */ free_yank_all(); /* free register nine */
for (n = 9; n > 1; --n) for (n = 9; n > 1; --n)
y_regs[n] = y_regs[n - 1]; y_regs[n] = y_regs[n - 1];
y_previous = y_current = &y_regs[1]; y_current = &y_regs[1];
if (!y_append)
y_previous = y_current;
y_regs[1].y_array = NULL; /* set register one to empty */ y_regs[1].y_array = NULL; /* set register one to empty */
} }

View File

@@ -4294,6 +4294,32 @@ set_title_defaults(void)
} }
#endif #endif
#if defined(FEAT_AUTOCMD) && defined(FEAT_EVAL)
static void
trigger_optionsset_string(
int opt_idx,
int opt_flags,
char_u *oldval,
char_u *newval)
{
if (oldval != NULL && newval != NULL)
{
char_u buf_type[7];
sprintf((char *)buf_type, "%s",
(opt_flags & OPT_LOCAL) ? "local" : "global");
set_vim_var_string(VV_OPTION_OLD, oldval, -1);
set_vim_var_string(VV_OPTION_NEW, newval, -1);
set_vim_var_string(VV_OPTION_TYPE, buf_type, -1);
apply_autocmds(EVENT_OPTIONSET,
(char_u *)options[opt_idx].fullname, NULL, FALSE, NULL);
reset_v_option_vars();
}
vim_free(oldval);
vim_free(newval);
}
#endif
/* /*
* Parse 'arg' for option settings. * Parse 'arg' for option settings.
* *
@@ -4763,6 +4789,7 @@ do_set(
char_u *origval = NULL; char_u *origval = NULL;
#if defined(FEAT_AUTOCMD) && defined(FEAT_EVAL) #if defined(FEAT_AUTOCMD) && defined(FEAT_EVAL)
char_u *saved_origval = NULL; char_u *saved_origval = NULL;
char_u *saved_newval = NULL;
#endif #endif
unsigned newlen; unsigned newlen;
int comma; int comma;
@@ -5114,14 +5141,21 @@ do_set(
# ifdef FEAT_CRYPT # ifdef FEAT_CRYPT
&& options[opt_idx].indir != PV_KEY && options[opt_idx].indir != PV_KEY
# endif # endif
&& origval != NULL) && origval != NULL && newval != NULL)
{
/* origval may be freed by /* origval may be freed by
* did_set_string_option(), make a copy. */ * did_set_string_option(), make a copy. */
saved_origval = vim_strsave(origval); saved_origval = vim_strsave(origval);
/* newval (and varp) may become invalid if the
* buffer is closed by autocommands. */
saved_newval = vim_strsave(newval);
}
#endif #endif
/* Handle side effects, and set the global value for /* Handle side effects, and set the global value for
* ":set" on local options. */ * ":set" on local options. Note: when setting 'syntax'
* or 'filetype' autocommands may be triggered that can
* cause havoc. */
errmsg = did_set_string_option(opt_idx, (char_u **)varp, errmsg = did_set_string_option(opt_idx, (char_u **)varp,
new_value_alloced, oldval, errbuf, opt_flags); new_value_alloced, oldval, errbuf, opt_flags);
@@ -5130,28 +5164,14 @@ do_set(
{ {
#if defined(FEAT_AUTOCMD) && defined(FEAT_EVAL) #if defined(FEAT_AUTOCMD) && defined(FEAT_EVAL)
vim_free(saved_origval); vim_free(saved_origval);
vim_free(saved_newval);
#endif #endif
goto skip; goto skip;
} }
#if defined(FEAT_AUTOCMD) && defined(FEAT_EVAL) #if defined(FEAT_AUTOCMD) && defined(FEAT_EVAL)
if (saved_origval != NULL) trigger_optionsset_string(opt_idx, opt_flags,
{ saved_origval, saved_newval);
char_u buf_type[7];
sprintf((char *)buf_type, "%s",
(opt_flags & OPT_LOCAL) ? "local" : "global");
set_vim_var_string(VV_OPTION_NEW,
*(char_u **)varp, -1);
set_vim_var_string(VV_OPTION_OLD, saved_origval, -1);
set_vim_var_string(VV_OPTION_TYPE, buf_type, -1);
apply_autocmds(EVENT_OPTIONSET,
(char_u *)options[opt_idx].fullname,
NULL, FALSE, NULL);
reset_v_option_vars();
vim_free(saved_origval);
}
#endif #endif
} }
else /* key code option */ else /* key code option */
{ {
@@ -5922,6 +5942,7 @@ set_string_option(
char_u *oldval; char_u *oldval;
#if defined(FEAT_AUTOCMD) && defined(FEAT_EVAL) #if defined(FEAT_AUTOCMD) && defined(FEAT_EVAL)
char_u *saved_oldval = NULL; char_u *saved_oldval = NULL;
char_u *saved_newval = NULL;
#endif #endif
char_u *r = NULL; char_u *r = NULL;
@@ -5945,26 +5966,19 @@ set_string_option(
&& options[opt_idx].indir != PV_KEY && options[opt_idx].indir != PV_KEY
# endif # endif
) )
{
saved_oldval = vim_strsave(oldval); saved_oldval = vim_strsave(oldval);
saved_newval = vim_strsave(s);
}
#endif #endif
if ((r = did_set_string_option(opt_idx, varp, TRUE, oldval, NULL, if ((r = did_set_string_option(opt_idx, varp, TRUE, oldval, NULL,
opt_flags)) == NULL) opt_flags)) == NULL)
did_set_option(opt_idx, opt_flags, TRUE); did_set_option(opt_idx, opt_flags, TRUE);
/* call autocommand after handling side effects */
#if defined(FEAT_AUTOCMD) && defined(FEAT_EVAL) #if defined(FEAT_AUTOCMD) && defined(FEAT_EVAL)
if (saved_oldval != NULL) /* call autocommand after handling side effects */
{ trigger_optionsset_string(opt_idx, opt_flags,
char_u buf_type[7]; saved_oldval, saved_newval);
sprintf((char *)buf_type, "%s",
(opt_flags & OPT_LOCAL) ? "local" : "global");
set_vim_var_string(VV_OPTION_NEW, *varp, -1);
set_vim_var_string(VV_OPTION_OLD, saved_oldval, -1);
set_vim_var_string(VV_OPTION_TYPE, buf_type, -1);
apply_autocmds(EVENT_OPTIONSET, (char_u *)options[opt_idx].fullname, NULL, FALSE, NULL);
reset_v_option_vars();
vim_free(saved_oldval);
}
#endif #endif
} }
return r; return r;

View File

@@ -69,9 +69,10 @@ void ex_argdelete(exarg_T *eap);
void ex_listdo(exarg_T *eap); void ex_listdo(exarg_T *eap);
void ex_compiler(exarg_T *eap); void ex_compiler(exarg_T *eap);
void ex_runtime(exarg_T *eap); void ex_runtime(exarg_T *eap);
int source_runtime(char_u *name, int flags);
int do_in_path(char_u *path, char_u *name, int flags, void (*callback)(char_u *fname, void *ck), void *cookie); int do_in_path(char_u *path, char_u *name, int flags, void (*callback)(char_u *fname, void *ck), void *cookie);
int do_in_runtimepath(char_u *name, int flags, void (*callback)(char_u *fname, void *ck), void *cookie); int do_in_runtimepath(char_u *name, int flags, void (*callback)(char_u *fname, void *ck), void *cookie);
int source_runtime(char_u *name, int flags);
int source_in_path(char_u *path, char_u *name, int flags);
void add_pack_start_dirs(void); void add_pack_start_dirs(void);
void load_start_packages(void); void load_start_packages(void);
void ex_packloadall(exarg_T *eap); void ex_packloadall(exarg_T *eap);

View File

@@ -3425,6 +3425,9 @@ qf_fill_buffer(qf_info_T *qi, buf_T *buf, qfline_T *old_last)
/* Set the 'filetype' to "qf" each time after filling the buffer. /* Set the 'filetype' to "qf" each time after filling the buffer.
* This resembles reading a file into a buffer, it's more logical when * This resembles reading a file into a buffer, it's more logical when
* using autocommands. */ * using autocommands. */
#ifdef FEAT_AUTOCMD
++curbuf_lock;
#endif
set_option_value((char_u *)"ft", 0L, (char_u *)"qf", OPT_LOCAL); set_option_value((char_u *)"ft", 0L, (char_u *)"qf", OPT_LOCAL);
curbuf->b_p_ma = FALSE; curbuf->b_p_ma = FALSE;
@@ -3435,6 +3438,7 @@ qf_fill_buffer(qf_info_T *qi, buf_T *buf, qfline_T *old_last)
apply_autocmds(EVENT_BUFWINENTER, (char_u *)"quickfix", NULL, apply_autocmds(EVENT_BUFWINENTER, (char_u *)"quickfix", NULL,
FALSE, curbuf); FALSE, curbuf);
keep_filetype = FALSE; keep_filetype = FALSE;
--curbuf_lock;
#endif #endif
/* make sure it will be redrawn */ /* make sure it will be redrawn */
redraw_curbuf_later(NOT_VALID); redraw_curbuf_later(NOT_VALID);

View File

@@ -5502,7 +5502,8 @@ win_line(
* Also highlight the 'colorcolumn' if it is different than * Also highlight the 'colorcolumn' if it is different than
* 'cursorcolumn' */ * 'cursorcolumn' */
vcol_save_attr = -1; vcol_save_attr = -1;
if (draw_state == WL_LINE && !lnum_in_visual_area) if (draw_state == WL_LINE && !lnum_in_visual_area
&& search_attr == 0 && area_attr == 0)
{ {
if (wp->w_p_cuc && VCOL_HLC == (long)wp->w_virtcol if (wp->w_p_cuc && VCOL_HLC == (long)wp->w_virtcol
&& lnum != wp->w_cursor.lnum) && lnum != wp->w_cursor.lnum)

View File

@@ -194,6 +194,21 @@ func Test_multibyte_sign_and_colorcolumn()
call s:close_windows() call s:close_windows()
endfunc endfunc
func Test_colorcolumn_priority()
call s:test_windows('setl cc=4 cuc hls')
call setline(1, ["xxyy", ""])
norm! gg
exe "normal! /xxyy\<CR>"
norm! G
redraw!
let line_attr = s:screen_attr(1, [1, &cc])
" Search wins over CursorColumn
call assert_equal(line_attr[1], line_attr[0])
" Search wins over Colorcolumn
call assert_equal(line_attr[2], line_attr[3])
call s:close_windows('setl hls&vim')
endfunc
func Test_illegal_byte_and_breakat() func Test_illegal_byte_and_breakat()
call s:test_windows("setl sbr= brk+=<") call s:test_windows("setl sbr= brk+=<")
vert resize 18 vert resize 18

View File

@@ -34,3 +34,14 @@ func Test_put_char_block2()
bw! bw!
call setreg('a', a[0], a[1]) call setreg('a', a[0], a[1])
endfunc endfunc
func Test_put_lines()
new
let a = [ getreg('a'), getregtype('a') ]
call setline(1, ['Line 1', 'Line2', 'Line 3', ''])
exe 'norm! gg"add"AddG""p'
call assert_equal(['Line 3', '', 'Line 1', 'Line2'], getline(1,'$'))
" clean up
bw!
call setreg('a', a[0], a[1])
endfunc

View File

@@ -2190,7 +2190,7 @@ endfunc
func Test_cclose_from_copen() func Test_cclose_from_copen()
augroup QF_Test augroup QF_Test
au! au!
au FileType qf :cclose au FileType qf :call assert_fails(':cclose', 'E788')
augroup END augroup END
copen copen
augroup QF_Test augroup QF_Test
@@ -2227,3 +2227,19 @@ func Test_Qf_Size()
call XsizeTests('c') call XsizeTests('c')
call XsizeTests('l') call XsizeTests('l')
endfunc endfunc
func Test_cclose_in_autocmd()
" Problem is only triggered if "starting" is zero, so that the OptionsSet
" event will be triggered.
call test_override('starting', 1)
augroup QF_Test
au!
au FileType qf :call assert_fails(':cclose', 'E788')
augroup END
copen
augroup QF_Test
au!
augroup END
augroup! QF_Test
call test_override('starting', 0)
endfunc

View File

@@ -23,28 +23,34 @@ func Test_after_comes_later()
\ 'set guioptions+=M', \ 'set guioptions+=M',
\ 'let $HOME = "/does/not/exist"', \ 'let $HOME = "/does/not/exist"',
\ 'set loadplugins', \ 'set loadplugins',
\ 'set rtp=Xhere,Xafter', \ 'set rtp=Xhere,Xafter,Xanother',
\ 'set packpath=Xhere,Xafter', \ 'set packpath=Xhere,Xafter',
\ 'set nomore', \ 'set nomore',
\ 'let g:sequence = ""',
\ ] \ ]
let after = [ let after = [
\ 'redir! > Xtestout', \ 'redir! > Xtestout',
\ 'scriptnames', \ 'scriptnames',
\ 'redir END', \ 'redir END',
\ 'redir! > Xsequence',
\ 'echo g:sequence',
\ 'redir END',
\ 'quit', \ 'quit',
\ ] \ ]
call mkdir('Xhere/plugin', 'p') call mkdir('Xhere/plugin', 'p')
call writefile(['let done = 1'], 'Xhere/plugin/here.vim') call writefile(['let g:sequence .= "here "'], 'Xhere/plugin/here.vim')
call mkdir('Xanother/plugin', 'p')
call writefile(['let g:sequence .= "another "'], 'Xanother/plugin/another.vim')
call mkdir('Xhere/pack/foo/start/foobar/plugin', 'p') call mkdir('Xhere/pack/foo/start/foobar/plugin', 'p')
call writefile(['let done = 1'], 'Xhere/pack/foo/start/foobar/plugin/foo.vim') call writefile(['let g:sequence .= "pack "'], 'Xhere/pack/foo/start/foobar/plugin/foo.vim')
call mkdir('Xafter/plugin', 'p') call mkdir('Xafter/plugin', 'p')
call writefile(['let done = 1'], 'Xafter/plugin/later.vim') call writefile(['let g:sequence .= "after "'], 'Xafter/plugin/later.vim')
if RunVim(before, after, '') if RunVim(before, after, '')
let lines = readfile('Xtestout') let lines = readfile('Xtestout')
let expected = ['Xbefore.vim', 'here.vim', 'foo.vim', 'later.vim', 'Xafter.vim'] let expected = ['Xbefore.vim', 'here.vim', 'another.vim', 'foo.vim', 'later.vim', 'Xafter.vim']
let found = [] let found = []
for line in lines for line in lines
for one in expected for one in expected
@@ -56,8 +62,12 @@ func Test_after_comes_later()
call assert_equal(expected, found) call assert_equal(expected, found)
endif endif
call assert_equal('here another pack after', substitute(join(readfile('Xsequence', 1), ''), '\s\+$', '', ''))
call delete('Xtestout') call delete('Xtestout')
call delete('Xsequence')
call delete('Xhere', 'rf') call delete('Xhere', 'rf')
call delete('Xanother', 'rf')
call delete('Xafter', 'rf') call delete('Xafter', 'rf')
endfunc endfunc

View File

@@ -418,7 +418,7 @@ func Test_bg_detection()
hi Normal ctermbg=15 hi Normal ctermbg=15
call assert_equal('light', &bg) call assert_equal('light', &bg)
" manually-set &bg takes precendence over auto-detection " manually-set &bg takes precedence over auto-detection
set bg=light set bg=light
hi Normal ctermbg=4 hi Normal ctermbg=4
call assert_equal('light', &bg) call assert_equal('light', &bg)
@@ -461,7 +461,6 @@ func Test_syntax_hangs()
bwipe! bwipe!
endfunc endfunc
func Test_conceal() func Test_conceal()
if !has('conceal') if !has('conceal')
return return
@@ -497,3 +496,27 @@ func Test_conceal()
set conceallevel& set conceallevel&
bw! bw!
endfunc endfunc
fun Test_synstack_synIDtrans()
new
setfiletype c
syntax on
call setline(1, ' /* A comment with a TODO */')
call assert_equal([], synstack(1, 1))
norm f/
call assert_equal(['cComment', 'cCommentStart'], map(synstack(line("."), col(".")), 'synIDattr(v:val, "name")'))
call assert_equal(['Comment', 'Comment'], map(synstack(line("."), col(".")), 'synIDattr(synIDtrans(v:val), "name")'))
norm fA
call assert_equal(['cComment'], map(synstack(line("."), col(".")), 'synIDattr(v:val, "name")'))
call assert_equal(['Comment'], map(synstack(line("."), col(".")), 'synIDattr(synIDtrans(v:val), "name")'))
norm fT
call assert_equal(['cComment', 'cTodo'], map(synstack(line("."), col(".")), 'synIDattr(v:val, "name")'))
call assert_equal(['Comment', 'Todo'], map(synstack(line("."), col(".")), 'synIDattr(synIDtrans(v:val), "name")'))
syn clear
bw!
endfunc

View File

@@ -318,6 +318,50 @@ func Test_window_width()
bw Xa Xb Xc bw Xa Xb Xc
endfunc endfunc
func Test_equalalways_on_close()
set equalalways
vsplit
windo split
split
wincmd J
" now we have a frame top-left with two windows, a frame top-right with two
" windows and a frame at the bottom, full-width.
let height_1 = winheight(1)
let height_2 = winheight(2)
let height_3 = winheight(3)
let height_4 = winheight(4)
" closing the bottom window causes all windows to be resized.
close
call assert_notequal(height_1, winheight(1))
call assert_notequal(height_2, winheight(2))
call assert_notequal(height_3, winheight(3))
call assert_notequal(height_4, winheight(4))
call assert_equal(winheight(1), winheight(3))
call assert_equal(winheight(2), winheight(4))
1wincmd w
split
4wincmd w
resize + 5
" left column has three windows, equalized heights.
" right column has two windows, top one a bit higher
let height_1 = winheight(1)
let height_2 = winheight(2)
let height_4 = winheight(4)
let height_5 = winheight(5)
3wincmd w
" closing window in left column equalizes heights in left column but not in
" the right column
close
call assert_notequal(height_1, winheight(1))
call assert_notequal(height_2, winheight(2))
call assert_equal(height_4, winheight(3))
call assert_equal(height_5, winheight(4))
only
set equalalways&
endfunc
func Test_window_jump_tag() func Test_window_jump_tag()
help help
/iccf /iccf

View File

@@ -764,6 +764,24 @@ static char *(features[]) =
static int included_patches[] = static int included_patches[] =
{ /* Add new patch number below this line */ { /* Add new patch number below this line */
/**/
682,
/**/
681,
/**/
680,
/**/
679,
/**/
678,
/**/
677,
/**/
676,
/**/
675,
/**/
674,
/**/ /**/
673, 673,
/**/ /**/

View File

@@ -2282,6 +2282,7 @@ win_close(win_T *win, int free_buf)
int dir; int dir;
int help_window = FALSE; int help_window = FALSE;
tabpage_T *prev_curtab = curtab; tabpage_T *prev_curtab = curtab;
frame_T *win_frame = win->w_frame->fr_parent;
if (last_window()) if (last_window())
{ {
@@ -2459,7 +2460,9 @@ win_close(win_T *win, int free_buf)
check_cursor(); check_cursor();
} }
if (p_ea && (*p_ead == 'b' || *p_ead == dir)) if (p_ea && (*p_ead == 'b' || *p_ead == dir))
win_equal(curwin, TRUE, dir); /* If the frame of the closed window contains the new current window,
* only resize that frame. Otherwise resize all windows. */
win_equal(curwin, curwin->w_frame->fr_parent == win_frame, dir);
else else
win_comp_pos(); win_comp_pos();
if (close_curwin) if (close_curwin)