From 5cad1e1cc9dc51823b5bce07b40ede749a1f03c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stephan=20A=C3=9Fmus?= Date: Wed, 22 Jan 2014 00:14:09 +0100 Subject: [PATCH] TextDocumentLayout: Fixed finding the right paragraph for an offset. It was not possible to place the cursor at the beginning of a paragraph once they actually contain the \n at the end. --- src/apps/haiku-depot/textview/TextDocumentLayout.cpp | 4 ++-- src/apps/haiku-depot/textview/TextDocumentLayout.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/apps/haiku-depot/textview/TextDocumentLayout.cpp b/src/apps/haiku-depot/textview/TextDocumentLayout.cpp index cd7b1d7905..aa7ef69d27 100644 --- a/src/apps/haiku-depot/textview/TextDocumentLayout.cpp +++ b/src/apps/haiku-depot/textview/TextDocumentLayout.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2013, Stephan Aßmus . + * Copyright 2013-2014, Stephan Aßmus . * All rights reserved. Distributed under the terms of the MIT License. */ @@ -337,7 +337,7 @@ TextDocumentLayout::_ParagraphLayoutIndexForOffset(int32& textOffset) const ParagraphLayoutInfo& info = fParagraphLayouts.ItemAtFast(i); int32 length = info.layout->CountGlyphs(); - if (textOffset > length) { + if (textOffset >= length) { textOffset -= length; continue; } diff --git a/src/apps/haiku-depot/textview/TextDocumentLayout.h b/src/apps/haiku-depot/textview/TextDocumentLayout.h index 2e3df4bdfb..89c5111f21 100644 --- a/src/apps/haiku-depot/textview/TextDocumentLayout.h +++ b/src/apps/haiku-depot/textview/TextDocumentLayout.h @@ -1,5 +1,5 @@ /* - * Copyright 2013, Stephan Aßmus . + * Copyright 2013-2014, Stephan Aßmus . * All rights reserved. Distributed under the terms of the MIT License. */ #ifndef TEXT_DOCUMENT_LAYOUT_H