]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 8.2.4630: 'cursorline' not always updated with 'culopt' is "screenline" v8.2.4630
authorBram Moolenaar <Bram@vim.org>
Sat, 26 Mar 2022 13:28:14 +0000 (13:28 +0000)
committerBram Moolenaar <Bram@vim.org>
Sat, 26 Mar 2022 13:28:14 +0000 (13:28 +0000)
Problem:    'cursorline' not always updated with 'cursorlineopt' is
            "screenline".
Solution:   Call check_redraw_cursorline() more often. (closes #10013)

src/edit.c
src/normal.c
src/testdir/dumps/Test_cursorline_screenline_1.dump [new file with mode: 0644]
src/testdir/dumps/Test_cursorline_screenline_2.dump [new file with mode: 0644]
src/testdir/test_cursorline.vim
src/version.c

index 0edd38be4c8ec3f561cd31aa4bccb7e8ccf49789..a183324b35ed6a808a36d928578e43eca7788210 100644 (file)
@@ -1058,6 +1058,10 @@ doESCkey:
        case K_COMMAND:             // <Cmd>command<CR>
        case K_SCRIPT_COMMAND:      // <ScriptCmd>command<CR>
            do_cmdkey_command(c, 0);
+#ifdef FEAT_SYN_HL
+           // Might need to update for 'cursorline'.
+           check_redraw_cursorline();
+#endif
 #ifdef FEAT_TERMINAL
            if (term_use_loop())
                // Started a terminal that gets the input, exit Insert mode.
index e39fb772ae15c5ca7edd7d08b738d13cc1ce6e3a..49e5a93b1d8624d40d502653d3e2f1ba0eb65be2 100644 (file)
@@ -6971,6 +6971,10 @@ nv_edit(cmdarg_T *cap)
            coladvance(getviscol());
            State = save_State;
        }
+#ifdef FEAT_SYN_HL
+       // Might need to update for 'cursorline'.
+       check_redraw_cursorline();
+#endif
 
        invoke_edit(cap, FALSE, cap->cmdchar, FALSE);
     }
diff --git a/src/testdir/dumps/Test_cursorline_screenline_1.dump b/src/testdir/dumps/Test_cursorline_screenline_1.dump
new file mode 100644 (file)
index 0000000..d28794b
--- /dev/null
@@ -0,0 +1,8 @@
+|x+0&#ffffff0|y|z| |x|y|z| |x|y|z| |x|y|z| |x|y|z| |x|y|z| |x|y|z| |x|y|z| |x|y|z| |x|y|z| |x|y|z| |x|y|z| |x|y|z| |x|y|z| |x|y|z| |x|y|z| |x|y|z| |x|y|z| |x|y|z
+| +8&&|x|y|z| |x|y|z| |x|y|z| |x|y|z| |x|y|z| |x|y|z| |x|y|z| |x|y|z| |x|y|z| |x|y|z| |x|y|z| > @29
+|~+0#4040ff13&| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|-+2#0000000&@1| |I|N|S|E|R|T| |-@1| +0&&@44|1|,|1|2|1| @8|A|l@1| 
diff --git a/src/testdir/dumps/Test_cursorline_screenline_2.dump b/src/testdir/dumps/Test_cursorline_screenline_2.dump
new file mode 100644 (file)
index 0000000..3c44da1
--- /dev/null
@@ -0,0 +1,8 @@
+>x+8&#ffffff0|y|z| |x|y|z| |x|y|z| |x|y|z| |x|y|z| |x|y|z| |x|y|z| |x|y|z| |x|y|z| |x|y|z| |x|y|z| |x|y|z| |x|y|z| |x|y|z| |x|y|z| |x|y|z| |x|y|z| |x|y|z| |x|y|z
+| +0&&|x|y|z| |x|y|z| |x|y|z| |x|y|z| |x|y|z| |x|y|z| |x|y|z| |x|y|z| |x|y|z| |x|y|z| |x|y|z| @30
+|~+0#4040ff13&| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|-+2#0000000&@1| |I|N|S|E|R|T| |-@1| +0&&@44|1|,|1| @10|A|l@1| 
index c2505e3d589446e057bf5b2be58dc858dd49511e..7797cd62805c68468119498b664536a3c635f066 100644 (file)
@@ -272,5 +272,26 @@ func Test_cursorline_callback()
   call delete('Xcul_timer')
 endfunc
 
+func Test_cursorline_screenline_update()
+  CheckScreendump
+
+  let lines =<< trim END
+      call setline(1, repeat('xyz ', 30))
+      set cursorline cursorlineopt=screenline
+      inoremap <F2> <Cmd>call cursor(1, 1)<CR>
+  END
+  call writefile(lines, 'Xcul_screenline')
+
+  let buf = RunVimInTerminal('-S Xcul_screenline', #{rows: 8})
+  call term_sendkeys(buf, "A")
+  call VerifyScreenDump(buf, 'Test_cursorline_screenline_1', {})
+  call term_sendkeys(buf, "\<F2>")
+  call VerifyScreenDump(buf, 'Test_cursorline_screenline_2', {})
+  call term_sendkeys(buf, "\<Esc>")
+
+  call StopVimInTerminal(buf)
+  call delete('Xcul_screenline')
+endfunc
+
 
 " vim: shiftwidth=2 sts=2 expandtab
index a68c88137ba262f0291db158a83a220a58b5ccdc..5eb4eea1e58a274d0c5aadca5ea100eb650d1c02 100644 (file)
@@ -750,6 +750,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    4630,
 /**/
     4629,
 /**/