summaryrefslogtreecommitdiffstats
path: root/scene/gui/code_edit.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'scene/gui/code_edit.cpp')
-rw-r--r--scene/gui/code_edit.cpp11
1 files changed, 9 insertions, 2 deletions
diff --git a/scene/gui/code_edit.cpp b/scene/gui/code_edit.cpp
index 632e6af2ce..4f90504e35 100644
--- a/scene/gui/code_edit.cpp
+++ b/scene/gui/code_edit.cpp
@@ -3398,9 +3398,16 @@ void CodeEdit::_filter_code_completion_candidates_impl() {
int offset = option.default_value.get_type() == Variant::COLOR ? line_height : 0;
if (in_string != -1) {
+ // The completion string may have a literal behind it, which should be removed before re-quoting.
+ String literal;
+ if (option.insert_text.substr(1).is_quoted()) {
+ literal = option.display.left(1);
+ option.display = option.display.substr(1);
+ option.insert_text = option.insert_text.substr(1);
+ }
String quote = single_quote ? "'" : "\"";
- option.display = option.display.unquote().quote(quote);
- option.insert_text = option.insert_text.unquote().quote(quote);
+ option.display = literal + (option.display.unquote().quote(quote));
+ option.insert_text = literal + (option.insert_text.unquote().quote(quote));
}
if (option.display.length() == 0) {