Skip to content

Commit 4312bd8

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 7c9b86b commit 4312bd8

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
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: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2492,6 +2492,9 @@
24922492
void
24932493
gui_mch_post_balloon(BalloonEval *beval UNUSED, char_u *mesg)
24942494
{
2495+
vim_free(beval->msg);
2496+
beval->msg = mesg == NULL ? NULL : vim_strsave(mesg);
2497+
24952498
NSString *toolTip = [NSString stringWithVimString:mesg];
24962499
[[MMBackend sharedInstance] setLastToolTip:toolTip];
24972500
}

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)