summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2017-02-12 23:09:34 +0100
committerGitHub <noreply@github.com>2017-02-12 23:09:34 +0100
commitd791f5f06ede101ac1990e1f5da05af589c681a2 (patch)
tree2078353960de8c2e1f7411fc5c60ab70568f4958
parentc51990ec9d64a1402e15a0490219bfd2e5bda95b (diff)
parent1169f4e040327c2353d29dccafa0e176eec56a0b (diff)
Merge pull request #7712 from kbake/deselect-selection-on-ctrl-home/end
Selected text is now deselected on ctrl+home/end
-rw-r--r--scene/gui/text_edit.cpp39
1 files changed, 25 insertions, 14 deletions
diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp
index 6036b3f9df..4ca95294ca 100644
--- a/scene/gui/text_edit.cpp
+++ b/scene/gui/text_edit.cpp
@@ -2431,6 +2431,8 @@ void TextEdit::_gui_input(const InputEvent& p_gui_input) {
if (k.mod.shift)
_post_shift_selection();
+ else if(k.mod.command || k.mod.control)
+ deselect();
} break;
#else
@@ -2440,25 +2442,30 @@ void TextEdit::_gui_input(const InputEvent& p_gui_input) {
if (k.mod.shift)
_pre_shift_selection();
- // 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)
+ if (k.mod.command) {
+ cursor_set_line(0);
cursor_set_column(0);
- else
- cursor_set_column(current_line_whitespace_len);
+ }
+ else {
+ // 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 (k.mod.command)
- cursor_set_line(0);
+ if( cursor_get_column() == current_line_whitespace_len )
+ cursor_set_column(0);
+ else
+ cursor_set_column(current_line_whitespace_len);
+ }
if (k.mod.shift)
_post_shift_selection();
+ else if(k.mod.command || k.mod.control)
+ deselect();
_cancel_completion();
completion_hint="";
@@ -2481,6 +2488,8 @@ void TextEdit::_gui_input(const InputEvent& p_gui_input) {
if (k.mod.shift)
_post_shift_selection();
+ else if(k.mod.command || k.mod.control)
+ deselect();
} break;
#else
@@ -2495,6 +2504,8 @@ void TextEdit::_gui_input(const InputEvent& p_gui_input) {
if (k.mod.shift)
_post_shift_selection();
+ else if(k.mod.command || k.mod.control)
+ deselect();
_cancel_completion();
completion_hint="";