summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorreduz <reduzio@gmail.com>2014-04-10 15:53:45 -0300
committerreduz <reduzio@gmail.com>2014-04-10 15:53:45 -0300
commit606b9d960af6ca4517503328b870214b96ff21d3 (patch)
tree8ecc15387cd8d8416e76743622014440b95890d9
parenta5f556c9ff7c80f5a30559cd22223e8a613d0a60 (diff)
parent89568b9017ec6f2c994697ce4d48de117e71b18e (diff)
Merge pull request #277 from jonyrock/master
home button & whitespace
-rw-r--r--scene/gui/text_edit.cpp17
1 files changed, 15 insertions, 2 deletions
diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp
index 233e3bee66..3e4c04873a 100644
--- a/scene/gui/text_edit.cpp
+++ b/scene/gui/text_edit.cpp
@@ -1349,8 +1349,21 @@ void TextEdit::_input_event(const InputEvent& p_input_event) {
if (k.mod.shift)
_pre_shift_selection();
-
- cursor_set_column(0);
+
+ // compute whitespace symbols seq length
+ int current_line_whitespace_len = 0;
+ while(current_line_whitespace_len < text[cursor.line].length()) {
+ CharType c = text[cursor.line][current_line_whitespace_len];
+ if(c != '\t' && c != ' ')
+ break;
+ current_line_whitespace_len++;
+ }
+
+ if(cursor_get_column() == current_line_whitespace_len)
+ cursor_set_column(0);
+ else
+ cursor_set_column(current_line_whitespace_len);
+
if (k.mod.command)
cursor_set_line(0);