To: vim_dev@googlegroups.com Subject: Patch 8.2.2340 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.2.2340 Problem: win_execute() unexpectedly returns number zero when failing. Solution: Return an empty string. (closes #7665) Files: src/evalwindow.c, src/testdir/test_vim9_builtin.vim, src/testdir/test_execute_func.vim *** ../vim-8.2.2339/src/evalwindow.c 2020-12-29 20:25:16.470694750 +0100 --- src/evalwindow.c 2021-01-12 22:02:07.880989471 +0100 *************** *** 673,678 **** --- 673,682 ---- win_T *save_curwin; tabpage_T *save_curtab; + // Return an empty string if something fails. + rettv->v_type = VAR_STRING; + rettv->vval.v_string = NULL; + if (wp != NULL && tp != NULL) { pos_T curpos = wp->w_cursor; *** ../vim-8.2.2339/src/testdir/test_vim9_builtin.vim 2021-01-12 21:48:55.879131998 +0100 --- src/testdir/test_vim9_builtin.vim 2021-01-12 22:06:10.068317541 +0100 *************** *** 800,805 **** --- 800,810 ---- timer_stop(id) enddef + def Test_win_execute() + assert_equal("\n" .. winnr(), win_execute(win_getid(), 'echo winnr()')) + assert_equal('', win_execute(342343, 'echo winnr()')) + enddef + def Test_win_splitmove() split win_splitmove(1, 2, {vertical: true, rightbelow: true}) *** ../vim-8.2.2339/src/testdir/test_execute_func.vim 2020-04-24 22:47:26.771359294 +0200 --- src/testdir/test_execute_func.vim 2021-01-12 22:07:34.536082364 +0100 *************** *** 89,94 **** --- 89,96 ---- call win_gotoid(thiswin) let line = win_execute(otherwin, 'echo getline(1)') call assert_match('the new window', line) + let line = win_execute(134343, 'echo getline(1)') + call assert_equal('', line) if has('popupwin') let popupwin = popup_create('the popup win', {'line': 2, 'col': 3}) *** ../vim-8.2.2339/src/version.c 2021-01-12 21:48:55.879131998 +0100 --- src/version.c 2021-01-12 22:01:18.205126696 +0100 *************** *** 752,753 **** --- 752,755 ---- { /* Add new patch number below this line */ + /**/ + 2340, /**/ -- Birthdays are healthy. The more you have them, the longer you live. /// 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 ///