diff options
author | Neil <nyamatongwe@gmail.com> | 2021-05-11 22:43:15 +1000 |
---|---|---|
committer | Neil <nyamatongwe@gmail.com> | 2021-05-11 22:43:15 +1000 |
commit | 1cfccee93cc5fd4d0fb56937b0402611b354e8c2 (patch) | |
tree | e3bcb9a3b2050901df8b17df7813577434b6a7d6 /src/ViewStyle.cxx | |
parent | 8dd2db6205ceb93506490bd94a031178b37710aa (diff) | |
download | scintilla-mirror-1cfccee93cc5fd4d0fb56937b0402611b354e8c2.tar.gz |
When setting or resetting elements, redraw if caused change.
Diffstat (limited to 'src/ViewStyle.cxx')
-rw-r--r-- | src/ViewStyle.cxx | 27 |
1 files changed, 17 insertions, 10 deletions
diff --git a/src/ViewStyle.cxx b/src/ViewStyle.cxx index 4d555b1c2..a8fcd2d8c 100644 --- a/src/ViewStyle.cxx +++ b/src/ViewStyle.cxx @@ -560,8 +560,20 @@ bool ViewStyle::ElementAllowsTranslucent(int element) const { return elementAllowsTranslucent.count(element) > 0; } -void ViewStyle::ResetElement(int element) { +bool ViewStyle::ResetElement(int element) { + ElementMap::const_iterator search = elementColours.find(element); + const bool changed = (search != elementColours.end()) && (search->second.has_value()); elementColours.erase(element); + return changed; +} + +bool ViewStyle::SetElementColour(int element, ColourAlpha colour) { + ElementMap::const_iterator search = elementColours.find(element); + const bool changed = + (search == elementColours.end()) || + (search->second.has_value() && !(*search->second == colour)); + elementColours[element] = colour; + return changed; } void ViewStyle::SetElementRGB(int element, int rgb) { @@ -583,17 +595,12 @@ bool ViewStyle::ElementIsSet(int element) const { } bool ViewStyle::SetElementBase(int element, ColourAlpha colour) { - bool different = false; ElementMap::const_iterator search = elementBaseColours.find(element); - if (search == elementBaseColours.end()) { - different = true; - } else { - if (search->second.has_value() && !(*search->second == colour)) { - different = true; - } - } + const bool changed = + (search == elementBaseColours.end()) || + (search->second.has_value() && !(*search->second == colour)); elementBaseColours[element] = colour; - return different; + return changed; } bool ViewStyle::SetWrapState(int wrapState_) noexcept { |