Fix handling of percent signs by gui.popupTip()
Since commit e41c0f099b
, the Tooltip class has performed string
interpolation (i.e., sprintf()-style formatting) regardless of whether a
<property> was specified for the tooltip. This broke the API of
gui.popupTip(): all '%' characters in the message had to be doubled to
work as before. This commit restores the normal behavior of
gui.popupTip() where '%' characters aren't interpreted in any special
way.
This commit is contained in:
parent
29a0766cd9
commit
4846871a5c
1 changed files with 9 additions and 1 deletions
|
@ -11,7 +11,15 @@ var popupTip = func(label, delay = nil, override = nil, position = nil)
|
|||
if (position == nil) {
|
||||
position = {};
|
||||
}
|
||||
fgcommand("show-message", props.Node.new({ "label": label, "delay":delay, "x": position['x'], "y": position['y'] }));
|
||||
|
||||
# Percent signs must be doubled because 'show-message' uses sprintf() on
|
||||
# the label.
|
||||
fgcommand("show-message",
|
||||
props.Node.new(
|
||||
{"label": string.replace(label, "%", "%%"),
|
||||
"delay": delay,
|
||||
"x": position['x'],
|
||||
"y": position['y']}));
|
||||
}
|
||||
|
||||
var showDialog = func(name) {
|
||||
|
|
Loading…
Reference in a new issue