diff options
author | Bram Moolenaar <Bram@vim.org> | 2019-05-08 21:59:25 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2019-05-08 21:59:25 +0200 |
commit | 2f10658b06bbdd8f25c4ff152266c808234cee0a (patch) | |
tree | 8227dc063a5f4f258563f74adf09326a7d57dae0 /src | |
parent | a5c6a0b6c71ae11078cbf6f5e18ce49a0468a117 (diff) | |
download | vim-git-2f10658b06bbdd8f25c4ff152266c808234cee0a.tar.gz |
patch 8.1.1300: in a terminal 'ballooneval' does not work right awayv8.1.1300
Problem: In a terminal 'ballooneval' does not work right away.
Solution: Flush output after drawing the balloon. Add the <Ignore> key
code. Add a test.
Diffstat (limited to 'src')
-rw-r--r-- | src/ex_cmds2.c | 7 | ||||
-rw-r--r-- | src/misc2.c | 1 | ||||
-rw-r--r-- | src/testdir/Make_all.mak | 2 | ||||
-rw-r--r-- | src/testdir/dumps/Test_balloon_eval_term_01.dump | 10 | ||||
-rw-r--r-- | src/testdir/test_balloon.vim | 32 | ||||
-rw-r--r-- | src/version.c | 2 |
6 files changed, 54 insertions, 0 deletions
diff --git a/src/ex_cmds2.c b/src/ex_cmds2.c index 07e664867..1e9d18e83 100644 --- a/src/ex_cmds2.c +++ b/src/ex_cmds2.c @@ -229,6 +229,9 @@ profile_zero(proftime_T *tm) static timer_T *first_timer = NULL; static long last_timer_id = 0; +/* + * Return time left until "due". Negative if past "due". + */ long proftime_time_left(proftime_T *due, proftime_T *now) { @@ -445,7 +448,11 @@ check_due_timer(void) balloonEvalForTerm = TRUE; } if (balloonEval != NULL) + { general_beval_cb(balloonEval, 0); + setcursor(); + out_flush(); + } } else if (next_due == -1 || next_due > this_due) next_due = this_due; diff --git a/src/misc2.c b/src/misc2.c index e615f96b5..3ef7c9422 100644 --- a/src/misc2.c +++ b/src/misc2.c @@ -2496,6 +2496,7 @@ static struct key_name_entry #endif {K_PLUG, (char_u *)"Plug"}, {K_CURSORHOLD, (char_u *)"CursorHold"}, + {K_IGNORE, (char_u *)"Ignore"}, {0, NULL} /* NOTE: When adding a long name update MAX_KEY_NAME_LEN. */ }; diff --git a/src/testdir/Make_all.mak b/src/testdir/Make_all.mak index 2bda74276..6b966e6fe 100644 --- a/src/testdir/Make_all.mak +++ b/src/testdir/Make_all.mak @@ -68,6 +68,7 @@ NEW_TESTS = \ test_autoload \ test_backspace_opt \ test_backup \ + test_balloon \ test_behave \ test_blob \ test_blockedit \ @@ -294,6 +295,7 @@ NEW_TESTS_RES = \ test_autocmd.res \ test_autoload.res \ test_backspace_opt.res \ + test_balloon.res \ test_blob.res \ test_blockedit.res \ test_breakindent.res \ diff --git a/src/testdir/dumps/Test_balloon_eval_term_01.dump b/src/testdir/dumps/Test_balloon_eval_term_01.dump new file mode 100644 index 000000000..20a7197a7 --- /dev/null +++ b/src/testdir/dumps/Test_balloon_eval_term_01.dump @@ -0,0 +1,10 @@ +>o+0&#ffffff0|n|e| |o|n|e| |o|n|e| @38 +@2|o| |t|X|o| |t|w|o| @38 +|t|h|r|e| +0#0000001#ffd7ff255@16| +0#0000000#ffffff0@28 +|~+0#4040ff13&| @2| +0#0000001#ffd7ff255|l|i|n|e| |2| |c|o|l|u|m|n| |6| | +0#4040ff13#ffffff0@28 +|~| @2| +0#0000001#ffd7ff255@16| +0#4040ff13#ffffff0@28 +|~| @48 +|~| @48 +|~| @48 +|~| @48 +| +0#0000000&@31|1|,|1| @10|A|l@1| diff --git a/src/testdir/test_balloon.vim b/src/testdir/test_balloon.vim new file mode 100644 index 000000000..e5187557a --- /dev/null +++ b/src/testdir/test_balloon.vim @@ -0,0 +1,32 @@ +" Tests for 'balloonevalterm'. + +if !has('balloon_eval_term') || has('gui_running') + finish +endif + +source screendump.vim +if !CanRunVimInTerminal() + finish +endif + +func Test_balloon_eval_term() + call writefile([ + \ 'call setline(1, ["one one one", "two tXo two", "three three three"])', + \ 'set balloonevalterm balloonexpr=MyBalloonExpr() balloondelay=100', + \ 'func MyBalloonExpr()', + \ ' return "line " . v:beval_lnum . " column " . v:beval_col', + \ 'endfun', + \ 'redraw', + \ 'call test_setmouse(2, 6)', + \ 'call feedkeys("\<MouseMove>\<Ignore>", "xt")', + \ ], 'XTest_beval') + + " Check that the balloon shows up + let buf = RunVimInTerminal('-S XTest_beval', {'rows': 10, 'cols': 50}) + call term_wait(buf, 100) + call VerifyScreenDump(buf, 'Test_balloon_eval_term_01', {}) + + " clean up + call StopVimInTerminal(buf) + call delete('XTest_beval') +endfunc diff --git a/src/version.c b/src/version.c index 1ea47db72..7905cdac1 100644 --- a/src/version.c +++ b/src/version.c @@ -768,6 +768,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 1300, +/**/ 1299, /**/ 1298, |