1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-27 02:20:05 +00:00

TextEditor: Avoid moveCaretTo(Start|End)OfLine moving to the previous line

This commit is contained in:
reuk 2023-07-31 18:35:41 +01:00
parent 97fa2f0e8a
commit 3387ca362c
No known key found for this signature in database
GPG key ID: FCB43929F012EE5C

View file

@ -2073,7 +2073,7 @@ bool TextEditor::moveCaretToTop (bool selecting)
bool TextEditor::moveCaretToStartOfLine (bool selecting)
{
const auto caretPos = (getCaretRectangle() - getTextOffset()).toFloat();
return moveCaretWithTransaction (indexAtPosition (0.0f, caretPos.getY()), selecting);
return moveCaretWithTransaction (indexAtPosition (0.0f, caretPos.getCentreY()), selecting);
}
bool TextEditor::moveCaretToEnd (bool selecting)
@ -2084,7 +2084,7 @@ bool TextEditor::moveCaretToEnd (bool selecting)
bool TextEditor::moveCaretToEndOfLine (bool selecting)
{
const auto caretPos = (getCaretRectangle() - getTextOffset()).toFloat();
return moveCaretWithTransaction (indexAtPosition ((float) textHolder->getWidth(), caretPos.getY()), selecting);
return moveCaretWithTransaction (indexAtPosition ((float) textHolder->getWidth(), caretPos.getCentreY()), selecting);
}
bool TextEditor::deleteBackwards (bool moveInWholeWordSteps)