• R/O
  • SSH

vim: Commit

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


Commit MetaInfo

Revisionb2cb2a321af96da0fc63e555b28ea58c521e02d5 (tree)
Time2020-09-25 06:00:04
AuthorBram Moolenaar <Bram@vim....>
CommiterBram Moolenaar

Log Message

patch 8.2.1737: cursor line highlight in popup window is not always updated

Commit: https://github.com/vim/vim/commit/10476521f51d5902d191f2189307781fc48a3a16
Author: Bram Moolenaar <Bram@vim.org>
Date: Thu Sep 24 22:57:31 2020 +0200

patch 8.2.1737: cursor line highlight in popup window is not always updated
Problem: Cursor line highlight in popup window is not always updated.
Solution: Check if the cursor has moved. (closes https://github.com/vim/vim/issues/7010)

Change Summary

Incremental Difference

diff -r 6820ccdb87df -r b2cb2a321af9 src/popupwin.c
--- a/src/popupwin.c Wed Sep 23 22:45:06 2020 +0200
+++ b/src/popupwin.c Thu Sep 24 23:00:04 2020 +0200
@@ -3711,6 +3711,11 @@
37113711 // Draw the popup text, unless it's off screen.
37123712 if (wp->w_winrow < screen_Rows && wp->w_wincol < screen_Columns)
37133713 {
3714+ // May need to update the "cursorline" highlighting, which may also
3715+ // change "topline"
3716+ if (wp->w_popup_last_curline != wp->w_cursor.lnum)
3717+ popup_highlight_curline(wp);
3718+
37143719 win_update(wp);
37153720
37163721 // move the cursor into the visible lines, otherwise executing
diff -r 6820ccdb87df -r b2cb2a321af9 src/testdir/dumps/Test_popupwin_win_execute_cursorline.dump
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/testdir/dumps/Test_popupwin_win_execute_cursorline.dump Thu Sep 24 23:00:04 2020 +0200
@@ -0,0 +1,14 @@
1+> +0&#ffffff0@74
2+|~+0#4040ff13&| @73
3+|~| @34|1+0#0000001#ffd7ff255|4| +0#0000000#a8a8a8255| +0#4040ff13#ffffff0@35
4+|~| @34|1+0#0000001#ffd7ff255|5| +0#0000000#a8a8a8255| +0#4040ff13#ffffff0@35
5+|~| @34|1+0#0000001#ffd7ff255|6| +0#0000000#a8a8a8255| +0#4040ff13#ffffff0@35
6+|~| @34|1+0#0000001#e0e0e08|7| +0#0000000#a8a8a8255| +0#4040ff13#ffffff0@35
7+|~| @34|1+0#0000001#ffd7ff255|8| +0#0000000#0000001| +0#4040ff13#ffffff0@35
8+|~| @34|1+0#0000001#ffd7ff255|9| +0#0000000#0000001| +0#4040ff13#ffffff0@35
9+|~| @34|2+0#0000001#ffd7ff255|0| +0#0000000#0000001| +0#4040ff13#ffffff0@35
10+|~| @34|2+0#0000001#ffd7ff255|1| +0#0000000#a8a8a8255| +0#4040ff13#ffffff0@35
11+|~| @34|2+0#0000001#ffd7ff255@1| +0#0000000#a8a8a8255| +0#4040ff13#ffffff0@35
12+|~| @73
13+|~| @73
14+|:+0#0000000&| @55|0|,|0|-|1| @8|A|l@1|
diff -r 6820ccdb87df -r b2cb2a321af9 src/testdir/test_popupwin.vim
--- a/src/testdir/test_popupwin.vim Wed Sep 23 22:45:06 2020 +0200
+++ b/src/testdir/test_popupwin.vim Thu Sep 24 23:00:04 2020 +0200
@@ -1556,16 +1556,41 @@
15561556 call delete('XtestPopupNormal')
15571557 endfunc
15581558
1559+" test that cursor line highlight is updated after using win_execute()
1560+func Test_popup_filter_win_execute()
1561+ CheckScreendump
1562+
1563+ let lines =<< trim END
1564+ let lines = range(1, &lines * 2)->map({_, v -> string(v)})
1565+ let g:id = popup_create(lines, #{
1566+ \ minheight: &lines - 5,
1567+ \ maxheight: &lines - 5,
1568+ \ cursorline: 1,
1569+ \ })
1570+ redraw
1571+ END
1572+ call writefile(lines, 'XtestPopupWinExecute')
1573+ let buf = RunVimInTerminal('-S XtestPopupWinExecute', #{rows: 14})
1574+
1575+ call term_sendkeys(buf, ":call win_execute(g:id, ['normal 17Gzz'])\<CR>")
1576+ call term_sendkeys(buf, ":\<CR>")
1577+
1578+ call VerifyScreenDump(buf, 'Test_popupwin_win_execute_cursorline', {})
1579+
1580+ call StopVimInTerminal(buf)
1581+ call delete('XtestPopupWinExecute')
1582+endfunc
1583+
15591584 " this tests that we don't get stuck with an error in "win_execute()"
1560-func Test_popup_filter_win_execute()
1585+func Test_popup_filter_win_execute_error()
15611586 CheckScreendump
15621587
15631588 let lines =<< trim END
15641589 let g:winid = popup_create('some text', {'filter': 'invalidfilter'})
15651590 call timer_start(0, {-> win_execute(g:winid, 'invalidCommand')})
15661591 END
1567- call writefile(lines, 'XtestPopupWinExecute')
1568- let buf = RunVimInTerminal('-S XtestPopupWinExecute', #{rows: 10, wait_for_ruler: 0})
1592+ call writefile(lines, 'XtestPopupWinExecuteError')
1593+ let buf = RunVimInTerminal('-S XtestPopupWinExecuteError', #{rows: 10, wait_for_ruler: 0})
15691594
15701595 call WaitFor({-> term_getline(buf, 9) =~ 'Not an editor command: invalidCommand'})
15711596 call term_sendkeys(buf, "\<CR>")
@@ -1577,7 +1602,7 @@
15771602 call VerifyScreenDump(buf, 'Test_popupwin_win_execute', {})
15781603
15791604 call StopVimInTerminal(buf)
1580- call delete('XtestPopupWinExecute')
1605+ call delete('XtestPopupWinExecuteError')
15811606 endfunc
15821607
15831608 func ShowDialog(key, result)
diff -r 6820ccdb87df -r b2cb2a321af9 src/version.c
--- a/src/version.c Wed Sep 23 22:45:06 2020 +0200
+++ b/src/version.c Thu Sep 24 23:00:04 2020 +0200
@@ -751,6 +751,8 @@
751751 static int included_patches[] =
752752 { /* Add new patch number below this line */
753753 /**/
754+ 1737,
755+/**/
754756 1736,
755757 /**/
756758 1735,
Show on old repository browser