From 8a62263409f5d222ac0d0ccf7bf0e7e0261224a8 Mon Sep 17 00:00:00 2001 From: Neil Hodgson Date: Sat, 5 Nov 2016 20:32:17 +1100 Subject: 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. --- src/PositionCache.h | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'src/PositionCache.h') diff --git a/src/PositionCache.h b/src/PositionCache.h index edc0a5ddb..5a829b76b 100644 --- a/src/PositionCache.h +++ b/src/PositionCache.h @@ -16,6 +16,15 @@ static inline bool IsEOLChar(char ch) { return (ch == '\r') || (ch == '\n'); } +// There are two points for some positions and this enumeration +// can choose between the end of the first line or subline +// and the start of the next line or subline. +enum PointEnd { + peDefault = 0x0, + peLineEnd = 0x1, + peSubLineEnd = 0x2 +}; + /** */ class LineLayout { @@ -28,6 +37,7 @@ private: bool inCache; public: enum { wrapWidthInfinite = 0x7ffffff }; + int maxLineLength; int numCharsInLine; int numCharsBeforeEOL; @@ -64,7 +74,7 @@ public: void RestoreBracesHighlight(Range rangeLine, const Position braces[], bool ignoreStyle); int FindBefore(XYPOSITION x, int lower, int upper) const; int FindPositionFromX(XYPOSITION x, Range range, bool charPosition) const; - Point PointFromPosition(int posInLine, int lineHeight) const; + Point PointFromPosition(int posInLine, int lineHeight, PointEnd pe) const; int EndLineStyle() const; }; -- cgit v1.2.3