diff options
Diffstat (limited to 'src/PositionCache.cxx')
-rw-r--r-- | src/PositionCache.cxx | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/PositionCache.cxx b/src/PositionCache.cxx index 997a4bfae..45731601a 100644 --- a/src/PositionCache.cxx +++ b/src/PositionCache.cxx @@ -217,7 +217,7 @@ int LineLayout::FindPositionFromX(XYPOSITION x, Range range, bool charPosition) return range.end; } -Point LineLayout::PointFromPosition(int posInLine, int lineHeight) const { +Point LineLayout::PointFromPosition(int posInLine, int lineHeight, PointEnd pe) const { Point pt; // In case of very long line put x at arbitrary large position if (posInLine > maxLineLength) { @@ -232,6 +232,12 @@ Point LineLayout::PointFromPosition(int posInLine, int lineHeight) const { pt.x = positions[posInLine] - positions[rangeSubLine.start]; if (rangeSubLine.start != 0) // Wrapped lines may be indented pt.x += wrapIndent; + if (pe & peSubLineEnd) // Return end of first subline not start of next + break; + } else if ((pe & peLineEnd) && (subLine == (lines-1))) { + pt.x = positions[numCharsInLine] - positions[rangeSubLine.start]; + if (rangeSubLine.start != 0) // Wrapped lines may be indented + pt.x += wrapIndent; } } else { break; |