diff options
author | Neil Hodgson <nyamatongwe@gmail.com> | 2016-11-05 20:32:17 +1100 |
---|---|---|
committer | Neil Hodgson <nyamatongwe@gmail.com> | 2016-11-05 20:32:17 +1100 |
commit | 8a62263409f5d222ac0d0ccf7bf0e7e0261224a8 (patch) | |
tree | 2fa3fea045c228d40e8a812b8553afd21f7f168a /src/PositionCache.cxx | |
parent | 1e36c7e89248cf5f9e4353673918e79cfcaeb857 (diff) | |
download | scintilla-mirror-8a62263409f5d222ac0d0ccf7bf0e7e0261224a8.tar.gz |
Add options to choose between the locations of a position when there
are multiple locations for one position.
The main current use is to find the location at the end of a line or display
line when the commonly used location is at the start of the next line.
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; |