Merge pull request #80476 from bruvzg/log_print_rich_ml
[Editor Log] Clear rich print tags only after the last line.
This commit is contained in:
commit
7df393312f
|
@ -212,7 +212,7 @@ void EditorLog::clear() {
|
||||||
_clear_request();
|
_clear_request();
|
||||||
}
|
}
|
||||||
|
|
||||||
void EditorLog::_process_message(const String &p_msg, MessageType p_type) {
|
void EditorLog::_process_message(const String &p_msg, MessageType p_type, bool p_clear) {
|
||||||
if (messages.size() > 0 && messages[messages.size() - 1].text == p_msg && messages[messages.size() - 1].type == p_type) {
|
if (messages.size() > 0 && messages[messages.size() - 1].text == p_msg && messages[messages.size() - 1].type == p_type) {
|
||||||
// If previous message is the same as the new one, increase previous count rather than adding another
|
// If previous message is the same as the new one, increase previous count rather than adding another
|
||||||
// instance to the messages list.
|
// instance to the messages list.
|
||||||
|
@ -222,7 +222,7 @@ void EditorLog::_process_message(const String &p_msg, MessageType p_type) {
|
||||||
_add_log_line(previous, collapse);
|
_add_log_line(previous, collapse);
|
||||||
} else {
|
} else {
|
||||||
// Different message to the previous one received.
|
// Different message to the previous one received.
|
||||||
LogMessage message(p_msg, p_type);
|
LogMessage message(p_msg, p_type, p_clear);
|
||||||
_add_log_line(message);
|
_add_log_line(message);
|
||||||
messages.push_back(message);
|
messages.push_back(message);
|
||||||
}
|
}
|
||||||
|
@ -237,9 +237,10 @@ void EditorLog::add_message(const String &p_msg, MessageType p_type) {
|
||||||
// search functionality (see the comments on the PR above for more details). This behavior
|
// search functionality (see the comments on the PR above for more details). This behavior
|
||||||
// also matches that of other IDE's.
|
// also matches that of other IDE's.
|
||||||
Vector<String> lines = p_msg.split("\n", true);
|
Vector<String> lines = p_msg.split("\n", true);
|
||||||
|
int line_count = lines.size();
|
||||||
|
|
||||||
for (int i = 0; i < lines.size(); i++) {
|
for (int i = 0; i < line_count; i++) {
|
||||||
_process_message(lines[i], p_type);
|
_process_message(lines[i], p_type, i == line_count - 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -338,7 +339,9 @@ void EditorLog::_add_log_line(LogMessage &p_message, bool p_replace_previous) {
|
||||||
} else {
|
} else {
|
||||||
log->add_text(p_message.text);
|
log->add_text(p_message.text);
|
||||||
}
|
}
|
||||||
|
if (p_message.clear || p_message.type != MSG_TYPE_STD_RICH) {
|
||||||
log->pop_all(); // Pop all unclosed tags.
|
log->pop_all(); // Pop all unclosed tags.
|
||||||
|
}
|
||||||
log->add_newline();
|
log->add_newline();
|
||||||
|
|
||||||
if (p_replace_previous) {
|
if (p_replace_previous) {
|
||||||
|
|
|
@ -60,12 +60,14 @@ private:
|
||||||
String text;
|
String text;
|
||||||
MessageType type;
|
MessageType type;
|
||||||
int count = 1;
|
int count = 1;
|
||||||
|
bool clear = true;
|
||||||
|
|
||||||
LogMessage() {}
|
LogMessage() {}
|
||||||
|
|
||||||
LogMessage(const String p_text, MessageType p_type) :
|
LogMessage(const String p_text, MessageType p_type, bool p_clear) :
|
||||||
text(p_text),
|
text(p_text),
|
||||||
type(p_type) {
|
type(p_type),
|
||||||
|
clear(p_clear) {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -166,7 +168,7 @@ private:
|
||||||
void _set_search_visible(bool p_visible);
|
void _set_search_visible(bool p_visible);
|
||||||
void _search_changed(const String &p_text);
|
void _search_changed(const String &p_text);
|
||||||
|
|
||||||
void _process_message(const String &p_msg, MessageType p_type);
|
void _process_message(const String &p_msg, MessageType p_type, bool p_clear);
|
||||||
void _reset_message_counts();
|
void _reset_message_counts();
|
||||||
|
|
||||||
void _set_collapse(bool p_collapse);
|
void _set_collapse(bool p_collapse);
|
||||||
|
|
Loading…
Reference in New Issue