Use get_slicec instead of get_slice for single character splitters

This commit is contained in:
A Thousand Ships 2024-11-16 17:16:07 +01:00
parent b5bdb88062
commit 466590d0ec
No known key found for this signature in database
GPG key ID: DEFC5A5B1306947D
58 changed files with 210 additions and 210 deletions

View file

@ -228,8 +228,8 @@ void ScriptTextEditor::_set_theme_for_script() {
script->get_language()->get_string_delimiters(&strings);
text_edit->clear_string_delimiters();
for (const String &string : strings) {
String beg = string.get_slice(" ", 0);
String end = string.get_slice_count(" ") > 1 ? string.get_slice(" ", 1) : String();
String beg = string.get_slicec(' ', 0);
String end = string.get_slice_count(" ") > 1 ? string.get_slicec(' ', 1) : String();
if (!text_edit->has_string_delimiter(beg)) {
text_edit->add_string_delimiter(beg, end, end.is_empty());
}
@ -244,8 +244,8 @@ void ScriptTextEditor::_set_theme_for_script() {
List<String> comments;
script->get_language()->get_comment_delimiters(&comments);
for (const String &comment : comments) {
String beg = comment.get_slice(" ", 0);
String end = comment.get_slice_count(" ") > 1 ? comment.get_slice(" ", 1) : String();
String beg = comment.get_slicec(' ', 0);
String end = comment.get_slice_count(" ") > 1 ? comment.get_slicec(' ', 1) : String();
text_edit->add_comment_delimiter(beg, end, end.is_empty());
if (!end.is_empty() && !text_edit->has_auto_brace_completion_open_key(beg)) {
@ -256,8 +256,8 @@ void ScriptTextEditor::_set_theme_for_script() {
List<String> doc_comments;
script->get_language()->get_doc_comment_delimiters(&doc_comments);
for (const String &doc_comment : doc_comments) {
String beg = doc_comment.get_slice(" ", 0);
String end = doc_comment.get_slice_count(" ") > 1 ? doc_comment.get_slice(" ", 1) : String();
String beg = doc_comment.get_slicec(' ', 0);
String end = doc_comment.get_slice_count(" ") > 1 ? doc_comment.get_slicec(' ', 1) : String();
text_edit->add_comment_delimiter(beg, end, end.is_empty());
if (!end.is_empty() && !text_edit->has_auto_brace_completion_open_key(beg)) {
@ -1278,12 +1278,12 @@ void ScriptTextEditor::_update_connected_methods() {
int line = -1;
for (int j = 0; j < functions.size(); j++) {
String name = functions[j].get_slice(":", 0);
String name = functions[j].get_slicec(':', 0);
if (name == method) {
Dictionary line_meta;
line_meta["type"] = "connection";
line_meta["method"] = method;
line = functions[j].get_slice(":", 1).to_int() - 1;
line = functions[j].get_slicec(':', 1).to_int() - 1;
text_edit->set_line_gutter_metadata(line, connection_gutter, line_meta);
text_edit->set_line_gutter_icon(line, connection_gutter, get_parent_control()->get_editor_theme_icon(SNAME("Slot")));
text_edit->set_line_gutter_clickable(line, connection_gutter, true);
@ -1318,7 +1318,7 @@ void ScriptTextEditor::_update_connected_methods() {
// Add override icons to methods.
methods_found.clear();
for (int i = 0; i < functions.size(); i++) {
String raw_name = functions[i].get_slice(":", 0);
String raw_name = functions[i].get_slicec(':', 0);
StringName name = StringName(raw_name);
if (methods_found.has(name)) {
continue;
@ -1364,7 +1364,7 @@ void ScriptTextEditor::_update_connected_methods() {
}
if (!found_base_class.is_empty()) {
int line = functions[i].get_slice(":", 1).to_int() - 1;
int line = functions[i].get_slicec(':', 1).to_int() - 1;
Dictionary line_meta = text_edit->get_line_gutter_metadata(line, connection_gutter);
if (line_meta.is_empty()) {