You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-06 12:20:30 +00:00
Added a cursor column check.
Fixes glich, when cursor is on column 0 of and indented line and you press return an extra indent is added.
This commit is contained in:
@@ -2115,14 +2115,14 @@ void TextEdit::_gui_input(const Ref<InputEvent> &p_gui_input) {
|
|||||||
//keep indentation
|
//keep indentation
|
||||||
int space_count = 0;
|
int space_count = 0;
|
||||||
for (int i = 0; i < text[cursor.line].length(); i++) {
|
for (int i = 0; i < text[cursor.line].length(); i++) {
|
||||||
if (text[cursor.line][i] == '\t') {
|
if (text[cursor.line][i] == '\t' && cursor.column > 0) {
|
||||||
if (indent_using_spaces) {
|
if (indent_using_spaces) {
|
||||||
ins += space_indent;
|
ins += space_indent;
|
||||||
} else {
|
} else {
|
||||||
ins += "\t";
|
ins += "\t";
|
||||||
}
|
}
|
||||||
space_count = 0;
|
space_count = 0;
|
||||||
} else if (text[cursor.line][i] == ' ') {
|
} else if (text[cursor.line][i] == ' ' && cursor.column > 0) {
|
||||||
space_count++;
|
space_count++;
|
||||||
|
|
||||||
if (space_count == indent_size) {
|
if (space_count == indent_size) {
|
||||||
|
|||||||
Reference in New Issue
Block a user