diff --git a/doc/classes/TextEdit.xml b/doc/classes/TextEdit.xml index 088bcd1c3cb..e2467b84a1c 100644 --- a/doc/classes/TextEdit.xml +++ b/doc/classes/TextEdit.xml @@ -5,6 +5,7 @@ TextEdit is meant for editing large, multiline text. It also has facilities for editing code, such as syntax highlighting support and multiple levels of undo/redo. + [b]Note:[/b] When holding down [kbd]Alt[/kbd], the vertical scroll wheel will scroll 5 times as fast as it would normally do. This also works in the Godot script editor. @@ -714,10 +715,10 @@ If [code]true[/code], read-only mode is enabled. Existing text cannot be modified and new text cannot be added. - If there is a horizontal scrollbar this determines the current horizontal scroll value in pixels. + If there is a horizontal scrollbar, this determines the current horizontal scroll value in pixels. - If there is a vertical scrollbar this determines the current vertical scroll value in line numbers, starting at 0 for the top line. + If there is a vertical scrollbar, this determines the current vertical scroll value in line numbers, starting at 0 for the top line. If [code]true[/code], text can be selected. diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp index 8e5f0e80b79..2269d4f0023 100644 --- a/scene/gui/text_edit.cpp +++ b/scene/gui/text_edit.cpp @@ -2917,14 +2917,22 @@ void TextEdit::_gui_input(const Ref &p_gui_input) { if (mb->get_button_index() == MOUSE_BUTTON_WHEEL_UP && !mb->is_command_pressed()) { if (mb->is_shift_pressed()) { h_scroll->set_value(h_scroll->get_value() - (100 * mb->get_factor())); + } else if (mb->get_alt()) { + // Scroll 5 times as fast as normal (like in Visual Studio Code). + _scroll_up(15 * mb->get_factor()); } else if (v_scroll->is_visible()) { + // Scroll 3 lines. _scroll_up(3 * mb->get_factor()); } } if (mb->get_button_index() == MOUSE_BUTTON_WHEEL_DOWN && !mb->is_command_pressed()) { if (mb->is_shift_pressed()) { h_scroll->set_value(h_scroll->get_value() + (100 * mb->get_factor())); + } else if (mb->get_alt()) { + // Scroll 5 times as fast as normal (like in Visual Studio Code). + _scroll_down(15 * mb->get_factor()); } else if (v_scroll->is_visible()) { + // Scroll 3 lines. _scroll_down(3 * mb->get_factor()); } }