mirror of
https://github.com/neovim/neovim.git
synced 2024-12-19 10:45:16 -07:00
Merge #11213 from janlazo/vim-8.1.0014
vim-patch:8.1.{14,288,345,410,434,438,455}
This commit is contained in:
commit
4f4f5ef4fd
@ -4553,6 +4553,10 @@ getloclist({nr},[, {what}]) *getloclist()*
|
||||
If the optional {what} dictionary argument is supplied, then
|
||||
returns the items listed in {what} as a dictionary. Refer to
|
||||
|getqflist()| for the supported items in {what}.
|
||||
If {what} contains 'filewinid', then returns the id of the
|
||||
window used to display files from the location list. This
|
||||
field is applicable only when called from a location list
|
||||
window.
|
||||
|
||||
getmatches() *getmatches()*
|
||||
Returns a |List| with all matches previously defined for the
|
||||
|
@ -10139,6 +10139,17 @@ static void ex_folddo(exarg_T *eap)
|
||||
ml_clearmarked(); // clear rest of the marks
|
||||
}
|
||||
|
||||
// Returns true if the supplied Ex cmdidx is for a location list command
|
||||
// instead of a quickfix command.
|
||||
bool is_loclist_cmd(int cmdidx)
|
||||
FUNC_ATTR_PURE FUNC_ATTR_WARN_UNUSED_RESULT
|
||||
{
|
||||
if (cmdidx < 0 || cmdidx > CMD_SIZE) {
|
||||
return false;
|
||||
}
|
||||
return cmdnames[cmdidx].cmd_name[0] == 'l';
|
||||
}
|
||||
|
||||
bool get_pressedreturn(void)
|
||||
FUNC_ATTR_PURE FUNC_ATTR_WARN_UNUSED_RESULT
|
||||
{
|
||||
|
@ -1929,6 +1929,7 @@ int ml_append_buf(
|
||||
colnr_T len, // length of new line, including NUL, or 0
|
||||
bool newfile // flag, see above
|
||||
)
|
||||
FUNC_ATTR_NONNULL_ARG(1)
|
||||
{
|
||||
if (buf->b_ml.ml_mfp == NULL)
|
||||
return FAIL;
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -988,9 +988,7 @@ add_llist_tags(
|
||||
cmd[len] = NUL;
|
||||
}
|
||||
|
||||
if ((dict = tv_dict_alloc()) == NULL) {
|
||||
continue;
|
||||
}
|
||||
dict = tv_dict_alloc();
|
||||
tv_list_append_dict(list, dict);
|
||||
|
||||
tv_dict_add_str(dict, S_LEN("text"), (const char *)tag_name);
|
||||
|
@ -1963,6 +1963,18 @@ func Xproperty_tests(cchar)
|
||||
call g:Xsetlist([], 'r', {'items' : [{'filename' : 'F1', 'lnum' : 10, 'text' : 'L10'}]})
|
||||
call assert_equal('TestTitle', g:Xgetlist({'title' : 1}).title)
|
||||
|
||||
" Test for getting id of window associated with a location list window
|
||||
if a:cchar == 'l'
|
||||
only
|
||||
call assert_equal(0, g:Xgetlist({'all' : 1}).filewinid)
|
||||
let wid = win_getid()
|
||||
Xopen
|
||||
call assert_equal(wid, g:Xgetlist({'filewinid' : 1}).filewinid)
|
||||
wincmd w
|
||||
call assert_equal(0, g:Xgetlist({'filewinid' : 1}).filewinid)
|
||||
only
|
||||
endif
|
||||
|
||||
" The following used to crash Vim with address sanitizer
|
||||
call g:Xsetlist([], 'f')
|
||||
call g:Xsetlist([], 'a', {'items' : [{'filename':'F1', 'lnum':10}]})
|
||||
@ -3075,7 +3087,17 @@ func Xgetlist_empty_tests(cchar)
|
||||
call assert_equal('', g:Xgetlist({'title' : 0}).title)
|
||||
call assert_equal(0, g:Xgetlist({'winid' : 0}).winid)
|
||||
call assert_equal(0, g:Xgetlist({'changedtick' : 0}).changedtick)
|
||||
call assert_equal({'context' : '', 'id' : 0, 'idx' : 0, 'items' : [], 'nr' : 0, 'size' : 0, 'title' : '', 'winid' : 0, 'changedtick': 0}, g:Xgetlist({'all' : 0}))
|
||||
if a:cchar == 'c'
|
||||
call assert_equal({'context' : '', 'id' : 0, 'idx' : 0,
|
||||
\ 'items' : [], 'nr' : 0, 'size' : 0,
|
||||
\ 'title' : '', 'winid' : 0, 'changedtick': 0},
|
||||
\ g:Xgetlist({'all' : 0}))
|
||||
else
|
||||
call assert_equal({'context' : '', 'id' : 0, 'idx' : 0,
|
||||
\ 'items' : [], 'nr' : 0, 'size' : 0, 'title' : '',
|
||||
\ 'winid' : 0, 'changedtick': 0, 'filewinid' : 0},
|
||||
\ g:Xgetlist({'all' : 0}))
|
||||
endif
|
||||
|
||||
" Quickfix window with empty stack
|
||||
silent! Xopen
|
||||
@ -3108,7 +3130,16 @@ func Xgetlist_empty_tests(cchar)
|
||||
call assert_equal('', g:Xgetlist({'id' : qfid, 'title' : 0}).title)
|
||||
call assert_equal(0, g:Xgetlist({'id' : qfid, 'winid' : 0}).winid)
|
||||
call assert_equal(0, g:Xgetlist({'id' : qfid, 'changedtick' : 0}).changedtick)
|
||||
call assert_equal({'context' : '', 'id' : 0, 'idx' : 0, 'items' : [], 'nr' : 0, 'size' : 0, 'title' : '', 'winid' : 0, 'changedtick' : 0}, g:Xgetlist({'id' : qfid, 'all' : 0}))
|
||||
if a:cchar == 'c'
|
||||
call assert_equal({'context' : '', 'id' : 0, 'idx' : 0, 'items' : [],
|
||||
\ 'nr' : 0, 'size' : 0, 'title' : '', 'winid' : 0,
|
||||
\ 'changedtick' : 0}, g:Xgetlist({'id' : qfid, 'all' : 0}))
|
||||
else
|
||||
call assert_equal({'context' : '', 'id' : 0, 'idx' : 0, 'items' : [],
|
||||
\ 'nr' : 0, 'size' : 0, 'title' : '', 'winid' : 0,
|
||||
\ 'changedtick' : 0, 'filewinid' : 0},
|
||||
\ g:Xgetlist({'id' : qfid, 'all' : 0}))
|
||||
endif
|
||||
|
||||
" Non-existing quickfix list number
|
||||
call assert_equal('', g:Xgetlist({'nr' : 5, 'context' : 0}).context)
|
||||
@ -3120,7 +3151,16 @@ func Xgetlist_empty_tests(cchar)
|
||||
call assert_equal('', g:Xgetlist({'nr' : 5, 'title' : 0}).title)
|
||||
call assert_equal(0, g:Xgetlist({'nr' : 5, 'winid' : 0}).winid)
|
||||
call assert_equal(0, g:Xgetlist({'nr' : 5, 'changedtick' : 0}).changedtick)
|
||||
call assert_equal({'context' : '', 'id' : 0, 'idx' : 0, 'items' : [], 'nr' : 0, 'size' : 0, 'title' : '', 'winid' : 0, 'changedtick' : 0}, g:Xgetlist({'nr' : 5, 'all' : 0}))
|
||||
if a:cchar == 'c'
|
||||
call assert_equal({'context' : '', 'id' : 0, 'idx' : 0, 'items' : [],
|
||||
\ 'nr' : 0, 'size' : 0, 'title' : '', 'winid' : 0,
|
||||
\ 'changedtick' : 0}, g:Xgetlist({'nr' : 5, 'all' : 0}))
|
||||
else
|
||||
call assert_equal({'context' : '', 'id' : 0, 'idx' : 0, 'items' : [],
|
||||
\ 'nr' : 0, 'size' : 0, 'title' : '', 'winid' : 0,
|
||||
\ 'changedtick' : 0, 'filewinid' : 0},
|
||||
\ g:Xgetlist({'nr' : 5, 'all' : 0}))
|
||||
endif
|
||||
endfunc
|
||||
|
||||
func Test_getqflist()
|
||||
|
@ -1530,8 +1530,9 @@ static void win_init(win_T *newp, win_T *oldp, int flags)
|
||||
/* Don't copy the location list. */
|
||||
newp->w_llist = NULL;
|
||||
newp->w_llist_ref = NULL;
|
||||
} else
|
||||
copy_loclist(oldp, newp);
|
||||
} else {
|
||||
copy_loclist_stack(oldp, newp);
|
||||
}
|
||||
newp->w_localdir = (oldp->w_localdir == NULL)
|
||||
? NULL : vim_strsave(oldp->w_localdir);
|
||||
|
||||
@ -1574,7 +1575,7 @@ static void win_init_some(win_T *newp, win_T *oldp)
|
||||
/// Check if "win" is a pointer to an existing window in the current tabpage.
|
||||
///
|
||||
/// @param win window to check
|
||||
bool win_valid(win_T *win) FUNC_ATTR_PURE FUNC_ATTR_WARN_UNUSED_RESULT
|
||||
bool win_valid(const win_T *win) FUNC_ATTR_PURE FUNC_ATTR_WARN_UNUSED_RESULT
|
||||
{
|
||||
if (win == NULL) {
|
||||
return false;
|
||||
|
Loading…
Reference in New Issue
Block a user