diff src/evalfunc.c @ 15117:2fed75dee954 v8.1.0569

patch 8.1.0569: execute() always resets display column to zero commit https://github.com/vim/vim/commit/10ccaa17ec8b2be1132fd19059e1cd5fb5c902c4 Author: Bram Moolenaar <Bram@vim.org> Date: Fri Dec 7 16:38:23 2018 +0100 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 https://github.com/vim/vim/issues/3669)
author Bram Moolenaar <Bram@vim.org>
date Fri, 07 Dec 2018 16:45:05 +0100
parents 3a94f7918980
children 895abc8a5195
line wrap: on
line diff
--- a/src/evalfunc.c
+++ b/src/evalfunc.c
@@ -3262,6 +3262,7 @@ f_execute(typval_T *argvars, typval_T *r
     int		save_redir_execute = redir_execute;
     int		save_redir_off = redir_off;
     garray_T	save_ga;
+    int		save_msg_col = msg_col;
 
     rettv->vval.v_string = NULL;
     rettv->v_type = VAR_STRING;
@@ -3304,6 +3305,7 @@ f_execute(typval_T *argvars, typval_T *r
     ga_init2(&redir_execute_ga, (int)sizeof(char), 500);
     redir_execute = TRUE;
     redir_off = FALSE;
+    msg_col = 0;  // prevent leading spaces
 
     if (cmd != NULL)
 	do_cmdline_cmd(cmd);
@@ -3336,9 +3338,9 @@ f_execute(typval_T *argvars, typval_T *r
 	redir_execute_ga = save_ga;
     redir_off = save_redir_off;
 
-    /* "silent reg" or "silent echo x" leaves msg_col somewhere in the
-     * line.  Put it back in the first column. */
-    msg_col = 0;
+    // "silent reg" or "silent echo x" leaves msg_col somewhere in the line.
+    // Put it back where it was, since nothing should have been written.
+    msg_col = save_msg_col;
 }
 
 /*