mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-10 23:44:24 +00:00
Fix key up behaviour in a multiline TextEditor
A regression was introduced in d564e4931. Before that commit you
could use key up to jump into position zero of a multiline TextEditor
if the cursor was somewhere in the first line. Since that commit the
keypress had no effect. This change restores the earlier behaviour.
This commit is contained in:
parent
14628ec824
commit
2e1809ec33
1 changed files with 7 additions and 1 deletions
|
|
@ -2036,7 +2036,13 @@ bool TextEditor::moveCaretUp (bool selecting)
|
|||
return moveCaretToStartOfLine (selecting);
|
||||
|
||||
const auto caretPos = (getCaretRectangle() - getTextOffset()).toFloat();
|
||||
return moveCaretWithTransaction (indexAtPosition (caretPos.getX(), caretPos.getY() - 1.0f), selecting);
|
||||
|
||||
const auto newY = caretPos.getY() - 1.0f;
|
||||
|
||||
if (newY < 0.0f)
|
||||
return moveCaretToStartOfLine (selecting);
|
||||
|
||||
return moveCaretWithTransaction (indexAtPosition (caretPos.getX(), newY), selecting);
|
||||
}
|
||||
|
||||
bool TextEditor::moveCaretDown (bool selecting)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue