1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-06-27 16:36:03 +00:00

Run unescape_enriched *after* unescape_string.

Doing it the other way round was a mistake, since it breaks
minetest.formspec_escape with escape sequences that contain
special characters.
This commit is contained in:
Ekdohibs 2016-05-05 19:08:45 +02:00
parent d5c3db9c41
commit 4d9dbceb39
2 changed files with 25 additions and 30 deletions

View file

@ -192,14 +192,6 @@ class GUIFormSpecMenu : public GUIModalMenu
bool scale;
};
/* The responsibility of unescaping the strings has been shifted
* from the formspec parsing methods to the draw methods.
* There still are a few exceptions:
* - Vertical label, because it modifies the string by inserting
* '\n' between each character,
* - Tab header, because it gives the string immediately to
* Irrlicht and we can't unescape it later.
*/
struct FieldSpec
{
FieldSpec()
@ -210,8 +202,8 @@ class GUIFormSpecMenu : public GUIModalMenu
fname(name),
fid(id)
{
flabel = unescape_string(unescape_enriched(label));
fdefault = unescape_string(unescape_enriched(default_text));
flabel = unescape_enriched(label);
fdefault = unescape_enriched(default_text);
send = false;
ftype = f_Unknown;
is_exit = false;
@ -247,7 +239,7 @@ class GUIFormSpecMenu : public GUIModalMenu
bgcolor(a_bgcolor),
color(a_color)
{
tooltip = unescape_string(unescape_enriched(utf8_to_wide(a_tooltip)));
tooltip = unescape_enriched(utf8_to_wide(a_tooltip));
}
std::wstring tooltip;
irr::video::SColor bgcolor;
@ -264,7 +256,7 @@ class GUIFormSpecMenu : public GUIModalMenu
rect(a_rect),
parent_button(NULL)
{
text = unescape_string(unescape_enriched(a_text));
text = unescape_enriched(a_text);
}
StaticTextSpec(const std::wstring &a_text,
const core::rect<s32> &a_rect,
@ -272,7 +264,7 @@ class GUIFormSpecMenu : public GUIModalMenu
rect(a_rect),
parent_button(a_parent_button)
{
text = unescape_string(unescape_enriched(a_text));
text = unescape_enriched(a_text);
}
std::wstring text;
core::rect<s32> rect;