summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDominik 'dreamsComeTrue' Jasiński <dominikjasinski@o2.pl>2020-02-14 23:15:38 +0100
committerDominik 'dreamsComeTrue' Jasiński <dominikjasinski@o2.pl>2020-02-14 23:15:38 +0100
commitff030afc936554ee93f7995d9c745b800ec9a0d7 (patch)
treee936db98d243334bb2377328005180c0ec614b8e
parent7724b842f61e570fcfb1254b12df8c9dc30375c6 (diff)
RichTextLabel: proper handling of internal key events
Fixes #36211
-rw-r--r--scene/gui/rich_text_label.cpp30
1 files changed, 20 insertions, 10 deletions
diff --git a/scene/gui/rich_text_label.cpp b/scene/gui/rich_text_label.cpp
index 0c686296b3..3cb1f75011 100644
--- a/scene/gui/rich_text_label.cpp
+++ b/scene/gui/rich_text_label.cpp
@@ -1208,49 +1208,59 @@ void RichTextLabel::_gui_input(Ref<InputEvent> p_event) {
if (k.is_valid()) {
if (k->is_pressed() && !k->get_alt() && !k->get_shift()) {
- bool handled = true;
+ bool handled = false;
switch (k->get_scancode()) {
case KEY_PAGEUP: {
- if (vscroll->is_visible_in_tree())
+ if (vscroll->is_visible_in_tree()) {
vscroll->set_value(vscroll->get_value() - vscroll->get_page());
+ handled = true;
+ }
} break;
case KEY_PAGEDOWN: {
- if (vscroll->is_visible_in_tree())
+ if (vscroll->is_visible_in_tree()) {
vscroll->set_value(vscroll->get_value() + vscroll->get_page());
+ handled = true;
+ }
} break;
case KEY_UP: {
- if (vscroll->is_visible_in_tree())
+ if (vscroll->is_visible_in_tree()) {
vscroll->set_value(vscroll->get_value() - get_font("normal_font")->get_height());
+ handled = true;
+ }
} break;
case KEY_DOWN: {
- if (vscroll->is_visible_in_tree())
+ if (vscroll->is_visible_in_tree()) {
vscroll->set_value(vscroll->get_value() + get_font("normal_font")->get_height());
+ handled = true;
+ }
} break;
case KEY_HOME: {
- if (vscroll->is_visible_in_tree())
+ if (vscroll->is_visible_in_tree()) {
vscroll->set_value(0);
+ handled = true;
+ }
} break;
case KEY_END: {
- if (vscroll->is_visible_in_tree())
+ if (vscroll->is_visible_in_tree()) {
vscroll->set_value(vscroll->get_max());
+ handled = true;
+ }
} break;
case KEY_INSERT:
case KEY_C: {
if (k->get_command()) {
selection_copy();
- } else {
- handled = false;
+ handled = true;
}
} break;
- default: handled = false;
}
if (handled)