summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorXhmikosR <xhmikosr@gmail.com>2014-06-30 10:58:02 +0300
committerXhmikosR <xhmikosr@gmail.com>2014-07-03 12:38:18 +0300
commit666822715a5f1f919d039ea4aed50effbf8fb984 (patch)
treed8e03b027a0c929d73dc63fd1f1c1764e600c003
parent80a1ee6430295f30fe78271398e78d13cd9a9d93 (diff)
downloadnotepad2-mod-666822715a5f1f919d039ea4aed50effbf8fb984.zip
notepad2-mod-666822715a5f1f919d039ea4aed50effbf8fb984.tar.gz
notepad2-mod-666822715a5f1f919d039ea4aed50effbf8fb984.tar.bz2
Update Scintilla to 3.4.4.
-rw-r--r--scintilla/doc/ScintillaDownload.html10
-rw-r--r--scintilla/doc/ScintillaHistory.html65
-rw-r--r--scintilla/doc/index.html7
-rw-r--r--scintilla/include/Scintilla.h4
-rw-r--r--scintilla/lexers/LexBash.cxx11
-rw-r--r--scintilla/lexers/LexCPP.cxx4
-rw-r--r--scintilla/lexers/LexTCL.cxx2
-rw-r--r--scintilla/lexlib/CharacterCategory.cxx2
-rw-r--r--scintilla/src/Document.h4
-rw-r--r--scintilla/src/Editor.cxx265
-rw-r--r--scintilla/src/Editor.h30
-rw-r--r--scintilla/src/Indicator.cxx2
-rw-r--r--scintilla/src/Indicator.h2
-rw-r--r--scintilla/src/LineMarker.cxx2
-rw-r--r--scintilla/src/LineMarker.h2
-rw-r--r--scintilla/src/PositionCache.cxx34
-rw-r--r--scintilla/src/PositionCache.h26
-rw-r--r--scintilla/src/Selection.cxx8
-rw-r--r--scintilla/src/Selection.h2
-rw-r--r--scintilla/src/Style.cxx4
-rw-r--r--scintilla/src/Style.h4
-rw-r--r--scintilla/src/ViewStyle.cxx37
-rw-r--r--scintilla/src/ViewStyle.h1
-rw-r--r--scintilla/version.txt2
-rw-r--r--scintilla/win32/ScintillaWin.cxx50
25 files changed, 336 insertions, 244 deletions
diff --git a/scintilla/doc/ScintillaDownload.html b/scintilla/doc/ScintillaDownload.html
index e8d382f..e1407c2 100644
--- a/scintilla/doc/ScintillaDownload.html
+++ b/scintilla/doc/ScintillaDownload.html
@@ -25,9 +25,9 @@
<table bgcolor="#CCCCCC" width="100%" cellspacing="0" cellpadding="8" border="0">
<tr>
<td>
- <font size="4"> <a href="http://prdownloads.sourceforge.net/scintilla/scintilla343.zip?download">
+ <font size="4"> <a href="http://prdownloads.sourceforge.net/scintilla/scintilla344.zip?download">
Windows</a>&nbsp;&nbsp;
- <a href="http://prdownloads.sourceforge.net/scintilla/scintilla343.tgz?download">
+ <a href="http://prdownloads.sourceforge.net/scintilla/scintilla344.tgz?download">
GTK+/Linux</a>&nbsp;&nbsp;
</font>
</td>
@@ -41,7 +41,7 @@
containing very few restrictions.
</p>
<h3>
- Release 3.4.3
+ Release 3.4.4
</h3>
<h4>
Source Code
@@ -49,8 +49,8 @@
The source code package contains all of the source code for Scintilla but no binary
executable code and is available in
<ul>
- <li><a href="http://prdownloads.sourceforge.net/scintilla/scintilla343.zip?download">zip format</a> (1450K) commonly used on Windows</li>
- <li><a href="http://prdownloads.sourceforge.net/scintilla/scintilla343.tgz?download">tgz format</a> (1300K) commonly used on Linux and compatible operating systems</li>
+ <li><a href="http://prdownloads.sourceforge.net/scintilla/scintilla344.zip?download">zip format</a> (1450K) commonly used on Windows</li>
+ <li><a href="http://prdownloads.sourceforge.net/scintilla/scintilla344.tgz?download">tgz format</a> (1300K) commonly used on Linux and compatible operating systems</li>
</ul>
Instructions for building on both Windows and Linux are included in the readme file.
<h4>
diff --git a/scintilla/doc/ScintillaHistory.html b/scintilla/doc/ScintillaHistory.html
index bae44c1..ddd2c26 100644
--- a/scintilla/doc/ScintillaHistory.html
+++ b/scintilla/doc/ScintillaHistory.html
@@ -464,15 +464,78 @@
</h3>
<ul>
<li>
- Released 27 May 2014.
+ Released 3 July 2014.
+ </li>
+ <li>
+ Style byte indicators removed. They were deprecated in 2007. Standard indicators should be used instead.
</li>
<li>
When multiple selections are active, autocompletion text may be inserted at each selection with new
SCI_AUTOCSETMULTI method.
</li>
<li>
+ C++ lexer fixes crash for "#define x(".
+ <a href="http://sourceforge.net/p/scintilla/bugs/1614/">Bug #1614</a>.
+ </li>
+ <li>
C++ lexer fixes raw string recognition so that R"xxx(blah)xxx" is styled as SCE_C_STRINGRAW.
</li>
+ <li>
+ The Postscript lexer no longer marks token edges with indicators as this used style byte indicators.
+ </li>
+ <li>
+ The Scriptol lexer no longer displays indicators for poor indentation as this used style byte indicators.
+ </li>
+ <li>
+ TCL lexer fixes names of keyword sets.
+ <a href="http://sourceforge.net/p/scintilla/bugs/1615/">Bug #1615</a>.
+ </li>
+ <li>
+ Shell lexer fixes fold matching problem caused by "&lt;&lt;&lt;".
+ <a href="http://sourceforge.net/p/scintilla/bugs/1605/">Bug #1605</a>.
+ </li>
+ <li>
+ Fix bug where indicators were not removed when fold highlighting on.
+ <a href="http://sourceforge.net/p/scintilla/bugs/1604/">Bug #1604</a>.
+ </li>
+ <li>
+ Fix bug on Cocoa where emoji were treated as being zero width.
+ </li>
+ <li>
+ Fix crash on GTK+ with Ubuntu 12.04 and overlay scroll bars.
+ </li>
+ <li>
+ Avoid creating a Cairo context when measuring text on GTK+ as future versions of GTK+
+ may prohibit calling gdk_cairo_create except inside drawing handlers. This prohibition may
+ be required on Wayland.
+ </li>
+ <li>
+ On Cocoa, the registerNotifyCallback method is now marked as deprecated so client code that
+ uses it will display an error message.
+ Client code should use the delegate mechanism or subclassing instead.
+ The method will be removed in the next version.
+ </li>
+ <li>
+ On Cocoa, package Scintilla more in compliance with platform conventions.
+ Only publish public headers in the framework headers directory.
+ Only define the Scintilla namespace in Scintilla.h when compiling as C++.
+ Use the Cocoa NS_ENUM and NS_OPTIONS macros for exposed enumerations.
+ Hide internal methods from public headers.
+ These changes are aimed towards publishing Scintilla as a module which will allow it to
+ be used from the Swift programming language, although more changes will be needed here.
+ </li>
+ <li>
+ Fix crash in SciTE when stream comment performed at line end.
+ <a href="http://sourceforge.net/p/scintilla/bugs/1610/">Bug #1610</a>.
+ </li>
+ <li>
+ For SciTE on Windows, display error message when common dialogs fail.
+ <a href="http://sourceforge.net/p/scintilla/bugs/156/">Bug #156</a>.
+ </li>
+ <li>
+ For SciTE on GTK+ fix bug with initialisation of toggle buttons in find and replace strips.
+ <a href="http://sourceforge.net/p/scintilla/bugs/1612/">Bug #1612</a>.
+ </li>
</ul>
<h3>
<a href="http://prdownloads.sourceforge.net/scintilla/scite343.zip?download">Release 3.4.3</a>
diff --git a/scintilla/doc/index.html b/scintilla/doc/index.html
index 06dcb41..01692cb 100644
--- a/scintilla/doc/index.html
+++ b/scintilla/doc/index.html
@@ -9,7 +9,7 @@
<meta name="keywords" content="Scintilla, SciTE, Editing Component, Text Editor" />
<meta name="Description"
content="www.scintilla.org is the home of the Scintilla editing component and SciTE text editor application." />
- <meta name="Date.Modified" content="20140527" />
+ <meta name="Date.Modified" content="20140703" />
<style type="text/css">
#versionlist {
margin: 0;
@@ -55,8 +55,8 @@
GTK+, and OS X</font>
</td>
<td width="40%" align="right">
- <font color="#FFCC99" size="3"> Release version 3.4.3<br />
- Site last modified May 27 2014</font>
+ <font color="#FFCC99" size="3"> Release version 3.4.4<br />
+ Site last modified July 3 2014</font>
</td>
<td width="20%">
&nbsp;
@@ -71,6 +71,7 @@
</tr>
</table>
<ul id="versionlist">
+ <li>Version 3.4.4 removes style byte indicators.</li>
<li>Version 3.4.3 fixes hangs and crashes at shutdown on Windows.</li>
<li>Version 3.4.2 allows the application to filter input from typing, paste, drag &amp; drop and similar.</li>
<li>Version 3.4.1 fixes a regression in 3.4.0 that stopped the caret moving when lines were wrapped.</li>
diff --git a/scintilla/include/Scintilla.h b/scintilla/include/Scintilla.h
index e49d2c3..183168e 100644
--- a/scintilla/include/Scintilla.h
+++ b/scintilla/include/Scintilla.h
@@ -1021,7 +1021,7 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,
* CHARRANGE, TEXTRANGE, FINDTEXTEX, FORMATRANGE, and NMHDR structs.
* So older code that treats Scintilla as a RichEdit will work. */
-#ifdef SCI_NAMESPACE
+#if defined(__cplusplus) && defined(SCI_NAMESPACE)
namespace Scintilla {
#endif
@@ -1113,7 +1113,7 @@ struct SCNotification {
int updated; /* SCN_UPDATEUI */
};
-#ifdef SCI_NAMESPACE
+#if defined(__cplusplus) && defined(SCI_NAMESPACE)
}
#endif
diff --git a/scintilla/lexers/LexBash.cxx b/scintilla/lexers/LexBash.cxx
index cf3c8ad..cfc214a 100644
--- a/scintilla/lexers/LexBash.cxx
+++ b/scintilla/lexers/LexBash.cxx
@@ -767,6 +767,7 @@ static void FoldBashDoc(unsigned int startPos, int length, int, WordList *[],
bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0;
unsigned int endPos = startPos + length;
int visibleChars = 0;
+ int skipHereCh = 0;
int lineCurrent = styler.GetLine(startPos);
int levelPrev = styler.LevelAt(lineCurrent) & SC_FOLDLEVELNUMBERMASK;
int levelCurrent = levelPrev;
@@ -798,7 +799,15 @@ static void FoldBashDoc(unsigned int startPos, int length, int, WordList *[],
// Here Document folding
if (style == SCE_SH_HERE_DELIM) {
if (ch == '<' && chNext == '<') {
- levelCurrent++;
+ if (styler.SafeGetCharAt(i + 2) == '<') {
+ skipHereCh = 1;
+ } else {
+ if (skipHereCh == 0) {
+ levelCurrent++;
+ } else {
+ skipHereCh = 0;
+ }
+ }
}
} else if (style == SCE_SH_HERE_Q && styler.StyleAt(i+1) == SCE_SH_DEFAULT) {
levelCurrent--;
diff --git a/scintilla/lexers/LexCPP.cxx b/scintilla/lexers/LexCPP.cxx
index b7ff185..5485bf2 100644
--- a/scintilla/lexers/LexCPP.cxx
+++ b/scintilla/lexers/LexCPP.cxx
@@ -1220,7 +1220,9 @@ void SCI_METHOD LexerCPP::Lex(unsigned int startPos, int length, int initStyle,
size_t startValue = endArgs+1;
while ((startValue < restOfLine.length()) && IsSpaceOrTab(restOfLine[startValue]))
startValue++;
- std::string value = restOfLine.substr(startValue);
+ std::string value;
+ if (startValue < restOfLine.length())
+ value = restOfLine.substr(startValue);
preprocessorDefinitions[key] = SymbolValue(value, args);
ppDefineHistory.push_back(PPDefinition(lineCurrent, key, value, false, args));
definitionsChanged = true;
diff --git a/scintilla/lexers/LexTCL.cxx b/scintilla/lexers/LexTCL.cxx
index 7658691..d684d3b 100644
--- a/scintilla/lexers/LexTCL.cxx
+++ b/scintilla/lexers/LexTCL.cxx
@@ -358,7 +358,7 @@ static const char * const tclWordListDesc[] = {
"TK Keywords",
"iTCL Keywords",
"tkCommands",
- "expand"
+ "expand",
"user1",
"user2",
"user3",
diff --git a/scintilla/lexlib/CharacterCategory.cxx b/scintilla/lexlib/CharacterCategory.cxx
index 765469a..2be46c0 100644
--- a/scintilla/lexlib/CharacterCategory.cxx
+++ b/scintilla/lexlib/CharacterCategory.cxx
@@ -3287,7 +3287,7 @@ const int nRanges = ELEMENTS(catRanges);
// Initial version has 3249 entries and adds about 13K to the executable.
// The array is in ascending order so can be searched using binary search.
// Therefore the average call takes log2(3249) = 12 comparisons.
-// For speed, it may be an useful to make a linear table for the common values,
+// For speed, it may be useful to make a linear table for the common values,
// possibly for 0..0xff for most Western European text or 0..0xfff for most
// alphabetic languages.
diff --git a/scintilla/src/Document.h b/scintilla/src/Document.h
index 0604474..600b41c 100644
--- a/scintilla/src/Document.h
+++ b/scintilla/src/Document.h
@@ -39,6 +39,10 @@ public:
start(start_), end(end_) {
}
+ bool operator==(const Range &other) const {
+ return (start == other.start) && (end == other.end);
+ }
+
bool Valid() const {
return (start != invalidPosition) && (end != invalidPosition);
}
diff --git a/scintilla/src/Editor.cxx b/scintilla/src/Editor.cxx
index 42628b3..7b521a6 100644
--- a/scintilla/src/Editor.cxx
+++ b/scintilla/src/Editor.cxx
@@ -220,8 +220,7 @@ Editor::Editor() {
convertPastes = true;
- hsStart = -1;
- hsEnd = -1;
+ hotspot = Range(invalidPosition);
llc.SetLevel(LineLayoutCache::llcCaret);
posCache.SetSize(0x400);
@@ -1739,7 +1738,7 @@ int Editor::SubstituteMarkerIfEmpty(int markerCheck, int markerDefault) const {
return markerCheck;
}
-bool ValidStyledText(ViewStyle &vs, size_t styleOffset, const StyledText &st) {
+bool ValidStyledText(const ViewStyle &vs, size_t styleOffset, const StyledText &st) {
if (st.multipleStyles) {
for (size_t iStyle=0; iStyle<st.length; iStyle++) {
if (!vs.ValidStyle(styleOffset + st.styles[iStyle]))
@@ -1752,7 +1751,7 @@ bool ValidStyledText(ViewStyle &vs, size_t styleOffset, const StyledText &st) {
return true;
}
-static int WidthStyledText(Surface *surface, ViewStyle &vs, int styleOffset,
+static int WidthStyledText(Surface *surface, const ViewStyle &vs, int styleOffset,
const char *text, const unsigned char *styles, size_t len) {
int width = 0;
size_t start = 0;
@@ -1761,14 +1760,15 @@ static int WidthStyledText(Surface *surface, ViewStyle &vs, int styleOffset,
size_t endSegment = start;
while ((endSegment+1 < len) && (static_cast<size_t>(styles[endSegment+1]) == style))
endSegment++;
- width += static_cast<int>(surface->WidthText(vs.styles[style + styleOffset].font, text + start,
+ FontAlias fontText = vs.styles[style + styleOffset].font;
+ width += static_cast<int>(surface->WidthText(fontText, text + start,
static_cast<int>(endSegment - start + 1)));
start = endSegment + 1;
}
return width;
}
-static int WidestLineWidth(Surface *surface, ViewStyle &vs, int styleOffset, const StyledText &st) {
+static int WidestLineWidth(Surface *surface, const ViewStyle &vs, int styleOffset, const StyledText &st) {
int widthMax = 0;
size_t start = 0;
while (start < st.length) {
@@ -1777,7 +1777,8 @@ static int WidestLineWidth(Surface *surface, ViewStyle &vs, int styleOffset, con
if (st.multipleStyles) {
widthSubLine = WidthStyledText(surface, vs, styleOffset, st.text + start, st.styles + start, lenLine);
} else {
- widthSubLine = static_cast<int>(surface->WidthText(vs.styles[styleOffset + st.style].font,
+ FontAlias fontText = vs.styles[styleOffset + st.style].font;
+ widthSubLine = static_cast<int>(surface->WidthText(fontText,
st.text + start, static_cast<int>(lenLine)));
}
if (widthSubLine > widthMax)
@@ -1787,7 +1788,13 @@ static int WidestLineWidth(Surface *surface, ViewStyle &vs, int styleOffset, con
return widthMax;
}
-void DrawStyledText(Surface *surface, ViewStyle &vs, int styleOffset, PRectangle rcText, int ascent,
+static void DrawTextInStyle(Surface *surface, PRectangle rcText, const Style &style, XYPOSITION ybase, const char *s, size_t length) {
+ FontAlias fontText = style.font;
+ surface->DrawTextNoClip(rcText, fontText, ybase, s, static_cast<int>(length),
+ style.fore, style.back);
+}
+
+static void DrawStyledText(Surface *surface, const ViewStyle &vs, int styleOffset, PRectangle rcText,
const StyledText &st, size_t start, size_t length) {
if (st.multipleStyles) {
@@ -1795,30 +1802,25 @@ void DrawStyledText(Surface *surface, ViewStyle &vs, int styleOffset, PRectangle
size_t i = 0;
while (i < length) {
size_t end = i;
- int style = st.styles[i + start];
+ size_t style = st.styles[i + start];
while (end < length-1 && st.styles[start+end+1] == style)
end++;
style += styleOffset;
- int width = static_cast<int>(surface->WidthText(vs.styles[style].font,
+ FontAlias fontText = vs.styles[style].font;
+ const int width = static_cast<int>(surface->WidthText(fontText,
st.text + start + i, static_cast<int>(end - i + 1)));
PRectangle rcSegment = rcText;
rcSegment.left = static_cast<XYPOSITION>(x);
rcSegment.right = static_cast<XYPOSITION>(x + width + 1);
- surface->DrawTextNoClip(rcSegment, vs.styles[style].font,
- static_cast<XYPOSITION>(ascent), st.text + start + i,
- static_cast<int>(end - i + 1),
- vs.styles[style].fore,
- vs.styles[style].back);
+ DrawTextInStyle(surface, rcSegment, vs.styles[style], rcText.top + vs.maxAscent,
+ st.text + start + i, end - i + 1);
x += width;
i = end + 1;
}
} else {
- size_t style = st.style + styleOffset;
- surface->DrawTextNoClip(rcText, vs.styles[style].font,
- rcText.top + vs.maxAscent, st.text + start,
- static_cast<int>(length),
- vs.styles[style].fore,
- vs.styles[style].back);
+ const size_t style = st.style + styleOffset;
+ DrawTextInStyle(surface, rcText, vs.styles[style], rcText.top + vs.maxAscent,
+ st.text + start, length);
}
}
@@ -1830,6 +1832,13 @@ void Editor::PaintSelMargin(Surface *surfWindow, PRectangle &rc) {
RefreshStyleData();
RefreshPixMaps(surfWindow);
+ // On GTK+ with Ubuntu overlay scroll bars, the surface may have been finished
+ // at this point. The Initialised call checks for this case and sets the status
+ // to be bad which avoids crashes in following calls.
+ if (!surfWindow->Initialised()) {
+ return;
+ }
+
PRectangle rcMargin = GetClientRectangle();
Point ptOrigin = GetVisibleOriginInMain();
rcMargin.Move(0, -ptOrigin.y);
@@ -2055,10 +2064,8 @@ void Editor::PaintSelMargin(Surface *surfWindow, PRectangle &rc) {
XYPOSITION width = surface->WidthText(vs.styles[STYLE_LINENUMBER].font, number, istrlen(number));
XYPOSITION xpos = rcNumber.right - width - vs.marginNumberPadding;
rcNumber.left = xpos;
- surface->DrawTextNoClip(rcNumber, vs.styles[STYLE_LINENUMBER].font,
- rcNumber.top + vs.maxAscent, number, istrlen(number),
- vs.styles[STYLE_LINENUMBER].fore,
- vs.styles[STYLE_LINENUMBER].back);
+ DrawTextInStyle(surface, rcNumber, vs.styles[STYLE_LINENUMBER],
+ rcNumber.top + vs.maxAscent, number, strlen(number));
} else if (vs.wrapVisualFlags & SC_WRAPVISUALFLAG_MARGIN) {
PRectangle rcWrapMarker = rcMarker;
rcWrapMarker.right -= 3;
@@ -2075,7 +2082,7 @@ void Editor::PaintSelMargin(Surface *surfWindow, PRectangle &rc) {
int width = WidestLineWidth(surface, vs, vs.marginStyleOffset, stMargin);
rcMarker.left = rcMarker.right - width - 3;
}
- DrawStyledText(surface, vs, vs.marginStyleOffset, rcMarker, static_cast<int>(rcMarker.top) + vs.maxAscent,
+ DrawStyledText(surface, vs, vs.marginStyleOffset, rcMarker,
stMargin, 0, stMargin.length);
}
}
@@ -2155,8 +2162,7 @@ LineLayout *Editor::RetrieveLineLayout(int lineNumber) {
* Copy the given @a line and its styles from the document into local arrays.
* Also determine the x position at which each character starts.
*/
-void Editor::LayoutLine(int line, Surface *surface, ViewStyle &vstyle, LineLayout *ll, int width) {
-//void LayoutLine(int line, Surface *surface, ViewStyle &vstyle, LineLayout *ll, int width, Document *pdoc, PositionCache &posCache, SpecialRepresentations &reprs) {
+void Editor::LayoutLine(int line, Surface *surface, const ViewStyle &vstyle, LineLayout *ll, int width) {
if (!ll)
return;
@@ -2248,7 +2254,7 @@ void Editor::LayoutLine(int line, Surface *surface, ViewStyle &vstyle, LineLayou
ll->positions[0] = 0;
bool lastSegItalics = false;
- BreakFinder bfLayout(ll, 0, numCharsInLine, posLineStart, 0, false, pdoc, &reprs);
+ BreakFinder bfLayout(ll, NULL, 0, numCharsInLine, posLineStart, 0, false, pdoc, &reprs);
while (bfLayout.More()) {
const TextSegment ts = bfLayout.Next();
@@ -2380,14 +2386,14 @@ void Editor::LayoutLine(int line, Surface *surface, ViewStyle &vstyle, LineLayou
}
}
-ColourDesired Editor::SelectionBackground(ViewStyle &vsDraw, bool main) const {
+ColourDesired Editor::SelectionBackground(const ViewStyle &vsDraw, bool main) const {
return main ?
(primarySelection ? vsDraw.selColours.back : vsDraw.selBackground2) :
vsDraw.selAdditionalBackground;
}
-ColourDesired Editor::TextBackground(ViewStyle &vsDraw, bool overrideBackground,
- ColourDesired background, int inSelection, bool inHotspot, int styleMain, int i, LineLayout *ll) const {
+ColourDesired Editor::TextBackground(const ViewStyle &vsDraw,
+ ColourOptional background, int inSelection, bool inHotspot, int styleMain, int i, LineLayout *ll) const {
if (inSelection == 1) {
if (vsDraw.selColours.back.isSet && (vsDraw.selAlpha == SC_ALPHA_NOALPHA)) {
return SelectionBackground(vsDraw, true);
@@ -2404,7 +2410,7 @@ ColourDesired Editor::TextBackground(ViewStyle &vsDraw, bool overrideBackground,
if (inHotspot && vsDraw.hotspotColours.back.isSet)
return vsDraw.hotspotColours.back;
}
- if (overrideBackground && (styleMain != STYLE_BRACELIGHT) && (styleMain != STYLE_BRACEBAD)) {
+ if (background.isSet && (styleMain != STYLE_BRACELIGHT) && (styleMain != STYLE_BRACEBAD)) {
return background;
} else {
return vsDraw.styles[styleMain].back;
@@ -2468,12 +2474,12 @@ static void SimpleAlphaRectangle(Surface *surface, PRectangle rc, ColourDesired
}
}
-void DrawTextBlob(Surface *surface, ViewStyle &vsDraw, PRectangle rcSegment,
+void DrawTextBlob(Surface *surface, const ViewStyle &vsDraw, PRectangle rcSegment,
const char *s, ColourDesired textBack, ColourDesired textFore, bool twoPhaseDraw) {
if (!twoPhaseDraw) {
surface->FillRectangle(rcSegment, textBack);
}
- Font &ctrlCharsFont = vsDraw.styles[STYLE_CONTROLCHAR].font;
+ FontAlias ctrlCharsFont = vsDraw.styles[STYLE_CONTROLCHAR].font;
int normalCharHeight = static_cast<int>(surface->Ascent(ctrlCharsFont) -
surface->InternalLeading(ctrlCharsFont));
PRectangle rcCChar = rcSegment;
@@ -2492,10 +2498,9 @@ void DrawTextBlob(Surface *surface, ViewStyle &vsDraw, PRectangle rcSegment,
textBack, textFore);
}
-void Editor::DrawEOL(Surface *surface, ViewStyle &vsDraw, PRectangle rcLine, LineLayout *ll,
+void Editor::DrawEOL(Surface *surface, const ViewStyle &vsDraw, PRectangle rcLine, LineLayout *ll,
int line, int lineEnd, int xStart, int subLine, XYACCUMULATOR subLineStart,
- bool overrideBackground, ColourDesired background,
- bool drawWrapMarkEnd, ColourDesired wrapColour) {
+ ColourOptional background) {
const int posLineStart = pdoc->LineStart(line);
PRectangle rcSegment = rcLine;
@@ -2512,7 +2517,7 @@ void Editor::DrawEOL(Surface *surface, ViewStyle &vsDraw, PRectangle rcLine, Lin
if (virtualSpace) {
rcSegment.left = xEol + xStart;
rcSegment.right = xEol + xStart + virtualSpace;
- surface->FillRectangle(rcSegment, overrideBackground ? background : vsDraw.styles[ll->styles[ll->numCharsInLine]].back);
+ surface->FillRectangle(rcSegment, background.isSet ? background : vsDraw.styles[ll->styles[ll->numCharsInLine]].back);
if (!hideSelection && ((vsDraw.selAlpha == SC_ALPHA_NOALPHA) || (vsDraw.selAdditionalAlpha == SC_ALPHA_NOALPHA))) {
SelectionSegment virtualSpaceRange(SelectionPosition(pdoc->LineEnd(line)), SelectionPosition(pdoc->LineEnd(line), sel.VirtualSpaceFor(pdoc->LineEnd(line))));
for (size_t r=0; r<sel.Count(); r++) {
@@ -2553,11 +2558,11 @@ void Editor::DrawEOL(Surface *surface, ViewStyle &vsDraw, PRectangle rcLine, Lin
const char *ctrlChar;
unsigned char chEOL = ll->chars[eolPos];
int styleMain = ll->styles[eolPos];
- ColourDesired textBack = TextBackground(vsDraw, overrideBackground, background, eolInSelection, false, styleMain, eolPos, ll);
+ ColourDesired textBack = TextBackground(vsDraw, background, eolInSelection, false, styleMain, eolPos, ll);
if (UTF8IsAscii(chEOL)) {
ctrlChar = ControlCharacterString(chEOL);
} else {
- Representation *repr = reprs.RepresentationFromCharacter(ll->chars + eolPos, ll->numCharsInLine - eolPos);
+ const Representation *repr = reprs.RepresentationFromCharacter(ll->chars + eolPos, ll->numCharsInLine - eolPos);
if (repr) {
ctrlChar = repr->stringRep.c_str();
eolPos = ll->numCharsInLine;
@@ -2593,7 +2598,7 @@ void Editor::DrawEOL(Surface *surface, ViewStyle &vsDraw, PRectangle rcLine, Lin
if (eolInSelection && vsDraw.selColours.back.isSet && (line < pdoc->LinesTotal() - 1) && (alpha == SC_ALPHA_NOALPHA)) {
surface->FillRectangle(rcSegment, SelectionBackground(vsDraw, eolInSelection == 1));
} else {
- if (overrideBackground) {
+ if (background.isSet) {
surface->FillRectangle(rcSegment, background);
} else if (line < pdoc->LinesTotal() - 1) {
surface->FillRectangle(rcSegment, vsDraw.styles[ll->styles[ll->numCharsInLine]].back);
@@ -2616,7 +2621,7 @@ void Editor::DrawEOL(Surface *surface, ViewStyle &vsDraw, PRectangle rcLine, Lin
if (eolInSelection && vsDraw.selEOLFilled && vsDraw.selColours.back.isSet && (line < pdoc->LinesTotal() - 1) && (alpha == SC_ALPHA_NOALPHA)) {
surface->FillRectangle(rcSegment, SelectionBackground(vsDraw, eolInSelection == 1));
} else {
- if (overrideBackground) {
+ if (background.isSet) {
surface->FillRectangle(rcSegment, background);
} else if (vsDraw.styles[ll->styles[ll->numCharsInLine]].eolFilled) {
surface->FillRectangle(rcSegment, vsDraw.styles[ll->styles[ll->numCharsInLine]].back);
@@ -2628,6 +2633,14 @@ void Editor::DrawEOL(Surface *surface, ViewStyle &vsDraw, PRectangle rcLine, Lin
}
}
+ bool drawWrapMarkEnd = false;
+
+ if (vsDraw.wrapVisualFlags & SC_WRAPVISUALFLAG_END) {
+ if (subLine + 1 < ll->lines) {
+ drawWrapMarkEnd = ll->LineStart(subLine + 1) != 0;
+ }
+ }
+
if (drawWrapMarkEnd) {
PRectangle rcPlace = rcSegment;
@@ -2639,11 +2652,11 @@ void Editor::DrawEOL(Surface *surface, ViewStyle &vsDraw, PRectangle rcLine, Lin
rcPlace.right = rcLine.right;
rcPlace.left = rcPlace.right - vsDraw.aveCharWidth;
}
- DrawWrapMarker(surface, rcPlace, true, wrapColour);
+ DrawWrapMarker(surface, rcPlace, true, vsDraw.WrapColour());
}
}
-void Editor::DrawIndicator(int indicNum, int startPos, int endPos, Surface *surface, ViewStyle &vsDraw,
+void Editor::DrawIndicator(int indicNum, int startPos, int endPos, Surface *surface, const ViewStyle &vsDraw,
int xStart, PRectangle rcLine, LineLayout *ll, int subLine) {
const XYPOSITION subLineStart = ll->positions[ll->LineStart(subLine)];
PRectangle rcIndic(
@@ -2654,7 +2667,7 @@ void Editor::DrawIndicator(int indicNum, int startPos, int endPos, Surface *surf
vsDraw.indicators[indicNum].Draw(surface, rcIndic, rcLine);
}
-void Editor::DrawIndicators(Surface *surface, ViewStyle &vsDraw, int line, int xStart,
+void Editor::DrawIndicators(Surface *surface, const ViewStyle &vsDraw, int line, int xStart,
PRectangle rcLine, LineLayout *ll, int subLine, int lineEnd, bool under) {
// Draw decorators
const int posLineStart = pdoc->LineStart(line);
@@ -2682,9 +2695,9 @@ void Editor::DrawIndicators(Surface *surface, ViewStyle &vsDraw, int line, int x
}
// Use indicators to highlight matching braces
- if ((vs.braceHighlightIndicatorSet && (bracesMatchStyle == STYLE_BRACELIGHT)) ||
- (vs.braceBadLightIndicatorSet && (bracesMatchStyle == STYLE_BRACEBAD))) {
- int braceIndicator = (bracesMatchStyle == STYLE_BRACELIGHT) ? vs.braceHighlightIndicator : vs.braceBadLightIndicator;
+ if ((vsDraw.braceHighlightIndicatorSet && (bracesMatchStyle == STYLE_BRACELIGHT)) ||
+ (vsDraw.braceBadLightIndicatorSet && (bracesMatchStyle == STYLE_BRACEBAD))) {
+ int braceIndicator = (bracesMatchStyle == STYLE_BRACELIGHT) ? vsDraw.braceHighlightIndicator : vsDraw.braceBadLightIndicator;
if (under == vsDraw.indicators[braceIndicator].under) {
Range rangeLine(posLineStart + lineStart, posLineEnd);
if (rangeLine.ContainsCharacter(braces[0])) {
@@ -2703,7 +2716,7 @@ void Editor::DrawIndicators(Surface *surface, ViewStyle &vsDraw, int line, int x
}
}
-void Editor::DrawAnnotation(Surface *surface, ViewStyle &vsDraw, int line, int xStart,
+void Editor::DrawAnnotation(Surface *surface, const ViewStyle &vsDraw, int line, int xStart,
PRectangle rcLine, LineLayout *ll, int subLine) {
int indent = static_cast<int>(pdoc->GetLineIndentation(line) * vsDraw.spaceWidth);
PRectangle rcSegment = rcLine;
@@ -2712,15 +2725,15 @@ void Editor::DrawAnnotation(Surface *surface, ViewStyle &vsDraw, int line, int x
if (stAnnotation.text && ValidStyledText(vsDraw, vsDraw.annotationStyleOffset, stAnnotation)) {
surface->FillRectangle(rcSegment, vsDraw.styles[0].back);
rcSegment.left = static_cast<XYPOSITION>(xStart);
- if (trackLineWidth || (vs.annotationVisible == ANNOTATION_BOXED)) {
+ if (trackLineWidth || (vsDraw.annotationVisible == ANNOTATION_BOXED)) {
// Only care about calculating width if tracking or need to draw box
int widthAnnotation = WidestLineWidth(surface, vsDraw, vsDraw.annotationStyleOffset, stAnnotation);
- if (vs.annotationVisible == ANNOTATION_BOXED) {
+ if (vsDraw.annotationVisible == ANNOTATION_BOXED) {
widthAnnotation += static_cast<int>(vsDraw.spaceWidth * 2); // Margins
}
if (widthAnnotation > lineWidthMaxSeen)
lineWidthMaxSeen = widthAnnotation;
- if (vs.annotationVisible == ANNOTATION_BOXED) {
+ if (vsDraw.annotationVisible == ANNOTATION_BOXED) {
rcSegment.left = static_cast<XYPOSITION>(xStart + indent);
rcSegment.right = rcSegment.left + widthAnnotation;
}
@@ -2735,14 +2748,14 @@ void Editor::DrawAnnotation(Surface *surface, ViewStyle &vsDraw, int line, int x
lineInAnnotation++;
}
PRectangle rcText = rcSegment;
- if (vs.annotationVisible == ANNOTATION_BOXED) {
+ if (vsDraw.annotationVisible == ANNOTATION_BOXED) {
surface->FillRectangle(rcText,
vsDraw.styles[stAnnotation.StyleAt(start) + vsDraw.annotationStyleOffset].back);
rcText.left += vsDraw.spaceWidth;
}
- DrawStyledText(surface, vsDraw, vsDraw.annotationStyleOffset, rcText, static_cast<int>(rcText.top + vsDraw.maxAscent),
+ DrawStyledText(surface, vsDraw, vsDraw.annotationStyleOffset, rcText,
stAnnotation, start, lengthAnnotation);
- if (vs.annotationVisible == ANNOTATION_BOXED) {
+ if (vsDraw.annotationVisible == ANNOTATION_BOXED) {
surface->PenColour(vsDraw.styles[vsDraw.annotationStyleOffset].fore);
surface->MoveTo(static_cast<int>(rcSegment.left), static_cast<int>(rcSegment.top));
surface->LineTo(static_cast<int>(rcSegment.left), static_cast<int>(rcSegment.bottom));
@@ -2760,7 +2773,7 @@ void Editor::DrawAnnotation(Surface *surface, ViewStyle &vsDraw, int line, int x
}
}
-void Editor::DrawLine(Surface *surface, ViewStyle &vsDraw, int line, int lineVisible, int xStart,
+void Editor::DrawLine(Surface *surface, const ViewStyle &vsDraw, int line, int lineVisible, int xStart,
PRectangle rcLine, LineLayout *ll, int subLine) {
if (subLine >= ll->lines) {
@@ -2773,49 +2786,13 @@ void Editor::DrawLine(Surface *surface, ViewStyle &vsDraw, int line, int lineVis
// Using one font for all control characters so it can be controlled independently to ensure
// the box goes around the characters tightly. Seems to be no way to work out what height
// is taken by an individual character - internal leading gives varying results.
- Font &ctrlCharsFont = vsDraw.styles[STYLE_CONTROLCHAR].font;
-
- // See if something overrides the line background color: Either if caret is on the line
- // and background color is set for that, or if a marker is defined that forces its background
- // color onto the line, or if a marker is defined but has no selection margin in which to
- // display itself (as long as it's not an SC_MARK_EMPTY marker). These are checked in order
- // with the earlier taking precedence. When multiple markers cause background override,
- // the color for the highest numbered one is used.
- bool overrideBackground = false;
- ColourDesired background;
- if ((caret.active || vsDraw.alwaysShowCaretLineBackground) && vsDraw.showCaretLineBackground && (vsDraw.caretLineAlpha == SC_ALPHA_NOALPHA) && ll->containsCaret) {
- overrideBackground = true;
- background = vsDraw.caretLineBackground;
- }
- if (!overrideBackground) {
- int marks = pdoc->GetMark(line);
- for (int markBit = 0; (markBit < 32) && marks; markBit++) {
- if ((marks & 1) && (vsDraw.markers[markBit].markType == SC_MARK_BACKGROUND) &&
- (vsDraw.markers[markBit].alpha == SC_ALPHA_NOALPHA)) {
- background = vsDraw.markers[markBit].back;
- overrideBackground = true;
- }
- marks >>= 1;
- }
- }
- if (!overrideBackground) {
- if (vsDraw.maskInLine) {
- int marksMasked = pdoc->GetMark(line) & vsDraw.maskInLine;
- if (marksMasked) {
- for (int markBit = 0; (markBit < 32) && marksMasked; markBit++) {
- if ((marksMasked & 1) && (vsDraw.markers[markBit].markType != SC_MARK_EMPTY) &&
- (vsDraw.markers[markBit].alpha == SC_ALPHA_NOALPHA)) {
- overrideBackground = true;
- background = vsDraw.markers[markBit].back;
- }
- marksMasked >>= 1;
- }
- }
- }
- }
+ FontAlias ctrlCharsFont = vsDraw.styles[STYLE_CONTROLCHAR].font;
+
+ // See if something overrides the line background color.
+ const ColourOptional background = vsDraw.Background(pdoc->GetMark(line), caret.active, ll->containsCaret);
const bool drawWhitespaceBackground = (vsDraw.viewWhitespace != wsInvisible) &&
- (!overrideBackground) && (vsDraw.whitespaceColours.back.isSet);
+ (!background.isSet) && (vsDraw.whitespaceColours.back.isSet);
bool inIndentation = subLine == 0; // Do not handle indentation except on first subline.
const XYPOSITION indentWidth = pdoc->IndentSize() * vsDraw.spaceWidth;
@@ -2835,16 +2812,6 @@ void Editor::DrawLine(Surface *surface, ViewStyle &vsDraw, int line, int lineVis
}
}
- const ColourDesired wrapColour = vsDraw.WrapColour();
-
- bool drawWrapMarkEnd = false;
-
- if (vsDraw.wrapVisualFlags & SC_WRAPVISUALFLAG_END) {
- if (subLine + 1 < ll->lines) {
- drawWrapMarkEnd = ll->LineStart(subLine + 1) != 0;
- }
- }
-
if (ll->wrapIndent != 0) {
bool continuedWrapLine = false;
@@ -2860,7 +2827,7 @@ void Editor::DrawLine(Surface *surface, ViewStyle &vsDraw, int line, int lineVis
rcPlace.right = rcPlace.left + ll->wrapIndent;
// default bgnd here..
- surface->FillRectangle(rcSegment, overrideBackground ? background :
+ surface->FillRectangle(rcSegment, background.isSet ? background :
vsDraw.styles[STYLE_DEFAULT].back);
// main line style would be below but this would be inconsistent with end markers
@@ -2875,7 +2842,7 @@ void Editor::DrawLine(Surface *surface, ViewStyle &vsDraw, int line, int lineVis
else
rcPlace.right = rcPlace.left + vsDraw.aveCharWidth;
- DrawWrapMarker(surface, rcPlace, false, wrapColour);
+ DrawWrapMarker(surface, rcPlace, false, vsDraw.WrapColour());
}
xStart += static_cast<int>(ll->wrapIndent);
@@ -2888,10 +2855,8 @@ void Editor::DrawLine(Surface *surface, ViewStyle &vsDraw, int line, int lineVis
// Does not take margin into account but not significant
const int xStartVisible = static_cast<int>(subLineStart) - xStart;
- ll->psel = &sel;
-
if (twoPhaseDraw) {
- BreakFinder bfBack(ll, lineStart, lineEnd, posLineStart, xStartVisible, selBackDrawn, pdoc, &reprs);
+ BreakFinder bfBack(ll, &sel, lineStart, lineEnd, posLineStart, xStartVisible, selBackDrawn, pdoc, &reprs);
// Background drawing loop
while (bfBack.More()) {
@@ -2912,8 +2877,8 @@ void Editor::DrawLine(Surface *surface, ViewStyle &vsDraw, int line, int lineVis
rcSegment.right = rcLine.right;
const int inSelection = hideSelection ? 0 : sel.CharacterInSelection(iDoc);
- const bool inHotspot = (ll->hsStart != -1) && (iDoc >= ll->hsStart) && (iDoc < ll->hsEnd);
- ColourDesired textBack = TextBackground(vsDraw, overrideBackground, background, inSelection,
+ const bool inHotspot = (ll->hotspot.Valid()) && ll->hotspot.ContainsCharacter(iDoc);
+ ColourDesired textBack = TextBackground(vsDraw, background, inSelection,
inHotspot, ll->styles[i], i, ll);
if (ts.representation) {
if (ll->chars[i] == '\t') {
@@ -2954,8 +2919,7 @@ void Editor::DrawLine(Surface *surface, ViewStyle &vsDraw, int line, int lineVis
}
DrawEOL(surface, vsDraw, rcLine, ll, line, lineEnd,
- xStart, subLine, subLineStart, overrideBackground, background,
- drawWrapMarkEnd, wrapColour);
+ xStart, subLine, subLineStart, background);
}
DrawIndicators(surface, vsDraw, line, xStart, rcLine, ll, subLine, lineEnd, true);
@@ -2984,7 +2948,7 @@ void Editor::DrawLine(Surface *surface, ViewStyle &vsDraw, int line, int lineVis
inIndentation = subLine == 0; // Do not handle indentation except on first subline.
// Foreground drawing loop
- BreakFinder bfFore(ll, lineStart, lineEnd, posLineStart, xStartVisible,
+ BreakFinder bfFore(ll, &sel, lineStart, lineEnd, posLineStart, xStartVisible,
((!twoPhaseDraw && selBackDrawn) || vsDraw.selColours.fore.isSet), pdoc, &reprs);
while (bfFore.More()) {
@@ -3000,9 +2964,10 @@ void Editor::DrawLine(Surface *surface, ViewStyle &vsDraw, int line, int lineVis
if (rcSegment.Intersects(rcLine)) {
int styleMain = ll->styles[i];
ColourDesired textFore = vsDraw.styles[styleMain].fore;
- Font &textFont = vsDraw.styles[styleMain].font;
+ FontAlias textFont = vsDraw.styles[styleMain].font;
//hotspot foreground
- if (ll->hsStart != -1 && iDoc >= ll->hsStart && iDoc < hsEnd) {
+ const bool inHotspot = (ll->hotspot.Valid()) && ll->hotspot.ContainsCharacter(iDoc);
+ if (inHotspot) {
if (vsDraw.hotspotColours.fore.isSet)
textFore = vsDraw.hotspotColours.fore;
}
@@ -3010,8 +2975,7 @@ void Editor::DrawLine(Surface *surface, ViewStyle &vsDraw, int line, int lineVis
if (inSelection && (vsDraw.selColours.fore.isSet)) {
textFore = (inSelection == 1) ? vsDraw.selColours.fore : vsDraw.selAdditionalForeground;
}
- const bool inHotspot = (ll->hsStart != -1) && (iDoc >= ll->hsStart) && (iDoc < ll->hsEnd);
- ColourDesired textBack = TextBackground(vsDraw, overrideBackground, background, inSelection, inHotspot, styleMain, i, ll);
+ ColourDesired textBack = TextBackground(vsDraw, background, inSelection, inHotspot, styleMain, i, ll);
if (ts.representation) {
if (ll->chars[i] == '\t') {
// Tab display
@@ -3087,8 +3051,8 @@ void Editor::DrawLine(Surface *surface, ViewStyle &vsDraw, int line, int lineVis
}
PRectangle rcDot(xmid + xStart - static_cast<XYPOSITION>(subLineStart),
rcSegment.top + vsDraw.lineHeight / 2, 0.0f, 0.0f);
- rcDot.right = rcDot.left + vs.whitespaceSize;
- rcDot.bottom = rcDot.top + vs.whitespaceSize;
+ rcDot.right = rcDot.left + vsDraw.whitespaceSize;
+ rcDot.bottom = rcDot.top + vsDraw.whitespaceSize;
surface->FillRectangle(rcDot, textFore);
}
}
@@ -3109,7 +3073,7 @@ void Editor::DrawLine(Surface *surface, ViewStyle &vsDraw, int line, int lineVis
}
}
}
- if (ll->hsStart != -1 && vsDraw.hotspotUnderline && iDoc >= ll->hsStart && iDoc < ll->hsEnd) {
+ if (ll->hotspot.Valid() && vsDraw.hotspotUnderline && ll->hotspot.ContainsCharacter(iDoc)) {
PRectangle rcUL = rcSegment;
rcUL.top = rcUL.top + vsDraw.maxAscent + 1;
rcUL.bottom = rcUL.top + 1;
@@ -3182,8 +3146,7 @@ void Editor::DrawLine(Surface *surface, ViewStyle &vsDraw, int line, int lineVis
// End of the drawing of the current line
if (!twoPhaseDraw) {
DrawEOL(surface, vsDraw, rcLine, ll, line, lineEnd,
- xStart, subLine, subLineStart, overrideBackground, background,
- drawWrapMarkEnd, wrapColour);
+ xStart, subLine, subLineStart, background);
}
if (!hideSelection && ((vsDraw.selAlpha != SC_ALPHA_NOALPHA) || (vsDraw.selAdditionalAlpha != SC_ALPHA_NOALPHA))) {
// For each selection draw
@@ -3246,8 +3209,8 @@ void Editor::DrawLine(Surface *surface, ViewStyle &vsDraw, int line, int lineVis
}
}
-void Editor::DrawBlockCaret(Surface *surface, ViewStyle &vsDraw, LineLayout *ll, int subLine,
- int xStart, int offset, int posCaret, PRectangle rcCaret, ColourDesired caretColour) {
+void Editor::DrawBlockCaret(Surface *surface, const ViewStyle &vsDraw, LineLayout *ll, int subLine,
+ int xStart, int offset, int posCaret, PRectangle rcCaret, ColourDesired caretColour) const {
int lineStart = ll->LineStart(subLine);
int posBefore = posCaret;
@@ -3305,7 +3268,8 @@ void Editor::DrawBlockCaret(Surface *surface, ViewStyle &vsDraw, LineLayout *ll,
// This character is where the caret block is, we override the colours
// (inversed) for drawing the caret here.
int styleMain = ll->styles[offsetFirstChar];
- surface->DrawTextClipped(rcCaret, vsDraw.styles[styleMain].font,
+ FontAlias fontText = vsDraw.styles[styleMain].font;
+ surface->DrawTextClipped(rcCaret, fontText,
rcCaret.top + vsDraw.maxAscent, ll->chars + offsetFirstChar,
numCharsToDraw, vsDraw.styles[styleMain].back,
caretColour);
@@ -3379,7 +3343,7 @@ void Editor::RefreshPixMaps(Surface *surfaceWindow) {
}
}
-void Editor::DrawCarets(Surface *surface, ViewStyle &vsDraw, int lineDoc, int xStart,
+void Editor::DrawCarets(Surface *surface, const ViewStyle &vsDraw, int lineDoc, int xStart,
PRectangle rcLine, LineLayout *ll, int subLine) {
// When drag is active it is the only caret drawn
bool drawDrag = posDrag.IsValid();
@@ -3611,7 +3575,7 @@ void Editor::Paint(Surface *surfaceWindow, PRectangle rcArea) {
ll->containsCaret = false;
}
- GetHotSpotRange(ll->hsStart, ll->hsEnd);
+ ll->hotspot = GetHotSpotRange();
PRectangle rcLine = rcTextArea;
rcLine.top = static_cast<XYPOSITION>(ypos);
@@ -6526,35 +6490,28 @@ void Editor::SetHotSpotRange(Point *pt) {
// If we don't limit this to word characters then the
// range can encompass more than the run range and then
// the underline will not be drawn properly.
- int hsStart_ = pdoc->ExtendStyleRange(pos, -1, vs.hotspotSingleLine);
- int hsEnd_ = pdoc->ExtendStyleRange(pos, 1, vs.hotspotSingleLine);
+ Range hsNew;
+ hsNew.start = pdoc->ExtendStyleRange(pos, -1, vs.hotspotSingleLine);
+ hsNew.end = pdoc->ExtendStyleRange(pos, 1, vs.hotspotSingleLine);
// Only invalidate the range if the hotspot range has changed...
- if (hsStart_ != hsStart || hsEnd_ != hsEnd) {
- if (hsStart != -1) {
- InvalidateRange(hsStart, hsEnd);
+ if (!(hsNew == hotspot)) {
+ if (hotspot.Valid()) {
+ InvalidateRange(hotspot.start, hotspot.end);
}
- hsStart = hsStart_;
- hsEnd = hsEnd_;
- InvalidateRange(hsStart, hsEnd);
+ hotspot = hsNew;
+ InvalidateRange(hotspot.start, hotspot.end);
}
} else {
- if (hsStart != -1) {
- int hsStart_ = hsStart;
- int hsEnd_ = hsEnd;
- hsStart = -1;
- hsEnd = -1;
- InvalidateRange(hsStart_, hsEnd_);
- } else {
- hsStart = -1;
- hsEnd = -1;
+ if (hotspot.Valid()) {
+ InvalidateRange(hotspot.start, hotspot.end);
}
+ hotspot = Range(invalidPosition);
}
}
-void Editor::GetHotSpotRange(int &hsStart_, int &hsEnd_) const {
- hsStart_ = hsStart;
- hsEnd_ = hsEnd;
+Range Editor::GetHotSpotRange() const {
+ return hotspot;
}
void Editor::ButtonMoveWithModifiers(Point pt, int modifiers) {
@@ -6641,7 +6598,7 @@ void Editor::ButtonMoveWithModifiers(Point pt, int modifiers) {
}
EnsureCaretVisible(false, false, true);
- if (hsStart != -1 && !PointIsHotspot(pt))
+ if (hotspot.Valid() && !PointIsHotspot(pt))
SetHotSpotRange(NULL);
if (hotSpotClickPos != INVALID_POSITION && PositionFromLocation(pt,true,true) != hotSpotClickPos) {
@@ -9265,7 +9222,7 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) {
break;
case SCI_GETREPRESENTATION: {
- Representation *repr = reprs.RepresentationFromCharacter(
+ const Representation *repr = reprs.RepresentationFromCharacter(
reinterpret_cast<const char *>(wParam), UTF8MaxBytes);
if (repr) {
return StringResult(lParam, repr->stringRep.c_str());
diff --git a/scintilla/src/Editor.h b/scintilla/src/Editor.h
index 468b5bb..4d69186 100644
--- a/scintilla/src/Editor.h
+++ b/scintilla/src/Editor.h
@@ -309,8 +309,7 @@ protected: // ScintillaBase subclass needs access to much of Editor
ContractionState cs;
// Hotspot support
- int hsStart;
- int hsEnd;
+ Range hotspot;
// Wrapping support
int wrapWidth;
@@ -435,27 +434,26 @@ protected: // ScintillaBase subclass needs access to much of Editor
int SubstituteMarkerIfEmpty(int markerCheck, int markerDefault) const;
void PaintSelMargin(Surface *surface, PRectangle &rc);
LineLayout *RetrieveLineLayout(int lineNumber);
- void LayoutLine(int line, Surface *surface, ViewStyle &vstyle, LineLayout *ll,
+ void LayoutLine(int line, Surface *surface, const ViewStyle &vstyle, LineLayout *ll,
int width=LineLayout::wrapWidthInfinite);
- ColourDesired SelectionBackground(ViewStyle &vsDraw, bool main) const;
- ColourDesired TextBackground(ViewStyle &vsDraw, bool overrideBackground, ColourDesired background, int inSelection, bool inHotspot, int styleMain, int i, LineLayout *ll) const;
+ ColourDesired SelectionBackground(const ViewStyle &vsDraw, bool main) const;
+ ColourDesired TextBackground(const ViewStyle &vsDraw, ColourOptional background, int inSelection, bool inHotspot, int styleMain, int i, LineLayout *ll) const;
void DrawIndentGuide(Surface *surface, int lineVisible, int lineHeight, int start, PRectangle rcSegment, bool highlight);
static void DrawWrapMarker(Surface *surface, PRectangle rcPlace, bool isEndMarker, ColourDesired wrapColour);
- void DrawEOL(Surface *surface, ViewStyle &vsDraw, PRectangle rcLine, LineLayout *ll,
+ void DrawEOL(Surface *surface, const ViewStyle &vsDraw, PRectangle rcLine, LineLayout *ll,
int line, int lineEnd, int xStart, int subLine, XYACCUMULATOR subLineStart,
- bool overrideBackground, ColourDesired background,
- bool drawWrapMark, ColourDesired wrapColour);
- static void DrawIndicator(int indicNum, int startPos, int endPos, Surface *surface, ViewStyle &vsDraw,
+ ColourOptional background);
+ static void DrawIndicator(int indicNum, int startPos, int endPos, Surface *surface, const ViewStyle &vsDraw,
int xStart, PRectangle rcLine, LineLayout *ll, int subLine);
- void DrawIndicators(Surface *surface, ViewStyle &vsDraw, int line, int xStart,
+ void DrawIndicators(Surface *surface, const ViewStyle &vsDraw, int line, int xStart,
PRectangle rcLine, LineLayout *ll, int subLine, int lineEnd, bool under);
- void DrawAnnotation(Surface *surface, ViewStyle &vsDraw, int line, int xStart,
+ void DrawAnnotation(Surface *surface, const ViewStyle &vsDraw, int line, int xStart,
PRectangle rcLine, LineLayout *ll, int subLine);
- void DrawLine(Surface *surface, ViewStyle &vsDraw, int line, int lineVisible, int xStart,
+ void DrawLine(Surface *surface, const ViewStyle &vsDraw, int line, int lineVisible, int xStart,
PRectangle rcLine, LineLayout *ll, int subLine);
- void DrawBlockCaret(Surface *surface, ViewStyle &vsDraw, LineLayout *ll, int subLine,
- int xStart, int offset, int posCaret, PRectangle rcCaret, ColourDesired caretColour);
- void DrawCarets(Surface *surface, ViewStyle &vsDraw, int line, int xStart,
+ void DrawBlockCaret(Surface *surface, const ViewStyle &vsDraw, LineLayout *ll, int subLine,
+ int xStart, int offset, int posCaret, PRectangle rcCaret, ColourDesired caretColour) const;
+ void DrawCarets(Surface *surface, const ViewStyle &vsDraw, int line, int xStart,
PRectangle rcLine, LineLayout *ll, int subLine);
void RefreshPixMaps(Surface *surfaceWindow);
void Paint(Surface *surfaceWindow, PRectangle rcArea);
@@ -623,7 +621,7 @@ protected: // ScintillaBase subclass needs access to much of Editor
bool PositionIsHotspot(int position) const;
bool PointIsHotspot(Point pt);
void SetHotSpotRange(Point *pt);
- void GetHotSpotRange(int &hsStart, int &hsEnd) const;
+ Range GetHotSpotRange() const;
int CodePage() const;
virtual bool ValidCodePage(int /* codePage */) const { return true; }
diff --git a/scintilla/src/Indicator.cxx b/scintilla/src/Indicator.cxx
index 6fadfad..f6e81f8 100644
--- a/scintilla/src/Indicator.cxx
+++ b/scintilla/src/Indicator.cxx
@@ -23,7 +23,7 @@ static PRectangle PixelGridAlign(const PRectangle &rc) {
return PRectangle::FromInts(int(rc.left + 0.5), int(rc.top), int(rc.right + 0.5), int(rc.bottom));
}
-void Indicator::Draw(Surface *surface, const PRectangle &rc, const PRectangle &rcLine) {
+void Indicator::Draw(Surface *surface, const PRectangle &rc, const PRectangle &rcLine) const {
surface->PenColour(fore);
int ymid = static_cast<int>(rc.bottom + rc.top) / 2;
if (style == INDIC_SQUIGGLE) {
diff --git a/scintilla/src/Indicator.h b/scintilla/src/Indicator.h
index c9f1af5..9deef45 100644
--- a/scintilla/src/Indicator.h
+++ b/scintilla/src/Indicator.h
@@ -23,7 +23,7 @@ public:
int outlineAlpha;
Indicator() : style(INDIC_PLAIN), under(false), fore(ColourDesired(0,0,0)), fillAlpha(30), outlineAlpha(50) {
}
- void Draw(Surface *surface, const PRectangle &rc, const PRectangle &rcLine);
+ void Draw(Surface *surface, const PRectangle &rc, const PRectangle &rcLine) const;
};
#ifdef SCI_NAMESPACE
diff --git a/scintilla/src/LineMarker.cxx b/scintilla/src/LineMarker.cxx
index b5d9f88..b7adaa6 100644
--- a/scintilla/src/LineMarker.cxx
+++ b/scintilla/src/LineMarker.cxx
@@ -71,7 +71,7 @@ static void DrawMinus(Surface *surface, int centreX, int centreY, int armSize, C
surface->FillRectangle(rcH, fore);
}
-void LineMarker::Draw(Surface *surface, PRectangle &rcWhole, Font &fontForCharacter, typeOfFold tFold, int marginStyle) {
+void LineMarker::Draw(Surface *surface, PRectangle &rcWhole, Font &fontForCharacter, typeOfFold tFold, int marginStyle) const {
ColourDesired head = back;
ColourDesired body = back;
ColourDesired tail = back;
diff --git a/scintilla/src/LineMarker.h b/scintilla/src/LineMarker.h
index c9dfeb7..3363fc7 100644
--- a/scintilla/src/LineMarker.h
+++ b/scintilla/src/LineMarker.h
@@ -66,7 +66,7 @@ public:
void SetXPM(const char *textForm);
void SetXPM(const char *const *linesForm);
void SetRGBAImage(Point sizeRGBAImage, float scale, const unsigned char *pixelsRGBAImage);
- void Draw(Surface *surface, PRectangle &rc, Font &fontForCharacter, typeOfFold tFold, int marginStyle);
+ void Draw(Surface *surface, PRectangle &rc, Font &fontForCharacter, typeOfFold tFold, int marginStyle) const;
};
#ifdef SCI_NAMESPACE
diff --git a/scintilla/src/PositionCache.cxx b/scintilla/src/PositionCache.cxx
index 10408aa..6ff24dc 100644
--- a/scintilla/src/PositionCache.cxx
+++ b/scintilla/src/PositionCache.cxx
@@ -54,14 +54,12 @@ LineLayout::LineLayout(int maxLineLength_) :
validity(llInvalid),
xHighlightGuide(0),
highlightColumn(0),
- psel(NULL),
containsCaret(false),
edgeColumn(0),
chars(0),
styles(0),
positions(0),
- hsStart(0),
- hsEnd(0),
+ hotspot(0,0),
widthLine(wrapWidthInfinite),
lines(1),
wrapIndent(0) {
@@ -148,7 +146,7 @@ void LineLayout::SetLineStart(int line, int start) {
lineStarts[line] = start;
}
-void LineLayout::SetBracesHighlight(Range rangeLine, Position braces[],
+void LineLayout::SetBracesHighlight(Range rangeLine, const Position braces[],
char bracesMatchStyle, int xHighlight, bool ignoreStyle) {
if (!ignoreStyle && rangeLine.ContainsCharacter(braces[0])) {
int braceOffset = braces[0] - rangeLine.start;
@@ -170,7 +168,7 @@ void LineLayout::SetBracesHighlight(Range rangeLine, Position braces[],
}
}
-void LineLayout::RestoreBracesHighlight(Range rangeLine, Position braces[], bool ignoreStyle) {
+void LineLayout::RestoreBracesHighlight(Range rangeLine, const Position braces[], bool ignoreStyle) {
if (!ignoreStyle && rangeLine.ContainsCharacter(braces[0])) {
int braceOffset = braces[0] - rangeLine.start;
if (braceOffset < numCharsInLine) {
@@ -405,11 +403,11 @@ void SpecialRepresentations::ClearRepresentation(const char *charBytes) {
}
}
-Representation *SpecialRepresentations::RepresentationFromCharacter(const char *charBytes, size_t len) {
+const Representation *SpecialRepresentations::RepresentationFromCharacter(const char *charBytes, size_t len) const {
PLATFORM_ASSERT(len <= 4);
if (!startByteHasReprs[static_cast<unsigned char>(charBytes[0])])
return 0;
- MapRepresentation::iterator it = mapReprs.find(KeyFromString(charBytes, len));
+ MapRepresentation::const_iterator it = mapReprs.find(KeyFromString(charBytes, len));
if (it != mapReprs.end()) {
return &(it->second);
}
@@ -440,8 +438,8 @@ void BreakFinder::Insert(int val) {
}
}
-BreakFinder::BreakFinder(LineLayout *ll_, int lineStart_, int lineEnd_, int posLineStart_,
- int xStart, bool breakForSelection, Document *pdoc_, SpecialRepresentations *preprs_) :
+BreakFinder::BreakFinder(const LineLayout *ll_, const Selection *psel, int lineStart_, int lineEnd_, int posLineStart_,
+ int xStart, bool breakForSelection, const Document *pdoc_, const SpecialRepresentations *preprs_) :
ll(ll_),
lineStart(lineStart_),
lineEnd(lineEnd_),
@@ -467,8 +465,8 @@ BreakFinder::BreakFinder(LineLayout *ll_, int lineStart_, int lineEnd_, int posL
SelectionPosition posStart(posLineStart);
SelectionPosition posEnd(posLineStart + lineEnd);
SelectionSegment segmentLine(posStart, posEnd);
- for (size_t r=0; r<ll->psel->Count(); r++) {
- SelectionSegment portion = ll->psel->Range(r).Intersect(segmentLine);
+ for (size_t r=0; r<psel->Count(); r++) {
+ SelectionSegment portion = psel->Range(r).Intersect(segmentLine);
if (!(portion.start == portion.end)) {
if (portion.start.IsValid())
Insert(portion.start.Position() - posLineStart);
@@ -495,7 +493,7 @@ TextSegment BreakFinder::Next() {
charWidth = UTF8DrawBytes(reinterpret_cast<unsigned char *>(ll->chars) + nextBreak, lineEnd - nextBreak);
else if (encodingFamily == efDBCS)
charWidth = pdoc->IsDBCSLeadByte(ll->chars[nextBreak]) ? 2 : 1;
- Representation *repr = preprs->RepresentationFromCharacter(ll->chars + nextBreak, charWidth);
+ const Representation *repr = preprs->RepresentationFromCharacter(ll->chars + nextBreak, charWidth);
if (((nextBreak > 0) && (ll->styles[nextBreak] != ll->styles[nextBreak - 1])) ||
repr ||
(nextBreak == saeNext)) {
@@ -560,7 +558,7 @@ void PositionCacheEntry::Set(unsigned int styleNumber_, const char *s_,
for (unsigned int i=0; i<len; i++) {
positions[i] = positions_[i];
}
- memcpy(reinterpret_cast<char *>(positions + len), s_, len);
+ memcpy(reinterpret_cast<char *>(reinterpret_cast<void *>(positions + len)), s_, len);
}
}
@@ -579,7 +577,7 @@ void PositionCacheEntry::Clear() {
bool PositionCacheEntry::Retrieve(unsigned int styleNumber_, const char *s_,
unsigned int len_, XYPOSITION *positions_) const {
if ((styleNumber == styleNumber_) && (len == len_) &&
- (memcmp(reinterpret_cast<char *>(positions + len), s_, len)== 0)) {
+ (memcmp(reinterpret_cast<char *>(reinterpret_cast<void *>(positions + len)), s_, len)== 0)) {
for (unsigned int i=0; i<len; i++) {
positions_[i] = positions[i];
}
@@ -637,7 +635,7 @@ void PositionCache::SetSize(size_t size_) {
pces.resize(size_);
}
-void PositionCache::MeasureWidths(Surface *surface, ViewStyle &vstyle, unsigned int styleNumber,
+void PositionCache::MeasureWidths(Surface *surface, const ViewStyle &vstyle, unsigned int styleNumber,
const char *s, unsigned int len, XYPOSITION *positions, Document *pdoc) {
allClear = false;
@@ -667,7 +665,8 @@ void PositionCache::MeasureWidths(Surface *surface, ViewStyle &vstyle, unsigned
XYPOSITION xStartSegment = 0;
while (startSegment < len) {
unsigned int lenSegment = pdoc->SafeSegment(s + startSegment, len - startSegment, BreakFinder::lengthEachSubdivision);
- surface->MeasureWidths(vstyle.styles[styleNumber].font, s + startSegment, lenSegment, positions + startSegment);
+ FontAlias fontStyle = vstyle.styles[styleNumber].font;
+ surface->MeasureWidths(fontStyle, s + startSegment, lenSegment, positions + startSegment);
for (unsigned int inSeg = 0; inSeg < lenSegment; inSeg++) {
positions[startSegment + inSeg] += xStartSegment;
}
@@ -675,7 +674,8 @@ void PositionCache::MeasureWidths(Surface *surface, ViewStyle &vstyle, unsigned
startSegment += lenSegment;
}
} else {
- surface->MeasureWidths(vstyle.styles[styleNumber].font, s, len, positions);
+ FontAlias fontStyle = vstyle.styles[styleNumber].font;
+ surface->MeasureWidths(fontStyle, s, len, positions);
}
if (probe < pces.size()) {
// Store into cache
diff --git a/scintilla/src/PositionCache.h b/scintilla/src/PositionCache.h
index 8c9a430..8148563 100644
--- a/scintilla/src/PositionCache.h
+++ b/scintilla/src/PositionCache.h
@@ -34,7 +34,6 @@ public:
enum validLevel { llInvalid, llCheckTextAndStyle, llPositions, llLines } validity;
int xHighlightGuide;
bool highlightColumn;
- Selection *psel;
bool containsCaret;
int edgeColumn;
char *chars;
@@ -43,8 +42,7 @@ public:
char bracePreviousStyles[2];
// Hotspot support
- int hsStart;
- int hsEnd;
+ Range hotspot;
// Wrapped line support
int widthLine;
@@ -61,9 +59,9 @@ public:
Range SubLineRange(int line) const;
bool InLine(int offset, int line) const;
void SetLineStart(int line, int start);
- void SetBracesHighlight(Range rangeLine, Position braces[],
+ void SetBracesHighlight(Range rangeLine, const Position braces[],
char bracesMatchStyle, int xHighlight, bool ignoreStyle);
- void RestoreBracesHighlight(Range rangeLine, Position braces[], bool ignoreStyle);
+ void RestoreBracesHighlight(Range rangeLine, const Position braces[], bool ignoreStyle);
int FindBefore(XYPOSITION x, int lower, int upper) const;
int FindPositionFromX(XYPOSITION x, Range range, bool charPosition) const;
Point PointFromPosition(int posInLine, int lineHeight) const;
@@ -130,7 +128,7 @@ public:
SpecialRepresentations();
void SetRepresentation(const char *charBytes, const char *value);
void ClearRepresentation(const char *charBytes);
- Representation *RepresentationFromCharacter(const char *charBytes, size_t len);
+ const Representation *RepresentationFromCharacter(const char *charBytes, size_t len) const;
bool Contains(const char *charBytes, size_t len) const;
void Clear();
};
@@ -138,8 +136,8 @@ public:
struct TextSegment {
int start;
int length;
- Representation *representation;
- TextSegment(int start_=0, int length_=0, Representation *representation_=0) :
+ const Representation *representation;
+ TextSegment(int start_=0, int length_=0, const Representation *representation_=0) :
start(start_), length(length_), representation(representation_) {
}
int end() const {
@@ -149,7 +147,7 @@ struct TextSegment {
// Class to break a line of text into shorter runs at sensible places.
class BreakFinder {
- LineLayout *ll;
+ const LineLayout *ll;
int lineStart;
int lineEnd;
int posLineStart;
@@ -158,9 +156,9 @@ class BreakFinder {
unsigned int saeCurrentPos;
int saeNext;
int subBreak;
- Document *pdoc;
+ const Document *pdoc;
EncodingFamily encodingFamily;
- SpecialRepresentations *preprs;
+ const SpecialRepresentations *preprs;
void Insert(int val);
// Private so BreakFinder objects can not be copied
BreakFinder(const BreakFinder &);
@@ -170,8 +168,8 @@ public:
enum { lengthStartSubdivision = 300 };
// Try to make each subdivided run lengthEachSubdivision or shorter.
enum { lengthEachSubdivision = 100 };
- BreakFinder(LineLayout *ll_, int lineStart_, int lineEnd_, int posLineStart_,
- int xStart, bool breakForSelection, Document *pdoc_, SpecialRepresentations *preprs_);
+ BreakFinder(const LineLayout *ll_, const Selection *psel, int lineStart_, int lineEnd_, int posLineStart_,
+ int xStart, bool breakForSelection, const Document *pdoc_, const SpecialRepresentations *preprs_);
~BreakFinder();
TextSegment Next();
bool More() const;
@@ -189,7 +187,7 @@ public:
void Clear();
void SetSize(size_t size_);
size_t GetSize() const { return pces.size(); }
- void MeasureWidths(Surface *surface, ViewStyle &vstyle, unsigned int styleNumber,
+ void MeasureWidths(Surface *surface, const ViewStyle &vstyle, unsigned int styleNumber,
const char *s, unsigned int len, XYPOSITION *positions, Document *pdoc);
};
diff --git a/scintilla/src/Selection.cxx b/scintilla/src/Selection.cxx
index 6465aae..656d754 100644
--- a/scintilla/src/Selection.cxx
+++ b/scintilla/src/Selection.cxx
@@ -226,10 +226,18 @@ SelectionRange &Selection::Range(size_t r) {
return ranges[r];
}
+const SelectionRange &Selection::Range(size_t r) const {
+ return ranges[r];
+}
+
SelectionRange &Selection::RangeMain() {
return ranges[mainRange];
}
+const SelectionRange &Selection::RangeMain() const {
+ return ranges[mainRange];
+}
+
SelectionPosition Selection::Start() const {
if (IsRectangular()) {
return rangeRectangular.Start();
diff --git a/scintilla/src/Selection.h b/scintilla/src/Selection.h
index eb74481..4996702 100644
--- a/scintilla/src/Selection.h
+++ b/scintilla/src/Selection.h
@@ -156,7 +156,9 @@ public:
size_t Main() const;
void SetMain(size_t r);
SelectionRange &Range(size_t r);
+ const SelectionRange &Range(size_t r) const;
SelectionRange &RangeMain();
+ const SelectionRange &RangeMain() const;
SelectionPosition Start() const;
bool MoveExtends() const;
void SetMoveExtends(bool moveExtends_);
diff --git a/scintilla/src/Style.cxx b/scintilla/src/Style.cxx
index e12bdd1..2552276 100644
--- a/scintilla/src/Style.cxx
+++ b/scintilla/src/Style.cxx
@@ -19,6 +19,10 @@ using namespace Scintilla;
FontAlias::FontAlias() {
}
+FontAlias::FontAlias(const FontAlias &other) : Font() {
+ SetID(other.fid);
+}
+
FontAlias::~FontAlias() {
SetID(0);
// ~Font will not release the actual font resource since it is now 0
diff --git a/scintilla/src/Style.h b/scintilla/src/Style.h
index 5f520e7..a4be6d9 100644
--- a/scintilla/src/Style.h
+++ b/scintilla/src/Style.h
@@ -33,11 +33,11 @@ struct FontSpecification {
// Just like Font but only has a copy of the FontID so should not delete it
class FontAlias : public Font {
- // Private so FontAlias objects can not be copied
- FontAlias(const FontAlias &);
+ // Private so FontAlias objects can not be assigned except for intiialization
FontAlias &operator=(const FontAlias &);
public:
FontAlias();
+ FontAlias(const FontAlias &);
virtual ~FontAlias();
void MakeAlias(Font &fontOrigin);
void ClearFont();
diff --git a/scintilla/src/ViewStyle.cxx b/scintilla/src/ViewStyle.cxx
index ee654f7..59a1375 100644
--- a/scintilla/src/ViewStyle.cxx
+++ b/scintilla/src/ViewStyle.cxx
@@ -434,6 +434,43 @@ void ViewStyle::CalcLargestMarkerHeight() {
}
}
+// See if something overrides the line background color: Either if caret is on the line
+// and background color is set for that, or if a marker is defined that forces its background
+// color onto the line, or if a marker is defined but has no selection margin in which to
+// display itself (as long as it's not an SC_MARK_EMPTY marker). These are checked in order
+// with the earlier taking precedence. When multiple markers cause background override,
+// the color for the highest numbered one is used.
+ColourOptional ViewStyle::Background(int marksOfLine, bool caretActive, bool lineContainsCaret) const {
+ ColourOptional background;
+ if ((caretActive || alwaysShowCaretLineBackground) && showCaretLineBackground && (caretLineAlpha == SC_ALPHA_NOALPHA) && lineContainsCaret) {
+ background = ColourOptional(caretLineBackground, true);
+ }
+ if (!background.isSet && marksOfLine) {
+ int marks = marksOfLine;
+ for (int markBit = 0; (markBit < 32) && marks; markBit++) {
+ if ((marks & 1) && (markers[markBit].markType == SC_MARK_BACKGROUND) &&
+ (markers[markBit].alpha == SC_ALPHA_NOALPHA)) {
+ background = ColourOptional(markers[markBit].back, true);
+ }
+ marks >>= 1;
+ }
+ }
+ if (!background.isSet && maskInLine) {
+ int marksMasked = marksOfLine & maskInLine;
+ if (marksMasked) {
+ for (int markBit = 0; (markBit < 32) && marksMasked; markBit++) {
+ if ((marksMasked & 1) && (markers[markBit].markType != SC_MARK_EMPTY) &&
+ (markers[markBit].alpha == SC_ALPHA_NOALPHA)) {
+ background = ColourOptional(markers[markBit].back, true);
+ }
+ marksMasked >>= 1;
+ }
+ }
+ }
+ return background;
+}
+
+
ColourDesired ViewStyle::WrapColour() const {
if (whitespaceColours.fore.isSet)
return whitespaceColours.fore;
diff --git a/scintilla/src/ViewStyle.h b/scintilla/src/ViewStyle.h
index d6e4311..ac513c8 100644
--- a/scintilla/src/ViewStyle.h
+++ b/scintilla/src/ViewStyle.h
@@ -169,6 +169,7 @@ public:
int ExternalMarginWidth() const;
bool ValidStyle(size_t styleIndex) const;
void CalcLargestMarkerHeight();
+ ColourOptional Background(int marksOfLine, bool caretActive, bool lineContainsCaret) const;
ColourDesired WrapColour() const;
bool SetWrapState(int wrapState_);
bool SetWrapVisualFlags(int wrapVisualFlags_);
diff --git a/scintilla/version.txt b/scintilla/version.txt
index 44c7d8a..ce295f4 100644
--- a/scintilla/version.txt
+++ b/scintilla/version.txt
@@ -1 +1 @@
-343
+344
diff --git a/scintilla/win32/ScintillaWin.cxx b/scintilla/win32/ScintillaWin.cxx
index 8f28218..db027ae 100644
--- a/scintilla/win32/ScintillaWin.cxx
+++ b/scintilla/win32/ScintillaWin.cxx
@@ -553,6 +553,31 @@ static int KeyTranslate(int keyIn) {
}
}
+static bool BoundsContains(PRectangle rcBounds, HRGN hRgnBounds, PRectangle rcCheck) {
+ bool contains = true;
+ if (!rcCheck.Empty()) {
+ if (!rcBounds.Contains(rcCheck)) {
+ contains = false;
+ } else if (hRgnBounds) {
+ // In bounding rectangle so check more accurately using region
+ HRGN hRgnCheck = ::CreateRectRgn(static_cast<int>(rcCheck.left), static_cast<int>(rcCheck.top),
+ static_cast<int>(rcCheck.right), static_cast<int>(rcCheck.bottom));
+ if (hRgnCheck) {
+ HRGN hRgnDifference = ::CreateRectRgn(0, 0, 0, 0);
+ if (hRgnDifference) {
+ int combination = ::CombineRgn(hRgnDifference, hRgnCheck, hRgnBounds, RGN_DIFF);
+ if (combination != NULLREGION) {
+ contains = false;
+ }
+ ::DeleteRgn(hRgnDifference);
+ }
+ ::DeleteRgn(hRgnCheck);
+ }
+ }
+ }
+ return contains;
+}
+
LRESULT ScintillaWin::WndPaint(uptr_t wParam) {
//ElapsedTime et;
@@ -576,7 +601,7 @@ LRESULT ScintillaWin::WndPaint(uptr_t wParam) {
}
rcPaint = PRectangle::FromInts(pps->rcPaint.left, pps->rcPaint.top, pps->rcPaint.right, pps->rcPaint.bottom);
PRectangle rcClient = GetClientRectangle();
- paintingAllText = rcPaint.Contains(rcClient);
+ paintingAllText = BoundsContains(rcPaint, hRgnUpdate, rcClient);
if (technology == SC_TECHNOLOGY_DEFAULT) {
AutoSurface surfaceWindow(pps->hdc, this);
if (surfaceWindow) {
@@ -1346,27 +1371,10 @@ void ScintillaWin::SetTrackMouseLeaveEvent(bool on) {
}
bool ScintillaWin::PaintContains(PRectangle rc) {
- bool contains = true;
- if ((paintState == painting) && (!rc.Empty())) {
- if (!rcPaint.Contains(rc)) {
- contains = false;
- } else {
- // In bounding rectangle so check more accurately using region
- HRGN hRgnRange = ::CreateRectRgn(static_cast<int>(rc.left), static_cast<int>(rc.top), static_cast<int>(rc.right), static_cast<int>(rc.bottom));
- if (hRgnRange) {
- HRGN hRgnDest = ::CreateRectRgn(0, 0, 0, 0);
- if (hRgnDest) {
- int combination = ::CombineRgn(hRgnDest, hRgnRange, hRgnUpdate, RGN_DIFF);
- if (combination != NULLREGION) {
- contains = false;
- }
- ::DeleteRgn(hRgnDest);
- }
- ::DeleteRgn(hRgnRange);
- }
- }
+ if (paintState == painting) {
+ return BoundsContains(rcPaint, hRgnUpdate, rc);
}
- return contains;
+ return true;
}
void ScintillaWin::ScrollText(int /* linesToMove */) {