mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
Merge pull request #14724 from janlazo/vim-8.2.2877
vim-patch:8.0.1578,8.2.{2877,2937}
This commit is contained in:
@@ -2547,7 +2547,7 @@ static void f_fnamemodify(typval_T *argvars, typval_T *rettv, FunPtr fptr)
|
||||
} else {
|
||||
len = strlen(fname);
|
||||
size_t usedlen = 0;
|
||||
if (mods != NULL && *mods != NUL) {
|
||||
if (*mods != NUL) {
|
||||
(void)modify_fname((char_u *)mods, false, &usedlen,
|
||||
(char_u **)&fname, &fbuf, &len);
|
||||
}
|
||||
|
||||
@@ -144,10 +144,6 @@ static int get_function_args(char_u **argp, char_u endchar, garray_T *newargs,
|
||||
c = *p;
|
||||
*p = NUL;
|
||||
expr = vim_strsave(expr);
|
||||
if (expr == NULL) {
|
||||
*p = c;
|
||||
goto err_ret;
|
||||
}
|
||||
((char_u **)(default_args->ga_data))
|
||||
[default_args->ga_len] = expr;
|
||||
default_args->ga_len++;
|
||||
|
||||
@@ -835,7 +835,7 @@ static int makeopens(FILE *fd, char_u *dirnow)
|
||||
p_shm) < 0) {
|
||||
return FAIL;
|
||||
}
|
||||
if (tab_firstwin->w_next != NULL) {
|
||||
if (tab_firstwin != NULL && tab_firstwin->w_next != NULL) {
|
||||
// Restore 'winminheight' and 'winminwidth'.
|
||||
PUTLINE_FAIL("let &winminheight = s:save_winminheight");
|
||||
PUTLINE_FAIL("let &winminwidth = s:save_winminwidth");
|
||||
|
||||
@@ -3552,7 +3552,7 @@ term_again:
|
||||
* Position the cursor over the rightmost paren, so that
|
||||
* matching it will take us back to the start of the line.
|
||||
*/
|
||||
find_last_paren(l, '(', ')');
|
||||
(void)find_last_paren(l, '(', ')');
|
||||
|
||||
if ((trypos = find_match_paren(curbuf->b_ind_maxparen)) != NULL)
|
||||
curwin->w_cursor = *trypos;
|
||||
|
||||
@@ -2238,7 +2238,7 @@ static int ml_append_int(
|
||||
*/
|
||||
lineadd = buf->b_ml.ml_locked_lineadd;
|
||||
buf->b_ml.ml_locked_lineadd = 0;
|
||||
ml_find_line(buf, (linenr_T)0, ML_FLUSH); /* flush data block */
|
||||
(void)ml_find_line(buf, (linenr_T)0, ML_FLUSH); // flush data block
|
||||
|
||||
/*
|
||||
* update pointer blocks for the new data block
|
||||
|
||||
@@ -5120,8 +5120,8 @@ static void nv_scroll(cmdarg_T *cap)
|
||||
/* Count a fold for one screen line. */
|
||||
lnum = curwin->w_topline;
|
||||
while (n-- > 0 && lnum < curwin->w_botline - 1) {
|
||||
hasFolding(lnum, NULL, &lnum);
|
||||
++lnum;
|
||||
(void)hasFolding(lnum, NULL, &lnum);
|
||||
lnum++;
|
||||
}
|
||||
n = lnum - curwin->w_topline;
|
||||
}
|
||||
|
||||
@@ -2912,7 +2912,7 @@ static int peekchr(void)
|
||||
at_start = false; // be able to say "/\*ptr"
|
||||
regparse++;
|
||||
after_slash++;
|
||||
peekchr();
|
||||
(void)peekchr();
|
||||
regparse--;
|
||||
after_slash--;
|
||||
curchr = toggle_Magic(curchr);
|
||||
|
||||
@@ -1461,10 +1461,10 @@ static int nfa_regatom(void)
|
||||
if (nfa_regatom() == FAIL)
|
||||
return FAIL;
|
||||
}
|
||||
getchr(); /* get the ] */
|
||||
if (n == 0)
|
||||
EMSG2_RET_FAIL(_(e_empty_sb),
|
||||
reg_magic == MAGIC_ALL);
|
||||
(void)getchr(); // get the ]
|
||||
if (n == 0) {
|
||||
EMSG2_RET_FAIL(_(e_empty_sb), reg_magic == MAGIC_ALL);
|
||||
}
|
||||
EMIT(NFA_OPT_CHARS);
|
||||
EMIT(n);
|
||||
|
||||
|
||||
@@ -2101,7 +2101,7 @@ static int win_line(win_T *wp, linenr_T lnum, int startrow, int endrow,
|
||||
bool search_attr_from_match = false; // if search_attr is from :match
|
||||
bool has_decor = false; // this buffer has decoration
|
||||
bool do_virttext = false; // draw virtual text for this line
|
||||
int win_col_offset; // offsett for window columns
|
||||
int win_col_offset = 0; // offset for window columns
|
||||
|
||||
char_u buf_fold[FOLD_TEXT_LEN + 1]; // Hold value returned by get_foldtext
|
||||
|
||||
|
||||
@@ -2012,9 +2012,6 @@ int sign_place_from_dict(
|
||||
group = NULL;
|
||||
} else {
|
||||
group = vim_strsave(group);
|
||||
if (group == NULL) {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2114,9 +2111,6 @@ int sign_unplace_from_dict(typval_T *group_tv, dict_T *dict)
|
||||
group = NULL;
|
||||
} else {
|
||||
group = vim_strsave(group);
|
||||
if (group == NULL) {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -850,6 +850,34 @@ func Test_popup_position()
|
||||
call delete('Xtest')
|
||||
endfunc
|
||||
|
||||
func Test_popup_command()
|
||||
if !CanRunVimInTerminal() || !has('menu')
|
||||
return
|
||||
endif
|
||||
|
||||
call writefile([
|
||||
\ 'one two three four five',
|
||||
\ 'and one two Xthree four five',
|
||||
\ 'one more two three four five',
|
||||
\ ], 'Xtest')
|
||||
let buf = RunVimInTerminal('Xtest', {})
|
||||
call term_sendkeys(buf, ":source $VIMRUNTIME/menu.vim\<CR>")
|
||||
call term_sendkeys(buf, "/X\<CR>:popup PopUp\<CR>")
|
||||
call VerifyScreenDump(buf, 'Test_popup_command_01', {})
|
||||
|
||||
" Select a word
|
||||
call term_sendkeys(buf, "jj")
|
||||
call VerifyScreenDump(buf, 'Test_popup_command_02', {})
|
||||
|
||||
" Select a word
|
||||
call term_sendkeys(buf, "j\<CR>")
|
||||
call VerifyScreenDump(buf, 'Test_popup_command_03', {})
|
||||
|
||||
call term_sendkeys(buf, "\<Esc>")
|
||||
call StopVimInTerminal(buf)
|
||||
call delete('Xtest')
|
||||
endfunc
|
||||
|
||||
func Test_popup_complete_backwards()
|
||||
new
|
||||
call setline(1, ['Post', 'Port', 'Po'])
|
||||
@@ -1077,4 +1105,77 @@ func Test_pum_getpos()
|
||||
unlet g:pum_pos
|
||||
endfunc
|
||||
|
||||
" Test for the popup menu with the 'rightleft' option set
|
||||
func Test_pum_rightleft()
|
||||
CheckFeature rightleft
|
||||
CheckScreendump
|
||||
|
||||
let lines =<< trim END
|
||||
abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz
|
||||
vim
|
||||
victory
|
||||
END
|
||||
call writefile(lines, 'Xtest1')
|
||||
let buf = RunVimInTerminal('--cmd "set rightleft" Xtest1', {})
|
||||
call term_wait(buf)
|
||||
call term_sendkeys(buf, "Go\<C-P>")
|
||||
call term_wait(buf)
|
||||
call VerifyScreenDump(buf, 'Test_pum_rightleft_01', {'rows': 8})
|
||||
call term_sendkeys(buf, "\<C-P>\<C-Y>")
|
||||
call term_wait(buf)
|
||||
redraw!
|
||||
call assert_match('\s*miv', Screenline(5))
|
||||
|
||||
" Test for expanding tabs to spaces in the popup menu
|
||||
let lines =<< trim END
|
||||
one two
|
||||
one three
|
||||
four
|
||||
END
|
||||
call writefile(lines, 'Xtest2')
|
||||
call term_sendkeys(buf, "\<Esc>:e! Xtest2\<CR>")
|
||||
call term_wait(buf)
|
||||
call term_sendkeys(buf, "Goone\<C-X>\<C-L>")
|
||||
call term_wait(buf)
|
||||
redraw!
|
||||
call VerifyScreenDump(buf, 'Test_pum_rightleft_02', {'rows': 7})
|
||||
call term_sendkeys(buf, "\<C-Y>")
|
||||
call term_wait(buf)
|
||||
redraw!
|
||||
call assert_match('\s*eerht eno', Screenline(4))
|
||||
|
||||
call StopVimInTerminal(buf)
|
||||
call delete('Xtest1')
|
||||
call delete('Xtest2')
|
||||
endfunc
|
||||
|
||||
" Test for a popup menu with a scrollbar
|
||||
func Test_pum_scrollbar()
|
||||
CheckScreendump
|
||||
let lines =<< trim END
|
||||
one
|
||||
two
|
||||
three
|
||||
END
|
||||
call writefile(lines, 'Xtest1')
|
||||
let buf = RunVimInTerminal('--cmd "set pumheight=2" Xtest1', {})
|
||||
call term_wait(buf)
|
||||
call term_sendkeys(buf, "Go\<C-P>\<C-P>\<C-P>")
|
||||
call term_wait(buf)
|
||||
call VerifyScreenDump(buf, 'Test_pum_scrollbar_01', {'rows': 7})
|
||||
call term_sendkeys(buf, "\<C-E>\<Esc>dd")
|
||||
call term_wait(buf)
|
||||
|
||||
if has('rightleft')
|
||||
call term_sendkeys(buf, ":set rightleft\<CR>")
|
||||
call term_wait(buf)
|
||||
call term_sendkeys(buf, "Go\<C-P>\<C-P>\<C-P>")
|
||||
call term_wait(buf)
|
||||
call VerifyScreenDump(buf, 'Test_pum_scrollbar_02', {'rows': 7})
|
||||
endif
|
||||
|
||||
call StopVimInTerminal(buf)
|
||||
call delete('Xtest1')
|
||||
endfunc
|
||||
|
||||
" vim: shiftwidth=2 sts=2 expandtab
|
||||
|
||||
@@ -1018,9 +1018,7 @@ static ExtmarkUndoObject *unserialize_extmark(bufinfo_T *bi, bool *error,
|
||||
goto error;
|
||||
}
|
||||
|
||||
if (buf) {
|
||||
xfree(buf);
|
||||
}
|
||||
xfree(buf);
|
||||
|
||||
return extup;
|
||||
|
||||
|
||||
@@ -2528,7 +2528,7 @@ int win_close(win_T *win, bool free_buf)
|
||||
// only resize that frame. Otherwise resize all windows.
|
||||
win_equal(curwin, curwin->w_frame->fr_parent == win_frame, dir);
|
||||
} else {
|
||||
win_comp_pos();
|
||||
(void)win_comp_pos();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6296,9 +6296,10 @@ restore_snapshot (
|
||||
&& curtab->tp_snapshot[idx]->fr_height == topframe->fr_height
|
||||
&& check_snapshot_rec(curtab->tp_snapshot[idx], topframe) == OK) {
|
||||
wp = restore_snapshot_rec(curtab->tp_snapshot[idx], topframe);
|
||||
win_comp_pos();
|
||||
if (wp != NULL && close_curwin)
|
||||
(void)win_comp_pos();
|
||||
if (wp != NULL && close_curwin) {
|
||||
win_goto(wp);
|
||||
}
|
||||
redraw_all_later(NOT_VALID);
|
||||
}
|
||||
clear_snapshot(curtab, idx);
|
||||
|
||||
@@ -6,23 +6,22 @@
|
||||
|
||||
#include <uv.h>
|
||||
|
||||
uv_loop_t *loop;
|
||||
uv_process_t child_req;
|
||||
uv_process_options_t options;
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
loop = uv_default_loop();
|
||||
uv_loop_t *loop = uv_default_loop();
|
||||
uv_process_t child_req;
|
||||
|
||||
char * args[3];
|
||||
args[0] = "sleep";
|
||||
args[1] = "10";
|
||||
args[2] = NULL;
|
||||
|
||||
options.exit_cb = NULL;
|
||||
options.file = "sleep";
|
||||
options.args = args;
|
||||
options.flags = UV_PROCESS_DETACHED;
|
||||
uv_process_options_t options = {
|
||||
.exit_cb = NULL,
|
||||
.file = "sleep",
|
||||
.args = args,
|
||||
.flags = UV_PROCESS_DETACHED,
|
||||
};
|
||||
|
||||
int r;
|
||||
if ((r = uv_spawn(loop, &child_req, &options))) {
|
||||
|
||||
Reference in New Issue
Block a user