summaryrefslogtreecommitdiffstats
path: root/editor/code_editor.cpp
diff options
context:
space:
mode:
authorjsjtxietian <jsjtxietian@outlook.com>2023-10-23 14:45:57 +0800
committerjsjtxietian <jsjtxietian@outlook.com>2023-10-24 11:23:59 +0800
commit961381cad522d1e3215cae4a9e420bbc41dc5726 (patch)
tree923a7184ccfa1679598a45417a429836c5f69ec6 /editor/code_editor.cpp
parent8c25a98fdf68dc388eddaefa188f3386236cdfe4 (diff)
downloadredot-engine-961381cad522d1e3215cae4a9e420bbc41dc5726.tar.gz
Fix unable to uncomment code in text shader editor
Diffstat (limited to 'editor/code_editor.cpp')
-rw-r--r--editor/code_editor.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/editor/code_editor.cpp b/editor/code_editor.cpp
index 7e6a49d6c0..1842e8c1c4 100644
--- a/editor/code_editor.cpp
+++ b/editor/code_editor.cpp
@@ -1514,8 +1514,8 @@ void CodeTextEditor::toggle_inline_comment(const String &delimiter) {
// Empty lines should not be counted.
bool is_empty = text_editor->get_line(line).strip_edges().is_empty();
is_all_empty = is_all_empty && is_empty;
- // `.left(1)` here because get_delimiter_start_key will return `##` instead of `#` when there is multiple comment delimiter in a line.
- if (!is_empty && (delimiter_idx == -1 || text_editor->get_delimiter_start_key(delimiter_idx).left(1) != delimiter)) {
+ // get_delimiter_start_key will return `##` instead of `#` when there is multiple comment delimiter in a line.
+ if (!is_empty && (delimiter_idx == -1 || !text_editor->get_delimiter_start_key(delimiter_idx).begins_with(delimiter))) {
is_commented = false;
break;
}