Skip to content

Commit 23a71da

Browse files
committed
Fix balloon API in MacVim GUI
* Fix the position of calling setLastToolTip: in gui_mch_retain_font() * Set balloonEval->msg in gui_mch_post_balloon() This fix makes Test_balloon_show_gui pass.
1 parent ffe535a commit 23a71da

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

src/MacVim/MMBackend.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3359,14 +3359,14 @@ - (void)bevalCallback:(id UNUSED)sender
33593359
// variable. (The reason we need to know is due to how the Cocoa tool
33603360
// tips work: if there is no tool tip we must set it to nil explicitly
33613361
// or it might never go away.)
3362-
[self setLastToolTip:nil];
3363-
33643362
(*balloonEval->msgCB)(balloonEval, 0);
33653363

33663364
[self queueMessage:SetTooltipMsgID properties:
33673365
[NSDictionary dictionaryWithObject:(lastToolTip ? lastToolTip : @"")
33683366
forKey:@"toolTip"]];
33693367
[self flushQueue:YES];
3368+
3369+
[self setLastToolTip:nil];
33703370
}
33713371
}
33723372
#endif

src/MacVim/gui_macvim.m

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2514,8 +2514,11 @@
25142514
* Show a balloon with "mesg".
25152515
*/
25162516
void
2517-
gui_mch_post_balloon(BalloonEval *beval UNUSED, char_u *mesg)
2517+
gui_mch_post_balloon(BalloonEval *beval, char_u *mesg)
25182518
{
2519+
vim_free(beval->msg);
2520+
beval->msg = mesg == NULL ? NULL : vim_strsave(mesg);
2521+
25192522
NSString *toolTip = [NSString stringWithVimString:mesg];
25202523
[[MMBackend sharedInstance] setLastToolTip:toolTip];
25212524
}

src/testdir/test_balloon_gui.vim

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@ source check.vim
44
CheckGui
55
CheckFeature balloon_eval
66

7-
if !has('gui_macvim') " See https://github.com/macvim-dev/macvim/issues/902
8-
97
func Test_balloon_show_gui()
108
let msg = 'this this this this'
119
call balloon_show(msg)
@@ -20,5 +18,4 @@ func Test_balloon_show_gui()
2018
call balloon_show('')
2119
endfunc
2220

23-
endif " !has('gui_macvim')
2421
" vim: shiftwidth=2 sts=2 expandtab

0 commit comments

Comments
 (0)