summaryrefslogtreecommitdiff
path: root/scene
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <rverschelde@gmail.com>2018-10-16 14:47:33 +0200
committerGitHub <noreply@github.com>2018-10-16 14:47:33 +0200
commit47c0aff491fc0020a2d5bdd7b4f1804d8d380af9 (patch)
tree5a4b2b34ce401f95daff073512b2179b4ce9bdd8 /scene
parentb4dd1afa74a4ea98ed05707f27b2abd6f5a07334 (diff)
parent317f7c91a22215205f2d4ae26724e322b702373f (diff)
Merge pull request #22894 from OsamaElHariri/prevent-comment-indent
A colon ending a comment line no longer indents the next line
Diffstat (limited to 'scene')
-rw-r--r--scene/gui/text_edit.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp
index 32580a5ae6..f8a5c4cea3 100644
--- a/scene/gui/text_edit.cpp
+++ b/scene/gui/text_edit.cpp
@@ -2331,9 +2331,9 @@ void TextEdit::_gui_input(const Ref<InputEvent> &p_gui_input) {
// no need to indent if we are going upwards.
if (auto_indent && !(k->get_command() && k->get_shift())) {
- // indent once again if previous line will end with ':' or '{'
+ // indent once again if previous line will end with ':' or '{' and the line is not a comment
// (i.e. colon/brace precedes current cursor position)
- if (cursor.column > 0 && (text[cursor.line][cursor.column - 1] == ':' || text[cursor.line][cursor.column - 1] == '{')) {
+ if (cursor.column > 0 && (text[cursor.line][cursor.column - 1] == ':' || text[cursor.line][cursor.column - 1] == '{') && !is_line_comment(cursor.line)) {
if (indent_using_spaces) {
ins += space_indent;
} else {