1
0
Fork 0

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:
Florent Rougon 2023-01-13 09:56:15 +01:00
parent 29a0766cd9
commit 4846871a5c

View file

@ -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) {