aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/eval.c
diff options
context:
space:
mode:
authorJan Edmund Lazo <janedmundlazo@hotmail.com>2018-12-09 08:33:11 -0500
committerJan Edmund Lazo <jan.lazo@mail.utoronto.ca>2019-06-03 00:12:01 -0400
commit7443da6f6e819cbe0c4432a44a596de54c64b3d8 (patch)
treeefe9c084612e2fcce82287bddbf60c5a0fa82d82 /src/nvim/eval.c
parent8de5d641691a0d7e29759c5f0fe54875acab124b (diff)
downloadrneovim-7443da6f6e819cbe0c4432a44a596de54c64b3d8.tar.gz
rneovim-7443da6f6e819cbe0c4432a44a596de54c64b3d8.tar.bz2
rneovim-7443da6f6e819cbe0c4432a44a596de54c64b3d8.zip
vim-patch:8.1.0571: non-silent execute() resets display column to zero
Problem: Non-silent execute() resets display column to zero. Solution: Keep the display column as-is. https://github.com/vim/vim/commit/446e7a3cd36b2de7d559f167eb5795d1e1cd3ddb
Diffstat (limited to 'src/nvim/eval.c')
-rw-r--r--src/nvim/eval.c19
1 files changed, 16 insertions, 3 deletions
diff --git a/src/nvim/eval.c b/src/nvim/eval.c
index f721d398c6..a4606f76f3 100644
--- a/src/nvim/eval.c
+++ b/src/nvim/eval.c
@@ -8332,6 +8332,7 @@ static void f_execute(typval_T *argvars, typval_T *rettv, FunPtr fptr)
const bool save_redir_off = redir_off;
garray_T *const save_capture_ga = capture_ga;
const int save_msg_col = msg_col;
+ bool echo_output = false;
if (check_secure()) {
return;
@@ -8344,6 +8345,9 @@ static void f_execute(typval_T *argvars, typval_T *rettv, FunPtr fptr)
if (s == NULL) {
return;
}
+ if (*s == NUL) {
+ echo_output = true;
+ }
if (strncmp(s, "silent", 6) == 0) {
msg_silent++;
}
@@ -8359,7 +8363,9 @@ static void f_execute(typval_T *argvars, typval_T *rettv, FunPtr fptr)
ga_init(&capture_local, (int)sizeof(char), 80);
capture_ga = &capture_local;
redir_off = false;
- msg_col = 0; // prevent leading spaces
+ if (!echo_output) {
+ msg_col = 0; // prevent leading spaces
+ }
if (argvars[0].v_type != VAR_LIST) {
do_cmdline_cmd(tv_get_string(&argvars[0]));
@@ -8379,8 +8385,15 @@ static void f_execute(typval_T *argvars, typval_T *rettv, FunPtr fptr)
emsg_noredir = save_emsg_noredir;
redir_off = save_redir_off;
// "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;
+ if (echo_output) {
+ // When not working silently: put it in column zero. A following
+ // "echon" will overwrite the message, unavoidably.
+ msg_col = 0;
+ } else {
+ // When working silently: Put it back where it was, since nothing
+ // should have been written.
+ msg_col = save_msg_col;
+ }
ga_append(capture_ga, NUL);
rettv->v_type = VAR_STRING;