From 41b666fbfec5adb14032c30ba66b5926136653dc Mon Sep 17 00:00:00 2001 From: "Ignacio R. Morelle" Date: Sat, 21 Dec 2013 11:49:17 -0300 Subject: [PATCH] gui1: Escape filenames in the file_menu menu that may contain WML formatting This prepends font::NULL_MARKUP to file_menu menu entries so that any WML formatting characters at the start of filenames such as "#foo.map" ('#' -> red font format specifier) are ignored. --- changelog | 3 +++ src/widgets/file_menu.cpp | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/changelog b/changelog index 7ae16230363..eecbe116764 100644 --- a/changelog +++ b/changelog @@ -105,6 +105,9 @@ Version 1.11.7+dev: * Added wmllint code for recognizing unit id fields in macros. * Refactored code in wmltools to create a macro-parsing function. * Added era descriptions. + * Fixed file chooser dialog (used in the map editor and for locating the + wesnothd executable) interpreting special markup at the beginning of file + names such as "#foo.map". Version 1.11.7: * Add-ons client: diff --git a/src/widgets/file_menu.cpp b/src/widgets/file_menu.cpp index 042a14ffc24..811fe1336ed 100644 --- a/src/widgets/file_menu.cpp +++ b/src/widgets/file_menu.cpp @@ -61,11 +61,11 @@ void file_menu::display_current_files() { for (it = dirs_in_current_dir_.begin(); it != dirs_in_current_dir_.end(); ++it) { // Add an image to show that these are directories. std::stringstream ss; - ss << font::IMAGE << dir_picture << COLUMN_SEPARATOR << *it; + ss << font::IMAGE << dir_picture << COLUMN_SEPARATOR << font::NULL_MARKUP << *it; to_show.push_back(ss.str()); } for (it = files_in_current_dir_.begin(); it != files_in_current_dir_.end(); ++it) { - const std::string display_string = COLUMN_SEPARATOR + *it; + const std::string display_string = COLUMN_SEPARATOR + std::string(1, font::NULL_MARKUP) + *it; to_show.push_back(display_string); } const int menu_font_size = font::SIZE_NORMAL; // Known from menu.cpp.