Clean up some uses of String::substr

Cases where the end position is either equvalent to the default or past
the end of the string.
This commit is contained in:
A Thousand Ships 2025-02-26 11:41:11 +01:00
parent f2cc3f1275
commit 5113022dfe
No known key found for this signature in database
GPG key ID: DEFC5A5B1306947D
54 changed files with 123 additions and 123 deletions

View file

@ -8597,7 +8597,7 @@ void TextEdit::_base_insert_text(int p_line, int p_char, const String &p_text, i
}
/* STEP 3: Separate dest string in pre and post text. */
String postinsert_text = text[p_line].substr(p_char, text[p_line].size());
String postinsert_text = text[p_line].substr(p_char);
substrings.write[0] = text[p_line].substr(0, p_char) + substrings[0];
substrings.write[substrings.size() - 1] += postinsert_text;
@ -8661,7 +8661,7 @@ void TextEdit::_base_remove_text(int p_from_line, int p_from_column, int p_to_li
ERR_FAIL_COND(p_to_line == p_from_line && p_to_column < p_from_column); // 'from > to'.
String pre_text = text[p_from_line].substr(0, p_from_column);
String post_text = text[p_to_line].substr(p_to_column, text[p_to_line].length());
String post_text = text[p_to_line].substr(p_to_column);
text.remove_range(p_from_line, p_to_line);
text.set(p_from_line, pre_text + post_text, structured_text_parser(st_parser, st_args, pre_text + post_text));