To: vim_dev@googlegroups.com Subject: Patch 8.2.1345 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.2.1345 Problem: Redraw error when using visual block and scroll. Solution: Add check for w_topline. ( closes #6597) Files: src/drawscreen.c, src/testdir/test_display.vim, src/testdir/dumps/Test_display_visual_block_scroll.dump *** ../vim-8.2.1344/src/drawscreen.c 2020-04-28 20:44:38.868258450 +0200 --- src/drawscreen.c 2020-08-01 19:11:55.749660722 +0200 *************** *** 1659,1668 **** #endif ) { ! if (mod_top != 0 && wp->w_topline == mod_top) { ! // w_topline is the first changed line, the scrolling will be done ! // further down. } else if (wp->w_lines[0].wl_valid && (wp->w_topline < wp->w_lines[0].wl_lnum --- 1659,1671 ---- #endif ) { ! if (mod_top != 0 ! && wp->w_topline == mod_top ! && (!wp->w_lines[0].wl_valid ! || wp->w_topline == wp->w_lines[0].wl_lnum)) { ! // w_topline is the first changed line and window is not scrolled, ! // the scrolling from changed lines will be done further down. } else if (wp->w_lines[0].wl_valid && (wp->w_topline < wp->w_lines[0].wl_lnum *** ../vim-8.2.1344/src/testdir/test_display.vim 2020-06-10 14:16:30.102988393 +0200 --- src/testdir/test_display.vim 2020-08-01 19:12:55.785377342 +0200 *************** *** 220,222 **** --- 220,245 ---- call delete('Xmac.txt') call delete(filename) endfunc + + " Test for scrolling that modifies buffer during visual block + func Test_visual_block_scroll() + CheckScreendump + + let lines =<< trim END + source $VIMRUNTIME/plugin/matchparen.vim + set scrolloff=1 + call setline(1, ['a', 'b', 'c', 'd', 'e', '', '{', '}', '{', 'f', 'g', '}']) + call cursor(5, 1) + END + + let filename = 'Xvisualblockmodifiedscroll' + call writefile(lines, filename) + + let buf = RunVimInTerminal('-S '.filename, #{rows: 7}) + call term_sendkeys(buf, "V\\") + + call VerifyScreenDump(buf, 'Test_display_visual_block_scroll', {}) + + call StopVimInTerminal(buf) + call delete(filename) + endfunc *** ../vim-8.2.1344/src/testdir/dumps/Test_display_visual_block_scroll.dump 2020-08-01 19:13:52.225109971 +0200 --- src/testdir/dumps/Test_display_visual_block_scroll.dump 2020-08-01 19:08:14.474693872 +0200 *************** *** 0 **** --- 1,7 ---- + |{+0&#e0e0e08| | +0&#ffffff0@72 + |}+0&#e0e0e08| | +0&#ffffff0@72 + |{+0&#e0e0e08| | +0&#ffffff0@72 + |f+0&#e0e0e08| | +0&#ffffff0@72 + >g| +0&#e0e0e08| +0&#ffffff0@72 + |}| @73 + |-+2&&@1| |V|I|S|U|A|L| |L|I|N|E| |-@1| +0&&@29|7| @8|1@1|,|1| @9|B|o|t| *** ../vim-8.2.1344/src/version.c 2020-08-01 18:57:49.277422206 +0200 --- src/version.c 2020-08-01 19:13:43.449151617 +0200 *************** *** 756,757 **** --- 756,759 ---- { /* Add new patch number below this line */ + /**/ + 1345, /**/ -- Contrary to popular belief, Unix is user friendly. It just happens to be selective about who it makes friends with. -- Dave Parnas /// 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 ///