summaryrefslogtreecommitdiff
path: root/src/ex_cmds2.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2017-11-18 18:52:04 +0100
committerBram Moolenaar <Bram@vim.org>2017-11-18 18:52:04 +0100
commit51b0f3701ecb440aa72ab6017c1df6940c0e0f6f (patch)
tree9cfd3546d8e52be2b1425dcc65095f8e650eadde /src/ex_cmds2.c
parent234d16286a2733adedef56784c17415ae169b9ad (diff)
downloadvim-git-51b0f3701ecb440aa72ab6017c1df6940c0e0f6f.tar.gz
patch 8.0.1309: cannot use 'balloonexpr' in a terminalv8.0.1309
Problem: Cannot use 'balloonexpr' in a terminal. Solution: Add 'balloonevalterm' and add code to handle mouse movements in a terminal. Initial implementation for Unix with GUI.
Diffstat (limited to 'src/ex_cmds2.c')
-rw-r--r--src/ex_cmds2.c39
1 files changed, 30 insertions, 9 deletions
diff --git a/src/ex_cmds2.c b/src/ex_cmds2.c
index 2eef050ee..c6a6dbe14 100644
--- a/src/ex_cmds2.c
+++ b/src/ex_cmds2.c
@@ -1093,21 +1093,21 @@ static timer_T *first_timer = NULL;
static long last_timer_id = 0;
static long
-timer_time_left(timer_T *timer, proftime_T *now)
+proftime_time_left(proftime_T *due, proftime_T *now)
{
# ifdef WIN3264
LARGE_INTEGER fr;
- if (now->QuadPart > timer->tr_due.QuadPart)
+ if (now->QuadPart > due->QuadPart)
return 0;
QueryPerformanceFrequency(&fr);
- return (long)(((double)(timer->tr_due.QuadPart - now->QuadPart)
+ return (long)(((double)(due->QuadPart - now->QuadPart)
/ (double)fr.QuadPart) * 1000);
# else
- if (now->tv_sec > timer->tr_due.tv_sec)
+ if (now->tv_sec > due->tv_sec)
return 0;
- return (timer->tr_due.tv_sec - now->tv_sec) * 1000
- + (timer->tr_due.tv_usec - now->tv_usec) / 1000;
+ return (due->tv_sec - now->tv_sec) * 1000
+ + (due->tv_usec - now->tv_usec) / 1000;
# endif
}
@@ -1219,7 +1219,7 @@ check_due_timer(void)
if (timer->tr_id == -1 || timer->tr_firing || timer->tr_paused)
continue;
- this_due = timer_time_left(timer, &now);
+ this_due = proftime_time_left(&timer->tr_due, &now);
if (this_due <= 1)
{
int save_timer_busy = timer_busy;
@@ -1271,7 +1271,7 @@ check_due_timer(void)
&& timer->tr_emsg_count < 3)
{
profile_setlimit(timer->tr_interval, &timer->tr_due);
- this_due = timer_time_left(timer, &now);
+ this_due = proftime_time_left(&timer->tr_due, &now);
if (this_due < 1)
this_due = 1;
if (timer->tr_repeat > 0)
@@ -1291,6 +1291,27 @@ check_due_timer(void)
if (did_one)
redraw_after_callback(need_update_screen);
+#ifdef FEAT_BEVALTERM
+ if (bevalexpr_due_set)
+ {
+ this_due = proftime_time_left(&bevalexpr_due, &now);
+ if (this_due <= 1)
+ {
+ bevalexpr_due_set = FALSE;
+
+ if (balloonEval == NULL)
+ {
+ balloonEval = (BalloonEval *)alloc(sizeof(BalloonEval));
+ balloonEvalForTerm = TRUE;
+ }
+ if (balloonEval != NULL)
+ general_beval_cb(balloonEval, 0);
+ }
+ else if (this_due > 0 && (next_due == -1 || next_due > this_due))
+ next_due = this_due;
+ }
+#endif
+
return current_id != last_timer_id ? 1 : next_due;
}
@@ -1358,7 +1379,7 @@ add_timer_info(typval_T *rettv, timer_T *timer)
dict_add_nr_str(dict, "time", (long)timer->tr_interval, NULL);
profile_start(&now);
- remaining = timer_time_left(timer, &now);
+ remaining = proftime_time_left(&timer->tr_due, &now);
dict_add_nr_str(dict, "remaining", (long)remaining, NULL);
dict_add_nr_str(dict, "repeat",