From 1d70e2ccd4d2e713cd8bd32ace51c7b7c30052d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stephan=20A=C3=9Fmus?= Date: Sat, 7 Dec 2013 14:37:52 +0100 Subject: [PATCH] TextDocumentLayout: Fixed LineIndexForOffset() It stepped over a wrong number of lines when skipping to the ParagraphLayout containing the text offset. --- src/apps/haiku-depot/textview/TextDocumentLayout.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/apps/haiku-depot/textview/TextDocumentLayout.cpp b/src/apps/haiku-depot/textview/TextDocumentLayout.cpp index d977cd2320..2b1806ba37 100644 --- a/src/apps/haiku-depot/textview/TextDocumentLayout.cpp +++ b/src/apps/haiku-depot/textview/TextDocumentLayout.cpp @@ -112,8 +112,7 @@ TextDocumentLayout::LineIndexForOffset(int32 textOffset) if (index >= 0) { int32 lineIndex = 0; for (int32 i = 0; i < index; i++) { - lineIndex += fParagraphLayouts.ItemAtFast(index) - .layout->CountLines(); + lineIndex += fParagraphLayouts.ItemAtFast(i).layout->CountLines(); } const ParagraphLayoutInfo& info = fParagraphLayouts.ItemAtFast(index);