• R/O
  • SSH

vim: Commit

Mirror of the Vim source from https://github.com/vim/vim


Commit MetaInfo

Revision5f4a188dead8bce4d7e299c4c2cf6dcd215fa1fd (tree)
Time2020-08-02 02:15:03
AuthorBram Moolenaar <Bram@vim....>
CommiterBram Moolenaar

Log Message

patch 8.2.1345: Redraw error when using visual block and scroll

Commit: https://github.com/vim/vim/commit/f8992d47cd50494c64bb733329067c9de3c75200
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat Aug 1 19:14:13 2020 +0200

patch 8.2.1345: Redraw error when using visual block and scroll
Problem: Redraw error when using visual block and scroll.
Solution: Add check for w_topline. ( closes https://github.com/vim/vim/issues/6597)

Change Summary

Incremental Difference

diff -r a38f99a23aa8 -r 5f4a188dead8 src/drawscreen.c
--- a/src/drawscreen.c Sat Aug 01 19:00:05 2020 +0200
+++ b/src/drawscreen.c Sat Aug 01 19:15:03 2020 +0200
@@ -1659,10 +1659,13 @@
16591659 #endif
16601660 )
16611661 {
1662- if (mod_top != 0 && wp->w_topline == mod_top)
1662+ if (mod_top != 0
1663+ && wp->w_topline == mod_top
1664+ && (!wp->w_lines[0].wl_valid
1665+ || wp->w_topline == wp->w_lines[0].wl_lnum))
16631666 {
1664- // w_topline is the first changed line, the scrolling will be done
1665- // further down.
1667+ // w_topline is the first changed line and window is not scrolled,
1668+ // the scrolling from changed lines will be done further down.
16661669 }
16671670 else if (wp->w_lines[0].wl_valid
16681671 && (wp->w_topline < wp->w_lines[0].wl_lnum
diff -r a38f99a23aa8 -r 5f4a188dead8 src/testdir/dumps/Test_display_visual_block_scroll.dump
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/testdir/dumps/Test_display_visual_block_scroll.dump Sat Aug 01 19:15:03 2020 +0200
@@ -0,0 +1,7 @@
1+|{+0&#e0e0e08| | +0&#ffffff0@72
2+|}+0&#e0e0e08| | +0&#ffffff0@72
3+|{+0&#e0e0e08| | +0&#ffffff0@72
4+|f+0&#e0e0e08| | +0&#ffffff0@72
5+>g| +0&#e0e0e08| +0&#ffffff0@72
6+|}| @73
7+|-+2&&@1| |V|I|S|U|A|L| |L|I|N|E| |-@1| +0&&@29|7| @8|1@1|,|1| @9|B|o|t|
diff -r a38f99a23aa8 -r 5f4a188dead8 src/testdir/test_display.vim
--- a/src/testdir/test_display.vim Sat Aug 01 19:00:05 2020 +0200
+++ b/src/testdir/test_display.vim Sat Aug 01 19:15:03 2020 +0200
@@ -220,3 +220,26 @@
220220 call delete('Xmac.txt')
221221 call delete(filename)
222222 endfunc
223+
224+" Test for scrolling that modifies buffer during visual block
225+func Test_visual_block_scroll()
226+ CheckScreendump
227+
228+ let lines =<< trim END
229+ source $VIMRUNTIME/plugin/matchparen.vim
230+ set scrolloff=1
231+ call setline(1, ['a', 'b', 'c', 'd', 'e', '', '{', '}', '{', 'f', 'g', '}'])
232+ call cursor(5, 1)
233+ END
234+
235+ let filename = 'Xvisualblockmodifiedscroll'
236+ call writefile(lines, filename)
237+
238+ let buf = RunVimInTerminal('-S '.filename, #{rows: 7})
239+ call term_sendkeys(buf, "V\<C-D>\<C-D>")
240+
241+ call VerifyScreenDump(buf, 'Test_display_visual_block_scroll', {})
242+
243+ call StopVimInTerminal(buf)
244+ call delete(filename)
245+endfunc
diff -r a38f99a23aa8 -r 5f4a188dead8 src/version.c
--- a/src/version.c Sat Aug 01 19:00:05 2020 +0200
+++ b/src/version.c Sat Aug 01 19:15:03 2020 +0200
@@ -755,6 +755,8 @@
755755 static int included_patches[] =
756756 { /* Add new patch number below this line */
757757 /**/
758+ 1345,
759+/**/
758760 1344,
759761 /**/
760762 1343,
Show on old repository browser