aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/PositionCache.cxx
diff options
context:
space:
mode:
authornyamatongwe <unknown>2009-08-26 10:48:18 +0000
committernyamatongwe <unknown>2009-08-26 10:48:18 +0000
commit275e0c25ae6cf1568099509682417b1c8ae60911 (patch)
tree1d4a17c53614d85917a198b948d6d96e174c7c8a /src/PositionCache.cxx
parent8e9c1647b1620be3e44d59d6429c68ed46010017 (diff)
downloadscintilla-mirror-275e0c25ae6cf1568099509682417b1c8ae60911.tar.gz
Avoid breaking text into substrings on selection boundaries for drawing
when the selection is empty (thus only needing a caret drawn) or when the selection settings do not need the text drawn as pieces such as when the selection is drawn translucently.
Diffstat (limited to 'src/PositionCache.cxx')
-rw-r--r--src/PositionCache.cxx20
1 files changed, 12 insertions, 8 deletions
diff --git a/src/PositionCache.cxx b/src/PositionCache.cxx
index 580a1797c..fa2d581e1 100644
--- a/src/PositionCache.cxx
+++ b/src/PositionCache.cxx
@@ -386,7 +386,7 @@ static int NextBadU(const char *s, int p, int len, int &trailBytes) {
return -1;
}
-BreakFinder::BreakFinder(LineLayout *ll_, int lineStart_, int lineEnd_, int posLineStart_, bool utf8_, int xStart) :
+BreakFinder::BreakFinder(LineLayout *ll_, int lineStart_, int lineEnd_, int posLineStart_, bool utf8_, int xStart, bool breakForSelection) :
ll(ll_),
lineStart(lineStart_),
lineEnd(lineEnd_),
@@ -412,13 +412,17 @@ BreakFinder::BreakFinder(LineLayout *ll_, int lineStart_, int lineEnd_, int posL
nextBreak--;
}
- SelectionSegment segmentLine(SelectionPosition(posLineStart), SelectionPosition(posLineStart + lineEnd));
- for (size_t r=0; r<ll->psel->Count(); r++) {
- SelectionSegment portion = ll->psel->Range(r).Intersect(segmentLine);
- if (portion.start.IsValid())
- Insert(portion.start.Position() - posLineStart - 1);
- if (portion.end.IsValid())
- Insert(portion.end.Position() - posLineStart - 1);
+ if (breakForSelection) {
+ SelectionSegment segmentLine(SelectionPosition(posLineStart), SelectionPosition(posLineStart + lineEnd));
+ for (size_t r=0; r<ll->psel->Count(); r++) {
+ SelectionSegment portion = ll->psel->Range(r).Intersect(segmentLine);
+ if (!(portion.start == portion.end)) {
+ if (portion.start.IsValid())
+ Insert(portion.start.Position() - posLineStart - 1);
+ if (portion.end.IsValid())
+ Insert(portion.end.Position() - posLineStart - 1);
+ }
+ }
}
Insert(ll->edgeColumn - 1);