To: vim_dev@googlegroups.com Subject: Patch 8.1.0571 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.1.0571 (after 8.1.0569) Problem: Non-silent execute() resets display column to zero. Solution: Keep the display column as-is. Files: src/evalfunc.c, src/testdir/test_execute_func.vim *** ../vim-8.1.0570/src/evalfunc.c 2018-12-07 16:38:20.461472100 +0100 --- src/evalfunc.c 2018-12-08 13:29:07.583916762 +0100 *************** *** 3263,3268 **** --- 3263,3269 ---- int save_redir_off = redir_off; garray_T save_ga; int save_msg_col = msg_col; + int echo_output = FALSE; rettv->vval.v_string = NULL; rettv->v_type = VAR_STRING; *************** *** 3289,3294 **** --- 3290,3297 ---- if (s == NULL) return; + if (*s == NUL) + echo_output = TRUE; if (STRNCMP(s, "silent", 6) == 0) ++msg_silent; if (STRCMP(s, "silent!") == 0) *************** *** 3305,3311 **** 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); --- 3308,3315 ---- ga_init2(&redir_execute_ga, (int)sizeof(char), 500); redir_execute = TRUE; redir_off = FALSE; ! if (!echo_output) ! msg_col = 0; // prevent leading spaces if (cmd != NULL) do_cmdline_cmd(cmd); *************** *** 3339,3346 **** 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; } /* --- 3343,3356 ---- redir_off = save_redir_off; // "silent reg" or "silent echo x" leaves msg_col somewhere in the line. ! 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; } /* *** ../vim-8.1.0570/src/testdir/test_execute_func.vim 2018-12-07 16:38:20.461472100 +0100 --- src/testdir/test_execute_func.vim 2018-12-08 13:31:33.151013537 +0100 *************** *** 61,63 **** --- 61,80 ---- endfor call assert_equal('abcdxyz', text) endfunc + + func Test_execute_not_silent() + echo '' + echon 'abcd' + let x = execute('echon 234', '') + echo 'xyz' + let text1 = '' + for col in range(1, 8) + let text1 .= nr2char(screenchar(&lines - 1, col)) + endfor + call assert_equal('abcd234 ', text1) + let text2 = '' + for col in range(1, 4) + let text2 .= nr2char(screenchar(&lines, col)) + endfor + call assert_equal('xyz ', text2) + endfunc *** ../vim-8.1.0570/src/version.c 2018-12-07 21:08:44.775946983 +0100 --- src/version.c 2018-12-08 13:32:59.090476830 +0100 *************** *** 794,795 **** --- 794,797 ---- { /* Add new patch number below this line */ + /**/ + 571, /**/ -- | Ceci n'est pas une pipe. /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///