aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/EditView.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'src/EditView.cxx')
-rw-r--r--src/EditView.cxx41
1 files changed, 33 insertions, 8 deletions
diff --git a/src/EditView.cxx b/src/EditView.cxx
index 2c8979f8c..9d940f701 100644
--- a/src/EditView.cxx
+++ b/src/EditView.cxx
@@ -445,7 +445,7 @@ void EditView::LayoutLine(const EditModel &model, int line, Surface *surface, co
ll->positions[0] = 0;
bool lastSegItalics = false;
- BreakFinder bfLayout(ll, NULL, Range(0, numCharsInLine), posLineStart, 0, false, model.pdoc, &model.reprs);
+ BreakFinder bfLayout(ll, NULL, Range(0, numCharsInLine), posLineStart, 0, false, model.pdoc, &model.reprs, NULL);
while (bfLayout.More()) {
const TextSegment ts = bfLayout.Next();
@@ -940,14 +940,14 @@ void EditView::DrawEOL(Surface *surface, const EditModel &model, const ViewStyle
}
static void DrawIndicator(int indicNum, int startPos, int endPos, Surface *surface, const ViewStyle &vsDraw,
- const LineLayout *ll, int xStart, PRectangle rcLine, int subLine, Indicator::DrawState drawState) {
+ const LineLayout *ll, int xStart, PRectangle rcLine, int subLine, Indicator::DrawState drawState, int value) {
const XYPOSITION subLineStart = ll->positions[ll->LineStart(subLine)];
PRectangle rcIndic(
ll->positions[startPos] + xStart - subLineStart,
rcLine.top + vsDraw.maxAscent,
ll->positions[endPos] + xStart - subLineStart,
rcLine.top + vsDraw.maxAscent + 3);
- vsDraw.indicators[indicNum].Draw(surface, rcIndic, rcLine, drawState);
+ vsDraw.indicators[indicNum].Draw(surface, rcIndic, rcLine, drawState, value);
}
static void DrawIndicators(Surface *surface, const EditModel &model, const ViewStyle &vsDraw, const LineLayout *ll,
@@ -969,9 +969,10 @@ static void DrawIndicators(Surface *surface, const EditModel &model, const ViewS
endPos = posLineEnd;
const bool hover = vsDraw.indicators[deco->indicator].IsDynamic() &&
((hoverIndicatorPos >= startPos) && (hoverIndicatorPos <= endPos));
+ const int value = deco->rs.ValueAt(startPos);
Indicator::DrawState drawState = hover ? Indicator::drawHover : Indicator::drawNormal;
DrawIndicator(deco->indicator, startPos - posLineStart, endPos - posLineStart,
- surface, vsDraw, ll, xStart, rcLine, subLine, drawState);
+ surface, vsDraw, ll, xStart, rcLine, subLine, drawState, value);
startPos = endPos;
if (!deco->rs.ValueAt(startPos)) {
startPos = deco->rs.EndRun(startPos);
@@ -989,13 +990,13 @@ static void DrawIndicators(Surface *surface, const EditModel &model, const ViewS
if (rangeLine.ContainsCharacter(model.braces[0])) {
int braceOffset = model.braces[0] - posLineStart;
if (braceOffset < ll->numCharsInLine) {
- DrawIndicator(braceIndicator, braceOffset, braceOffset + 1, surface, vsDraw, ll, xStart, rcLine, subLine, Indicator::drawNormal);
+ DrawIndicator(braceIndicator, braceOffset, braceOffset + 1, surface, vsDraw, ll, xStart, rcLine, subLine, Indicator::drawNormal, 1);
}
}
if (rangeLine.ContainsCharacter(model.braces[1])) {
int braceOffset = model.braces[1] - posLineStart;
if (braceOffset < ll->numCharsInLine) {
- DrawIndicator(braceIndicator, braceOffset, braceOffset + 1, surface, vsDraw, ll, xStart, rcLine, subLine, Indicator::drawNormal);
+ DrawIndicator(braceIndicator, braceOffset, braceOffset + 1, surface, vsDraw, ll, xStart, rcLine, subLine, Indicator::drawNormal, 1);
}
}
}
@@ -1250,7 +1251,7 @@ void EditView::DrawBackground(Surface *surface, const EditModel &model, const Vi
// Does not take margin into account but not significant
const int xStartVisible = static_cast<int>(subLineStart)-xStart;
- BreakFinder bfBack(ll, &model.sel, lineRange, posLineStart, xStartVisible, selBackDrawn, model.pdoc, &model.reprs);
+ BreakFinder bfBack(ll, &model.sel, lineRange, posLineStart, xStartVisible, selBackDrawn, model.pdoc, &model.reprs, NULL);
const bool drawWhitespaceBackground = vsDraw.WhitespaceBackgroundDrawn() && !background.isSet;
@@ -1427,7 +1428,7 @@ void EditView::DrawForeground(Surface *surface, const EditModel &model, const Vi
// Foreground drawing loop
BreakFinder bfFore(ll, &model.sel, lineRange, posLineStart, xStartVisible,
- (((phasesDraw == phasesOne) && selBackDrawn) || vsDraw.selColours.fore.isSet), model.pdoc, &model.reprs);
+ (((phasesDraw == phasesOne) && selBackDrawn) || vsDraw.selColours.fore.isSet), model.pdoc, &model.reprs, &vsDraw);
while (bfFore.More()) {
@@ -1450,6 +1451,30 @@ void EditView::DrawForeground(Surface *surface, const EditModel &model, const Vi
if (vsDraw.hotspotColours.fore.isSet)
textFore = vsDraw.hotspotColours.fore;
}
+ if (vsDraw.indicatorsSetFore > 0) {
+ // At least one indicator sets the text colour so see if it applies to this segment
+ for (Decoration *deco = model.pdoc->decorations.root; deco; deco = deco->next) {
+ const int indicatorValue = deco->rs.ValueAt(ts.start + posLineStart);
+ if (indicatorValue) {
+ const Indicator &indicator = vsDraw.indicators[deco->indicator];
+ const bool hover = indicator.IsDynamic() &&
+ ((model.hoverIndicatorPos >= ts.start + posLineStart) &&
+ (model.hoverIndicatorPos <= ts.end() + posLineStart));
+ if (hover) {
+ if (indicator.sacHover.style == INDIC_TEXTFORE) {
+ textFore = indicator.sacHover.fore;
+ }
+ } else {
+ if (indicator.sacNormal.style == INDIC_TEXTFORE) {
+ if (indicator.Flags() & SC_INDICFLAG_VALUEFORE)
+ textFore = indicatorValue & SC_INDICVALUEMASK;
+ else
+ textFore = indicator.sacNormal.fore;
+ }
+ }
+ }
+ }
+ }
const int inSelection = hideSelection ? 0 : model.sel.CharacterInSelection(iDoc);
if (inSelection && (vsDraw.selColours.fore.isSet)) {
textFore = (inSelection == 1) ? vsDraw.selColours.fore : vsDraw.selAdditionalForeground;