aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/ViewStyle.cxx
diff options
context:
space:
mode:
authorNeil <nyamatongwe@gmail.com>2021-05-05 13:32:23 +1000
committerNeil <nyamatongwe@gmail.com>2021-05-05 13:32:23 +1000
commitf35a4835be4888005f19dd8fbd638ff209bb77fc (patch)
tree5e7ee5d9b00ca9707754964dad68eb4b404cee97 /src/ViewStyle.cxx
parent9b8ce7d9a3b7cbfe1a56fdb422f9e91b8f3ece14 (diff)
downloadscintilla-mirror-f35a4835be4888005f19dd8fbd638ff209bb77fc.tar.gz
Hoist selection text colour into SelectionForeground function and whether
there is a selection text colour into ViewStyle::SelectionTextDrawn. Pass EditModel to SelectionBackground so focus can be used in a future change. Simplify code, use const and better names. Prefer explicit iterator type to auto in cases where it makes little difference.
Diffstat (limited to 'src/ViewStyle.cxx')
-rw-r--r--src/ViewStyle.cxx12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/ViewStyle.cxx b/src/ViewStyle.cxx
index 9d9fd6712..58af810b8 100644
--- a/src/ViewStyle.cxx
+++ b/src/ViewStyle.cxx
@@ -487,6 +487,10 @@ bool ViewStyle::SelectionBackgroundDrawn() const noexcept {
((selection.alpha == SC_ALPHA_NOALPHA) || (selection.additionalAlpha == SC_ALPHA_NOALPHA));
}
+bool ViewStyle::SelectionTextDrawn() const {
+ return selection.colours.fore.has_value();
+}
+
bool ViewStyle::WhitespaceBackgroundDrawn() const noexcept {
return (viewWhitespace != WhiteSpace::invisible) && (whitespaceColours.back);
}
@@ -512,8 +516,8 @@ void ViewStyle::AddMultiEdge(uptr_t wParam, sptr_t lParam) {
EdgeProperties(column, lParam));
}
-std::optional<ColourAlpha> ViewStyle::ElementColour(int index) const {
- auto search = elementColours.find(index);
+std::optional<ColourAlpha> ViewStyle::ElementColour(int element) const {
+ ElementMap::const_iterator search = elementColours.find(element);
if (search != elementColours.end()) {
if (search->second.has_value()) {
return search->second;
@@ -522,8 +526,8 @@ std::optional<ColourAlpha> ViewStyle::ElementColour(int index) const {
return {};
}
-bool ViewStyle::ElementAllowsTranslucent(int index) const {
- return elementAllowsTranslucent.count(index) > 0;
+bool ViewStyle::ElementAllowsTranslucent(int element) const {
+ return elementAllowsTranslucent.count(element) > 0;
}
bool ViewStyle::SetWrapState(int wrapState_) noexcept {