To: vim_dev@googlegroups.com Subject: Patch 8.1.0569 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.1.0569 Problem: Execute() always resets display column to zero. (Sha Liu) Solution: Don't reset it to zero, restore the previous value. (closes #3669) Files: src/evalfunc.c, src/testdir/test_execute_func.c *** ../vim-8.1.0568/src/evalfunc.c 2018-11-22 03:07:30.944596219 +0100 --- src/evalfunc.c 2018-12-07 16:34:07.079078592 +0100 *************** *** 3262,3267 **** --- 3262,3268 ---- 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,3309 **** --- 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); *************** *** 3336,3344 **** 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; } /* --- 3338,3346 ---- 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 where it was, since nothing should have been written. ! msg_col = save_msg_col; } /* *** ../vim-8.1.0568/src/testdir/test_execute_func.vim 2016-07-09 16:44:29.000000000 +0200 --- src/testdir/test_execute_func.vim 2018-12-07 16:36:51.086039444 +0100 *************** *** 49,51 **** --- 49,63 ---- call assert_equal("", execute([])) call assert_equal("", execute(test_null_list())) 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 *** ../vim-8.1.0568/src/version.c 2018-12-07 14:10:33.934952419 +0100 --- src/version.c 2018-12-07 16:37:07.753933691 +0100 *************** *** 794,795 **** --- 794,797 ---- { /* Add new patch number below this line */ + /**/ + 569, /**/ -- ARTHUR: Now stand aside worthy adversary. BLACK KNIGHT: (Glancing at his shoulder) 'Tis but a scratch. ARTHUR: A scratch? Your arm's off. "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD /// 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 ///