From 7dca8727af27e1df39cf65964c205e06345759aa Mon Sep 17 00:00:00 2001 From: Kae <80987908+Novaenia@users.noreply.github.com> Date: Wed, 28 Jun 2023 20:25:53 +1000 Subject: [PATCH] Fix normal backspace broken by previous change --- source/windowing/StarTextBoxWidget.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/source/windowing/StarTextBoxWidget.cpp b/source/windowing/StarTextBoxWidget.cpp index db9374c..87ed3c7 100644 --- a/source/windowing/StarTextBoxWidget.cpp +++ b/source/windowing/StarTextBoxWidget.cpp @@ -334,15 +334,16 @@ bool TextBoxWidget::innerSendEvent(InputEvent const& event) { } auto calculateSteps = [&](bool dir) { + int steps = 1; if ((keyDown->mods & (KeyMod::LCtrl | KeyMod::RCtrl)) != KeyMod::NoMod || (keyDown->mods & (KeyMod::LAlt | KeyMod::RAlt)) != KeyMod::NoMod) { - int steps; if (dir) // right - steps = m_text.findNextBoundary(m_cursorOffset) - m_cursorOffset; + steps = m_text.findNextBoundary(m_cursorOffset) - m_cursorOffset; else // left - steps = m_cursorOffset - m_text.findNextBoundary(m_cursorOffset, true); + steps = m_cursorOffset - m_text.findNextBoundary(m_cursorOffset, true); return steps < 1 ? 1 : steps; } + return 1; }; if (keyDown->key == Key::Backspace) {