@@ -3263,6 +3263,7 @@ f_execute(typval_T *argvars, typval_T *rettv)
32633263 int save_redir_off = redir_off ;
32643264 garray_T save_ga ;
32653265 int save_msg_col = msg_col ;
3266+ int echo_output = FALSE;
32663267
32673268 rettv -> vval .v_string = NULL ;
32683269 rettv -> v_type = VAR_STRING ;
@@ -3289,6 +3290,8 @@ f_execute(typval_T *argvars, typval_T *rettv)
32893290
32903291 if (s == NULL )
32913292 return ;
3293+ if (* s == NUL )
3294+ echo_output = TRUE;
32923295 if (STRNCMP (s , "silent" , 6 ) == 0 )
32933296 ++ msg_silent ;
32943297 if (STRCMP (s , "silent!" ) == 0 )
@@ -3305,7 +3308,8 @@ f_execute(typval_T *argvars, typval_T *rettv)
33053308 ga_init2 (& redir_execute_ga , (int )sizeof (char ), 500 );
33063309 redir_execute = TRUE;
33073310 redir_off = FALSE;
3308- msg_col = 0 ; // prevent leading spaces
3311+ if (!echo_output )
3312+ msg_col = 0 ; // prevent leading spaces
33093313
33103314 if (cmd != NULL )
33113315 do_cmdline_cmd (cmd );
@@ -3339,8 +3343,14 @@ f_execute(typval_T *argvars, typval_T *rettv)
33393343 redir_off = save_redir_off ;
33403344
33413345 // "silent reg" or "silent echo x" leaves msg_col somewhere in the line.
3342- // Put it back where it was, since nothing should have been written.
3343- msg_col = save_msg_col ;
3346+ if (echo_output )
3347+ // When not working silently: put it in column zero. A following
3348+ // "echon" will overwrite the message, unavoidably.
3349+ msg_col = 0 ;
3350+ else
3351+ // When working silently: Put it back where it was, since nothing
3352+ // should have been written.
3353+ msg_col = save_msg_col ;
33443354}
33453355
33463356/*
0 commit comments