aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/ex_getln.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/nvim/ex_getln.c')
-rw-r--r--src/nvim/ex_getln.c38
1 files changed, 16 insertions, 22 deletions
diff --git a/src/nvim/ex_getln.c b/src/nvim/ex_getln.c
index ed408c28e5..626b840798 100644
--- a/src/nvim/ex_getln.c
+++ b/src/nvim/ex_getln.c
@@ -523,7 +523,7 @@ static void may_do_incsearch_highlighting(int firstc, long count,
// positioned in the same way as the actual search command
restore_viewstate(&s->old_viewstate);
changed_cline_bef_curs();
- update_topline();
+ update_topline(curwin);
if (found != 0) {
pos_T save_pos = curwin->w_cursor;
@@ -1082,6 +1082,7 @@ static int command_line_execute(VimState *state, int key)
if (s->c == K_DOWN && ccline.cmdpos > 0
&& ccline.cmdbuff[ccline.cmdpos - 1] == '.') {
s->c = (int)p_wc;
+ KeyTyped = true; // in case the key was mapped
} else if (s->c == K_UP) {
// Hitting <Up>: Remove one submenu name in front of the
// cursor
@@ -1112,6 +1113,7 @@ static int command_line_execute(VimState *state, int key)
cmdline_del(i);
}
s->c = (int)p_wc;
+ KeyTyped = true; // in case the key was mapped
s->xpc.xp_context = EXPAND_NOTHING;
}
}
@@ -1134,6 +1136,7 @@ static int command_line_execute(VimState *state, int key)
|| ccline.cmdbuff[ccline.cmdpos - 3] != '.')) {
// go down a directory
s->c = (int)p_wc;
+ KeyTyped = true; // in case the key was mapped
} else if (STRNCMP(s->xpc.xp_pattern, upseg + 1, 3) == 0
&& s->c == K_DOWN) {
// If in a direct ancestor, strip off one ../ to go down
@@ -1154,6 +1157,7 @@ static int command_line_execute(VimState *state, int key)
&& (vim_ispathsep(ccline.cmdbuff[j - 3]) || j == i + 2)) {
cmdline_del(j - 2);
s->c = (int)p_wc;
+ KeyTyped = true; // in case the key was mapped
}
} else if (s->c == K_UP) {
// go up a directory
@@ -1546,7 +1550,7 @@ static int may_do_command_line_next_incsearch(int firstc, long count,
set_search_match(&s->match_end);
curwin->w_cursor = s->match_start;
changed_cline_bef_curs();
- update_topline();
+ update_topline(curwin);
validate_cursor();
highlight_match = true;
save_viewstate(&s->old_viewstate);
@@ -1880,9 +1884,6 @@ static int command_line_handle_key(CommandLineState *s)
return command_line_not_changed(s); // Ignore mouse
case K_MIDDLEMOUSE:
- if (!mouse_has(MOUSE_COMMAND)) {
- return command_line_not_changed(s); // Ignore mouse
- }
cmdline_paste(eval_has_provider("clipboard") ? '*' : 0, true, true);
redrawcmd();
return command_line_changed(s);
@@ -1906,10 +1907,6 @@ static int command_line_handle_key(CommandLineState *s)
s->ignore_drag_release = false;
}
- if (!mouse_has(MOUSE_COMMAND)) {
- return command_line_not_changed(s); // Ignore mouse
- }
-
ccline.cmdspos = cmd_startcol();
for (ccline.cmdpos = 0; ccline.cmdpos < ccline.cmdlen;
ccline.cmdpos++) {
@@ -2242,7 +2239,7 @@ static int command_line_changed(CommandLineState *s)
// Restore the window "view".
curwin->w_cursor = s->is_state.save_cursor;
restore_viewstate(&s->is_state.old_viewstate);
- update_topline();
+ update_topline(curwin);
redrawcmdline();
@@ -2251,7 +2248,9 @@ static int command_line_changed(CommandLineState *s)
close_preview_windows();
update_screen(SOME_VALID); // Clear 'inccommand' preview.
} else {
- may_do_incsearch_highlighting(s->firstc, s->count, &s->is_state);
+ if (s->xpc.xp_context == EXPAND_NOTHING) {
+ may_do_incsearch_highlighting(s->firstc, s->count, &s->is_state);
+ }
}
if (cmdmsg_rl || (p_arshape && !p_tbidi)) {
@@ -4229,17 +4228,11 @@ ExpandOne (
* Prepare an expand structure for use.
*/
void ExpandInit(expand_T *xp)
+ FUNC_ATTR_NONNULL_ALL
{
- xp->xp_pattern = NULL;
- xp->xp_pattern_len = 0;
+ CLEAR_POINTER(xp);
xp->xp_backslash = XP_BS_NONE;
-#ifndef BACKSLASH_IN_FILENAME
- xp->xp_shell = FALSE;
-#endif
xp->xp_numfiles = -1;
- xp->xp_files = NULL;
- xp->xp_arg = NULL;
- xp->xp_line = NULL;
}
/*
@@ -4327,7 +4320,8 @@ void ExpandEscape(expand_T *xp, char_u *str, int numfiles, char_u **files, int o
/// if true then it escapes for a shell command.
///
/// @return [allocated] escaped file name.
-char *vim_strsave_fnameescape(const char *const fname, const bool shell)
+char *vim_strsave_fnameescape(const char *const fname,
+ const bool shell FUNC_ATTR_UNUSED)
FUNC_ATTR_NONNULL_RET FUNC_ATTR_MALLOC FUNC_ATTR_NONNULL_ALL
{
#ifdef BACKSLASH_IN_FILENAME
@@ -4786,7 +4780,7 @@ char_u *addstar(char_u *fname, size_t len, int context)
* EXPAND_COMMANDS Cursor is still touching the command, so complete
* it.
* EXPAND_BUFFERS Complete file names for :buf and :sbuf commands.
- * EXPAND_FILES After command with XFILE set, or after setting
+ * EXPAND_FILES After command with EX_XFILE set, or after setting
* with P_EXPAND set. eg :e ^I, :w>>^I
* EXPAND_DIRECTORIES In some cases this is used instead of the latter
* when we know only directories are of interest. eg
@@ -5398,7 +5392,7 @@ static void expand_shellcmd(char_u *filepat, int *num_file, char_u ***file,
}
/// Call "user_expand_func()" to invoke a user defined Vim script function and
-/// return the result (either a string or a List).
+/// return the result (either a string, a List or NULL).
static void * call_user_expand_func(user_expand_func_T user_expand_func,
expand_T *xp, int *num_file, char_u ***file)
FUNC_ATTR_NONNULL_ALL