From 3387ca362cd76e68dd019695b7af93b9435ac9f0 Mon Sep 17 00:00:00 2001 From: reuk Date: Mon, 31 Jul 2023 18:35:41 +0100 Subject: [PATCH] TextEditor: Avoid moveCaretTo(Start|End)OfLine moving to the previous line --- modules/juce_gui_basics/widgets/juce_TextEditor.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/juce_gui_basics/widgets/juce_TextEditor.cpp b/modules/juce_gui_basics/widgets/juce_TextEditor.cpp index 82dcd3bc5e..57ac184024 100644 --- a/modules/juce_gui_basics/widgets/juce_TextEditor.cpp +++ b/modules/juce_gui_basics/widgets/juce_TextEditor.cpp @@ -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)