To: vim_dev@googlegroups.com Subject: Patch 8.2.1781 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.2.1781 Problem: Writing to prompt buffer interferes with insert mode. Solution: Use win_enter() instead of just setting "curwin". (Ben Jackson, closes #7035) Files: src/autocmd.c, src/testdir/test_prompt_buffer.vim *** ../vim-8.2.1780/src/autocmd.c 2020-08-20 15:02:38.536534973 +0200 --- src/autocmd.c 2020-10-01 20:02:24.633439584 +0200 *************** *** 1533,1539 **** unblock_autocmds(); if (win_valid(aco->save_curwin)) ! curwin = aco->save_curwin; else // Hmm, original window disappeared. Just use the first one. curwin = firstwin; --- 1533,1539 ---- unblock_autocmds(); if (win_valid(aco->save_curwin)) ! win_enter(aco->save_curwin, TRUE); else // Hmm, original window disappeared. Just use the first one. curwin = firstwin; *** ../vim-8.2.1780/src/testdir/test_prompt_buffer.vim 2020-09-04 16:35:06.425571289 +0200 --- src/testdir/test_prompt_buffer.vim 2020-10-01 20:00:35.613764908 +0200 *************** *** 182,185 **** --- 182,218 ---- %bwipe! endfunc + function! Test_prompt_while_writing_to_hidden_buffer() + call CanTestPromptBuffer() + CheckUnix + + " Make a job continuously write to a hidden buffer, check that the prompt + " buffer is not affected. + let scriptName = 'XpromptscriptHiddenBuf' + let script =<< trim END + set buftype=prompt + call prompt_setprompt( bufnr(), 'cmd:' ) + let job = job_start(['/bin/sh', '-c', + \ 'while true; + \ do echo line; + \ sleep 0.1; + \ done'], #{out_io: 'buffer', out_name: ''}) + startinsert + END + eval script->writefile(scriptName) + + let buf = RunVimInTerminal('-S ' .. scriptName, {}) + call WaitForAssert({-> assert_equal('cmd:', term_getline(buf, 1))}) + + call term_sendkeys(buf, 'test') + call WaitForAssert({-> assert_equal('cmd:test', term_getline(buf, 1))}) + call term_sendkeys(buf, 'test') + call WaitForAssert({-> assert_equal('cmd:testtest', term_getline(buf, 1))}) + call term_sendkeys(buf, 'test') + call WaitForAssert({-> assert_equal('cmd:testtesttest', term_getline(buf, 1))}) + + call StopVimInTerminal(buf) + call delete(scriptName) + endfunc + " vim: shiftwidth=2 sts=2 expandtab *** ../vim-8.2.1780/src/version.c 2020-10-01 19:06:31.851610491 +0200 --- src/version.c 2020-10-01 19:56:11.830563748 +0200 *************** *** 752,753 **** --- 752,755 ---- { /* Add new patch number below this line */ + /**/ + 1781, /**/ -- I have a drinking problem -- I can't afford it. /// 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 ///