To: vim_dev@googlegroups.com Subject: Patch 8.2.5020 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.2.5020 Problem: Using 'imstatusfunc' and 'imactivatefunc' breaks 'foldopen'. Solution: Save and restore the KeyTyped flag. (closes #10479) Files: src/gui_xim.c, src/testdir/test_iminsert.vim *** ../vim-8.2.5019/src/gui_xim.c 2022-05-07 20:01:10.058731693 +0100 --- src/gui_xim.c 2022-05-26 13:12:57.319234178 +0100 *************** *** 89,105 **** --- 89,109 ---- call_imactivatefunc(int active) { typval_T argv[2]; + int save_KeyTyped = KeyTyped; argv[0].v_type = VAR_NUMBER; argv[0].vval.v_number = active ? 1 : 0; argv[1].v_type = VAR_UNKNOWN; (void)call_callback_retnr(&imaf_cb, 1, argv); + + KeyTyped = save_KeyTyped; } static int call_imstatusfunc(void) { int is_active; + int save_KeyTyped = KeyTyped; // FIXME: Don't execute user function in unsafe situation. if (exiting || is_autocmd_blocked()) *************** *** 109,114 **** --- 113,120 ---- ++msg_silent; is_active = call_callback_retnr(&imsf_cb, 0, NULL); --msg_silent; + + KeyTyped = save_KeyTyped; return (is_active > 0); } #endif *** ../vim-8.2.5019/src/testdir/test_iminsert.vim 2022-01-29 21:45:30.485921485 +0000 --- src/testdir/test_iminsert.vim 2022-05-26 13:12:57.319234178 +0100 *************** *** 63,68 **** --- 63,97 ---- set imstatusfunc= endfunc + func Test_imactivatefunc_imstatusfunc_callback_no_breaks_foldopen() + CheckScreendump + + let lines =<< trim END + func IM_activatefunc(active) + endfunc + func IM_statusfunc() + return 0 + endfunc + set imactivatefunc=IM_activatefunc + set imstatusfunc=IM_statusfunc + set foldmethod=marker + set foldopen=search + call setline(1, ['{{{', 'abc', '}}}']) + %foldclose + END + call writefile(lines, 'Xscript') + let buf = RunVimInTerminal('-S Xscript', {}) + call term_wait(buf) + call assert_notequal('abc', term_getline(buf, 2)) + call term_sendkeys(buf, "/abc\n") + call term_wait(buf) + call assert_equal('abc', term_getline(buf, 2)) + + " clean up + call StopVimInTerminal(buf) + call delete('Xscript') + endfunc + " Test for using an lmap in insert mode func Test_lmap_in_insert_mode() new *** ../vim-8.2.5019/src/version.c 2022-05-26 12:10:33.593893486 +0100 --- src/version.c 2022-05-26 13:15:01.359148466 +0100 *************** *** 736,737 **** --- 736,739 ---- { /* Add new patch number below this line */ + /**/ + 5020, /**/ -- CONCORDE: Message for you, sir. He falls forward revealing the arrow with the note. "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/ /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///