You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-05 12:10:55 +00:00
Merge pull request #110972 from Tcarr20/fix-editor-log-bbcode-search
Fix editor log search ignoring BBCode formatting in messages
This commit is contained in:
@@ -341,7 +341,28 @@ void EditorLog::_rebuild_log() {
|
|||||||
bool EditorLog::_check_display_message(LogMessage &p_message) {
|
bool EditorLog::_check_display_message(LogMessage &p_message) {
|
||||||
bool filter_active = type_filter_map[p_message.type]->is_active();
|
bool filter_active = type_filter_map[p_message.type]->is_active();
|
||||||
String search_text = search_box->get_text();
|
String search_text = search_box->get_text();
|
||||||
bool search_match = search_text.is_empty() || p_message.text.containsn(search_text);
|
|
||||||
|
if (search_text.is_empty()) {
|
||||||
|
return filter_active;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool search_match = p_message.text.containsn(search_text);
|
||||||
|
|
||||||
|
// If not found and message contains BBCode tags, also check the parsed text
|
||||||
|
if (!search_match && p_message.text.contains_char('[')) {
|
||||||
|
// Lazy initialize the BBCode parser
|
||||||
|
if (!bbcode_parser) {
|
||||||
|
bbcode_parser = memnew(RichTextLabel);
|
||||||
|
bbcode_parser->set_use_bbcode(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Ensure clean state for each message
|
||||||
|
bbcode_parser->clear();
|
||||||
|
bbcode_parser->parse_bbcode(p_message.text);
|
||||||
|
String parsed_text = bbcode_parser->get_parsed_text();
|
||||||
|
search_match = parsed_text.containsn(search_text);
|
||||||
|
}
|
||||||
|
|
||||||
return filter_active && search_match;
|
return filter_active && search_match;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -586,6 +607,10 @@ void EditorLog::deinit() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
EditorLog::~EditorLog() {
|
EditorLog::~EditorLog() {
|
||||||
|
if (bbcode_parser) {
|
||||||
|
memdelete(bbcode_parser);
|
||||||
|
}
|
||||||
|
|
||||||
for (const KeyValue<MessageType, LogFilter *> &E : type_filter_map) {
|
for (const KeyValue<MessageType, LogFilter *> &E : type_filter_map) {
|
||||||
// MSG_TYPE_STD_RICH is connected to the std_filter button, so we do this
|
// MSG_TYPE_STD_RICH is connected to the std_filter button, so we do this
|
||||||
// to avoid it from being deleted twice, causing a crash on closing.
|
// to avoid it from being deleted twice, causing a crash on closing.
|
||||||
|
|||||||
@@ -140,6 +140,9 @@ private:
|
|||||||
Button *show_search_button = nullptr;
|
Button *show_search_button = nullptr;
|
||||||
LineEdit *search_box = nullptr;
|
LineEdit *search_box = nullptr;
|
||||||
|
|
||||||
|
// Reusable RichTextLabel for BBCode parsing during search
|
||||||
|
RichTextLabel *bbcode_parser = nullptr;
|
||||||
|
|
||||||
// Reference to the "Output" button on the toolbar so we can update its icon when warnings or errors are encountered.
|
// Reference to the "Output" button on the toolbar so we can update its icon when warnings or errors are encountered.
|
||||||
Button *tool_button = nullptr;
|
Button *tool_button = nullptr;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user