diff options
Diffstat (limited to 'src/ViewStyle.cxx')
-rw-r--r-- | src/ViewStyle.cxx | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/src/ViewStyle.cxx b/src/ViewStyle.cxx index af808f3c1..2983bb0c0 100644 --- a/src/ViewStyle.cxx +++ b/src/ViewStyle.cxx @@ -434,6 +434,43 @@ void ViewStyle::CalcLargestMarkerHeight() { } } +// See if something overrides the line background color: Either if caret is on the line +// and background color is set for that, or if a marker is defined that forces its background +// color onto the line, or if a marker is defined but has no selection margin in which to +// display itself (as long as it's not an SC_MARK_EMPTY marker). These are checked in order +// with the earlier taking precedence. When multiple markers cause background override, +// the color for the highest numbered one is used. +ColourOptional ViewStyle::Background(int marksOfLine, bool caretActive, bool lineContainsCaret) const { + ColourOptional background; + if ((caretActive || alwaysShowCaretLineBackground) && showCaretLineBackground && (caretLineAlpha == SC_ALPHA_NOALPHA) && lineContainsCaret) { + background = ColourOptional(caretLineBackground, true); + } + if (!background.isSet && marksOfLine) { + int marks = marksOfLine; + for (int markBit = 0; (markBit < 32) && marks; markBit++) { + if ((marks & 1) && (markers[markBit].markType == SC_MARK_BACKGROUND) && + (markers[markBit].alpha == SC_ALPHA_NOALPHA)) { + background = ColourOptional(markers[markBit].back, true); + } + marks >>= 1; + } + } + if (!background.isSet && maskInLine) { + int marksMasked = marksOfLine & maskInLine; + if (marksMasked) { + for (int markBit = 0; (markBit < 32) && marksMasked; markBit++) { + if ((marksMasked & 1) && (markers[markBit].markType != SC_MARK_EMPTY) && + (markers[markBit].alpha == SC_ALPHA_NOALPHA)) { + background = ColourOptional(markers[markBit].back, true); + } + marksMasked >>= 1; + } + } + } + return background; +} + + ColourDesired ViewStyle::WrapColour() const { if (whitespaceColours.fore.isSet) return whitespaceColours.fore; |