summaryrefslogtreecommitdiffstats
path: root/editor/code_editor.cpp
diff options
context:
space:
mode:
authorLunarisnia <r.arswendo.r@gmail.com>2023-10-15 18:28:43 +0700
committerLunarisnia <r.arswendo.r@gmail.com>2023-10-16 16:43:49 +0700
commit85d592dbf0332518fe497befb23f3a01cc930308 (patch)
treef2737d7f98d3300a7f75079f8c35e859633a6353 /editor/code_editor.cpp
parenta574c0296b38d5f786f249b12e6251e562c528cc (diff)
downloadredot-engine-85d592dbf0332518fe497befb23f3a01cc930308.tar.gz
Fix multiple comment delimiter break toggle comment shortcut
Diffstat (limited to 'editor/code_editor.cpp')
-rw-r--r--editor/code_editor.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/editor/code_editor.cpp b/editor/code_editor.cpp
index cd6f672b4b..f85d177eef 100644
--- a/editor/code_editor.cpp
+++ b/editor/code_editor.cpp
@@ -1505,7 +1505,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;
- if (!is_empty && (delimiter_idx == -1 || text_editor->get_delimiter_start_key(delimiter_idx) != delimiter)) {
+ // `.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)) {
is_commented = false;
break;
}