To: vim_dev@googlegroups.com Subject: Patch 8.0.1109 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.0.1109 Problem: Timer causes error on exit from Ex mode. (xtal8) Solution: save and restore the ex_pressedreturn flag. (Christian Brabandt, closes #2079) Files: src/ex_docmd.c, src/proto/ex_docmd.pro, src/ex_cmds2.c, src/testdir/test_timers.vim *** ../vim-8.0.1108/src/ex_docmd.c 2017-09-14 20:37:49.959213776 +0200 --- src/ex_docmd.c 2017-09-14 22:49:39.275537639 +0200 *************** *** 12418,12420 **** --- 12418,12434 ---- #endif } #endif + + # if defined(FEAT_TIMERS) || defined(PROTO) + int + get_pressedreturn(void) + { + return ex_pressedreturn; + } + + void + set_pressedreturn(int val) + { + ex_pressedreturn = val; + } + #endif *** ../vim-8.0.1108/src/proto/ex_docmd.pro 2017-08-06 15:22:10.305211941 +0200 --- src/proto/ex_docmd.pro 2017-09-14 22:47:58.936146665 +0200 *************** *** 63,66 **** --- 63,68 ---- char_u *get_behave_arg(expand_T *xp, int idx); char_u *get_messages_arg(expand_T *xp, int idx); char_u *get_mapclear_arg(expand_T *xp, int idx); + int get_pressedreturn(void); + void set_pressedreturn(int val); /* vim: set ft=c : */ *** ../vim-8.0.1108/src/ex_cmds2.c 2017-09-06 23:40:05.513366294 +0200 --- src/ex_cmds2.c 2017-09-14 22:49:06.251738043 +0200 *************** *** 1224,1229 **** --- 1224,1230 ---- int save_must_redraw = must_redraw; int save_trylevel = trylevel; int save_did_throw = did_throw; + int save_ex_pressedreturn = get_pressedreturn(); except_T *save_current_exception = current_exception; /* Create a scope for running the timer callback, ignoring most of *************** *** 1257,1262 **** --- 1258,1264 ---- need_update_screen = TRUE; must_redraw = must_redraw > save_must_redraw ? must_redraw : save_must_redraw; + set_pressedreturn(save_ex_pressedreturn); /* Only fire the timer again if it repeats and stop_timer() wasn't * called while inside the callback (tr_id == -1). */ *** ../vim-8.0.1108/src/testdir/test_timers.vim 2017-09-06 23:40:05.513366294 +0200 --- src/testdir/test_timers.vim 2017-09-14 22:46:58.484513764 +0200 *************** *** 246,249 **** --- 246,260 ---- call timer_stop(intr) endfunc + func Test_ex_mode() + " Function with an empty line. + func Foo(...) + + endfunc + let timer = timer_start(40, function('g:Foo'), {'repeat':-1}) + " This used to throw error E749. + exe "normal Qsleep 100m\rvi\r" + call timer_stop(timer) + endfunc + " vim: shiftwidth=2 sts=2 expandtab *** ../vim-8.0.1108/src/version.c 2017-09-14 20:37:49.967213729 +0200 --- src/version.c 2017-09-14 22:50:12.599335458 +0200 *************** *** 771,772 **** --- 771,774 ---- { /* Add new patch number below this line */ + /**/ + 1109, /**/ -- I have a watch cat! Just break in and she'll watch. /// 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 ///