diff options
author | RĂ©mi Verschelde <rverschelde@gmail.com> | 2019-07-09 08:56:27 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-07-09 08:56:27 +0200 |
commit | 2633efd55bf8731e7af5f2949fe3a8a9cd596e34 (patch) | |
tree | 73aaf85e067fc17a5b6bd1c1ded55f294d0dde3e | |
parent | 0c1394e1a3934521e5788a934b13f4f025430b3a (diff) | |
parent | eb5807984c12e90dc46e359463db1a178fe8a1c5 (diff) |
Merge pull request #28190 from griant/test
fix improper uncommenting behavior in TextEditor
-rw-r--r-- | scene/gui/text_edit.cpp | 40 | ||||
-rw-r--r-- | scene/gui/text_edit.h | 1 |
2 files changed, 0 insertions, 41 deletions
diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp index a7b4e08553..7a937843ab 100644 --- a/scene/gui/text_edit.cpp +++ b/scene/gui/text_edit.cpp @@ -3287,28 +3287,6 @@ void TextEdit::_gui_input(const Ref<InputEvent> &p_gui_input) { } break; - case KEY_U: { - if (!k->get_command() || k->get_shift()) { - scancode_handled = false; - break; - } else { - if (selection.active) { - int ini = selection.from_line; - int end = selection.to_line; - - for (int i = ini; i <= end; i++) { - _uncomment_line(i); - } - } else { - _uncomment_line(cursor.line); - if (cursor.column >= get_line(cursor.line).length()) { - cursor.column = MAX(0, get_line(cursor.line).length() - 1); - } - } - update(); - } - } break; - default: { scancode_handled = false; @@ -3367,24 +3345,6 @@ void TextEdit::_gui_input(const Ref<InputEvent> &p_gui_input) { } } -void TextEdit::_uncomment_line(int p_line) { - String line_text = get_line(p_line); - for (int i = 0; i < line_text.length(); i++) { - if (line_text[i] == '#') { - _remove_text(p_line, i, p_line, i + 1); - if (p_line == selection.to_line && selection.to_column > line_text.length() - 1) { - selection.to_column -= 1; - if (selection.to_column >= selection.from_column) { - selection.active = false; - } - } - return; - } else if (line_text[i] != '\t' && line_text[i] != ' ') { - return; - } - } -} - void TextEdit::_scroll_up(real_t p_delta) { if (scrolling && smooth_scroll_enabled && SGN(target_v_scroll - v_scroll->get_value()) != SGN(-p_delta)) diff --git a/scene/gui/text_edit.h b/scene/gui/text_edit.h index 9fb8e03288..b47dac0902 100644 --- a/scene/gui/text_edit.h +++ b/scene/gui/text_edit.h @@ -395,7 +395,6 @@ private: void _update_selection_mode_word(); void _update_selection_mode_line(); - void _uncomment_line(int p_line); void _scroll_up(real_t p_delta); void _scroll_down(real_t p_delta); |