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.
This commit is contained in:
Stephan Aßmus
2014-01-22 00:14:09 +01:00
parent 41889b59f3
commit 5cad1e1cc9
2 changed files with 3 additions and 3 deletions
@@ -1,5 +1,5 @@
/* /*
* Copyright 2013, Stephan Aßmus <[email protected]>. * Copyright 2013-2014, Stephan Aßmus <[email protected]>.
* All rights reserved. Distributed under the terms of the MIT License. * 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); const ParagraphLayoutInfo& info = fParagraphLayouts.ItemAtFast(i);
int32 length = info.layout->CountGlyphs(); int32 length = info.layout->CountGlyphs();
if (textOffset > length) { if (textOffset >= length) {
textOffset -= length; textOffset -= length;
continue; continue;
} }
@@ -1,5 +1,5 @@
/* /*
* Copyright 2013, Stephan Aßmus <[email protected]>. * Copyright 2013-2014, Stephan Aßmus <[email protected]>.
* All rights reserved. Distributed under the terms of the MIT License. * All rights reserved. Distributed under the terms of the MIT License.
*/ */
#ifndef TEXT_DOCUMENT_LAYOUT_H #ifndef TEXT_DOCUMENT_LAYOUT_H