aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/PositionCache.cxx
diff options
context:
space:
mode:
authorNeil <nyamatongwe@gmail.com>2014-07-08 16:35:34 +1000
committerNeil <nyamatongwe@gmail.com>2014-07-08 16:35:34 +1000
commit1e8908c6d5fd998e9d8a9408a6b86ef4a2ff64e8 (patch)
tree71c71ca48b7324b12ace12b9feecbe15a1f1feae /src/PositionCache.cxx
parente34a993a93ef59b13eb32b6fd5b53d8e95b75f0e (diff)
downloadscintilla-mirror-1e8908c6d5fd998e9d8a9408a6b86ef4a2ff64e8.tar.gz
Split parts of Editor class off into EditModel, MarginView, and EditView classes.
Diffstat (limited to 'src/PositionCache.cxx')
-rw-r--r--src/PositionCache.cxx25
1 files changed, 12 insertions, 13 deletions
diff --git a/src/PositionCache.cxx b/src/PositionCache.cxx
index 9e55c1a82..53767e032 100644
--- a/src/PositionCache.cxx
+++ b/src/PositionCache.cxx
@@ -438,13 +438,12 @@ void BreakFinder::Insert(int val) {
}
}
-BreakFinder::BreakFinder(const LineLayout *ll_, const Selection *psel, int lineStart_, int lineEnd_, int posLineStart_,
+BreakFinder::BreakFinder(const LineLayout *ll_, const Selection *psel, Range lineRange_, int posLineStart_,
int xStart, bool breakForSelection, const Document *pdoc_, const SpecialRepresentations *preprs_) :
ll(ll_),
- lineStart(lineStart_),
- lineEnd(lineEnd_),
+ lineRange(lineRange_),
posLineStart(posLineStart_),
- nextBreak(lineStart_),
+ nextBreak(lineRange_.start),
saeCurrentPos(0),
saeNext(0),
subBreak(-1),
@@ -455,15 +454,15 @@ BreakFinder::BreakFinder(const LineLayout *ll_, const Selection *psel, int lineS
// Search for first visible break
// First find the first visible character
if (xStart > 0.0f)
- nextBreak = ll->FindBefore(static_cast<XYPOSITION>(xStart), lineStart, lineEnd);
+ nextBreak = ll->FindBefore(static_cast<XYPOSITION>(xStart), lineRange.start, lineRange.end);
// Now back to a style break
- while ((nextBreak > lineStart) && (ll->styles[nextBreak] == ll->styles[nextBreak - 1])) {
+ while ((nextBreak > lineRange.start) && (ll->styles[nextBreak] == ll->styles[nextBreak - 1])) {
nextBreak--;
}
if (breakForSelection) {
SelectionPosition posStart(posLineStart);
- SelectionPosition posEnd(posLineStart + lineEnd);
+ SelectionPosition posEnd(posLineStart + lineRange.end);
SelectionSegment segmentLine(posStart, posEnd);
for (size_t r=0; r<psel->Count(); r++) {
SelectionSegment portion = psel->Range(r).Intersect(segmentLine);
@@ -477,7 +476,7 @@ BreakFinder::BreakFinder(const LineLayout *ll_, const Selection *psel, int lineS
}
Insert(ll->edgeColumn);
- Insert(lineEnd);
+ Insert(lineRange.end);
saeNext = (!selAndEdge.empty()) ? selAndEdge[0] : -1;
}
@@ -487,19 +486,19 @@ BreakFinder::~BreakFinder() {
TextSegment BreakFinder::Next() {
if (subBreak == -1) {
int prev = nextBreak;
- while (nextBreak < lineEnd) {
+ while (nextBreak < lineRange.end) {
int charWidth = 1;
if (encodingFamily == efUnicode)
- charWidth = UTF8DrawBytes(reinterpret_cast<unsigned char *>(ll->chars) + nextBreak, lineEnd - nextBreak);
+ charWidth = UTF8DrawBytes(reinterpret_cast<unsigned char *>(ll->chars) + nextBreak, lineRange.end - nextBreak);
else if (encodingFamily == efDBCS)
charWidth = pdoc->IsDBCSLeadByte(ll->chars[nextBreak]) ? 2 : 1;
const Representation *repr = preprs->RepresentationFromCharacter(ll->chars + nextBreak, charWidth);
if (((nextBreak > 0) && (ll->styles[nextBreak] != ll->styles[nextBreak - 1])) ||
repr ||
(nextBreak == saeNext)) {
- while ((nextBreak >= saeNext) && (saeNext < lineEnd)) {
+ while ((nextBreak >= saeNext) && (saeNext < lineRange.end)) {
saeCurrentPos++;
- saeNext = (saeCurrentPos < selAndEdge.size()) ? selAndEdge[saeCurrentPos] : lineEnd;
+ saeNext = (saeCurrentPos < selAndEdge.size()) ? selAndEdge[saeCurrentPos] : lineRange.end;
}
if ((nextBreak > prev) || repr) {
// Have a segment to report
@@ -540,7 +539,7 @@ TextSegment BreakFinder::Next() {
}
bool BreakFinder::More() const {
- return (subBreak >= 0) || (nextBreak < lineEnd);
+ return (subBreak >= 0) || (nextBreak < lineRange.end);
}
PositionCacheEntry::PositionCacheEntry() :