To: vim_dev@googlegroups.com Subject: Patch 8.1.2363 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.1.2363 Problem: ml_get error when accessing Visual area in 'statusline'. Solution: Disable Visual mode when using another window. (closes #5278) Files: src/testdir/test_statusline.vim, src/buffer.c *** ../vim-8.1.2362/src/testdir/test_statusline.vim 2019-05-23 22:11:56.288893239 +0200 --- src/testdir/test_statusline.vim 2019-11-30 14:55:45.630083860 +0100 *************** *** 368,370 **** --- 368,392 ---- set laststatus& set splitbelow& endfunc + + func Test_statusline_visual() + func CallWordcount() + call wordcount() + endfunc + new x1 + setl statusline=count=%{CallWordcount()} + " buffer must not be empty + call setline(1, 'hello') + + " window with more lines than x1 + new x2 + call setline(1, range(10)) + $ + " Visual mode in line below liast line in x1 should not give ml_get error + call feedkeys("\", "xt") + redraw + + delfunc CallWordcount + bwipe! x1 + bwipe! x2 + endfunc *** ../vim-8.1.2362/src/buffer.c 2019-11-17 17:06:25.820081750 +0100 --- src/buffer.c 2019-11-30 15:00:43.032650225 +0100 *************** *** 3979,3984 **** --- 3979,3985 ---- #ifdef FEAT_EVAL win_T *save_curwin; buf_T *save_curbuf; + int save_VIsual_active; #endif int empty_line; colnr_T virtcol; *************** *** 4368,4380 **** --- 4369,4386 ---- save_curbuf = curbuf; save_curwin = curwin; + save_VIsual_active = VIsual_active; curwin = wp; curbuf = wp->w_buffer; + // Visual mode is only valid in the current window. + if (curwin != save_curwin) + VIsual_active = FALSE; str = eval_to_string_safe(p, &t, use_sandbox); curwin = save_curwin; curbuf = save_curbuf; + VIsual_active = save_VIsual_active; do_unlet((char_u *)"g:actual_curbuf", TRUE); do_unlet((char_u *)"g:actual_curwin", TRUE); *** ../vim-8.1.2362/src/version.c 2019-11-30 14:21:35.051829558 +0100 --- src/version.c 2019-11-30 15:05:02.035343384 +0100 *************** *** 739,740 **** --- 739,742 ---- { /* Add new patch number below this line */ + /**/ + 2363, /**/ -- hundred-and-one symptoms of being an internet addict: 147. You finally give up smoking...because it made the monitor dirty. /// 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 ///