diff --git a/src/richtext/richtextbuffer.cpp b/src/richtext/richtextbuffer.cpp index 0a46f82d00..1b3ff5896f 100644 --- a/src/richtext/richtextbuffer.cpp +++ b/src/richtext/richtextbuffer.cpp @@ -1387,7 +1387,7 @@ long wxRichTextParagraphLayoutBox::GetVisibleLineNumber(long pos, bool caretPosi wxRichTextLine* line = node2->GetData(); wxRichTextRange lineRange = line->GetAbsoluteRange(); - if (lineRange.Contains(pos)) + if (lineRange.Contains(pos) || pos == lineRange.GetStart()) { // If the caret is displayed at the end of the previous wrapped line, // we want to return the line it's _displayed_ at (not the actual line