Merge remote-tracking branch 'vim/master'

This commit is contained in:
Kazuki Sakamoto
2017-05-01 15:01:30 -07:00
29 changed files with 3582 additions and 153 deletions
+23 -14
View File
@@ -1,4 +1,4 @@
*eval.txt* For Vim version 8.0. Last change: 2017 Apr 22
*eval.txt* For Vim version 8.0. Last change: 2017 Apr 29
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -4584,6 +4584,7 @@ getqflist([{what}]) *getqflist()*
If the optional {what} dictionary argument is supplied, then
returns only the items listed in {what} as a dictionary. The
following string items are supported in {what}:
context get the context stored with |setqflist()|
nr get information for this quickfix list; zero
means the current quickfix list
title get the list title
@@ -4595,6 +4596,7 @@ getqflist([{what}]) *getqflist()*
returned.
The returned dictionary contains the following entries:
context context information stored with |setqflist()|
nr quickfix list number
title quickfix list title text
winid quickfix |window-ID| (if opened)
@@ -5265,9 +5267,14 @@ job_stop({job} [, {how}]) *job_stop()*
0 if "how" is not supported on the system.
Note that even when the operation was executed, whether the
job was actually stopped needs to be checked with
job_status().
The status of the job isn't checked, the operation will even
be done when Vim thinks the job isn't running.
|job_status()|.
If the status of the job is "dead", the signal will not be
sent. This is to avoid to stop the wrong job (esp. on Unix,
where process numbers are recycled).
When using "kill" Vim will assume the job will die and close
the channel.
{only available when compiled with the |+job| feature}
@@ -6982,6 +6989,7 @@ setqflist({list} [, {action}[, {what}]]) *setqflist()*
only the items listed in {what} are set. The first {list}
argument is ignored. The following items can be specified in
{what}:
context any Vim type can be stored as a context
nr list number in the quickfix stack
title quickfix list title text
Unsupported keys in {what} are ignored.
@@ -8499,8 +8507,8 @@ listcmds Compiled with commands for the buffer list |:files|
localmap Compiled with local mappings and abbr. |:map-local|
lua Compiled with Lua interface |Lua|.
mac Any Macintosh version of Vim, but not all OS X.
macunix Compiled for OS X, with darwin
osx Compiled for OS X, with or without darwin
macunix Compiled for OS X, with |mac-darwin-feature|
osx Compiled for OS X, with or w/o |mac-darwin-feature|
menu Compiled with support for |:menu|.
mksession Compiled with support for |:mksession|.
modify_fname Compiled with file name modifiers. |filename-modifiers|
@@ -10679,18 +10687,19 @@ missing: >
To execute a command only when the |+eval| feature is disabled requires a trick,
as this example shows: >
if 1
nnoremap : :"
endif
normal :set history=111<CR>
if 1
nunmap :
endif
silent! while 0
set history=111
silent! endwhile
When the |+eval| feature is available the command is skipped because of the
"while 0". Without the |+eval| feature the "while 0" is an error, which is
silently ignored, and the command is executed.
The "<CR>" here is a real CR character, type CTRL-V Enter to get it.
When the |+eval| feature is available the ":" is remapped to add a double
quote, which has the effect of commenting-out the command. without the
quote, which has the effect of commenting-out the command. Without the
|+eval| feature the nnoremap command is skipped and the command is executed.
==============================================================================
+52 -1
View File
@@ -1,4 +1,4 @@
*os_mac.txt* For Vim version 8.0. Last change: 2006 Apr 30
*os_mac.txt* For Vim version 8.0. Last change: 2017 Apr 28
VIM REFERENCE MANUAL by Bram Moolenaar et al.
@@ -22,6 +22,7 @@ Carbon version of Vim here:
5. Known Lack |mac-lack|
6. Mac Bug Report |mac-bug|
7. Compiling Vim |mac-compile|
8. The darwin feature |mac-darwin-feature|
There was a Mac port for version 3.0 of Vim. Here are the first few lines
from the old file:
@@ -130,5 +131,55 @@ send a message to the current MacVim maintainers:
See the file "src/INSTALLmac.txt" that comes with the source files.
==============================================================================
8. The Darwin Feature *mac-darwin-feature*
If you have a Mac that isn't very old, you will be running OS X, also called
Darwin. The last pre-Darwin OS was Mac OS 9. The darwin feature makes Vim
use Darwin-specific properties.
What is accomplished with this feature is two-fold:
- Make Vim interoperable with the system clipboard.
- Incorporate into Vim a converter module that bridges the gap between some
character encodings specific to the platform and those known to Vim.
Needless to say, both are not to be missed for any decent text editor to work
nicely with other applications running on the same desktop environment.
As Vim is not an application dedicated only to macOS, we need an extra feature
to add in order for it to offer the same user experience that our users on
other platforms enjoy to people on macOS.
For brevity, the feature is referred to as "darwin" to signify it one of the
Vim features that are specific to that particular platform.
The feature is a configuration option. Accordingly, whether it is enabled or
not is determined at build time; once it is selected to be enabled, it is
compiled in and hence cannot be disabled at runtime.
The feature is enabled by default. For most macOS users, that should be
sufficient unless they have specific needs mentioned briefly below.
If you want to disable it, pass `--disable-darwin` to the configure script: >
./configure --disable-darwin <other options>
and then run `make` to build Vim. The order of the options doesn't matter.
To make sure at runtime whether or not the darwin feature is compiled in, you
can use `has('macunix')` which returns 1 if the feature is compiled in; 0
otherwise.
Notable use cases where `--disable-darwin` is turned out to be useful are:
- When you want to use |x11-selection| instead of the system clipboard.
- When you want to use |x11-clientserver|.
Since both have to make use of X11 inter-client communication for them to work
properly, and since the communication mechanism can come into conflict with
the system clipboard, the darwin feature should be disabled to prevent Vim
from hanging at runtime.
vim:tw=78:ts=8:ft=help:norl:
+1
View File
@@ -7245,6 +7245,7 @@ m` motion.txt /*m`*
mac os_mac.txt /*mac*
mac-bug os_mac.txt /*mac-bug*
mac-compile os_mac.txt /*mac-compile*
mac-darwin-feature os_mac.txt /*mac-darwin-feature*
mac-faq os_mac.txt /*mac-faq*
mac-filename os_mac.txt /*mac-filename*
mac-lack os_mac.txt /*mac-lack*
+13 -1
View File
@@ -1,4 +1,4 @@
*todo.txt* For Vim version 8.0. Last change: 2017 Apr 23
*todo.txt* For Vim version 8.0. Last change: 2017 Apr 28
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -111,11 +111,16 @@ Regexp problems:
- Difference between two engines: ".*\zs\/\@>\/" on text "///"
(Chris Paul, 2016 Nov 13) New engine not greedy enough?
With foldmethod=syntax and nofoldenable comment highlighting isn't removed.
(Marcin Szewczyk, 2017 Apr 26)
Running test_gui and test_gui_init with Motif sometimes kills the window
manager. Problem with Motif?
Memory leak in test97? The string is actually freed. Weird.
Patch for shellescape(). (Christian Brabandt, 2017 Apr 20, #1590)
Patch for flickering redraw. (Hirohito Higashi, 2017 Apr 23, #1637)
New value "uselast" for 'switchbuf'. (Lemonboy, 2017 Apr 23, #1652)
@@ -246,6 +251,9 @@ Does this also fix #1408 ?
Patch for 'cursorlinenr' option. (Ozaki Kiichi, 2016 Nov 30)
When 'completeopt' has "noselect" does not insert a newline. (Lifepillar, 2017
Apr 23, #1653)
Window resizing with 'winfixheight': With a vertical split the height changes
anyway. (Tommy allen, 2017 Feb 21, #1502)
@@ -355,6 +363,10 @@ names, shell commands and the like. (Kikuchan, 2010 Oct 14)
Assume the system converts between the actual encoding of the filesystem to
the system encoding (usually utf-8).
Using ":tab drop file" does not trigger BufEnter or TabEnter events.
(Andy Stewart, 2017 Apr 27, #1660)
Autocommands blocked in do_arg_all(). Supposed to happen later?
'hlsearch' interferes with a Conceal match. (Rom Grk, 2016 Aug 9)
Patch to add context information to quickfix/location list. (Yegappan
+3108 -1
View File
File diff suppressed because it is too large Load Diff
+23 -27
View File
@@ -1,7 +1,7 @@
" Vim syntax file
" Language: php PHP 3/4/5/7
" Maintainer: Jason Woofenden <jason@jasonwoof.com>
" Last Change: Dec 11, 2016
" Last Change: Apr 28, 2017
" URL: https://jasonwoof.com/gitweb/?p=vim-syntax.git;a=blob;f=php.vim;hb=HEAD
" Former Maintainers: Peter Hodge <toomuchphp-vim@yahoo.com>
" Debian VIM Maintainers <pkg-vim-maintainers@lists.alioth.debian.org>
@@ -11,32 +11,28 @@
" colourscheme, because elflord's colours will better highlight the break-points
" (Statements) in your code.
"
" Options: php_sql_query = 1 for SQL syntax highlighting inside strings
" php_htmlInStrings = 1 for HTML syntax highlighting inside strings
" php_baselib = 1 for highlighting baselib functions
" php_asp_tags = 1 for highlighting ASP-style short tags
" php_parent_error_close = 1 for highlighting parent error ] or )
" php_parent_error_open = 1 for skipping an php end tag, if there exists an open ( or [ without a closing one
" php_oldStyle = 1 for using old colorstyle
" php_noShortTags = 1 don't sync <? ?> as php
" php_folding = 1 for folding classes and functions
" php_folding = 2 for folding all { } regions
" php_sync_method = x
" x=-1 to sync by search ( default )
" x>0 to sync at least x lines backwards
" x=0 to sync from start
"
" Added by Peter Hodge On June 9, 2006:
" php_special_functions = 1|0 to highlight functions with abnormal behaviour
" php_alt_comparisons = 1|0 to highlight comparison operators in an alternate colour
" php_alt_assignByReference = 1|0 to highlight '= &' in an alternate colour
"
" Note: these all default to 1 (On), so you would set them to '0' to turn them off.
" E.g., in your .vimrc or _vimrc file:
" let php_special_functions = 0
" let php_alt_comparisons = 0
" let php_alt_assignByReference = 0
" Unletting these variables will revert back to their default (On).
" Options:
" Set to anything to enable:
" php_sql_query SQL syntax highlighting inside strings
" php_htmlInStrings HTML syntax highlighting inside strings
" php_baselib highlighting baselib functions
" php_asp_tags highlighting ASP-style short tags
" php_parent_error_close highlighting parent error ] or )
" php_parent_error_open skipping an php end tag, if there exists
" an open ( or [ without a closing one
" php_oldStyle use old colorstyle
" php_noShortTags don't sync <? ?> as php
" Set to a specific value:
" php_folding = 1 fold classes and functions
" php_folding = 2 fold all { } regions
" php_sync_method = x where x is an integer:
" -1 sync by search ( default )
" >0 sync at least x lines backwards
" 0 sync from start
" Set to 0 to _disable_: (Added by Peter Hodge On June 9, 2006)
" php_special_functions = 0 highlight functions with abnormal behaviour
" php_alt_comparisons = 0 comparison operators in an alternate colour
" php_alt_assignByReference = 0 '= &' in an alternate colour
"
"
" Note:
+7 -9
View File
@@ -11630,16 +11630,15 @@ if test "x$vim_cv_terminfo" = "xyes" ; then
fi
if test "x$olibs" != "x$LIBS"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking what tgetent() returns for an unknown terminal" >&5
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking what tgetent() returns for an unknown terminal" >&5
$as_echo_n "checking what tgetent() returns for an unknown terminal... " >&6; }
if ${vim_cv_tgent+:} false; then :
$as_echo_n "(cached) " >&6
else
if test "$cross_compiling" = yes; then :
if test "$cross_compiling" = yes; then :
as_fn_error $? "failed to compile test program." "$LINENO" 5
as_fn_error $? "failed to compile test program." "$LINENO" 5
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
@@ -11659,11 +11658,11 @@ main()
_ACEOF
if ac_fn_c_try_run "$LINENO"; then :
vim_cv_tgent=zero
vim_cv_tgent=zero
else
vim_cv_tgent=non-zero
vim_cv_tgent=non-zero
fi
rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
@@ -11675,10 +11674,9 @@ fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $vim_cv_tgent" >&5
$as_echo "$vim_cv_tgent" >&6; }
if test "x$vim_cv_tgent" = "xzero" ; then
$as_echo "#define TGETENT_ZERO_ERR 0" >>confdefs.h
if test "x$vim_cv_tgent" = "xzero" ; then
$as_echo "#define TGETENT_ZERO_ERR 0" >>confdefs.h
fi
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether termcap.h contains ospeed" >&5
+8 -3
View File
@@ -2425,7 +2425,7 @@ append_to_buffer(buf_T *buffer, char_u *msg, channel_T *channel, ch_part_T part)
curbuf = curwin->w_buffer;
}
}
redraw_buf_later(buffer, VALID);
redraw_buf_and_status_later(buffer, VALID);
channel_need_redraw = TRUE;
}
@@ -5173,12 +5173,17 @@ job_stop(job_T *job, typval_T *argvars)
return 0;
}
}
if (job->jv_status == JOB_ENDED)
{
ch_log(job->jv_channel, "Job has already ended, job_stop() skipped");
return 0;
}
ch_logs(job->jv_channel, "Stopping job with '%s'", (char *)arg);
if (mch_stop_job(job, arg) == FAIL)
return 0;
/* Assume that "hup" does not kill the job. */
if (job->jv_channel != NULL && STRCMP(arg, "hup") != 0)
/* Assume that only "kill" will kill the job. */
if (job->jv_channel != NULL && STRCMP(arg, "kill") == 0)
job->jv_channel->ch_job_killed = TRUE;
/* We don't try freeing the job, obviously the caller still has a
+13 -15
View File
@@ -3440,10 +3440,9 @@ if test "x$vim_cv_terminfo" = "xyes" ; then
AC_DEFINE(TERMINFO)
fi
if test "x$olibs" != "x$LIBS"; then
AC_CACHE_CHECK([what tgetent() returns for an unknown terminal], [vim_cv_tgent],
[
AC_RUN_IFELSE([AC_LANG_SOURCE([[
AC_CACHE_CHECK([what tgetent() returns for an unknown terminal], [vim_cv_tgent],
[
AC_RUN_IFELSE([AC_LANG_SOURCE([[
#include "confdefs.h"
#ifdef HAVE_TERMCAP_H
# include <termcap.h>
@@ -3454,18 +3453,17 @@ if test "x$olibs" != "x$LIBS"; then
#endif
main()
{char s[10000]; int res = tgetent(s, "thisterminaldoesnotexist"); exit(res != 0); }
]])],[
vim_cv_tgent=zero
],[
vim_cv_tgent=non-zero
],[
AC_MSG_ERROR(failed to compile test program.)
])
]])],[
vim_cv_tgent=zero
],[
vim_cv_tgent=non-zero
],[
AC_MSG_ERROR(failed to compile test program.)
])
if test "x$vim_cv_tgent" = "xzero" ; then
AC_DEFINE(TGETENT_ZERO_ERR, 0)
fi
])
if test "x$vim_cv_tgent" = "xzero" ; then
AC_DEFINE(TGETENT_ZERO_ERR, 0)
fi
AC_MSG_CHECKING(whether termcap.h contains ospeed)
+14 -8
View File
@@ -59,13 +59,23 @@ rettv_dict_alloc(typval_T *rettv)
if (d == NULL)
return FAIL;
rettv->vval.v_dict = d;
rettv->v_type = VAR_DICT;
rettv_dict_set(rettv, d);
rettv->v_lock = 0;
++d->dv_refcount;
return OK;
}
/*
* Set a dictionary as the return value
*/
void
rettv_dict_set(typval_T *rettv, dict_T *d)
{
rettv->v_type = VAR_DICT;
rettv->vval.v_dict = d;
if (d != NULL)
++d->dv_refcount;
}
/*
* Free a Dictionary, including all non-container items it contains.
* Ignores the reference count.
@@ -646,11 +656,7 @@ failret:
*arg = skipwhite(*arg + 1);
if (evaluate)
{
rettv->v_type = VAR_DICT;
rettv->vval.v_dict = d;
++d->dv_refcount;
}
rettv_dict_set(rettv, d);
return OK;
}
+19 -10
View File
@@ -96,6 +96,7 @@ struct compl_S
static compl_T *compl_first_match = NULL;
static compl_T *compl_curr_match = NULL;
static compl_T *compl_shown_match = NULL;
static compl_T *compl_old_match = NULL;
/* After using a cursor key <Enter> selects a match in the popup menu,
* otherwise it inserts a line break. */
@@ -3440,6 +3441,7 @@ ins_compl_free(void)
} while (compl_curr_match != NULL && compl_curr_match != compl_first_match);
compl_first_match = compl_curr_match = NULL;
compl_shown_match = NULL;
compl_old_match = NULL;
}
static void
@@ -4286,7 +4288,6 @@ ins_compl_get_exp(pos_T *ini)
char_u *ptr;
char_u *dict = NULL;
int dict_f = 0;
compl_T *old_match;
int set_match_pos;
if (!compl_started)
@@ -4300,7 +4301,7 @@ ins_compl_get_exp(pos_T *ini)
last_match_pos = first_match_pos = *ini;
}
old_match = compl_curr_match; /* remember the last current match */
compl_old_match = compl_curr_match; /* remember the last current match */
pos = (compl_direction == FORWARD) ? &last_match_pos : &first_match_pos;
/* For ^N/^P loop over all the flags/windows/buffers in 'complete' */
for (;;)
@@ -4402,6 +4403,11 @@ ins_compl_get_exp(pos_T *ini)
}
}
/* If complete() was called then compl_pattern has been reset. The
* following won't work then, bail out. */
if (compl_pattern == NULL)
break;
switch (type)
{
case -1:
@@ -4635,7 +4641,7 @@ ins_compl_get_exp(pos_T *ini)
/* check if compl_curr_match has changed, (e.g. other type of
* expansion added something) */
if (type != 0 && compl_curr_match != old_match)
if (type != 0 && compl_curr_match != compl_old_match)
found_new_match = OK;
/* break the loop for specialized modes (use 'complete' just for the
@@ -4674,13 +4680,16 @@ ins_compl_get_exp(pos_T *ini)
|| (ctrl_x_mode != 0 && !CTRL_X_MODE_LINE_OR_EVAL(ctrl_x_mode)))
i = ins_compl_make_cyclic();
/* If several matches were added (FORWARD) or the search failed and has
* just been made cyclic then we have to move compl_curr_match to the next
* or previous entry (if any) -- Acevedo */
compl_curr_match = compl_direction == FORWARD ? old_match->cp_next
: old_match->cp_prev;
if (compl_curr_match == NULL)
compl_curr_match = old_match;
if (compl_old_match != NULL)
{
/* If several matches were added (FORWARD) or the search failed and has
* just been made cyclic then we have to move compl_curr_match to the
* next or previous entry (if any) -- Acevedo */
compl_curr_match = compl_direction == FORWARD ? compl_old_match->cp_next
: compl_old_match->cp_prev;
if (compl_curr_match == NULL)
compl_curr_match = compl_old_match;
}
return i;
}
+6 -6
View File
@@ -4665,9 +4665,7 @@ eval_index(
item = item->li_next;
}
clear_tv(rettv);
rettv->v_type = VAR_LIST;
rettv->vval.v_list = l;
++l->lv_refcount;
rettv_list_set(rettv, l);
}
else
{
@@ -5327,6 +5325,10 @@ garbage_collect(int testing)
abort = abort || set_ref_in_timer(copyID);
#endif
#ifdef FEAT_QUICKFIX
abort = abort || set_ref_in_quickfix(copyID);
#endif
if (!abort)
{
/*
@@ -8482,9 +8484,7 @@ getwinvar(
if (opts != NULL)
{
rettv->v_type = VAR_DICT;
rettv->vval.v_dict = opts;
++opts->dv_refcount;
rettv_dict_set(rettv, opts);
done = TRUE;
}
}
+12 -32
View File
@@ -3005,8 +3005,7 @@ f_expand(typval_T *argvars, typval_T *rettv)
&& get_tv_number_chk(&argvars[2], &error)
&& !error)
{
rettv->v_type = VAR_LIST;
rettv->vval.v_list = NULL;
rettv_list_set(rettv, NULL);
}
s = get_tv_string(&argvars[0]);
@@ -3909,12 +3908,7 @@ f_get(typval_T *argvars, typval_T *rettv)
}
}
else if (STRCMP(what, "dict") == 0)
{
rettv->v_type = VAR_DICT;
rettv->vval.v_dict = pt->pt_dict;
if (pt->pt_dict != NULL)
++pt->pt_dict->dv_refcount;
}
rettv_dict_set(rettv, pt->pt_dict);
else if (STRCMP(what, "args") == 0)
{
rettv->v_type = VAR_LIST;
@@ -4214,9 +4208,7 @@ f_getbufvar(typval_T *argvars, typval_T *rettv)
if (opts != NULL)
{
rettv->v_type = VAR_DICT;
rettv->vval.v_dict = opts;
++opts->dv_refcount;
rettv_dict_set(rettv, opts);
done = TRUE;
}
}
@@ -5379,8 +5371,7 @@ f_glob(typval_T *argvars, typval_T *rettv)
{
if (get_tv_number_chk(&argvars[2], &error))
{
rettv->v_type = VAR_LIST;
rettv->vval.v_list = NULL;
rettv_list_set(rettv, NULL);
}
if (argvars[3].v_type != VAR_UNKNOWN
&& get_tv_number_chk(&argvars[3], &error))
@@ -5436,8 +5427,7 @@ f_globpath(typval_T *argvars, typval_T *rettv)
{
if (get_tv_number_chk(&argvars[3], &error))
{
rettv->v_type = VAR_LIST;
rettv->vval.v_list = NULL;
rettv_list_set(rettv, NULL);
}
if (argvars[4].v_type != VAR_UNKNOWN
&& get_tv_number_chk(&argvars[4], &error))
@@ -9179,9 +9169,7 @@ f_reverse(typval_T *argvars, typval_T *rettv)
list_append(l, li);
li = ni;
}
rettv->vval.v_list = l;
rettv->v_type = VAR_LIST;
++l->lv_refcount;
rettv_list_set(rettv, l);
l->lv_idx = l->lv_len - l->lv_idx - 1;
}
}
@@ -10769,9 +10757,7 @@ do_sort_uniq(typval_T *argvars, typval_T *rettv, int sort)
(char_u *)(sort ? N_("sort() argument") : N_("uniq() argument")),
TRUE))
goto theend;
rettv->vval.v_list = l;
rettv->v_type = VAR_LIST;
++l->lv_refcount;
rettv_list_set(rettv, l);
len = list_len(l);
if (len <= 1)
@@ -11859,8 +11845,7 @@ f_synconcealed(typval_T *argvars UNUSED, typval_T *rettv)
char_u str[NUMBUFLEN];
#endif
rettv->v_type = VAR_LIST;
rettv->vval.v_list = NULL;
rettv_list_set(rettv, NULL);
#if defined(FEAT_SYN_HL) && defined(FEAT_CONCEAL)
lnum = get_tv_lnum(argvars); /* -1 on type error */
@@ -11917,8 +11902,7 @@ f_synstack(typval_T *argvars UNUSED, typval_T *rettv)
int id;
#endif
rettv->v_type = VAR_LIST;
rettv->vval.v_list = NULL;
rettv_list_set(rettv, NULL);
#ifdef FEAT_SYN_HL
lnum = get_tv_lnum(argvars); /* -1 on type error */
@@ -12084,9 +12068,7 @@ get_cmd_output_as_rettv(
list_append(list, li);
}
++list->lv_refcount;
rettv->v_type = VAR_LIST;
rettv->vval.v_list = list;
rettv_list_set(rettv, list);
list = NULL;
}
else
@@ -12492,8 +12474,7 @@ f_test_null_channel(typval_T *argvars UNUSED, typval_T *rettv)
static void
f_test_null_dict(typval_T *argvars UNUSED, typval_T *rettv)
{
rettv->v_type = VAR_DICT;
rettv->vval.v_dict = NULL;
rettv_dict_set(rettv, NULL);
}
#ifdef FEAT_JOB_CHANNEL
@@ -12508,8 +12489,7 @@ f_test_null_job(typval_T *argvars UNUSED, typval_T *rettv)
static void
f_test_null_list(typval_T *argvars UNUSED, typval_T *rettv)
{
rettv->v_type = VAR_LIST;
rettv->vval.v_list = NULL;
rettv_list_set(rettv, NULL);
}
static void
+8 -1
View File
@@ -3347,11 +3347,18 @@ cmdline_del(int from)
*/
void
redrawcmdline(void)
{
redrawcmdline_ex(TRUE);
}
void
redrawcmdline_ex(int do_compute_cmdrow)
{
if (cmd_silent)
return;
need_wait_return = FALSE;
compute_cmdrow();
if (do_compute_cmdrow)
compute_cmdrow();
redrawcmd();
cursorcmd();
}
+1
View File
@@ -97,6 +97,7 @@ EXTERN int cmdline_row;
EXTERN int redraw_cmdline INIT(= FALSE); /* cmdline must be redrawn */
EXTERN int clear_cmdline INIT(= FALSE); /* cmdline must be cleared */
EXTERN int mode_displayed INIT(= FALSE); /* mode is being displayed */
EXTERN int no_win_do_lines_ins INIT(= FALSE); /* don't insert lines */
#if defined(FEAT_CRYPT) || defined(FEAT_EVAL)
EXTERN int cmdline_star INIT(= FALSE); /* cmdline is crypted */
#endif
+2 -2
View File
@@ -2642,11 +2642,11 @@ ex_simalt(exarg_T *eap)
}
if (fill_typebuf)
{
/* Put something in the typeahead buffer so that the message will get
/* Put a NOP in the typeahead buffer so that the message will get
* processed. */
key_name[0] = K_SPECIAL;
key_name[1] = KS_EXTRA;
key_name[2] = KE_IGNORE;
key_name[2] = KE_NOP;
key_name[3] = NUL;
typebuf_was_filled = TRUE;
(void)ins_typebuf(key_name, REMAP_NONE, 0, TRUE, FALSE);
+2 -6
View File
@@ -1136,9 +1136,7 @@ perl_to_vim(SV *sv, typval_T *rettv)
}
}
list->lv_refcount++;
rettv->v_type = VAR_LIST;
rettv->vval.v_list = list;
rettv_list_set(rettv, list);
break;
}
case SVt_PVHV: /* dictionary */
@@ -1192,9 +1190,7 @@ perl_to_vim(SV *sv, typval_T *rettv)
}
}
dict->dv_refcount++;
rettv->v_type = VAR_DICT;
rettv->vval.v_dict = dict;
rettv_dict_set(rettv, dict);
break;
}
default: /* not convertible */
+14 -8
View File
@@ -97,13 +97,23 @@ rettv_list_alloc(typval_T *rettv)
if (l == NULL)
return FAIL;
rettv->vval.v_list = l;
rettv->v_type = VAR_LIST;
rettv->v_lock = 0;
++l->lv_refcount;
rettv_list_set(rettv, l);
return OK;
}
/*
* Set a list as the return value
*/
void
rettv_list_set(typval_T *rettv, list_T *l)
{
rettv->v_type = VAR_LIST;
rettv->vval.v_list = l;
if (l != NULL)
++l->lv_refcount;
}
/*
* Unreference a list: decrement the reference count and free it when it
* becomes zero.
@@ -875,11 +885,7 @@ failret:
*arg = skipwhite(*arg + 1);
if (evaluate)
{
rettv->v_type = VAR_LIST;
rettv->vval.v_list = l;
++l->lv_refcount;
}
rettv_list_set(rettv, l);
return OK;
}
+1
View File
@@ -1,6 +1,7 @@
/* dict.c */
dict_T *dict_alloc(void);
int rettv_dict_alloc(typval_T *rettv);
void rettv_dict_set(typval_T *rettv, dict_T *d);
void dict_unref(dict_T *d);
int dict_free_nonref(int copyID);
void dict_free_items(int copyID);
+1
View File
@@ -19,6 +19,7 @@ char_u *save_cmdline_alloc(void);
void restore_cmdline_alloc(char_u *p);
void cmdline_paste_str(char_u *s, int literally);
void redrawcmdline(void);
void redrawcmdline_ex(int do_compute_cmdrow);
void redrawcmd(void);
void compute_cmdrow(void);
void gotocmdline(int clr);
+1
View File
@@ -4,6 +4,7 @@ void list_rem_watch(list_T *l, listwatch_T *lwrem);
void list_fix_watch(list_T *l, listitem_T *item);
list_T *list_alloc(void);
int rettv_list_alloc(typval_T *rettv);
void rettv_list_set(typval_T *rettv, list_T *l);
void list_unref(list_T *l);
int list_free_nonref(int copyID);
void list_free_items(int copyID);
+1
View File
@@ -29,6 +29,7 @@ void ex_vimgrep(exarg_T *eap);
int get_errorlist(win_T *wp, int qf_idx, list_T *list);
int get_errorlist_properties(win_T *wp, dict_T *what, dict_T *retdict);
int set_errorlist(win_T *wp, list_T *list, int action, char_u *title, dict_T *what);
int set_ref_in_quickfix(int copyID);
void ex_cbuffer(exarg_T *eap);
void ex_cexpr(exarg_T *eap);
void ex_helpgrep(exarg_T *eap);
+2 -1
View File
@@ -5,11 +5,12 @@ void redraw_later_clear(void);
void redraw_all_later(int type);
void redraw_curbuf_later(int type);
void redraw_buf_later(buf_T *buf, int type);
void redraw_buf_and_status_later(buf_T *buf, int type);
int redraw_asap(int type);
void redraw_after_callback(void);
void redrawWinline(linenr_T lnum, int invalid);
void update_curbuf(int type);
void update_screen(int type);
void update_screen(int type_arg);
int conceal_cursor_line(win_T *wp);
void conceal_check_cursur_line(void);
void update_single_line(win_T *wp, linenr_T lnum);
+87
View File
@@ -57,6 +57,7 @@ typedef struct qf_list_S
int qf_nonevalid; /* TRUE if not a single valid entry found */
char_u *qf_title; /* title derived from the command that created
* the error list */
typval_T *qf_ctx; /* context set by setqflist/setloclist */
} qf_list_T;
struct qf_info_S
@@ -1596,6 +1597,14 @@ copy_loclist(win_T *from, win_T *to)
to_qfl->qf_title = vim_strsave(from_qfl->qf_title);
else
to_qfl->qf_title = NULL;
if (from_qfl->qf_ctx != NULL)
{
to_qfl->qf_ctx = alloc_tv();
if (to_qfl->qf_ctx != NULL)
copy_tv(from_qfl->qf_ctx, to_qfl->qf_ctx);
}
else
to_qfl->qf_ctx = NULL;
if (from_qfl->qf_count)
{
@@ -2749,6 +2758,8 @@ qf_free(qf_info_T *qi, int idx)
}
vim_free(qi->qf_lists[idx].qf_title);
qi->qf_lists[idx].qf_title = NULL;
free_tv(qi->qf_lists[idx].qf_ctx);
qi->qf_lists[idx].qf_ctx = NULL;
qi->qf_lists[idx].qf_index = 0;
qi->qf_lists[idx].qf_start = NULL;
qi->qf_lists[idx].qf_last = NULL;
@@ -4629,6 +4640,7 @@ enum {
QF_GETLIST_ITEMS = 0x2,
QF_GETLIST_NR = 0x4,
QF_GETLIST_WINID = 0x8,
QF_GETLIST_CONTEXT = 0x10,
QF_GETLIST_ALL = 0xFF
};
@@ -4681,6 +4693,9 @@ get_errorlist_properties(win_T *wp, dict_T *what, dict_T *retdict)
if (dict_find(what, (char_u *)"winid", -1) != NULL)
flags |= QF_GETLIST_WINID;
if (dict_find(what, (char_u *)"context", -1) != NULL)
flags |= QF_GETLIST_CONTEXT;
if (flags & QF_GETLIST_TITLE)
{
char_u *t;
@@ -4699,6 +4714,22 @@ get_errorlist_properties(win_T *wp, dict_T *what, dict_T *retdict)
status = dict_add_nr_str(retdict, "winid", win->w_id, NULL);
}
if ((status == OK) && (flags & QF_GETLIST_CONTEXT))
{
if (qi->qf_lists[qf_idx].qf_ctx != NULL)
{
di = dictitem_alloc((char_u *)"context");
if (di != NULL)
{
copy_tv(qi->qf_lists[qf_idx].qf_ctx, &di->di_tv);
if (dict_add(retdict, di) == FAIL)
dictitem_free(di);
}
}
else
status = dict_add_nr_str(retdict, "context", 0L, (char_u *)"");
}
return status;
}
@@ -4874,6 +4905,16 @@ qf_set_properties(qf_info_T *qi, dict_T *what, int action)
}
}
if ((di = dict_find(what, (char_u *)"context", -1)) != NULL)
{
typval_T *ctx;
free_tv(qi->qf_lists[qi->qf_curlist].qf_ctx);
ctx = alloc_tv();
if (ctx != NULL)
copy_tv(&di->di_tv, ctx);
qi->qf_lists[qi->qf_curlist].qf_ctx = ctx;
}
return retval;
}
@@ -4981,6 +5022,52 @@ set_errorlist(
return retval;
}
static int
mark_quickfix_ctx(qf_info_T *qi, int copyID)
{
int i;
int abort = FALSE;
typval_T *ctx;
for (i = 0; i < LISTCOUNT && !abort; ++i)
{
ctx = qi->qf_lists[i].qf_ctx;
if (ctx != NULL && ctx->v_type != VAR_NUMBER &&
ctx->v_type != VAR_STRING && ctx->v_type != VAR_FLOAT)
abort = set_ref_in_item(ctx, copyID, NULL, NULL);
}
return abort;
}
/*
* Mark the context of the quickfix list and the location lists (if present) as
* "in use". So that garabage collection doesn't free the context.
*/
int
set_ref_in_quickfix(int copyID)
{
int abort = FALSE;
tabpage_T *tp;
win_T *win;
abort = mark_quickfix_ctx(&ql_info, copyID);
if (abort)
return abort;
FOR_ALL_TAB_WINDOWS(tp, win)
{
if (win->w_llist != NULL)
{
abort = mark_quickfix_ctx(win->w_llist, copyID);
if (abort)
return abort;
}
}
return abort;
}
#endif
/*
+66 -8
View File
@@ -265,6 +265,23 @@ redraw_buf_later(buf_T *buf, int type)
}
}
void
redraw_buf_and_status_later(buf_T *buf, int type)
{
win_T *wp;
FOR_ALL_WINDOWS(wp)
{
if (wp->w_buffer == buf)
{
redraw_win_later(wp, type);
#ifdef FEAT_WINDOWS
wp->w_redr_status = TRUE;
#endif
}
}
}
/*
* Redraw as soon as possible. When the command line is not scrolled redraw
* right away and restore what was on the command line.
@@ -421,10 +438,29 @@ redraw_after_callback(void)
if (State == HITRETURN || State == ASKMORE)
; /* do nothing */
else if (State & CMDLINE)
redrawcmdline();
{
/* Redrawing only works when the screen didn't scroll. */
if (msg_scrolled == 0)
{
update_screen(0);
compute_cmdrow();
}
else
{
/* Redraw in the same position, so that the user can continue
* editing the command. */
compute_cmdrow();
if (cmdline_row > msg_scrolled)
cmdline_row -= msg_scrolled;
else
cmdline_row = 0;
}
redrawcmdline_ex(FALSE);
}
else if (State & (NORMAL | INSERT))
{
update_screen(0);
/* keep the command line if possible */
update_screen(VALID_NO_UPDATE);
setcursor();
}
cursor_on();
@@ -476,7 +512,7 @@ redrawWinline(
}
/*
* update all windows that are editing the current buffer
* Update all windows that are editing the current buffer.
*/
void
update_curbuf(int type)
@@ -490,8 +526,9 @@ update_curbuf(int type)
* of stuff from Filemem to ScreenLines[], and update curwin->w_botline.
*/
void
update_screen(int type)
update_screen(int type_arg)
{
int type = type_arg;
win_T *wp;
static int did_intro = FALSE;
#if defined(FEAT_SEARCH_EXTRA) || defined(FEAT_CLIPBOARD)
@@ -502,11 +539,18 @@ update_screen(int type)
int gui_cursor_col;
int gui_cursor_row;
#endif
int no_update = FALSE;
/* Don't do anything if the screen structures are (not yet) valid. */
if (!screen_valid(TRUE))
return;
if (type == VALID_NO_UPDATE)
{
no_update = TRUE;
type = 0;
}
if (must_redraw)
{
if (type < must_redraw) /* use maximal type */
@@ -539,6 +583,8 @@ update_screen(int type)
++display_tick; /* let syntax code know we're in a next round of
* display updating */
#endif
if (no_update)
++no_win_do_lines_ins;
/*
* if the screen was scrolled up when displaying a message, scroll it down
@@ -576,7 +622,8 @@ update_screen(int type)
}
}
}
redraw_cmdline = TRUE;
if (!no_update)
redraw_cmdline = TRUE;
#ifdef FEAT_WINDOWS
redraw_tabline = TRUE;
#endif
@@ -748,6 +795,9 @@ update_screen(int type)
if (clear_cmdline || redraw_cmdline)
showmode();
if (no_update)
--no_win_do_lines_ins;
/* May put up an introductory message when not editing a file */
if (!did_intro)
maybe_intro_message();
@@ -9503,6 +9553,11 @@ win_do_lines(
if (!redrawing() || line_count <= 0)
return FAIL;
/* When inserting lines would result in loss of command output, just redraw
* the lines. */
if (no_win_do_lines_ins && !del)
return FAIL;
/* only a few lines left: redraw is faster */
if (mayclear && Rows - line_count < 5
#ifdef FEAT_WINDOWS
@@ -9510,7 +9565,8 @@ win_do_lines(
#endif
)
{
screenclear(); /* will set wp->w_lines_valid to 0 */
if (!no_win_do_lines_ins)
screenclear(); /* will set wp->w_lines_valid to 0 */
return FAIL;
}
@@ -9526,10 +9582,12 @@ win_do_lines(
}
/*
* when scrolling, the message on the command line should be cleared,
* When scrolling, the message on the command line should be cleared,
* otherwise it will stay there forever.
* Don't do this when avoiding to insert lines.
*/
clear_cmdline = TRUE;
if (!no_win_do_lines_ins)
clear_cmdline = TRUE;
/*
* If the terminal can set a scroll region, use that.
+43
View File
@@ -570,4 +570,47 @@ func Test_completion_comment_formatting()
bwipe!
endfunc
fun MessCompleteMonths()
for m in split("Jan Feb Mar Apr May Jun Jul Aug Sep")
call complete_add(m)
if complete_check()
break
endif
endfor
return []
endfun
fun MessCompleteMore()
call complete(1, split("Oct Nov Dec"))
return []
endfun
fun MessComplete(findstart, base)
if a:findstart
let line = getline('.')
let start = col('.') - 1
while start > 0 && line[start - 1] =~ '\a'
let start -= 1
endwhile
return start
else
call MessCompleteMonths()
call MessCompleteMore()
return []
endif
endf
func Test_complete_func_mess()
" Calling complete() after complete_add() in 'completefunc' is wrong, but it
" should not crash.
set completefunc=MessComplete
new
call setline(1, 'Ju')
call feedkeys("A\<c-x>\<c-u>/\<esc>", 'tx')
call assert_equal('Oct/Oct', getline(1))
bwipe!
set completefunc=
endfunc
" vim: shiftwidth=2 sts=2 expandtab
+32
View File
@@ -1772,6 +1772,38 @@ func Xproperty_tests(cchar)
if a:cchar == 'l'
call assert_equal({}, getloclist(99, {'title': 1}))
endif
" Context related tests
call g:Xsetlist([], 'a', {'context':[1,2,3]})
call test_garbagecollect_now()
let d = g:Xgetlist({'context':1})
call assert_equal([1,2,3], d.context)
call g:Xsetlist([], 'a', {'context':{'color':'green'}})
let d = g:Xgetlist({'context':1})
call assert_equal({'color':'green'}, d.context)
call g:Xsetlist([], 'a', {'context':"Context info"})
let d = g:Xgetlist({'context':1})
call assert_equal("Context info", d.context)
call g:Xsetlist([], 'a', {'context':246})
let d = g:Xgetlist({'context':1})
call assert_equal(246, d.context)
if a:cchar == 'l'
" Test for copying context across two different location lists
new | only
let w1_id = win_getid()
let l = [1]
call setloclist(0, [], 'a', {'context':l})
new
let w2_id = win_getid()
call add(l, 2)
call assert_equal([1, 2], getloclist(w1_id, {'context':1}).context)
call assert_equal([1, 2], getloclist(w2_id, {'context':1}).context)
unlet! l
call assert_equal([1, 2], getloclist(w2_id, {'context':1}).context)
only
call setloclist(0, [], 'f')
call assert_equal({}, getloclist(0, {'context':1}))
endif
endfunc
func Test_qf_property()
+20
View File
@@ -779,6 +779,26 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
596,
/**/
595,
/**/
594,
/**/
593,
/**/
592,
/**/
591,
/**/
590,
/**/
589,
/**/
588,
/**/
587,
/**/
586,
/**/
+2
View File
@@ -632,6 +632,8 @@ extern int (*dyn_libintl_putenv)(const char *envstring);
* flags for update_screen()
* The higher the value, the higher the priority
*/
#define VALID_NO_UPDATE 5 /* no new changes, keep the command line if
possible */
#define VALID 10 /* buffer not changed, or changes marked
with b_mod_* */
#define INVERTED 20 /* redisplay inverted part that changed */