Merge pull request #10791 from tuga3d/indent-glitch-attempt-2

second attempt on fixing the indent glitch.
This commit is contained in:
Rémi Verschelde 2017-08-31 19:26:07 +02:00 committed by GitHub
commit a717083235

View file

@ -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) {