Skip to content

Commit c2f5054

Browse files
committed
patch 8.1.1640: the CursorHold autocommand takes down a balloon
Problem: The CursorHold autocommand takes down a balloon. (Paul Jolly) Solution: Ignore the CursorHold pseudo-key.
1 parent 28fc247 commit c2f5054

5 files changed

Lines changed: 31 additions & 7 deletions

File tree

src/getchar.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1794,7 +1794,7 @@ vgetc(void)
17941794
may_garbage_collect = FALSE;
17951795
#endif
17961796
#ifdef FEAT_BEVAL_TERM
1797-
if (c != K_MOUSEMOVE && c != K_IGNORE)
1797+
if (c != K_MOUSEMOVE && c != K_IGNORE && c != K_CURSORHOLD)
17981798
{
17991799
/* Don't trigger 'balloonexpr' unless only the mouse was moved. */
18001800
bevalexpr_due_set = FALSE;
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
>o+0&#ffffff0|n|e| |o|n|e| |o|n|e| @38
1+
|o+0&#ffffff0|n>e| |o|n|e| |o|n|e| @38
22
@2|o| |t|X|o| |t|w|o| @38
33
|t|h|r|e| +0#0000001#ffd7ff255@21| +0#0000000#ffffff0@23
44
|~+0#4040ff13&| @2| +0#0000001#ffd7ff255|l|i|n|e| |2| |c|o|l|u|m|n| |6|:| |t|X|o| | +0#4040ff13#ffffff0@23
@@ -7,4 +7,4 @@
77
|~| @48
88
|~| @48
99
|~| @48
10-
| +0#0000000&@31|1|,|1| @10|A|l@1|
10+
|:+0#0000000&|c|a|l@1| |T|r|i|g@1|e|r|(|)| @16|1|,|3| @10|A|l@1|
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
|o+0&#ffffff0|n>e| |o|n|e| |o|n|e| @38
2+
@2|o| |t|X|o| |t|w|o| @38
3+
|t|h|r|e| +0#0000001#ffd7ff255@21| +0#0000000#ffffff0@23
4+
|~+0#4040ff13&| @2| +0#0000001#ffd7ff255|l|i|n|e| |2| |c|o|l|u|m|n| |6|:| |t|X|o| | +0#4040ff13#ffffff0@23
5+
|~| @2| +0#0000001#ffd7ff255@21| +0#4040ff13#ffffff0@23
6+
|~| @48
7+
|~| @48
8+
|~| @48
9+
|~| @48
10+
|h+0#0000000&|o|l|d| |f|i|r|e|d| @39

src/testdir/test_balloon.vim

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,16 +25,28 @@ let s:common_script =<< trim [CODE]
2525
func Test_balloon_eval_term()
2626
" Use <Ignore> after <MouseMove> to return from vgetc() without removing
2727
" the balloon.
28-
call writefile(s:common_script + [
29-
\ 'call test_setmouse(2, 6)',
30-
\ 'call feedkeys("\<MouseMove>\<Ignore>", "xt")',
31-
\ ], 'XTest_beval')
28+
let xtra_lines =<< trim [CODE]
29+
set updatetime=300
30+
au CursorHold * echo 'hold fired'
31+
func Trigger()
32+
call test_setmouse(2, 6)
33+
call feedkeys("\<MouseMove>\<Ignore>", "xt")
34+
endfunc
35+
[CODE]
36+
call writefile(s:common_script + xtra_lines, 'XTest_beval')
3237

3338
" Check that the balloon shows up after a mouse move
3439
let buf = RunVimInTerminal('-S XTest_beval', {'rows': 10, 'cols': 50})
3540
call term_wait(buf, 100)
41+
call term_sendkeys(buf, 'll')
42+
call term_sendkeys(buf, ":call Trigger()\<CR>")
3643
call VerifyScreenDump(buf, 'Test_balloon_eval_term_01', {})
3744

45+
" Make sure the balloon still shows after 'updatetime' passed and CursorHold
46+
" was triggered.
47+
call term_wait(buf, 300)
48+
call VerifyScreenDump(buf, 'Test_balloon_eval_term_01a', {})
49+
3850
" clean up
3951
call StopVimInTerminal(buf)
4052
call delete('XTest_beval')

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -777,6 +777,8 @@ static char *(features[]) =
777777

778778
static int included_patches[] =
779779
{ /* Add new patch number below this line */
780+
/**/
781+
1640,
780782
/**/
781783
1639,
782784
/**/

0 commit comments

Comments
 (0)