]> granicus.if.org Git - vim/commitdiff
patch 8.2.4626: Visual area not updated when removing sign in Visual mode v8.2.4626
authorBram Moolenaar <Bram@vim.org>
Fri, 25 Mar 2022 15:42:27 +0000 (15:42 +0000)
committerBram Moolenaar <Bram@vim.org>
Fri, 25 Mar 2022 15:42:27 +0000 (15:42 +0000)
Problem:    Visual area not fully updated when removing sign in Visual mode
            while scrolling.
Solution:   Adjust check for topline. (closes #10017)

src/drawscreen.c
src/testdir/dumps/Test_display_scroll_update_visual.dump [new file with mode: 0644]
src/testdir/test_display.vim
src/version.c

index a902397cd7ff14da71f8dd15c18498fddf2b5860..12eed8c4766e2a57917bb9751a66b0c104c289ca 100644 (file)
@@ -1730,7 +1730,7 @@ win_update(win_T *wp)
        if (mod_top != 0
                && wp->w_topline == mod_top
                && (!wp->w_lines[0].wl_valid
-                   || wp->w_topline <= wp->w_lines[0].wl_lnum))
+                   || 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.
diff --git a/src/testdir/dumps/Test_display_scroll_update_visual.dump b/src/testdir/dumps/Test_display_scroll_update_visual.dump
new file mode 100644 (file)
index 0000000..c174390
--- /dev/null
@@ -0,0 +1,8 @@
+| +0#0000e05#a8a8a8255@1>f+0#0000000#ffffff0|o+0&#e0e0e08@1| | +0&#ffffff0@53
+| +0#0000e05#a8a8a8255@1|f+0#0000000#ffffff0|o@1| @54
+| +0#0000e05#a8a8a8255@1|f+0#0000000#ffffff0|o@1| @54
+| +0#0000e05#a8a8a8255@1|f+0#0000000#ffffff0|o@1| @54
+| +0#0000e05#a8a8a8255@1|f+0#0000000#ffffff0|o@1| @54
+| +0#0000e05#a8a8a8255@1|f+0#0000000#ffffff0|o@1| @54
+| +0#0000e05#a8a8a8255@1|f+0#0000000#ffffff0|o@1| @54
+|-+2&&@1| |V|I|S|U|A|L| |L|I|N|E| |-@1| +0&&@14|2| @8|2|,|1| @10|3@1|%| 
index a2e6fafd8802daf02651d28053dfefa12496ef05..a000521d0c40461ef7410437a000108895ed7afd 100644 (file)
@@ -256,6 +256,27 @@ func Test_display_scroll_at_topline()
   call StopVimInTerminal(buf)
 endfunc
 
+func Test_display_scroll_update_visual()
+  CheckScreendump
+
+  let lines =<< trim END
+      set scrolloff=0
+      call setline(1, repeat(['foo'], 10))
+      call sign_define('foo', { 'text': '>' })
+      call sign_place(1, 'bar', 'foo', bufnr(), { 'lnum': 2 })
+      call sign_place(2, 'bar', 'foo', bufnr(), { 'lnum': 1 })
+      autocmd CursorMoved * if getcurpos()[1] == 2 | call sign_unplace('bar', { 'id': 1 }) | endif
+  END
+  call writefile(lines, 'XupdateVisual.vim')
+
+  let buf = RunVimInTerminal('-S XupdateVisual.vim', #{rows: 8, cols: 60})
+  call term_sendkeys(buf, "VG7kk")
+  call VerifyScreenDump(buf, 'Test_display_scroll_update_visual', {})
+
+  call StopVimInTerminal(buf)
+  call delete('XupdateVisual.vim')
+endfunc
+
 " Test for 'eob' (EndOfBuffer) item in 'fillchars'
 func Test_eob_fillchars()
   " default value
index 748a12f398e9f9de915a482da0c8921e9ed171a3..c13d03f2cccabec374a594dab7f980520d2c8473 100644 (file)
@@ -750,6 +750,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    4626,
 /**/
     4625,
 /**/