From 1f47f38256cc99019914b32f906fd13788ca48db Mon Sep 17 00:00:00 2001 From: MihailRis Date: Tue, 31 Dec 2024 14:39:07 +0300 Subject: [PATCH] feat: 'CTRL + Up/Down' in multiline textbox --- src/graphics/ui/elements/TextBox.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/graphics/ui/elements/TextBox.cpp b/src/graphics/ui/elements/TextBox.cpp index 7d2cb352..f1ed6608 100644 --- a/src/graphics/ui/elements/TextBox.cpp +++ b/src/graphics/ui/elements/TextBox.cpp @@ -699,6 +699,10 @@ std::shared_ptr TextBox::getAt( void TextBox::setOnUpPressed(const runnable &callback) { if (callback == nullptr) { onUpPressed = [this]() { + if (Events::pressed(keycode::LEFT_CONTROL)) { + scrolled(1); + return; + } bool shiftPressed = Events::pressed(keycode::LEFT_SHIFT); bool breakSelection = getSelectionLength() != 0 && !shiftPressed; stepDefaultUp(shiftPressed, breakSelection); @@ -711,6 +715,10 @@ void TextBox::setOnUpPressed(const runnable &callback) { void TextBox::setOnDownPressed(const runnable &callback) { if (callback == nullptr) { onDownPressed = [this]() { + if (Events::pressed(keycode::LEFT_CONTROL)) { + scrolled(-1); + return; + } bool shiftPressed = Events::pressed(keycode::LEFT_SHIFT); bool breakSelection = getSelectionLength() != 0 && !shiftPressed; stepDefaultDown(shiftPressed, breakSelection);