+ upd: Scintilla Library updated to version v4.1.3

This commit is contained in:
Rainer Kottenhoff 2019-01-10 13:42:07 +01:00
parent 5f00e3d1cd
commit bfc0921fd9
18 changed files with 87 additions and 54 deletions

View File

@ -10,6 +10,9 @@ useInitializationList
// produces same result on empty collections
useStlAlgorithm
// cppcheck 1.86 seems to be misunderstanding flow control in the large switch statement
knownConditionTrueFalse:scintilla/src/Editor.cxx
// Some non-explicit constructors are used for conversions or are private to lexers
noExplicitConstructor
@ -26,6 +29,7 @@ passedByValue
// Suppress most lexer warnings since the lexers are maintained by others
redundantCondition:scintilla/lexers/LexA68k.cxx
useInitializationList:scintilla/lexers/LexAsm.cxx
shadowVar:scintilla/lexers/LexAU3.cxx
useInitializationList:scintilla/lexers/LexBasic.cxx
uninitMemberVar:scintilla/lexers/LexBash.cxx
variableScope:scintilla/lexers/LexBash.cxx
@ -33,6 +37,7 @@ variableScope:scintilla/lexers/LexBatch.cxx
variableScope:scintilla/lexers/LexCmake.cxx
variableScope:scintilla/lexers/LexCSS.cxx
useInitializationList:scintilla/lexers/LexD.cxx
unreadVariable:scintilla/lexers/LexDMAP.cxx
variableScope:scintilla/lexers/LexErlang.cxx
variableScope:scintilla/lexers/LexGui4Cli.cxx
variableScope:scintilla/lexers/LexInno.cxx
@ -45,7 +50,9 @@ variableScope:scintilla/lexers/LexNimrod.cxx
variableScope:scintilla/lexers/LexNsis.cxx
variableScope:scintilla/lexers/LexOpal.cxx
variableScope:scintilla/lexers/LexPB.cxx
shadowVar:scintilla/lexers/LexPowerPro.cxx
variableScope:scintilla/lexers/LexProgress.cxx
redundantAssignment:scintilla/lexers/LexRegistry.cxx
variableScope:scintilla/lexers/LexRuby.cxx
uninitMemberVar:scintilla/lexers/LexRuby.cxx
variableScope:scintilla/lexers/LexSpecman.cxx
@ -53,10 +60,13 @@ clarifyCalculation:scintilla/lexers/LexTADS3.cxx
invalidscanf:scintilla/lexers/LexTCMD.cxx
knownConditionTrueFalse:scintilla/lexers/LexTCMD.cxx
variableScope:scintilla/lexers/LexTeX.cxx
knownConditionTrueFalse:scintilla/lexers/LexVerilog.cxx
shadowVar:scintilla/lexers/LexVHDL.cxx
variableScope:scintilla/lexers/LexVHDL.cxx
unreadVariable:scintilla/lexers/LexVisualProlog.cxx
// Suppress everything in catch.hpp as won't be changing
*:scintilla/test/unit/catch.hpp
preprocessorErrorDirective:scintilla/test/unit/*.cxx
syntaxError:scintilla/test/unit/unitTest.cxx
// For now, suppress all test source files as, since Catch 2, cppcheck shows many warnings showing
// it doesn't understand the REQUIRE macro
*:scintilla/test/unit/*.cxx

View File

@ -26,9 +26,9 @@
<table bgcolor="#CCCCCC" width="100%" cellspacing="0" cellpadding="8" border="0">
<tr>
<td>
<font size="4"> <a href="https://www.scintilla.org/scintilla412.zip">
<font size="4"> <a href="https://www.scintilla.org/scintilla413.zip">
Windows</a>&nbsp;&nbsp;
<a href="https://www.scintilla.org/scintilla412.tgz">
<a href="https://www.scintilla.org/scintilla413.tgz">
GTK+/Linux</a>&nbsp;&nbsp;
</font>
</td>
@ -42,7 +42,7 @@
containing very few restrictions.
</p>
<h3>
Release 4.1.2
Release 4.1.3
</h3>
<h4>
Source Code
@ -50,8 +50,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="https://www.scintilla.org/scintilla412.zip">zip format</a> (1600K) commonly used on Windows</li>
<li><a href="https://www.scintilla.org/scintilla412.tgz">tgz format</a> (1400K) commonly used on Linux and compatible operating systems</li>
<li><a href="https://www.scintilla.org/scintilla413.zip">zip format</a> (1600K) commonly used on Windows</li>
<li><a href="https://www.scintilla.org/scintilla413.tgz">tgz format</a> (1400K) 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>

View File

@ -555,6 +555,9 @@
<a href="https://www.scintilla.org/scite413.zip">Release 4.1.3</a>
</h3>
<ul>
<li>
Released 10 January 2019.
</li>
<li>
Add SCI_SETCOMMANDEVENTS API to allow turning off command events as they
can be a significant performance cost.
@ -566,6 +569,11 @@
<li>
Updated case conversion and character categories to Unicode 11.
</li>
<li>
Errorlist lexer recognizes negative line numbers as some programs show whole-file
errors occurring on line -1.
SciTE's parsing of diagnostics also updated to handle this case.
</li>
<li>
Added "nim" lexer (SCLEX_NIM) for the Nim language which was previously called Nimrod.
For compatibility, the old "nimrod" lexer is still present but is deprecated and will be removed at the
@ -587,6 +595,10 @@
<a href="https://sourceforge.net/p/scintilla/bugs/2069/">Bug #2069</a>.
</li>
<li>
The EDIFACT lexer handles message groups as well as messages.
<a href="https://sourceforge.net/p/scintilla/feature-requests/1247/">Feature #1247</a>.
</li>
<li>
For SciTE's Find in Files, allow case-sensitivity and whole-word options when running
a user defined command.
<a href="https://sourceforge.net/p/scintilla/bugs/2053/">Bug #2053</a>.
@ -595,6 +607,10 @@
Notify with SC_UPDATE_SELECTION when user performs a multiple selection add.
</li>
<li>
On macOS 10.14 Cocoa, fix incorrect horizontal offset.
<a href="https://sourceforge.net/p/scintilla/bugs/2022/">Bug #2022</a>.
</li>
<li>
On Cocoa, fix a crash that occurred when entering a dead key diacritic then a character
that can not take that diacritic, such as option+e (acute accent) followed by g.
<a href="https://sourceforge.net/p/scintilla/bugs/2061/">Bug #2061</a>.
@ -615,6 +631,10 @@
Improve performance of text insertion when Unicode line indexing off.
</li>
<li>
For Qt on Windows, stop specifying -std:c++latest as that is no longer needed
to enable C++17 with MSVC 2017 and Qt 5.12 and it caused duplicate flag warnings.
</li>
<li>
On Linux, enable Lua to access dynamic libraries.
<a href="https://sourceforge.net/p/scintilla/bugs/2058/">Bug #2058</a>.
</li>

View File

@ -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="20181002" />
<meta name="Date.Modified" content="20190110" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<style type="text/css">
#versionlist {
@ -56,8 +56,8 @@
GTK+, and OS X</font>
</td>
<td width="40%" align="right">
<font color="#FFCC99" size="3"> Release version 4.1.2<br />
Site last modified October 2 2018</font>
<font color="#FFCC99" size="3"> Release version 4.1.3<br />
Site last modified January 10 2019</font>
</td>
<td width="20%">
&nbsp;
@ -72,11 +72,10 @@
</tr>
</table>
<ul id="versionlist">
<li>Version 4.1.3 is compatible with macOS 10.14, improves performance, and adds a new lexer for Nim which will replace the "nimrod" lexer.</li>
<li>Version 4.1.2 is a minor release.</li>
<li>Version 4.1.1 adds optional indexing of line starts in UTF-8 documents by UTF-32 code points and UTF-16 code units.</li>
<li>Version 4.1.0 adds experimental support for bidirectional text as used by Arabic and Hebrew on Win32 and Cocoa.</li>
<li>Version 4.0.5 adds experimental support for documents larger than 2 GigaBytes.</li>
<li>Version 4.0.4 adds a lexer for Maxima.</li>
</ul>
<ul id="menu">
<li id="remote1"><a href="https://www.scintilla.org/SciTEImage.html">Screenshot</a></li>

View File

@ -25,28 +25,30 @@
using namespace Scintilla;
static bool strstart(const char *haystack, const char *needle) {
namespace {
bool strstart(const char *haystack, const char *needle) noexcept {
return strncmp(haystack, needle, strlen(needle)) == 0;
}
static bool Is0To9(char ch) {
constexpr bool Is0To9(char ch) noexcept {
return (ch >= '0') && (ch <= '9');
}
static bool Is1To9(char ch) {
constexpr bool Is1To9(char ch) noexcept {
return (ch >= '1') && (ch <= '9');
}
static bool IsAlphabetic(int ch) {
bool IsAlphabetic(int ch) {
return IsASCII(ch) && isalpha(ch);
}
static inline bool AtEOL(Accessor &styler, Sci_PositionU i) {
inline bool AtEOL(Accessor &styler, Sci_PositionU i) {
return (styler[i] == '\n') ||
((styler[i] == '\r') && (styler.SafeGetCharAt(i + 1) != '\n'));
}
static int RecogniseErrorListLine(const char *lineBuffer, Sci_PositionU lengthLine, Sci_Position &startValue) {
int RecogniseErrorListLine(const char *lineBuffer, Sci_PositionU lengthLine, Sci_Position &startValue) {
if (lineBuffer[0] == '>') {
// Command or return status
return SCE_ERR_CMD;
@ -175,7 +177,7 @@ static int RecogniseErrorListLine(const char *lineBuffer, Sci_PositionU lengthLi
canBeCtags = false;
}
} else if (state == stGccStart) { // <filename>:
state = Is0To9(ch) ? stGccDigit : stUnrecognized;
state = ((ch == '-') || Is0To9(ch)) ? stGccDigit : stUnrecognized;
} else if (state == stGccDigit) { // <filename>:<line>
if (ch == ':') {
state = stGccColumn; // :9.*: is GCC
@ -206,14 +208,13 @@ static int RecogniseErrorListLine(const char *lineBuffer, Sci_PositionU lengthLi
} else if ((ch == ':' && chNext == ' ') || (ch == ' ')) {
// Possibly Delphi.. don't test against chNext as it's one of the strings below.
char word[512];
Sci_PositionU j, chPos;
unsigned numstep;
chPos = 0;
if (ch == ' ')
numstep = 1; // ch was ' ', handle as if it's a delphi errorline, only add 1 to i.
else
numstep = 2; // otherwise add 2.
for (j = i + numstep; j < lengthLine && IsAlphabetic(lineBuffer[j]) && chPos < sizeof(word) - 1; j++)
Sci_PositionU chPos = 0;
for (Sci_PositionU j = i + numstep; j < lengthLine && IsAlphabetic(lineBuffer[j]) && chPos < sizeof(word) - 1; j++)
word[chPos++] = lineBuffer[j];
word[chPos] = 0;
if (!CompareCaseInsensitive(word, "error") || !CompareCaseInsensitive(word, "warning") ||
@ -268,13 +269,11 @@ static int RecogniseErrorListLine(const char *lineBuffer, Sci_PositionU lengthLi
#define CSI "\033["
namespace {
bool SequenceEnd(int ch) {
constexpr bool SequenceEnd(int ch) noexcept {
return (ch == 0) || ((ch >= '@') && (ch <= '~'));
}
int StyleFromSequence(const char *seq) {
int StyleFromSequence(const char *seq) noexcept {
int bold = 0;
int colour = 0;
while (!SequenceEnd(*seq)) {
@ -301,9 +300,7 @@ int StyleFromSequence(const char *seq) {
return SCE_ERR_ES_BLACK + bold * 8 + colour;
}
}
static void ColouriseErrorListLine(
void ColouriseErrorListLine(
char *lineBuffer,
Sci_PositionU lengthLine,
Sci_PositionU endPos,
@ -311,7 +308,7 @@ static void ColouriseErrorListLine(
bool valueSeparate,
bool escapeSequences) {
Sci_Position startValue = -1;
int style = RecogniseErrorListLine(lineBuffer, lengthLine, startValue);
const int style = RecogniseErrorListLine(lineBuffer, lengthLine, startValue);
if (escapeSequences && strstr(lineBuffer, CSI)) {
const Sci_Position startPos = endPos - lengthLine;
const char *linePortion = lineBuffer;
@ -354,7 +351,7 @@ static void ColouriseErrorListLine(
}
}
static void ColouriseErrorListDoc(Sci_PositionU startPos, Sci_Position length, int, WordList *[], Accessor &styler) {
void ColouriseErrorListDoc(Sci_PositionU startPos, Sci_Position length, int, WordList *[], Accessor &styler) {
char lineBuffer[10000];
styler.StartAt(startPos);
styler.StartSegment(startPos);
@ -386,8 +383,10 @@ static void ColouriseErrorListDoc(Sci_PositionU startPos, Sci_Position length, i
}
}
static const char *const emptyWordListDesc[] = {
0
const char *const emptyWordListDesc[] = {
nullptr
};
}
LexerModule lmErrorList(SCLEX_ERRORLIST, ColouriseErrorListDoc, "errorlist", 0, emptyWordListDesc);

View File

@ -297,6 +297,7 @@ void SCI_METHOD LexerNim::Lex(Sci_PositionU startPos, Sci_Position length,
int decimalCount = 0;
bool funcNameExists = false;
bool isStylingRawString = false;
for (; sc.More(); sc.Forward()) {
if (sc.atLineStart) {
@ -310,7 +311,7 @@ void SCI_METHOD LexerNim::Lex(Sci_PositionU startPos, Sci_Position length,
// Handle string line continuation
if (sc.ch == '\\' && (sc.chNext == '\n' || sc.chNext == '\r') &&
(sc.state == SCE_NIM_STRING || sc.state == SCE_NIM_CHARACTER)) {
(sc.state == SCE_NIM_STRING || sc.state == SCE_NIM_CHARACTER) && !isStylingRawString) {
sc.Forward();
if (sc.ch == '\r' && sc.chNext == '\n') {
@ -477,7 +478,7 @@ void SCI_METHOD LexerNim::Lex(Sci_PositionU startPos, Sci_Position length,
}
break;
case SCE_NIM_STRING:
if (sc.ch == '\\') {
if (sc.ch == '\\' && !isStylingRawString) {
if (sc.chNext == '\"' || sc.chNext == '\'' || sc.chNext == '\\') {
sc.Forward();
}
@ -543,11 +544,15 @@ void SCI_METHOD LexerNim::Lex(Sci_PositionU startPos, Sci_Position length,
}
// Raw string
else if ((sc.ch == 'r' || sc.ch == 'R') && sc.chNext == '\"') {
isStylingRawString = true;
sc.SetState(SCE_NIM_STRING);
sc.Forward();
}
// String and triple double literal
else if (sc.ch == '\"') {
isStylingRawString = false;
if (sc.Match(R"(""")")) {
sc.SetState(SCE_NIM_TRIPLEDOUBLE);
} else {

View File

@ -117,7 +117,7 @@ static int ExpandAllInPlace(const PropSetSimple &props, std::string &withVars, i
innerVarStart = withVars.find("$(", varStart+2);
}
std::string var(withVars.c_str(), varStart + 2, varEnd - varStart - 2);
std::string var(withVars, varStart + 2, varEnd - varStart - 2);
std::string val = props.Get(var.c_str());
if (blankVars.contains(var.c_str())) {

View File

@ -600,7 +600,7 @@ public:
}
virtual ~CaseConverter() = default;
bool Initialised() const {
return characters.size() > 0;
return !characters.empty();
}
void Add(int character, const char *conversion) {
characterToConversion.emplace_back(character, conversion);

View File

@ -211,7 +211,7 @@ Sci::Line ContractionState<LINE>::DocFromDisplay(Sci::Line lineDisplay) const {
template <typename LINE>
void ContractionState<LINE>::InsertLines(Sci::Line lineDoc, Sci::Line lineCount) {
for (int l = 0; l < lineCount; l++) {
for (Sci::Line l = 0; l < lineCount; l++) {
InsertLine(lineDoc + l);
}
Check();

View File

@ -927,8 +927,8 @@ Sci::Position Document::GetRelativePositionUTF16(Sci::Position positionStart, Sc
int SCI_METHOD Document::GetCharacterAndWidth(Sci_Position position, Sci_Position *pWidth) const {
int character;
int bytesInCharacter = 1;
const unsigned char leadByte = cb.UCharAt(position);
if (dbcsCodePage) {
const unsigned char leadByte = cb.UCharAt(position);
if (SC_CP_UTF8 == dbcsCodePage) {
if (UTF8IsAscii(leadByte)) {
// Single byte character or invalid
@ -956,7 +956,7 @@ int SCI_METHOD Document::GetCharacterAndWidth(Sci_Position position, Sci_Positio
}
}
} else {
character = cb.CharAt(position);
character = leadByte;
}
if (pWidth) {
*pWidth = bytesInCharacter;
@ -3191,7 +3191,7 @@ const char *BuiltinRegex::SubstituteByPosition(Document *doc, const char *text,
substituted.clear();
const DocumentIndexer di(doc, doc->Length());
search.GrabMatches(di);
for (int j = 0; j < *length; j++) {
for (Sci::Position j = 0; j < *length; j++) {
if (text[j] == '\\') {
if (text[j + 1] >= '0' && text[j + 1] <= '9') {
const unsigned int patNum = text[j + 1] - '0';

View File

@ -976,7 +976,7 @@ void EditView::DrawEOL(Surface *surface, const EditModel &model, const ViewStyle
int alpha = SC_ALPHA_NOALPHA;
if (!hideSelection) {
const Sci::Position posAfterLineEnd = model.pdoc->LineStart(line + 1);
eolInSelection = (lastSubLine == true) ? model.sel.InSelectionForEOL(posAfterLineEnd) : 0;
eolInSelection = lastSubLine ? model.sel.InSelectionForEOL(posAfterLineEnd) : 0;
alpha = (eolInSelection == 1) ? vsDraw.selAlpha : vsDraw.selAdditionalAlpha;
}

View File

@ -5781,7 +5781,7 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) {
if (wParam == 0)
return 0;
char *ptr = CharPtrFromSPtr(lParam);
unsigned int iChar = 0;
size_t iChar = 0;
for (; iChar < wParam - 1; iChar++)
ptr[iChar] = pdoc->CharAt(iChar);
ptr[iChar] = '\0';
@ -5915,7 +5915,7 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) {
return selectedText.LengthWithTerminator();
} else {
char *ptr = CharPtrFromSPtr(lParam);
unsigned int iChar = 0;
size_t iChar = 0;
if (selectedText.Length()) {
for (; iChar < selectedText.LengthWithTerminator(); iChar++)
ptr[iChar] = selectedText.Data()[iChar];

View File

@ -683,7 +683,7 @@ PositionCacheEntry::PositionCacheEntry(const PositionCacheEntry &other) :
}
void PositionCacheEntry::Set(unsigned int styleNumber_, const char *s_,
unsigned int len_, XYPOSITION *positions_, unsigned int clock_) {
unsigned int len_, const XYPOSITION *positions_, unsigned int clock_) {
Clear();
styleNumber = styleNumber_;
len = len_;

View File

@ -192,7 +192,7 @@ public:
void operator=(const PositionCacheEntry &) = delete;
void operator=(PositionCacheEntry &&) = delete;
~PositionCacheEntry();
void Set(unsigned int styleNumber_, const char *s_, unsigned int len_, XYPOSITION *positions_, unsigned int clock_);
void Set(unsigned int styleNumber_, const char *s_, unsigned int len_, const XYPOSITION *positions_, unsigned int clock_);
void Clear();
bool Retrieve(unsigned int styleNumber_, const char *s_, unsigned int len_, XYPOSITION *positions_) const;
static unsigned int Hash(unsigned int styleNumber_, const char *s, unsigned int len_);

View File

@ -250,7 +250,7 @@ DISTANCE RunStyles<DISTANCE, STYLE>::Runs() const noexcept {
template <typename DISTANCE, typename STYLE>
bool RunStyles<DISTANCE, STYLE>::AllSame() const noexcept {
for (int run = 1; run < starts->Partitions(); run++) {
for (DISTANCE run = 1; run < starts->Partitions(); run++) {
if (styles->ValueAt(run) != styles->ValueAt(run - 1))
return false;
}
@ -300,7 +300,7 @@ void RunStyles<DISTANCE, STYLE>::Check() const {
if (styles->ValueAt(styles->Length()-1) != 0) {
throw std::runtime_error("RunStyles: Unused style at end changed.");
}
for (int j=1; j<styles->Length()-1; j++) {
for (ptrdiff_t j=1; j<styles->Length()-1; j++) {
if (styles->ValueAt(j) == styles->ValueAt(j-1)) {
throw std::runtime_error("RunStyles: Style of a partition same as previous.");
}

View File

@ -406,7 +406,7 @@ void ViewStyle::ResetDefaultStyle() {
void ViewStyle::ClearStyles() {
// Reset all styles to be like the default style
for (unsigned int i=0; i<styles.size(); i++) {
for (size_t i=0; i<styles.size(); i++) {
if (i != STYLE_DEFAULT) {
styles[i].ClearTo(styles[STYLE_DEFAULT]);
}

View File

@ -1 +1 @@
412
413

View File

@ -1115,7 +1115,7 @@ public:
SurfaceD2D(SurfaceD2D &&) = delete;
SurfaceD2D &operator=(const SurfaceD2D &) = delete;
SurfaceD2D &operator=(SurfaceD2D &&) = delete;
virtual ~SurfaceD2D() override;
~SurfaceD2D() override;
void SetScale();
void Init(WindowID wid) override;
@ -1274,9 +1274,9 @@ void SurfaceD2D::PenColour(ColourDesired fore) {
void SurfaceD2D::D2DPenColour(ColourDesired fore, int alpha) {
if (pRenderTarget) {
D2D_COLOR_F col;
col.r = (fore.AsInteger() & 0xff) / 255.0f;
col.g = ((fore.AsInteger() & 0xff00) >> 8) / 255.0f;
col.b = (fore.AsInteger() >> 16) / 255.0f;
col.r = fore.GetRedComponent();
col.g = fore.GetGreenComponent();
col.b = fore.GetBlueComponent();
col.a = alpha / 255.0f;
if (pBrush) {
pBrush->SetColor(col);