summaryrefslogtreecommitdiff
path: root/editor/plugins
diff options
context:
space:
mode:
authorandrycodestuffs <andrybusa@gmail.com>2019-12-03 17:19:57 +0100
committerRémi Verschelde <rverschelde@gmail.com>2020-01-16 13:50:30 +0100
commitd0b3cb89f704402f0fdd599a188d141b376a5b1f (patch)
tree89b666af455592176c5d96db4ffe1096b64961d4 /editor/plugins
parente329cd60052f2dbfcca5bf2750672a3c2ca9dfa5 (diff)
Fixed unknown symbol drawn instead of tabs in breakpoints/bookmarks lists
Tab characters were not rendered properly in the breakpoints and bookmarks lists of the script editor if the bookmarked line was a comment, resulting in unknown ASCII symbols “�”. Fixes #34046. Also changed formatting a bit to enclose the code in backticks (like in Markdown) instead of quotes. Co-authored-by: Rémi Verschelde <rverschelde@gmail.com>
Diffstat (limited to 'editor/plugins')
-rw-r--r--editor/plugins/script_text_editor.cpp14
1 files changed, 10 insertions, 4 deletions
diff --git a/editor/plugins/script_text_editor.cpp b/editor/plugins/script_text_editor.cpp
index f0e4a4bfdc..1432c3fc63 100644
--- a/editor/plugins/script_text_editor.cpp
+++ b/editor/plugins/script_text_editor.cpp
@@ -691,13 +691,16 @@ void ScriptTextEditor::_update_bookmark_list() {
bookmarks_menu->add_separator();
for (int i = 0; i < bookmark_list.size(); i++) {
- String line = code_editor->get_text_edit()->get_line(bookmark_list[i]).strip_edges();
+ // Strip edges to remove spaces or tabs.
+ // Also replace any tabs by spaces, since we can't print tabs in the menu.
+ String line = code_editor->get_text_edit()->get_line(bookmark_list[i]).replace("\t", " ").strip_edges();
+
// Limit the size of the line if too big.
if (line.length() > 50) {
line = line.substr(0, 50);
}
- bookmarks_menu->add_item(String::num((int)bookmark_list[i] + 1) + " - \"" + line + "\"");
+ bookmarks_menu->add_item(String::num((int)bookmark_list[i] + 1) + " - `" + line + "`");
bookmarks_menu->set_item_metadata(bookmarks_menu->get_item_count() - 1, bookmark_list[i]);
}
}
@@ -841,13 +844,16 @@ void ScriptTextEditor::_update_breakpoint_list() {
breakpoints_menu->add_separator();
for (int i = 0; i < breakpoint_list.size(); i++) {
- String line = code_editor->get_text_edit()->get_line(breakpoint_list[i]).strip_edges();
+ // Strip edges to remove spaces or tabs.
+ // Also replace any tabs by spaces, since we can't print tabs in the menu.
+ String line = code_editor->get_text_edit()->get_line(breakpoint_list[i]).replace("\t", " ").strip_edges();
+
// Limit the size of the line if too big.
if (line.length() > 50) {
line = line.substr(0, 50);
}
- breakpoints_menu->add_item(String::num((int)breakpoint_list[i] + 1) + " - \"" + line + "\"");
+ breakpoints_menu->add_item(String::num((int)breakpoint_list[i] + 1) + " - `" + line + "`");
breakpoints_menu->set_item_metadata(breakpoints_menu->get_item_count() - 1, breakpoint_list[i]);
}
}