aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorGravatar mitchell <none@none>2021-10-24 11:06:45 -0400
committerGravatar mitchell <none@none>2021-10-24 11:06:45 -0400
commit979e8aeb70601486969877edc59d36a8c0e55db1 (patch)
tree6eb62610e8335a3e9e44588b444cafd82d9bb3b0 /src
parent262a61547fdd1146e989fe80adbe85f958eb57ba (diff)
Updated scintilla.patch with bugfix for previous commit.
Diffstat (limited to 'src')
-rw-r--r--src/scintilla.patch158
1 files 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 @@
- <p><b id="SCI_SETCARETSTYLE">SCI_SETCARETSTYLE(int caretStyle)</b><br />
- <b id="SCI_GETCARETSTYLE">SCI_GETCARETSTYLE &rarr; int</b><br />
- The style of the caret can be set with <code>SCI_SETCARETSTYLE</code>.
-- There are separate styles for insert mode (lower 4-bits, <code>CARETSTYLE_INS_MASK</code>) and
-- overtype mode (bit 4).
-+ There are separate styles for insert mode (lower 4-bits, <code>CARETSTYLE_INS_MASK</code>),
-+ overtype mode (bit 4), and curses mode (bit 5).
-
- <table class="standard" summary="Caret Styles">
- <tbody valign="top">
-@@ -3828,6 +3828,13 @@
- <td>Draws an overstrike caret as a block. This should be ored with one of the first three styles.</td>
- </tr>
- <tr>
-+ <th align="left"><code>CARETSTYLE_CURSES</code></th>
-+ <td>32</td>
-+ <td>Draws 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.</td>
-+ </tr>
-+ <tr>
- <th align="left"><code>CARETSTYLE_BLOCK_AFTER</code></th>
- <td>256</td>
- <td>When 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<ColourRGBA> background) const {
-@@ -1746,7 +1762,7 @@
+@@ -1743,7 +1759,8 @@
// Does not take margin into account but not significant
const XYPOSITION xStartVisible = static_cast<XYPOSITION>(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<XYPOSITION>(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<ColourRGBA> 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<CaretStyle>(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<CaretShape>(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 };