summaryrefslogtreecommitdiff
path: root/editor/plugins/script_text_editor.cpp
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <remi@verschelde.fr>2021-11-11 13:00:21 +0100
committerGitHub <noreply@github.com>2021-11-11 13:00:21 +0100
commit1aa3c8419b2405d81d04f4fb3ac142fcd355de85 (patch)
treecb9c9b08941468bc4f7a6aa50e0464ce70b1c03f /editor/plugins/script_text_editor.cpp
parent51c8e4429b85b4c39302b8cc9e5a97137b0ad430 (diff)
parent2beaae4b6f1c4a2c3833a5e205157fd3be2fcabc (diff)
Merge pull request #54869 from akien-mga/string-remove-erase
Diffstat (limited to 'editor/plugins/script_text_editor.cpp')
-rw-r--r--editor/plugins/script_text_editor.cpp5
1 files changed, 1 insertions, 4 deletions
diff --git a/editor/plugins/script_text_editor.cpp b/editor/plugins/script_text_editor.cpp
index a655420d27..a5088a5246 100644
--- a/editor/plugins/script_text_editor.cpp
+++ b/editor/plugins/script_text_editor.cpp
@@ -1629,10 +1629,7 @@ void ScriptTextEditor::_color_changed(const Color &p_color) {
}
String line = code_editor->get_text_editor()->get_line(color_position.x);
- int color_args_pos = line.find(color_args, color_position.y);
- String line_with_replaced_args = line;
- line_with_replaced_args.erase(color_args_pos, color_args.length());
- line_with_replaced_args = line_with_replaced_args.insert(color_args_pos, new_args);
+ String line_with_replaced_args = line.replace(color_args, new_args);
color_args = new_args;
code_editor->get_text_editor()->begin_complex_operation();