mirror of
https://github.com/wesnoth/wesnoth
synced 2025-05-02 19:41:15 +00:00
Fixed an exception in the new dialog.
AI0867 and soliton discovered that the new dialogs sometimes failed with an exception. The pango markup requires some characters to be escaped so added the code to do that.
This commit is contained in:
parent
2e17f9dbbb
commit
d8424f2b1a
@ -2,6 +2,8 @@ Version 1.5.9+svn:
|
||||
* Language and i18n:
|
||||
* new translations: Marathi
|
||||
* updated translations: British English, Dutch, German, Slovenian
|
||||
* User interface:
|
||||
* Fixed an exception when a certain characters weren't escaped
|
||||
* Miscellaneous and bug fixes:
|
||||
* Fix flickering of units in the second part of the tutorial (bug #12923)
|
||||
|
||||
|
@ -407,6 +407,28 @@ std::string colour_prefix(const SDL_Color& colour)
|
||||
return result.str();
|
||||
}
|
||||
|
||||
/** escapes a string to be used in a pango formatted string. */
|
||||
std::string escape_string(const std::string& str)
|
||||
{
|
||||
struct tconverter
|
||||
{
|
||||
tconverter(const std::string& string)
|
||||
: str(g_markup_escape_text(string.c_str(), -1))
|
||||
{
|
||||
}
|
||||
|
||||
~tconverter()
|
||||
{
|
||||
g_free(str);
|
||||
}
|
||||
|
||||
gchar* str;
|
||||
};
|
||||
|
||||
tconverter converter(str);
|
||||
return std::string(converter.str);
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
std::string tcontrol::get_pango_markup() const
|
||||
@ -505,7 +527,7 @@ std::string tcontrol::get_pango_markup() const
|
||||
}
|
||||
}
|
||||
|
||||
line = pre + line + post;
|
||||
line = pre + escape_string(line) + post;
|
||||
}
|
||||
return utils::join(lines, '\n');
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user