mirror of
https://github.com/vim/vim.git
synced 2025-10-06 05:44:14 -04:00
patch 8.1.0569: execute() always resets display column to zero
Problem: Execute() always resets display column to zero. (Sha Liu) Solution: Don't reset it to zero, restore the previous value. (closes #3669)
This commit is contained in:
@@ -3262,6 +3262,7 @@ f_execute(typval_T *argvars, typval_T *rettv)
|
|||||||
int save_redir_execute = redir_execute;
|
int save_redir_execute = redir_execute;
|
||||||
int save_redir_off = redir_off;
|
int save_redir_off = redir_off;
|
||||||
garray_T save_ga;
|
garray_T save_ga;
|
||||||
|
int save_msg_col = msg_col;
|
||||||
|
|
||||||
rettv->vval.v_string = NULL;
|
rettv->vval.v_string = NULL;
|
||||||
rettv->v_type = VAR_STRING;
|
rettv->v_type = VAR_STRING;
|
||||||
@@ -3304,6 +3305,7 @@ f_execute(typval_T *argvars, typval_T *rettv)
|
|||||||
ga_init2(&redir_execute_ga, (int)sizeof(char), 500);
|
ga_init2(&redir_execute_ga, (int)sizeof(char), 500);
|
||||||
redir_execute = TRUE;
|
redir_execute = TRUE;
|
||||||
redir_off = FALSE;
|
redir_off = FALSE;
|
||||||
|
msg_col = 0; // prevent leading spaces
|
||||||
|
|
||||||
if (cmd != NULL)
|
if (cmd != NULL)
|
||||||
do_cmdline_cmd(cmd);
|
do_cmdline_cmd(cmd);
|
||||||
@@ -3336,9 +3338,9 @@ f_execute(typval_T *argvars, typval_T *rettv)
|
|||||||
redir_execute_ga = save_ga;
|
redir_execute_ga = save_ga;
|
||||||
redir_off = save_redir_off;
|
redir_off = save_redir_off;
|
||||||
|
|
||||||
/* "silent reg" or "silent echo x" leaves msg_col somewhere in the
|
// "silent reg" or "silent echo x" leaves msg_col somewhere in the line.
|
||||||
* line. Put it back in the first column. */
|
// Put it back where it was, since nothing should have been written.
|
||||||
msg_col = 0;
|
msg_col = save_msg_col;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@@ -49,3 +49,15 @@ func Test_execute_list()
|
|||||||
call assert_equal("", execute([]))
|
call assert_equal("", execute([]))
|
||||||
call assert_equal("", execute(test_null_list()))
|
call assert_equal("", execute(test_null_list()))
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
|
func Test_execute_does_not_change_col()
|
||||||
|
echo ''
|
||||||
|
echon 'abcd'
|
||||||
|
let x = execute('silent echo 234343')
|
||||||
|
echon 'xyz'
|
||||||
|
let text = ''
|
||||||
|
for col in range(1, 7)
|
||||||
|
let text .= nr2char(screenchar(&lines, col))
|
||||||
|
endfor
|
||||||
|
call assert_equal('abcdxyz', text)
|
||||||
|
endfunc
|
||||||
|
@@ -792,6 +792,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
569,
|
||||||
/**/
|
/**/
|
||||||
568,
|
568,
|
||||||
/**/
|
/**/
|
||||||
|
Reference in New Issue
Block a user