]> granicus.if.org Git - vim/commitdiff
patch 8.1.0849: cursorline highlight is not always updated v8.1.0849
authorBram Moolenaar <Bram@vim.org>
Wed, 30 Jan 2019 20:41:14 +0000 (21:41 +0100)
committerBram Moolenaar <Bram@vim.org>
Wed, 30 Jan 2019 20:41:14 +0000 (21:41 +0100)
Problem:    Cursorline highlight is not always updated.
Solution:   Set w_last_cursorline when redrawing.  Fix resetting cursor flags
            when using the popup menu.

src/popupmnu.c
src/screen.c
src/testdir/dumps/Test_cursorline_yank_01.dump [new file with mode: 0644]
src/testdir/test_highlight.vim
src/version.c

index 2f2bde0bb5ed4f5e435e4c959cb0a7b1687cf8be..755dba45a69055a2f3276ee1f03f03e024f2b71e 100644 (file)
@@ -368,7 +368,7 @@ pum_call_update_screen()
     // Update the cursor position to be able to compute the popup menu
     // position.  The cursor line length may have changed because of the
     // inserted completion.
-    curwin->w_valid &= VALID_CROW|VALID_CHEIGHT;
+    curwin->w_valid &= ~(VALID_CROW|VALID_CHEIGHT);
     validate_cursor();
 }
 
index 570910e29f8dca050bcb521f14163c3bd229320e..1370773f8f0e8d884c09b3a0d6781e81ef22b6e1 100644 (file)
@@ -3712,6 +3712,7 @@ win_line(
     {
        line_attr = HL_ATTR(HLF_CUL);
        area_highlighting = TRUE;
+       wp->w_last_cursorline = wp->w_cursor.lnum;
     }
 #endif
 
diff --git a/src/testdir/dumps/Test_cursorline_yank_01.dump b/src/testdir/dumps/Test_cursorline_yank_01.dump
new file mode 100644 (file)
index 0000000..3de1bff
--- /dev/null
@@ -0,0 +1,8 @@
+| +0#af5f00255#ffffff0@1|3| | +0#0000000&@70
+| +0#af5f00255&@1|2| |1+0#0000000&| @69
+| +0#af5f00255&@1|1| |2+0#0000000&| @69
+| +0#af5f00255&@1|0| >3+8#0000000&| @69
+| +0#af5f00255&@1|1| | +0#0000000&@70
+|~+0#4040ff13&| @73
+|~| @73
+|4+0#0000000&| |l|i|n|e|s| |y|a|n|k|e|d| @42|4|,|1| @10|A|l@1| 
index 67c7506133cb7f6203b53a38a213b93bcbcb24e6..b37684c6f5a7caa1de8386222081456d68f8d064 100644 (file)
@@ -1,6 +1,7 @@
 " Tests for ":highlight" and highlighting.
 
 source view_util.vim
+source screendump.vim
 
 func Test_highlight()
   " basic test if ":highlight" doesn't crash
@@ -129,10 +130,6 @@ func Test_highlight_eol_with_cursorline()
 endfunc
 
 func Test_highlight_eol_with_cursorline_vertsplit()
-  if !has('vertsplit')
-    return
-  endif
-
   let [hiCursorLine, hi_ul, hi_bg] = HiCursorLine()
 
   call NewWindow('topleft 5', 5)
@@ -533,3 +530,25 @@ func Test_termguicolors()
   set t_Co=0
   redraw
 endfunc
+
+func Test_cursorline_after_yank()
+  if !CanRunVimInTerminal()
+    return
+  endif
+
+  call writefile([
+       \ 'set cul rnu',
+       \ 'call setline(1, ["","1","2","3",""])',
+       \ ], 'Xtest_cursorline_yank')
+  let buf = RunVimInTerminal('-S Xtest_cursorline_yank', {'rows': 8})
+  call term_wait(buf)
+  call term_sendkeys(buf, "Gy3k")
+  call term_wait(buf)
+  call term_sendkeys(buf, "jj")
+
+  call VerifyScreenDump(buf, 'Test_cursorline_yank_01', {})
+
+  " clean up
+  call StopVimInTerminal(buf)
+  call delete('Xtest_cursorline_yank')
+endfunc
index 114539abb13fa6281570a2bcd3e7cbfce50be598..864ca44c2bbb84c4c889987c5c2335e7bb57f55a 100644 (file)
@@ -783,6 +783,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    849,
 /**/
     848,
 /**/