From e8f134e9a1567775377c66c8bd34825380c328a6 Mon Sep 17 00:00:00 2001 From: Neil Date: Thu, 29 Jul 2021 13:12:16 +1000 Subject: Add SC_ELEMENT_HIDDEN_LINE to show where lines are hidden. --- doc/ScintillaDoc.html | 13 +++++++++++++ doc/ScintillaHistory.html | 1 + include/Scintilla.h | 1 + include/Scintilla.iface | 1 + include/ScintillaTypes.h | 1 + src/EditView.cxx | 11 +++++++++++ 6 files changed, 28 insertions(+) diff --git a/doc/ScintillaDoc.html b/doc/ScintillaDoc.html index 511632937..b38cfb83c 100644 --- a/doc/ScintillaDoc.html +++ b/doc/ScintillaDoc.html @@ -3504,6 +3504,14 @@ struct Sci_TextToFind { Colour of fold lines + + SC_ELEMENT_HIDDEN_LINE + 81 + Translucent + All + + Colour of line drawn to show there are lines hidden at that point + @@ -7008,6 +7016,7 @@ sptr_t CallScintilla(unsigned int iMessage, uptr_t wParam, sptr_t lParam){ SCI_DOCLINEFROMVISIBLE(line displayLine) → line
SCI_SHOWLINES(line lineStart, line lineEnd)
SCI_HIDELINES(line lineStart, line lineEnd)
+ SC_ELEMENT_HIDDEN_LINE : colouralpha
SCI_GETLINEVISIBLE(line line) → bool
SCI_GETALLLINESVISIBLE → bool
SCI_SETFOLDLEVEL(line line, int level)
@@ -7059,10 +7068,14 @@ sptr_t CallScintilla(unsigned int iMessage, uptr_t wParam, sptr_t lParam){

SCI_SHOWLINES(line lineStart, line lineEnd)
SCI_HIDELINES(line lineStart, line lineEnd)
+ SC_ELEMENT_HIDDEN_LINE : colouralpha
SCI_GETLINEVISIBLE(line line) → bool
SCI_GETALLLINESVISIBLE → bool
The first two messages mark a range of lines as visible or invisible and then redraw the display. + If SC_ELEMENT_HIDDEN_LINE + is set then a horizontal line is drawn in that colour to indicate that there are hidden lines. + A fold line drawn in that position overrides the hidden line indicator. SCI_GETLINEVISIBLE reports on the visible state of a line and returns 1 if it is visible and 0 if it is not visible. SCI_GETALLLINESVISIBLE returns 1 if all lines are visible and 0 diff --git a/doc/ScintillaHistory.html b/doc/ScintillaHistory.html index f0c6ded0b..21f44f476 100644 --- a/doc/ScintillaHistory.html +++ b/doc/ScintillaHistory.html @@ -576,6 +576,7 @@

  • Add SC_ELEMENT_FOLD_LINE to set the colour of fold lines. + Add SC_ELEMENT_HIDDEN_LINE to show where lines are hidden.
  • Fix display of fold lines when wrapped so they are only drawn once per line, not on each subline. diff --git a/include/Scintilla.h b/include/Scintilla.h index 3af22dfc5..3a6e301b3 100644 --- a/include/Scintilla.h +++ b/include/Scintilla.h @@ -292,6 +292,7 @@ typedef sptr_t (*SciFnDirectStatus)(sptr_t ptr, unsigned int iMessage, uptr_t wP #define SC_ELEMENT_HOT_SPOT_ACTIVE 70 #define SC_ELEMENT_HOT_SPOT_ACTIVE_BACK 71 #define SC_ELEMENT_FOLD_LINE 80 +#define SC_ELEMENT_HIDDEN_LINE 81 #define SCI_SETELEMENTCOLOUR 2753 #define SCI_GETELEMENTCOLOUR 2754 #define SCI_RESETELEMENTCOLOUR 2755 diff --git a/include/Scintilla.iface b/include/Scintilla.iface index d8a1bdec1..837e4d841 100644 --- a/include/Scintilla.iface +++ b/include/Scintilla.iface @@ -698,6 +698,7 @@ val SC_ELEMENT_WHITE_SPACE_BACK=61 val SC_ELEMENT_HOT_SPOT_ACTIVE=70 val SC_ELEMENT_HOT_SPOT_ACTIVE_BACK=71 val SC_ELEMENT_FOLD_LINE=80 +val SC_ELEMENT_HIDDEN_LINE=81 # Set the colour of an element. Translucency (alpha) may or may not be significant # and this may depend on the platform. The alpha byte should commonly be 0xff for opaque. diff --git a/include/ScintillaTypes.h b/include/ScintillaTypes.h index ab4a55131..910cd5ec8 100644 --- a/include/ScintillaTypes.h +++ b/include/ScintillaTypes.h @@ -181,6 +181,7 @@ enum class Element { HotSpotActive = 70, HotSpotActiveBack = 71, FoldLine = 80, + HiddenLine = 81, }; enum class Layer { diff --git a/src/EditView.cxx b/src/EditView.cxx index 7eea729fd..e32e791ec 100644 --- a/src/EditView.cxx +++ b/src/EditView.cxx @@ -2304,6 +2304,17 @@ static void DrawFoldLines(Surface *surface, const EditModel &model, const ViewSt || (!expanded && (FlagSet(model.foldFlags, FoldFlag::LineAfterContracted))))) { surface->FillRectangleAligned(Side(rcLine, Edge::bottom, 1.0), foldLineColour); + // If contracted fold line drawn then don't overwrite with hidden line + // as fold lines are more specific then hidden lines. + if (!expanded) { + return; + } + } + } + if (lastSubLine && model.pcs->GetVisible(line) && !model.pcs->GetVisible(line + 1)) { + std::optional hiddenLineColour = vsDraw.ElementColour(Element::HiddenLine); + if (hiddenLineColour) { + surface->FillRectangleAligned(Side(rcLine, Edge::bottom, 1.0), *hiddenLineColour); } } } -- cgit v1.2.3