From 979e8aeb70601486969877edc59d36a8c0e55db1 Mon Sep 17 00:00:00 2001 From: mitchell Date: Sun, 24 Oct 2021 11:06:45 -0400 Subject: Updated scintilla.patch with bugfix for previous commit. --- src/scintilla.patch | 158 +++++++++++++++++++++++++++++++--------------------- 1 file changed, 96 insertions(+), 62 deletions(-) diff --git a/src/scintilla.patch b/src/scintilla.patch index 86959d1c..fc5979c0 100644 --- a/src/scintilla.patch +++ b/src/scintilla.patch @@ -47,37 +47,9 @@ diff -r beeb51d2c645 gtk/ScintillaGTK.cxx } void ScintillaGTK::RealizeThis(GtkWidget *widget) { -diff -r b800ec7cc345 -r 64286148d3fd doc/ScintillaDoc.html ---- a/doc/ScintillaDoc.html Fri Oct 22 11:26:03 2021 +1100 -+++ b/doc/ScintillaDoc.html Fri Oct 22 15:58:17 2021 +1100 -@@ -3797,8 +3797,8 @@ -

SCI_SETCARETSTYLE(int caretStyle)
- SCI_GETCARETSTYLE → int
- The style of the caret can be set with SCI_SETCARETSTYLE. -- There are separate styles for insert mode (lower 4-bits, CARETSTYLE_INS_MASK) and -- overtype mode (bit 4). -+ There are separate styles for insert mode (lower 4-bits, CARETSTYLE_INS_MASK), -+ overtype mode (bit 4), and curses mode (bit 5). - - - -@@ -3828,6 +3828,13 @@ - - - -+ -+ -+ -+ -+ - - -
Draws an overstrike caret as a block. This should be ored with one of the first three styles.
CARETSTYLE_CURSES32Draws carets that cannot be drawn in a curses (terminal) environment (such as additional carets), -+ and draws them as blocks. The main caret is left to be drawn by the terminal itself. This setting is -+ typically a standalone setting.
CARETSTYLE_BLOCK_AFTER256When the caret end of a range is at the end and a block caret style is chosen, draws the block -diff -r b800ec7cc345 -r 64286148d3fd include/Scintilla.h ---- a/include/Scintilla.h Fri Oct 22 11:26:03 2021 +1100 -+++ b/include/Scintilla.h Fri Oct 22 15:58:17 2021 +1100 +diff -r beeb51d2c645 include/Scintilla.h +--- a/include/Scintilla.h Wed Sep 29 10:29:58 2021 +1000 ++++ b/include/Scintilla.h Sun Oct 24 11:02:34 2021 -0400 @@ -907,6 +907,7 @@ #define CARETSTYLE_BLOCK 2 #define CARETSTYLE_OVERSTRIKE_BAR 0 @@ -86,9 +58,9 @@ diff -r b800ec7cc345 -r 64286148d3fd include/Scintilla.h #define CARETSTYLE_INS_MASK 0xF #define CARETSTYLE_BLOCK_AFTER 0x100 #define SCI_SETCARETSTYLE 2512 -diff -r b800ec7cc345 -r 64286148d3fd include/Scintilla.iface ---- a/include/Scintilla.iface Fri Oct 22 11:26:03 2021 +1100 -+++ b/include/Scintilla.iface Fri Oct 22 15:58:17 2021 +1100 +diff -r beeb51d2c645 include/Scintilla.iface +--- a/include/Scintilla.iface Wed Sep 29 10:29:58 2021 +1000 ++++ b/include/Scintilla.iface Sun Oct 24 11:02:34 2021 -0400 @@ -2489,6 +2489,7 @@ val CARETSTYLE_BLOCK=2 val CARETSTYLE_OVERSTRIKE_BAR=0 @@ -97,9 +69,9 @@ diff -r b800ec7cc345 -r 64286148d3fd include/Scintilla.iface val CARETSTYLE_INS_MASK=0xF val CARETSTYLE_BLOCK_AFTER=0x100 -diff -r b800ec7cc345 -r 64286148d3fd include/ScintillaTypes.h ---- a/include/ScintillaTypes.h Fri Oct 22 11:26:03 2021 +1100 -+++ b/include/ScintillaTypes.h Fri Oct 22 15:58:17 2021 +1100 +diff -r beeb51d2c645 include/ScintillaTypes.h +--- a/include/ScintillaTypes.h Wed Sep 29 10:29:58 2021 +1000 ++++ b/include/ScintillaTypes.h Sun Oct 24 11:02:34 2021 -0400 @@ -439,6 +439,7 @@ Block = 2, OverstrikeBar = 0, @@ -108,10 +80,19 @@ diff -r b800ec7cc345 -r 64286148d3fd include/ScintillaTypes.h InsMask = 0xF, BlockAfter = 0x100, }; -diff -r b800ec7cc345 -r 64286148d3fd src/EditView.cxx ---- a/src/EditView.cxx Fri Oct 22 11:26:03 2021 +1100 -+++ b/src/EditView.cxx Fri Oct 22 15:58:17 2021 +1100 -@@ -1639,7 +1639,7 @@ +diff -r beeb51d2c645 src/EditView.cxx +--- a/src/EditView.cxx Wed Sep 29 10:29:58 2021 +1000 ++++ b/src/EditView.cxx Sun Oct 24 11:02:34 2021 -0400 +@@ -470,7 +470,7 @@ + ll->positions[0] = 0; + bool lastSegItalics = false; + +- BreakFinder bfLayout(ll, nullptr, Range(0, numCharsInLine), posLineStart, 0, false, model.pdoc, &model.reprs, nullptr); ++ BreakFinder bfLayout(ll, nullptr, Range(0, numCharsInLine), posLineStart, 0, BreakFinder::BreakFor::Text, model.pdoc, &model.reprs, nullptr); + while (bfLayout.More()) { + + const TextSegment ts = bfLayout.Next(); +@@ -1636,7 +1636,7 @@ } const bool caretBlinkState = (model.caret.active && model.caret.on) || (!additionalCaretsBlink && !mainCaret); const bool caretVisibleState = additionalCaretsVisible || mainCaret; @@ -120,7 +101,7 @@ diff -r b800ec7cc345 -r 64286148d3fd src/EditView.cxx (drawDrag || (caretBlinkState && caretVisibleState))) { bool canDrawBlockCaret = true; bool drawBlockCaret = false; -@@ -1663,7 +1663,8 @@ +@@ -1660,7 +1660,8 @@ if (xposCaret > 0) caretWidthOffset = 0.51f; // Move back so overlaps both character cells. xposCaret += xStart; @@ -130,7 +111,7 @@ diff -r b800ec7cc345 -r 64286148d3fd src/EditView.cxx if (drawDrag) { /* Dragging text, use a line caret */ rcCaret.left = std::round(xposCaret - caretWidthOffset); -@@ -1736,6 +1737,21 @@ +@@ -1733,6 +1734,21 @@ } } @@ -152,16 +133,17 @@ diff -r b800ec7cc345 -r 64286148d3fd src/EditView.cxx void EditView::DrawBackground(Surface *surface, const EditModel &model, const ViewStyle &vsDraw, const LineLayout *ll, PRectangle rcLine, Range lineRange, Sci::Position posLineStart, int xStart, int subLine, std::optional background) const { -@@ -1746,7 +1762,7 @@ +@@ -1743,7 +1759,8 @@ // Does not take margin into account but not significant const XYPOSITION xStartVisible = static_cast(subLineStart-xStart); - BreakFinder bfBack(ll, &model.sel, lineRange, posLineStart, xStartVisible, selBackDrawn, model.pdoc, &model.reprs, nullptr); -+ BreakFinder bfBack(ll, &model.sel, lineRange, posLineStart, xStartVisible, selBackDrawn, model.pdoc, &model.reprs, &vsDraw); ++ const BreakFinder::BreakFor breakFor = selBackDrawn ? BreakFinder::BreakFor::Selection : BreakFinder::BreakFor::Text; ++ BreakFinder bfBack(ll, &model.sel, lineRange, posLineStart, xStartVisible, breakFor, model.pdoc, &model.reprs, &vsDraw); const bool drawWhitespaceBackground = vsDraw.WhitespaceBackgroundDrawn() && !background; -@@ -1769,7 +1785,9 @@ +@@ -1766,7 +1783,9 @@ if (rcSegment.right > rcLine.right) rcSegment.right = rcLine.right; @@ -172,7 +154,19 @@ diff -r b800ec7cc345 -r 64286148d3fd src/EditView.cxx const bool inHotspot = model.hotspot.Valid() && model.hotspot.ContainsCharacter(iDoc); ColourRGBA textBack = TextBackground(model, vsDraw, ll, background, inSelection, inHotspot, ll->styles[i], i); -@@ -2013,7 +2031,9 @@ +@@ -1959,8 +1978,9 @@ + const XYPOSITION xStartVisible = static_cast(subLineStart-xStart); + + // Foreground drawing loop +- BreakFinder bfFore(ll, &model.sel, lineRange, posLineStart, xStartVisible, +- (((phasesDraw == PhasesDraw::One) && selBackDrawn) || vsDraw.SelectionTextDrawn()), model.pdoc, &model.reprs, &vsDraw); ++ const BreakFinder::BreakFor breakFor = (((phasesDraw == PhasesDraw::One) && selBackDrawn) || vsDraw.SelectionTextDrawn()) ++ ? BreakFinder::BreakFor::ForegroundAndSelection : BreakFinder::BreakFor::Foreground; ++ BreakFinder bfFore(ll, &model.sel, lineRange, posLineStart, xStartVisible, breakFor, model.pdoc, &model.reprs, &vsDraw); + + while (bfFore.More()) { + +@@ -2010,7 +2030,9 @@ } } } @@ -183,9 +177,9 @@ diff -r b800ec7cc345 -r 64286148d3fd src/EditView.cxx const std::optional selectionFore = SelectionForeground(model, vsDraw, inSelection); if (selectionFore) { textFore = *selectionFore; -diff -r b800ec7cc345 -r 64286148d3fd src/Editor.cxx ---- a/src/Editor.cxx Fri Oct 22 11:26:03 2021 +1100 -+++ b/src/Editor.cxx Fri Oct 22 15:58:17 2021 +1100 +diff -r beeb51d2c645 src/Editor.cxx +--- a/src/Editor.cxx Wed Sep 29 10:29:58 2021 +1000 ++++ b/src/Editor.cxx Sun Oct 24 11:02:34 2021 -0400 @@ -7592,7 +7592,7 @@ return vs.ElementColour(Element::Caret)->OpaqueRGB(); @@ -195,17 +189,35 @@ diff -r b800ec7cc345 -r 64286148d3fd src/Editor.cxx vs.caret.style = static_cast(wParam); else /* Default to the line caret */ -diff -r b800ec7cc345 -r 64286148d3fd src/PositionCache.cxx ---- a/src/PositionCache.cxx Fri Oct 22 11:26:03 2021 +1100 -+++ b/src/PositionCache.cxx Fri Oct 22 15:58:17 2021 +1100 -@@ -696,6 +696,21 @@ +diff -r beeb51d2c645 src/PositionCache.cxx +--- a/src/PositionCache.cxx Wed Sep 29 10:29:58 2021 +1000 ++++ b/src/PositionCache.cxx Sun Oct 24 11:02:34 2021 -0400 +@@ -662,7 +662,7 @@ + } + + BreakFinder::BreakFinder(const LineLayout *ll_, const Selection *psel, Range lineRange_, Sci::Position posLineStart_, +- XYPOSITION xStart, bool breakForSelection, const Document *pdoc_, const SpecialRepresentations *preprs_, const ViewStyle *pvsDraw) : ++ XYPOSITION xStart, BreakFor breakFor, const Document *pdoc_, const SpecialRepresentations *preprs_, const ViewStyle *pvsDraw) : + ll(ll_), + lineRange(lineRange_), + posLineStart(posLineStart_), +@@ -683,7 +683,7 @@ + nextBreak--; + } + +- if (breakForSelection) { ++ if (FlagSet(breakFor, BreakFor::Selection)) { + const SelectionPosition posStart(posLineStart); + const SelectionPosition posEnd(posLineStart + lineRange.end); + const SelectionSegment segmentLine(posStart, posEnd); +@@ -696,8 +696,23 @@ Insert(portion.end.Position() - posLineStart); } } + // On the curses platform, the terminal is drawing its own caret, so add breaks around the + // caret in the main selection in order to help prevent the selection from being drawn in + // the caret's cell. -+ if (pvsDraw && FlagSet(pvsDraw->caret.style, CaretStyle::Curses) && !psel->RangeMain().Empty()) { ++ if (FlagSet(pvsDraw->caret.style, CaretStyle::Curses) && !psel->RangeMain().Empty()) { + const Sci::Position caretPos = psel->RangeMain().caret.Position(); + const Sci::Position anchorPos = psel->RangeMain().anchor.Position(); + if (caretPos < anchorPos) { @@ -218,11 +230,33 @@ diff -r b800ec7cc345 -r 64286148d3fd src/PositionCache.cxx + } + } } - if (pvsDraw && pvsDraw->indicatorsSetFore) { +- if (pvsDraw && pvsDraw->indicatorsSetFore) { ++ if (FlagSet(breakFor, BreakFor::Foreground) && pvsDraw->indicatorsSetFore) { for (const IDecoration *deco : pdoc->decorations->View()) { -diff -r b800ec7cc345 -r 64286148d3fd src/ViewStyle.cxx ---- a/src/ViewStyle.cxx Fri Oct 22 11:26:03 2021 +1100 -+++ b/src/ViewStyle.cxx Fri Oct 22 15:58:17 2021 +1100 + if (pvsDraw->indicators[deco->Indicator()].OverridesTextFore()) { + Sci::Position startPos = deco->EndRun(posLineStart); +diff -r beeb51d2c645 src/PositionCache.h +--- a/src/PositionCache.h Wed Sep 29 10:29:58 2021 +1000 ++++ b/src/PositionCache.h Sun Oct 24 11:02:34 2021 -0400 +@@ -259,8 +259,14 @@ + enum { lengthStartSubdivision = 300 }; + // Try to make each subdivided run lengthEachSubdivision or shorter. + enum { lengthEachSubdivision = 100 }; ++ enum class BreakFor { ++ Text = 0, ++ Selection = 1, ++ Foreground = 2, ++ ForegroundAndSelection = 3, ++ }; + BreakFinder(const LineLayout *ll_, const Selection *psel, Range lineRange_, Sci::Position posLineStart_, +- XYPOSITION xStart, bool breakForSelection, const Document *pdoc_, const SpecialRepresentations *preprs_, const ViewStyle *pvsDraw); ++ XYPOSITION xStart, BreakFor breakFor, const Document *pdoc_, const SpecialRepresentations *preprs_, const ViewStyle *pvsDraw); + // Deleted so BreakFinder objects can not be copied. + BreakFinder(const BreakFinder &) = delete; + BreakFinder(BreakFinder &&) = delete; +diff -r beeb51d2c645 src/ViewStyle.cxx +--- a/src/ViewStyle.cxx Wed Sep 29 10:29:58 2021 +1000 ++++ b/src/ViewStyle.cxx Sun Oct 24 11:02:34 2021 -0400 @@ -661,11 +661,14 @@ bool ViewStyle::IsBlockCaretStyle() const noexcept { @@ -263,9 +297,9 @@ diff -r b800ec7cc345 -r 64286148d3fd src/ViewStyle.cxx const CaretStyle caretStyle = caret.style & CaretStyle::InsMask; return (caretStyle <= CaretStyle::Block) ? static_cast(caretStyle) : CaretShape::line; } -diff -r b800ec7cc345 -r 64286148d3fd src/ViewStyle.h ---- a/src/ViewStyle.h Fri Oct 22 11:26:03 2021 +1100 -+++ b/src/ViewStyle.h Fri Oct 22 15:58:17 2021 +1100 +diff -r beeb51d2c645 src/ViewStyle.h +--- a/src/ViewStyle.h Wed Sep 29 10:29:58 2021 +1000 ++++ b/src/ViewStyle.h Sun Oct 24 11:02:34 2021 -0400 @@ -235,9 +235,9 @@ enum class CaretShape { invisible, line, block, bar }; -- cgit v1.2.3