Reasons:
- One does not have to do `s[len] = NUL` to work with these functions if they do
not need to replace the whole string: thus `s` may be const.
- One does not have to save/restore p_cpo to work with them.
A wrong format specifier and not enough allocated memory for
sourcing_name could lead to a heap corruption.
Original patch by Rui Abreu Ferreira (@equalsraf)
Fixes#4582
Prior to this change, type errors were silently ignored. They're explicit now.
setqflist(list, action, title)
setloclist(win, list, action, title)
"list" (required) must be a list.
"action" (optional) must a string.
"title" (optional) must a string or number that gets converted to a string.
An error is thrown otherwise.
Problem: Typo in test goes unnoticed.
Solution: Fix the typo. Give error for wrong arguments to cursor().
(partly by Hirohito Higashi) Add a test for cursor().
24c4d539ee
Problem: searchpos() always starts searching in the first column, which is
not what some people expect. (Brett Stahlman)
Solution: Add the 'z' flag: start at the specified column.
ad4d8a192a
Problem: When using slices there is a mixup of variable name and namespace.
Solution: Recognize variables that can't be a namespace. (Hirohito Higashi)
9bbf63dbf8
All syntastic users experienced this problem:
E685: Internal error: get_tv_string_buf()
It's reproducable with:
:call setloclist(0, [''])
So, not given optional arguments to setloclist() lead to some fields not
inizilied and the code took the wrong branches.
Add an extra argument to these functions to set w:quickfix_title.
This is a modified version of a patch from vim_dev. Discussion here:
https://groups.google.com/forum/#!topic/vim_dev/X7VVPd4Do5s
Credits go to Christian "chrisbra" Brabandt and Daniel "blueyed" Hahler.
<abuf> from the TermClose event now returns the correct buffer number.
Prior to this change it would always return the buffer number of the current
buffer, which is obviously wrong in an async environment.
Problem: The OptionSet autocommands are not triggered from setwinvar().
Solution: Do not use switch_win() when not needed. (Hirohito Higashi)
ba117c23df
Problem: gettabvar() doesn't work after Vim start. (Szymon Wrozynski)
Solution: Handle first window in tab still being NULL. (Christian Brabandt)
7e47d1ac6a
Problem: gettext() is called too often.
Solution: Do not call gettext() for messages until they are actually used.
(idea by Yasuhiro Matsumoto)
77354e78a8
Plugins (YCM, dispatch.vim) use gui_running to decide behavior; so do
some colorschemes. Up to now, nvim lied about gui_running for the
benefit of colorschemes and the detriment of all _other_ plugins that
check this condition. That's counterproductive: a user employs at most
_one_ colorscheme but may use many other plugins which expect the Vim
legacy semantics of gui_running.
Moreover, colorschemes usually don't _need_ to check gui_running: they
can instead set cterm{fg,bg} and gui{fg,bg} in the same :highlight call.
It is reasonable for users who want "true color" to modify their
colorscheme once (or request upstream to do so) in order to avoid
running into quirks in any other plugins.
Closes#2782