summaryrefslogtreecommitdiff
path: root/scene
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <rverschelde@gmail.com>2017-08-31 19:26:07 +0200
committerGitHub <noreply@github.com>2017-08-31 19:26:07 +0200
commita717083235b3369aef9a3846b5071fac023a60b2 (patch)
tree15b62cd6af96fc61194413693810fea800d9d6e9 /scene
parent4722593448b93e34d84a55010c10770c2d12e223 (diff)
parent2eb46801cb8122b6767d5d756a4c4e608049694c (diff)
Merge pull request #10791 from tuga3d/indent-glitch-attempt-2
second attempt on fixing the indent glitch.
Diffstat (limited to 'scene')
-rw-r--r--scene/gui/text_edit.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp
index 7a9daea73e..7b93393851 100644
--- a/scene/gui/text_edit.cpp
+++ b/scene/gui/text_edit.cpp
@@ -2113,15 +2113,15 @@ void TextEdit::_gui_input(const Ref<InputEvent> &p_gui_input) {
//keep indentation
int space_count = 0;
- for (int i = 0; i < text[cursor.line].length(); i++) {
- if (text[cursor.line][i] == '\t' && cursor.column > 0) {
+ for (int i = 0; i < cursor.column; i++) {
+ if (text[cursor.line][i] == '\t') {
if (indent_using_spaces) {
ins += space_indent;
} else {
ins += "\t";
}
space_count = 0;
- } else if (text[cursor.line][i] == ' ' && cursor.column > 0) {
+ } else if (text[cursor.line][i] == ' ') {
space_count++;
if (space_count == indent_size) {