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:
@@ -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.
|
||||
*/
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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.
|
||||
*/
|
||||
#ifndef TEXT_DOCUMENT_LAYOUT_H
|
||||
|
||||
Reference in New Issue
Block a user