diff options
author | Kae <80987908+Novaenia@users.noreply.github.com> | 2023-06-28 20:25:53 +1000 |
---|---|---|
committer | Kae <80987908+Novaenia@users.noreply.github.com> | 2023-06-28 20:26:04 +1000 |
commit | be8c722a7ea8c5fe8406de0f3ce79c134ff2eb46 (patch) | |
tree | 4f51ff1e1370dae6e895767f3062b8163e0e626f /source/windowing/StarTextBoxWidget.cpp | |
parent | 98c4e55380baefc3aae58ead213052ea713e00c7 (diff) |
Fix normal backspace broken by previous change
Diffstat (limited to 'source/windowing/StarTextBoxWidget.cpp')
-rw-r--r-- | source/windowing/StarTextBoxWidget.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/source/windowing/StarTextBoxWidget.cpp b/source/windowing/StarTextBoxWidget.cpp index db9374c..bc64d37 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 steps; }; if (keyDown->key == Key::Backspace) { |