From bb387ecf5a9a81723637a153896e4ee0eb16bbc8 Mon Sep 17 00:00:00 2001 From: Neil Hodgson Date: Fri, 15 Mar 2024 17:54:07 +1100 Subject: Bug [#2417]. Add elements for inactive additional selections SC_ELEMENT_SELECTION_INACTIVE_ADDITIONAL_TEXT and SC_ELEMENT_SELECTION_INACTIVE_ADDITIONAL_BACK. --- src/EditView.cxx | 13 ++++++++++--- src/ViewStyle.cxx | 6 +++++- 2 files changed, 15 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/EditView.cxx b/src/EditView.cxx index b3e024fe1..5c88080a1 100644 --- a/src/EditView.cxx +++ b/src/EditView.cxx @@ -844,8 +844,13 @@ ColourRGBA SelectionBackground(const EditModel &model, const ViewStyle &vsDraw, element = Element::SelectionAdditionalBack; if (!model.primarySelection) element = Element::SelectionSecondaryBack; - if (!model.hasFocus && vsDraw.ElementColour(Element::SelectionInactiveBack)) - element = Element::SelectionInactiveBack; + if (!model.hasFocus) { + if ((inSelection == InSelection::inAdditional) && vsDraw.ElementColour(Element::SelectionInactiveAdditionalBack)) { + element = Element::SelectionInactiveAdditionalBack; + } else if (vsDraw.ElementColour(Element::SelectionInactiveBack)) { + element = Element::SelectionInactiveBack; + } + } return vsDraw.ElementColour(element).value_or(colourBug); } @@ -858,7 +863,9 @@ ColourOptional SelectionForeground(const EditModel &model, const ViewStyle &vsDr if (!model.primarySelection) // Secondary selection element = Element::SelectionSecondaryText; if (!model.hasFocus) { - if (vsDraw.ElementColour(Element::SelectionInactiveText)) { + if ((inSelection == InSelection::inAdditional) && vsDraw.ElementColour(Element::SelectionInactiveAdditionalText)) { + element = Element::SelectionInactiveAdditionalText; + } else if (vsDraw.ElementColour(Element::SelectionInactiveText)) { element = Element::SelectionInactiveText; } else { return {}; diff --git a/src/ViewStyle.cxx b/src/ViewStyle.cxx index afca0e0e7..a06882879 100644 --- a/src/ViewStyle.cxx +++ b/src/ViewStyle.cxx @@ -177,6 +177,7 @@ ViewStyle::ViewStyle(size_t stylesSize_) : elementColours.erase(Element::SelectionAdditionalText); elementColours.erase(Element::SelectionSecondaryText); elementColours.erase(Element::SelectionInactiveText); + elementColours.erase(Element::SelectionInactiveAdditionalText); // Shades of grey for selection backgrounds elementBaseColours[Element::SelectionBack] = ColourRGBA::Grey(light); constexpr unsigned int veryLight = 0xd7U; @@ -193,6 +194,8 @@ ViewStyle::ViewStyle(size_t stylesSize_) : Element::SelectionSecondaryBack, Element::SelectionInactiveText, Element::SelectionInactiveBack, + Element::SelectionInactiveAdditionalText, + Element::SelectionInactiveAdditionalBack, }); foldmarginColour.reset(); @@ -590,7 +593,8 @@ bool ViewStyle::SelectionTextDrawn() const { ElementIsSet(Element::SelectionText) || ElementIsSet(Element::SelectionAdditionalText) || ElementIsSet(Element::SelectionSecondaryText) || - ElementIsSet(Element::SelectionInactiveText); + ElementIsSet(Element::SelectionInactiveText) || + ElementIsSet(Element::SelectionInactiveAdditionalText); } bool ViewStyle::WhitespaceBackgroundDrawn() const { -- cgit v1.2.3