Update scintilla 5.3.4 and lexilla 5.2.4 with:

https://www.scintilla.org/scintilla534.zip

    Released 8 March 2023.
    Add multithreaded wrap to significantly improve performance of wrapping large files.
    More typesafe bindings of *Full APIs in ScintillaCall. Feature #1477.
    Fix overlapping of text with line end wrap marker. Bug #2378.
    Fix clipping of line end wrap symbol for SC_WRAPVISUALFLAGLOC_END_BY_TEXT.
    Where a multi-byte character contains multiple styles, display each byte as a representation. This makes it easier to see and fix lexers that change styles mid-character, commonly because they use fixed size buffers.
    Fix a potential crash with autocompletion list fill-ups where a SCN_CHARADDED handler retriggered an autocompletion list, but with no items that match the typed character.

lexilla523

    Released 8 March 2023.
    Add scripts/PromoteNew.bat script to promote .new files after checking.
    Makefile: Remove 1024-byte line length limit..
    Ruby: Add new lexical classes for % literals SCE_RB_STRING_W (%w non-interpolable string array), SCE_RB_STRING_I (%i non-interpolable symbol array), SCE_RB_STRING_QI (%I interpolable symbol array), and SCE_RB_STRING_QS (%s symbol). Issue #124.
    Ruby: Disambiguate %= which may be a quote or modulo assignment. Issue #124, Bug #1255, Bug #2182.
    Ruby: Fix additional fold level for single character in SCE_RB_STRING_QW. Issue #132.
    Ruby: Set SCE_RB_HERE_QQ for unquoted and double-quoted heredocs and SCE_RB_HERE_QX for backticks-quoted heredocs. Issue #134.
    Ruby: Recognise #{} inside SCE_RB_HERE_QQ and SCE_RB_HERE_QX. Issue #134.
    Ruby: Improve regex and heredoc recognition. Issue #136.
    Ruby: Highlight #@, #@@ and #$ style interpolation. Issue #140.
    Ruby: Fix folding for multiple heredocs started on one line. Fix folding when there is a space after heredoc opening delimiter. Issue #135.
    YAML: Remove 1024-byte line length limit.

https://www.scintilla.org/lexilla524.zip

    Released 13 March 2023.
    C++: Fix failure to recognize keywords containing upper case. Issue #149.
    GDScript: Support % and $ node paths. Issue #145, Pull request #146.

Close #13338
This commit is contained in:
Christian Grasser 2023-03-10 03:37:21 +01:00 committed by Don Ho
parent 12f649bf54
commit feb454ad6f
128 changed files with 2048 additions and 825 deletions

View File

@ -29,6 +29,7 @@
**.vb text **.vb text
**.cmake text **.cmake text
**.d text **.d text
**.diff text
**.erl text **.erl text
**.gd text **.gd text
**.gui text **.gui text

View File

@ -61,7 +61,6 @@ unreadVariable:lexilla/lexers/LexJulia.cxx
variableScope:lexilla/lexers/LexJulia.cxx variableScope:lexilla/lexers/LexJulia.cxx
variableScope:lexilla/lexers/LexLaTeX.cxx variableScope:lexilla/lexers/LexLaTeX.cxx
constParameter:lexilla/lexers/LexLaTeX.cxx constParameter:lexilla/lexers/LexLaTeX.cxx
constParameter:lexilla/lexers/LexLisp.cxx
constParameter:lexilla/lexers/LexMagik.cxx constParameter:lexilla/lexers/LexMagik.cxx
constParameter:lexilla/lexers/LexMatlab.cxx constParameter:lexilla/lexers/LexMatlab.cxx
unreadVariable:lexilla/lexers/LexMatlab.cxx unreadVariable:lexilla/lexers/LexMatlab.cxx
@ -89,8 +88,8 @@ constParameter:lexilla/lexers/LexRaku.cxx
variableScope:lexilla/lexers/LexRaku.cxx variableScope:lexilla/lexers/LexRaku.cxx
redundantInitialization:lexilla/lexers/LexRegistry.cxx redundantInitialization:lexilla/lexers/LexRegistry.cxx
constParameter:lexilla/lexers/LexRuby.cxx constParameter:lexilla/lexers/LexRuby.cxx
knownConditionTrueFalse:lexilla/lexers/LexRuby.cxx
constParameter:lexilla/lexers/LexRust.cxx constParameter:lexilla/lexers/LexRust.cxx
constParameter:lexilla/lexers/LexScriptol.cxx
knownConditionTrueFalse:lexilla/lexers/LexScriptol.cxx knownConditionTrueFalse:lexilla/lexers/LexScriptol.cxx
variableScope:lexilla/lexers/LexSpecman.cxx variableScope:lexilla/lexers/LexSpecman.cxx
unreadVariable:lexilla/lexers/LexSpice.cxx unreadVariable:lexilla/lexers/LexSpice.cxx
@ -127,30 +126,12 @@ constParameterCallback:lexilla/lexers/LexPython.cxx
constParameterCallback:lexilla/lexers/LexScriptol.cxx constParameterCallback:lexilla/lexers/LexScriptol.cxx
constParameterCallback:lexilla/lexers/LexVB.cxx constParameterCallback:lexilla/lexers/LexVB.cxx
constVariable:lexilla/lexers/LexA68k.cxx
constVariable:lexilla/lexers/LexAsn1.cxx
constVariable:lexilla/lexers/LexCLW.cxx
constVariable:lexilla/lexers/LexCOBOL.cxx
constVariable:lexilla/lexers/LexCSS.cxx constVariable:lexilla/lexers/LexCSS.cxx
constVariable:lexilla/lexers/LexCrontab.cxx constVariable:lexilla/lexers/LexCrontab.cxx
constVariable:lexilla/lexers/LexEScript.cxx
constVariable:lexilla/lexers/LexEiffel.cxx
constVariable:lexilla/lexers/LexForth.cxx
constVariable:lexilla/lexers/LexGui4Cli.cxx constVariable:lexilla/lexers/LexGui4Cli.cxx
constVariable:lexilla/lexers/LexKix.cxx constVariable:lexilla/lexers/LexKix.cxx
constVariable:lexilla/lexers/LexLout.cxx
constVariable:lexilla/lexers/LexMetapost.cxx constVariable:lexilla/lexers/LexMetapost.cxx
constVariable:lexilla/lexers/LexModula.cxx
constVariable:lexilla/lexers/LexOpal.cxx constVariable:lexilla/lexers/LexOpal.cxx
constVariable:lexilla/lexers/LexPS.cxx
constVariable:lexilla/lexers/LexPascal.cxx
constVariable:lexilla/lexers/LexRebol.cxx
constVariable:lexilla/lexers/LexRuby.cxx
constVariable:lexilla/lexers/LexSorcus.cxx
constVariable:lexilla/lexers/LexStata.cxx
constVariable:lexilla/lexers/LexTACL.cxx
constVariable:lexilla/lexers/LexTADS3.cxx
constVariable:lexilla/lexers/LexTAL.cxx
// cppcheck appears wrong as atKeyPath must be remembered between loops // cppcheck appears wrong as atKeyPath must be remembered between loops
variableScope:lexilla/lexers/LexRegistry.cxx variableScope:lexilla/lexers/LexRegistry.cxx

View File

@ -9,7 +9,7 @@
<meta name="keywords" content="Scintilla, SciTE, Editing Component, Text Editor" /> <meta name="keywords" content="Scintilla, SciTE, Editing Component, Text Editor" />
<meta name="Description" <meta name="Description"
content="www.scintilla.org is the home of the Scintilla editing component and SciTE text editor application." /> content="www.scintilla.org is the home of the Scintilla editing component and SciTE text editor application." />
<meta name="Date.Modified" content="20230208" /> <meta name="Date.Modified" content="20230313" />
<meta name="viewport" content="width=device-width, initial-scale=1" /> <meta name="viewport" content="width=device-width, initial-scale=1" />
<style type="text/css"> <style type="text/css">
.logo { .logo {
@ -61,8 +61,8 @@
<font color="#FFCC99" size="4"> A library of language lexers for use with Scintilla</font> <font color="#FFCC99" size="4"> A library of language lexers for use with Scintilla</font>
</td> </td>
<td width="40%" align="right"> <td width="40%" align="right">
<font color="#FFCC99" size="3">Release version 5.2.2<br /> <font color="#FFCC99" size="3">Release version 5.2.4<br />
Site last modified February 8 2023</font> Site last modified March 13 2023</font>
</td> </td>
<td width="20%"> <td width="20%">
&nbsp; &nbsp;
@ -77,13 +77,13 @@
</tr> </tr>
</table> </table>
<ul id="versionlist"> <ul id="versionlist">
<li>Version 5.2.4 improves C++ and GDScript.</li>
<li>Version 5.2.3 improves Makefile, Ruby, and YAML.</li>
<li>Version 5.2.2 improves C++, Matlab, Modula-3, Python, and X12.</li> <li>Version 5.2.2 improves C++, Matlab, Modula-3, Python, and X12.</li>
<li>Version 5.2.1 improves Batch, F#, Markdown, and PowerShell.</li> <li>Version 5.2.1 improves Batch, F#, Markdown, and PowerShell.</li>
<li>Version 5.2.0 improves PowerShell and R.</li> <li>Version 5.2.0 improves PowerShell and R.</li>
<li>Version 5.1.9 improves Julia and Properties.</li> <li>Version 5.1.9 improves Julia and Properties.</li>
<li>Version 5.1.8 improves F#, MS SQL, PowerShell, and Visual Prolog.</li> <li>Version 5.1.8 improves F#, MS SQL, PowerShell, and Visual Prolog.</li>
<li>Version 5.1.7 improves CMake, HTML, Matlab, Raku, Ruby, and VHDL.</li>
<li>Version 5.1.6 improves Markdown and Ruby.</li>
</ul> </ul>
<ul id="menu"> <ul id="menu">
<li id="remote1"><a href="https://www.scintilla.org/SciTEImage.html">Screenshot</a></li> <li id="remote1"><a href="https://www.scintilla.org/SciTEImage.html">Screenshot</a></li>

View File

@ -26,9 +26,9 @@
<table bgcolor="#CCCCCC" width="100%" cellspacing="0" cellpadding="8" border="0"> <table bgcolor="#CCCCCC" width="100%" cellspacing="0" cellpadding="8" border="0">
<tr> <tr>
<td> <td>
<font size="4"> <a href="https://www.scintilla.org/lexilla522.zip"> <font size="4"> <a href="https://www.scintilla.org/lexilla524.zip">
Windows</a>&nbsp;&nbsp; Windows</a>&nbsp;&nbsp;
<a href="https://www.scintilla.org/lexilla522.tgz"> <a href="https://www.scintilla.org/lexilla524.tgz">
GTK/Linux</a>&nbsp;&nbsp; GTK/Linux</a>&nbsp;&nbsp;
</font> </font>
</td> </td>
@ -42,7 +42,7 @@
containing very few restrictions. containing very few restrictions.
</p> </p>
<h3> <h3>
Release 5.2.2 Release 5.2.4
</h3> </h3>
<h4> <h4>
Source Code Source Code
@ -50,8 +50,8 @@
The source code package contains all of the source code for Lexilla but no binary The source code package contains all of the source code for Lexilla but no binary
executable code and is available in executable code and is available in
<ul> <ul>
<li><a href="https://www.scintilla.org/lexilla522.zip">zip format</a> (1.2M) commonly used on Windows</li> <li><a href="https://www.scintilla.org/lexilla524.zip">zip format</a> (1.2M) commonly used on Windows</li>
<li><a href="https://www.scintilla.org/lexilla522.tgz">tgz format</a> (0.9M) commonly used on Linux and compatible operating systems</li> <li><a href="https://www.scintilla.org/lexilla524.tgz">tgz format</a> (0.9M) commonly used on Linux and compatible operating systems</li>
</ul> </ul>
Instructions for building on both Windows and Linux are included in the readme file. Instructions for building on both Windows and Linux are included in the readme file.
<h4> <h4>

View File

@ -585,6 +585,79 @@
</tr> </tr>
</table> </table>
<h2>Releases</h2> <h2>Releases</h2>
<h3>
<a href="https://www.scintilla.org/lexilla524.zip">Release 5.2.4</a>
</h3>
<ul>
<li>
Released 13 March 2023.
</li>
<li>
C++: Fix failure to recognize keywords containing upper case.
<a href="https://github.com/ScintillaOrg/lexilla/issues/149">Issue #149</a>.
</li>
<li>
GDScript: Support % and $ node paths.
<a href="https://github.com/ScintillaOrg/lexilla/issues/145">Issue #145</a>,
<a href="https://github.com/ScintillaOrg/lexilla/pull/146">Pull request #146</a>.
</li>
</ul>
<h3>
<a href="https://www.scintilla.org/lexilla523.zip">Release 5.2.3</a>
</h3>
<ul>
<li>
Released 8 March 2023.
</li>
<li>
Add scripts/PromoteNew.bat script to promote .new files after checking.
</li>
<li>
Makefile: Remove 1024-byte line length limit..
</li>
<li>
Ruby: Add new lexical classes for % literals SCE_RB_STRING_W (%w non-interpolable string array),
SCE_RB_STRING_I (%i non-interpolable symbol array),
SCE_RB_STRING_QI (%I interpolable symbol array),
and SCE_RB_STRING_QS (%s symbol).
<a href="https://github.com/ScintillaOrg/lexilla/issues/124">Issue #124</a>.
</li>
<li>
Ruby: Disambiguate %= which may be a quote or modulo assignment.
<a href="https://github.com/ScintillaOrg/lexilla/issues/124">Issue #124</a>,
<a href="https://sourceforge.net/p/scintilla/bugs/1255/">Bug #1255</a>,
<a href="https://sourceforge.net/p/scintilla/bugs/2182/">Bug #2182</a>.
</li>
<li>
Ruby: Fix additional fold level for single character in SCE_RB_STRING_QW.
<a href="https://github.com/ScintillaOrg/lexilla/issues/132">Issue #132</a>.
</li>
<li>
Ruby: Set SCE_RB_HERE_QQ for unquoted and double-quoted heredocs and
SCE_RB_HERE_QX for backticks-quoted heredocs.
<a href="https://github.com/ScintillaOrg/lexilla/issues/134">Issue #134</a>.
</li>
<li>
Ruby: Recognise #{} inside SCE_RB_HERE_QQ and SCE_RB_HERE_QX.
<a href="https://github.com/ScintillaOrg/lexilla/issues/134">Issue #134</a>.
</li>
<li>
Ruby: Improve regex and heredoc recognition.
<a href="https://github.com/ScintillaOrg/lexilla/issues/136">Issue #136</a>.
</li>
<li>
Ruby: Highlight #@, #@@ and #$ style interpolation.
<a href="https://github.com/ScintillaOrg/lexilla/issues/140">Issue #140</a>.
</li>
<li>
Ruby: Fix folding for multiple heredocs started on one line.
Fix folding when there is a space after heredoc opening delimiter.
<a href="https://github.com/ScintillaOrg/lexilla/issues/135">Issue #135</a>.
</li>
<li>
YAML: Remove 1024-byte line length limit.
</li>
</ul>
<h3> <h3>
<a href="https://www.scintilla.org/lexilla522.zip">Release 5.2.2</a> <a href="https://www.scintilla.org/lexilla522.zip">Release 5.2.2</a>
</h3> </h3>

View File

@ -467,7 +467,11 @@ val SCE_RB_WORD_DEMOTED=29
val SCE_RB_STDIN=30 val SCE_RB_STDIN=30
val SCE_RB_STDOUT=31 val SCE_RB_STDOUT=31
val SCE_RB_STDERR=40 val SCE_RB_STDERR=40
val SCE_RB_UPPER_BOUND=41 val SCE_RB_STRING_W=41
val SCE_RB_STRING_I=42
val SCE_RB_STRING_QI=43
val SCE_RB_STRING_QS=44
val SCE_RB_UPPER_BOUND=45
# Lexical states for SCLEX_VB, SCLEX_VBSCRIPT, SCLEX_POWERBASIC, SCLEX_BLITZBASIC, SCLEX_PUREBASIC, SCLEX_FREEBASIC # Lexical states for SCLEX_VB, SCLEX_VBSCRIPT, SCLEX_POWERBASIC, SCLEX_BLITZBASIC, SCLEX_PUREBASIC, SCLEX_FREEBASIC
lex VB=SCLEX_VB SCE_B_ lex VB=SCLEX_VB SCE_B_
lex VBScript=SCLEX_VBSCRIPT SCE_B_ lex VBScript=SCLEX_VBSCRIPT SCE_B_
@ -2301,3 +2305,4 @@ val SCE_GD_COMMENTBLOCK=12
val SCE_GD_STRINGEOL=13 val SCE_GD_STRINGEOL=13
val SCE_GD_WORD2=14 val SCE_GD_WORD2=14
val SCE_GD_ANNOTATION=15 val SCE_GD_ANNOTATION=15
val SCE_GD_NODEPATH=16

View File

@ -558,7 +558,11 @@
#define SCE_RB_STDIN 30 #define SCE_RB_STDIN 30
#define SCE_RB_STDOUT 31 #define SCE_RB_STDOUT 31
#define SCE_RB_STDERR 40 #define SCE_RB_STDERR 40
#define SCE_RB_UPPER_BOUND 41 #define SCE_RB_STRING_W 41
#define SCE_RB_STRING_I 42
#define SCE_RB_STRING_QI 43
#define SCE_RB_STRING_QS 44
#define SCE_RB_UPPER_BOUND 45
#define SCE_B_DEFAULT 0 #define SCE_B_DEFAULT 0
#define SCE_B_COMMENT 1 #define SCE_B_COMMENT 1
#define SCE_B_NUMBER 2 #define SCE_B_NUMBER 2
@ -2175,6 +2179,7 @@
#define SCE_GD_STRINGEOL 13 #define SCE_GD_STRINGEOL 13
#define SCE_GD_WORD2 14 #define SCE_GD_WORD2 14
#define SCE_GD_ANNOTATION 15 #define SCE_GD_ANNOTATION 15
#define SCE_GD_NODEPATH 16
/* --Autogenerated -- end of section automatically generated from Scintilla.iface */ /* --Autogenerated -- end of section automatically generated from Scintilla.iface */
#endif #endif

View File

@ -91,6 +91,10 @@ constexpr bool IsSpaceOrTab(int ch) noexcept {
return ch == ' ' || ch == '\t'; return ch == ' ' || ch == '\t';
} }
constexpr bool IsOperatorOrSpace(int ch) noexcept {
return isoperator(ch) || IsASpace(ch);
}
bool OnlySpaceOrTab(const std::string &s) noexcept { bool OnlySpaceOrTab(const std::string &s) noexcept {
for (const char ch : s) { for (const char ch : s) {
if (!IsSpaceOrTab(ch)) if (!IsSpaceOrTab(ch))
@ -138,23 +142,18 @@ BracketPair FindBracketPair(Tokens &tokens) {
void highlightTaskMarker(StyleContext &sc, LexAccessor &styler, void highlightTaskMarker(StyleContext &sc, LexAccessor &styler,
int activity, const WordList &markerList, bool caseSensitive){ int activity, const WordList &markerList, bool caseSensitive){
if ((isoperator(sc.chPrev) || IsASpace(sc.chPrev)) && markerList.Length()) { if (IsOperatorOrSpace(sc.chPrev) && !IsOperatorOrSpace(sc.ch) && markerList.Length()) {
constexpr Sci_PositionU lengthMarker = 50; std::string marker;
char marker[lengthMarker+1] = ""; for (Sci_PositionU currPos = sc.currentPos; true; currPos++) {
const Sci_PositionU currPos = sc.currentPos; const char ch = styler.SafeGetCharAt(currPos);
Sci_PositionU i = 0; if (IsOperatorOrSpace(ch)) {
while (i < lengthMarker) {
const char ch = styler.SafeGetCharAt(currPos + i);
if (IsASpace(ch) || isoperator(ch)) {
break; break;
} }
if (caseSensitive) if (caseSensitive)
marker[i] = ch; marker.push_back(ch);
else else
marker[i] = MakeLowerCase(ch); marker.push_back(MakeLowerCase(ch));
i++;
} }
marker[i] = '\0';
if (markerList.InList(marker)) { if (markerList.InList(marker)) {
sc.SetState(SCE_C_TASKMARKER|activity); sc.SetState(SCE_C_TASKMARKER|activity);
} }
@ -732,10 +731,7 @@ Sci_Position SCI_METHOD LexerCPP::WordListSet(int n, const char *wl) {
} }
Sci_Position firstModification = -1; Sci_Position firstModification = -1;
if (wordListN) { if (wordListN) {
WordList wlNew; if (wordListN->Set(wl)) {
wlNew.Set(wl);
if (*wordListN != wlNew) {
wordListN->Set(wl);
firstModification = 0; firstModification = 0;
if (n == 4) { if (n == 4) {
// Rebuild preprocessorDefinitions // Rebuild preprocessorDefinitions
@ -771,6 +767,9 @@ Sci_Position SCI_METHOD LexerCPP::WordListSet(int n, const char *wl) {
void SCI_METHOD LexerCPP::Lex(Sci_PositionU startPos, Sci_Position length, int initStyle, IDocument *pAccess) { void SCI_METHOD LexerCPP::Lex(Sci_PositionU startPos, Sci_Position length, int initStyle, IDocument *pAccess) {
LexAccessor styler(pAccess); LexAccessor styler(pAccess);
const StyleContext::Transform transform = caseSensitive ?
StyleContext::Transform::none : StyleContext::Transform::lower;
const CharacterSet setOKBeforeRE(CharacterSet::setNone, "([{=,:;!%^&*|?~+-"); const CharacterSet setOKBeforeRE(CharacterSet::setNone, "([{=,:;!%^&*|?~+-");
const CharacterSet setCouldBePostOp(CharacterSet::setNone, "+-"); const CharacterSet setCouldBePostOp(CharacterSet::setNone, "+-");
@ -847,6 +846,8 @@ void SCI_METHOD LexerCPP::Lex(Sci_PositionU startPos, Sci_Position length, int i
std::string rawStringTerminator = rawStringTerminators.ValueAt(lineCurrent-1); std::string rawStringTerminator = rawStringTerminators.ValueAt(lineCurrent-1);
SparseState<std::string> rawSTNew(lineCurrent); SparseState<std::string> rawSTNew(lineCurrent);
std::string currentText;
int activitySet = preproc.ActiveState(); int activitySet = preproc.ActiveState();
const WordClassifier &classifierIdentifiers = subStyles.Classifier(SCE_C_IDENTIFIER); const WordClassifier &classifierIdentifiers = subStyles.Classifier(SCE_C_IDENTIFIER);
@ -932,31 +933,29 @@ void SCI_METHOD LexerCPP::Lex(Sci_PositionU startPos, Sci_Position length, int i
break; break;
case SCE_C_IDENTIFIER: case SCE_C_IDENTIFIER:
if (sc.atLineStart || sc.atLineEnd || !setWord.Contains(sc.ch) || (sc.ch == '.')) { if (sc.atLineStart || sc.atLineEnd || !setWord.Contains(sc.ch) || (sc.ch == '.')) {
char s[1000]; sc.GetCurrentString(currentText, transform);
if (caseSensitive) { if (keywords.InList(currentText)) {
sc.GetCurrent(s, sizeof(s)); lastWordWasUUID = currentText == "uuid";
} else {
sc.GetCurrentLowered(s, sizeof(s));
}
if (keywords.InList(s)) {
lastWordWasUUID = strcmp(s, "uuid") == 0;
sc.ChangeState(SCE_C_WORD|activitySet); sc.ChangeState(SCE_C_WORD|activitySet);
} else if (keywords2.InList(s)) { } else if (keywords2.InList(currentText)) {
sc.ChangeState(SCE_C_WORD2|activitySet); sc.ChangeState(SCE_C_WORD2|activitySet);
} else if (keywords4.InList(s)) { } else if (keywords4.InList(currentText)) {
sc.ChangeState(SCE_C_GLOBALCLASS|activitySet); sc.ChangeState(SCE_C_GLOBALCLASS|activitySet);
} else { } else {
const int subStyle = classifierIdentifiers.ValueFor(s); const int subStyle = classifierIdentifiers.ValueFor(currentText);
if (subStyle >= 0) { if (subStyle >= 0) {
sc.ChangeState(subStyle|activitySet); sc.ChangeState(subStyle|activitySet);
} }
} }
const bool literalString = sc.ch == '\"'; const bool literalString = sc.ch == '\"';
if (literalString || sc.ch == '\'') { if (literalString || sc.ch == '\'') {
size_t lenS = strlen(s); std::string_view s = currentText;
size_t lenS = s.length();
const bool raw = literalString && sc.chPrev == 'R' && !setInvalidRawFirst.Contains(sc.chNext); const bool raw = literalString && sc.chPrev == 'R' && !setInvalidRawFirst.Contains(sc.chNext);
if (raw) if (raw) {
s[lenS--] = '\0'; s.remove_suffix(1);
lenS--;
}
const bool valid = const bool valid =
(lenS == 0) || (lenS == 0) ||
((lenS == 1) && ((s[0] == 'L') || (s[0] == 'u') || (s[0] == 'U'))) || ((lenS == 1) && ((s[0] == 'L') || (s[0] == 'u') || (s[0] == 'U'))) ||
@ -1070,33 +1069,27 @@ void SCI_METHOD LexerCPP::Lex(Sci_PositionU startPos, Sci_Position length, int i
seenDocKeyBrace = true; seenDocKeyBrace = true;
} else if (!setDoxygen.Contains(sc.ch) } else if (!setDoxygen.Contains(sc.ch)
&& !(seenDocKeyBrace && (sc.ch == ',' || sc.ch == '.'))) { && !(seenDocKeyBrace && (sc.ch == ',' || sc.ch == '.'))) {
char s[100];
if (caseSensitive) {
sc.GetCurrent(s, sizeof(s));
} else {
sc.GetCurrentLowered(s, sizeof(s));
}
if (!(IsASpace(sc.ch) || (sc.ch == 0))) { if (!(IsASpace(sc.ch) || (sc.ch == 0))) {
sc.ChangeState(SCE_C_COMMENTDOCKEYWORDERROR|activitySet); sc.ChangeState(SCE_C_COMMENTDOCKEYWORDERROR|activitySet);
} else if (!keywords3.InList(s + 1) && !keywords3.InList(s)) { } else {
const int subStyleCDKW = classifierDocKeyWords.ValueFor(s+1); sc.GetCurrentString(currentText, transform);
if (subStyleCDKW >= 0) { assert(!currentText.empty());
sc.ChangeState(subStyleCDKW|activitySet); std::string currentSuffix = currentText.substr(1);
} else { if (!keywords3.InList(currentSuffix) && !keywords3.InList(currentText)) {
sc.ChangeState(SCE_C_COMMENTDOCKEYWORDERROR|activitySet); const int subStyleCDKW = classifierDocKeyWords.ValueFor(currentSuffix.c_str());
if (subStyleCDKW >= 0) {
sc.ChangeState(subStyleCDKW | activitySet);
} else {
sc.ChangeState(SCE_C_COMMENTDOCKEYWORDERROR | activitySet);
}
} }
} }
sc.SetState(styleBeforeDCKeyword|activitySet); sc.SetState(styleBeforeDCKeyword|activitySet);
seenDocKeyBrace = false; seenDocKeyBrace = false;
} else if (sc.ch == '>') { } else if (sc.ch == '>') {
char s[100]; sc.GetCurrentString(currentText, transform);
if (caseSensitive) { if (!keywords3.InList(currentText)) {
sc.GetCurrent(s, sizeof(s)); const int subStyleCDKW = classifierDocKeyWords.ValueFor(currentText.substr(1));
} else {
sc.GetCurrentLowered(s, sizeof(s));
}
if (!keywords3.InList(s)) {
const int subStyleCDKW = classifierDocKeyWords.ValueFor(s + 1);
if (subStyleCDKW >= 0) { if (subStyleCDKW >= 0) {
sc.ChangeState(subStyleCDKW | activitySet); sc.ChangeState(subStyleCDKW | activitySet);
} else { } else {
@ -1226,7 +1219,7 @@ void SCI_METHOD LexerCPP::Lex(Sci_PositionU startPos, Sci_Position length, int i
} }
break; break;
case SCE_C_TASKMARKER: case SCE_C_TASKMARKER:
if (isoperator(sc.ch) || IsASpace(sc.ch)) { if (IsOperatorOrSpace(sc.ch)) {
sc.SetState(styleBeforeTaskMarker|activitySet); sc.SetState(styleBeforeTaskMarker|activitySet);
styleBeforeTaskMarker = SCE_C_DEFAULT; styleBeforeTaskMarker = SCE_C_DEFAULT;
} }

View File

@ -5,12 +5,12 @@
// Copyright 1998-2001 by Neil Hodgson <neilh@scintilla.org> // Copyright 1998-2001 by Neil Hodgson <neilh@scintilla.org>
// The License.txt file describes the conditions under which this software may be distributed. // The License.txt file describes the conditions under which this software may be distributed.
#include <stdlib.h> #include <cstdlib>
#include <string.h> #include <cassert>
#include <stdio.h> #include <cstring>
#include <stdarg.h> #include <cctype>
#include <assert.h> #include <cstdio>
#include <ctype.h> #include <cstdarg>
#include <string> #include <string>
#include <string_view> #include <string_view>
@ -28,16 +28,14 @@
using namespace Lexilla; using namespace Lexilla;
static inline bool AtEOL(Accessor &styler, Sci_PositionU i) { namespace {
inline bool AtEOL(Accessor &styler, Sci_PositionU i) {
return (styler[i] == '\n') || return (styler[i] == '\n') ||
((styler[i] == '\r') && (styler.SafeGetCharAt(i + 1) != '\n')); ((styler[i] == '\r') && (styler.SafeGetCharAt(i + 1) != '\n'));
} }
#define DIFF_BUFFER_START_SIZE 16 void ColouriseDiffLine(const char *lineBuffer, Sci_Position endLine, Accessor &styler) {
// Note that ColouriseDiffLine analyzes only the first DIFF_BUFFER_START_SIZE
// characters of each line to classify the line.
static void ColouriseDiffLine(char *lineBuffer, Sci_Position endLine, Accessor &styler) {
// It is needed to remember the current state to recognize starting // It is needed to remember the current state to recognize starting
// comment lines before the first "diff " or "--- ". If a real // comment lines before the first "diff " or "--- ". If a real
// difference starts then each line starting with ' ' is a whitespace // difference starts then each line starting with ' ' is a whitespace
@ -102,39 +100,30 @@ static void ColouriseDiffLine(char *lineBuffer, Sci_Position endLine, Accessor &
} }
} }
static void ColouriseDiffDoc(Sci_PositionU startPos, Sci_Position length, int, WordList *[], Accessor &styler) { void ColouriseDiffDoc(Sci_PositionU startPos, Sci_Position length, int, WordList *[], Accessor &styler) {
char lineBuffer[DIFF_BUFFER_START_SIZE] = ""; std::string lineBuffer;
styler.StartAt(startPos); styler.StartAt(startPos);
styler.StartSegment(startPos); styler.StartSegment(startPos);
Sci_PositionU linePos = 0;
for (Sci_PositionU i = startPos; i < startPos + length; i++) { for (Sci_PositionU i = startPos; i < startPos + length; i++) {
if (AtEOL(styler, i)) { if (AtEOL(styler, i)) {
if (linePos < DIFF_BUFFER_START_SIZE) { ColouriseDiffLine(lineBuffer.c_str(), i, styler);
lineBuffer[linePos] = 0; lineBuffer.clear();
} } else {
ColouriseDiffLine(lineBuffer, i, styler); lineBuffer.push_back(styler[i]);
linePos = 0;
} else if (linePos < DIFF_BUFFER_START_SIZE - 1) {
lineBuffer[linePos++] = styler[i];
} else if (linePos == DIFF_BUFFER_START_SIZE - 1) {
lineBuffer[linePos++] = 0;
} }
} }
if (linePos > 0) { // Last line does not have ending characters if (!lineBuffer.empty()) { // Last line does not have ending characters
if (linePos < DIFF_BUFFER_START_SIZE) { ColouriseDiffLine(lineBuffer.c_str(), startPos + length - 1, styler);
lineBuffer[linePos] = 0;
}
ColouriseDiffLine(lineBuffer, startPos + length - 1, styler);
} }
} }
static void FoldDiffDoc(Sci_PositionU startPos, Sci_Position length, int, WordList *[], Accessor &styler) { void FoldDiffDoc(Sci_PositionU startPos, Sci_Position length, int, WordList *[], Accessor &styler) {
Sci_Position curLine = styler.GetLine(startPos); Sci_Position curLine = styler.GetLine(startPos);
Sci_Position curLineStart = styler.LineStart(curLine); Sci_Position curLineStart = styler.LineStart(curLine);
int prevLevel = curLine > 0 ? styler.LevelAt(curLine - 1) : SC_FOLDLEVELBASE; int prevLevel = curLine > 0 ? styler.LevelAt(curLine - 1) : SC_FOLDLEVELBASE;
int nextLevel;
do { do {
int nextLevel = 0;
const int lineType = styler.StyleAt(curLineStart); const int lineType = styler.StyleAt(curLineStart);
if (lineType == SCE_DIFF_COMMAND) if (lineType == SCE_DIFF_COMMAND)
nextLevel = SC_FOLDLEVELBASE | SC_FOLDLEVELHEADERFLAG; nextLevel = SC_FOLDLEVELBASE | SC_FOLDLEVELHEADERFLAG;
@ -157,8 +146,10 @@ static void FoldDiffDoc(Sci_PositionU startPos, Sci_Position length, int, WordLi
} while (static_cast<Sci_Position>(startPos)+length > curLineStart); } while (static_cast<Sci_Position>(startPos)+length > curLineStart);
} }
static const char *const emptyWordListDesc[] = { const char *const emptyWordListDesc[] = {
0 nullptr
}; };
}
LexerModule lmDiff(SCLEX_DIFF, ColouriseDiffDoc, "diff", FoldDiffDoc, emptyWordListDesc); LexerModule lmDiff(SCLEX_DIFF, ColouriseDiffDoc, "diff", FoldDiffDoc, emptyWordListDesc);

View File

@ -48,22 +48,13 @@ static constexpr int keywordClasses[] = {
namespace { namespace {
struct OptionsFSharp { struct OptionsFSharp {
bool fold; bool fold = true;
bool foldCompact; bool foldCompact = true;
bool foldComment; bool foldComment = true;
bool foldCommentStream; bool foldCommentStream = true;
bool foldCommentMultiLine; bool foldCommentMultiLine = true;
bool foldPreprocessor; bool foldPreprocessor = false;
bool foldImports; bool foldImports = true;
OptionsFSharp() {
fold = true;
foldCompact = true;
foldComment = true;
foldCommentStream = true;
foldCommentMultiLine = true;
foldPreprocessor = false;
foldImports = true;
}
}; };
struct OptionSetFSharp : public OptionSet<OptionsFSharp> { struct OptionSetFSharp : public OptionSet<OptionsFSharp> {
@ -91,25 +82,11 @@ struct OptionSetFSharp : public OptionSet<OptionsFSharp> {
} }
}; };
const CharacterSet setOperators = CharacterSet(CharacterSet::setNone, "~^'-+*/%=@|&<>()[]{};,:!?");
const CharacterSet setClosingTokens = CharacterSet(CharacterSet::setNone, ")}]");
const CharacterSet setFormatSpecs = CharacterSet(CharacterSet::setNone, ".%aAbBcdeEfFgGiMoOstuxX0123456789");
const CharacterSet setDotNetFormatSpecs = CharacterSet(CharacterSet::setNone, "cCdDeEfFgGnNpPxX");
const CharacterSet setFormatFlags = CharacterSet(CharacterSet::setNone, ".-+0 ");
const CharacterSet numericMetaChars1 = CharacterSet(CharacterSet::setNone, "_uU");
const CharacterSet numericMetaChars2 = CharacterSet(CharacterSet::setNone, "fFIlLmMnsy");
std::map<int, int> numericPrefixes = { { 'b', 2 }, { 'o', 8 }, { 'x', 16 } };
constexpr Sci_Position ZERO_LENGTH = -1;
struct FSharpString { struct FSharpString {
Sci_Position startPos; Sci_Position startPos = INVALID_POSITION;
int startChar; int startChar = '"';
FSharpString() {
startPos = ZERO_LENGTH;
startChar = '"';
}
constexpr bool HasLength() const { constexpr bool HasLength() const {
return startPos > ZERO_LENGTH; return startPos > INVALID_POSITION;
} }
constexpr bool CanInterpolate() const { constexpr bool CanInterpolate() const {
return startChar == '$'; return startChar == '$';
@ -278,20 +255,6 @@ inline bool CanEmbedQuotes(StyleContext &cxt) {
cxt.Match('`', '`'); cxt.Match('`', '`');
} }
inline bool IsNumber(StyleContext &cxt, const int base = 10) {
return IsADigit(cxt.ch, base) || (IsADigit(cxt.chPrev, base) && numericMetaChars1.Contains(cxt.ch)) ||
(IsADigit(cxt.GetRelative(-2), base) && numericMetaChars2.Contains(cxt.ch));
}
inline bool IsFloat(StyleContext &cxt) {
if (cxt.MatchIgnoreCase("e+") || cxt.MatchIgnoreCase("e-")) {
cxt.Forward();
return true;
}
return ((cxt.chPrev == '.' && IsADigit(cxt.ch)) ||
(IsADigit(cxt.chPrev) && (cxt.ch == '.' || numericMetaChars2.Contains(cxt.ch))));
}
inline bool IsLineEnd(StyleContext &cxt, const Sci_Position offset) { inline bool IsLineEnd(StyleContext &cxt, const Sci_Position offset) {
const int ch = cxt.GetRelative(offset, '\n'); const int ch = cxt.GetRelative(offset, '\n');
return (ch == '\r' || ch == '\n'); return (ch == '\r' || ch == '\n');
@ -301,10 +264,28 @@ class LexerFSharp : public DefaultLexer {
WordList keywords[WORDLIST_SIZE]; WordList keywords[WORDLIST_SIZE];
OptionsFSharp options; OptionsFSharp options;
OptionSetFSharp optionSet; OptionSetFSharp optionSet;
CharacterSet setOperators;
CharacterSet setFormatSpecs;
CharacterSet setDotNetFormatSpecs;
CharacterSet setFormatFlags;
CharacterSet numericMetaChars1;
CharacterSet numericMetaChars2;
std::map<int, int> numericPrefixes = { { 'b', 2 }, { 'o', 8 }, { 'x', 16 } };
public: public:
explicit LexerFSharp() : DefaultLexer(lexerName, SCLEX_FSHARP) { explicit LexerFSharp()
: DefaultLexer(lexerName, SCLEX_FSHARP),
setOperators(CharacterSet::setNone, "~^'-+*/%=@|&<>()[]{};,:!?"),
setFormatSpecs(CharacterSet::setNone, ".%aAbBcdeEfFgGiMoOstuxX0123456789"),
setDotNetFormatSpecs(CharacterSet::setNone, "cCdDeEfFgGnNpPxX"),
setFormatFlags(CharacterSet::setNone, ".-+0 "),
numericMetaChars1(CharacterSet::setNone, "_uU"),
numericMetaChars2(CharacterSet::setNone, "fFIlLmMnsy") {
} }
LexerFSharp(const LexerFSharp &) = delete;
LexerFSharp(LexerFSharp &&) = delete;
LexerFSharp &operator=(const LexerFSharp &) = delete;
LexerFSharp &operator=(LexerFSharp &&) = delete;
static ILexer5 *LexerFactoryFSharp() { static ILexer5 *LexerFactoryFSharp() {
return new LexerFSharp(); return new LexerFSharp();
} }
@ -347,16 +328,31 @@ public:
if (optionSet.PropertySet(&options, key, val)) { if (optionSet.PropertySet(&options, key, val)) {
return 0; return 0;
} }
return ZERO_LENGTH; return INVALID_POSITION;
} }
Sci_Position SCI_METHOD WordListSet(int n, const char *wl) override; Sci_Position SCI_METHOD WordListSet(int n, const char *wl) override;
void SCI_METHOD Lex(Sci_PositionU start, Sci_Position length, int initStyle, IDocument *pAccess) override; void SCI_METHOD Lex(Sci_PositionU start, Sci_Position length, int initStyle, IDocument *pAccess) override;
void SCI_METHOD Fold(Sci_PositionU start, Sci_Position length, int initStyle,IDocument *pAccess) override; void SCI_METHOD Fold(Sci_PositionU start, Sci_Position length, int initStyle,IDocument *pAccess) override;
private:
inline bool IsNumber(StyleContext &cxt, const int base = 10) {
return IsADigit(cxt.ch, base) || (IsADigit(cxt.chPrev, base) && numericMetaChars1.Contains(cxt.ch)) ||
(IsADigit(cxt.GetRelative(-2), base) && numericMetaChars2.Contains(cxt.ch));
}
inline bool IsFloat(StyleContext &cxt) {
if (cxt.MatchIgnoreCase("e+") || cxt.MatchIgnoreCase("e-")) {
cxt.Forward();
return true;
}
return ((cxt.chPrev == '.' && IsADigit(cxt.ch)) ||
(IsADigit(cxt.chPrev) && (cxt.ch == '.' || numericMetaChars2.Contains(cxt.ch))));
}
}; };
Sci_Position SCI_METHOD LexerFSharp::WordListSet(int n, const char *wl) { Sci_Position SCI_METHOD LexerFSharp::WordListSet(int n, const char *wl) {
WordList *wordListN = nullptr; WordList *wordListN = nullptr;
Sci_Position firstModification = ZERO_LENGTH; Sci_Position firstModification = INVALID_POSITION;
if (n < WORDLIST_SIZE) { if (n < WORDLIST_SIZE) {
wordListN = &keywords[n]; wordListN = &keywords[n];
@ -370,7 +366,7 @@ Sci_Position SCI_METHOD LexerFSharp::WordListSet(int n, const char *wl) {
void SCI_METHOD LexerFSharp::Lex(Sci_PositionU start, Sci_Position length, int initStyle, IDocument *pAccess) { void SCI_METHOD LexerFSharp::Lex(Sci_PositionU start, Sci_Position length, int initStyle, IDocument *pAccess) {
LexAccessor styler(pAccess); LexAccessor styler(pAccess);
StyleContext sc(start, static_cast<Sci_PositionU>(length), initStyle, styler); StyleContext sc(start, static_cast<Sci_PositionU>(length), initStyle, styler);
Sci_Position lineCurrent = styler.GetLine(start); Sci_Position lineCurrent = styler.GetLine(static_cast<Sci_Position>(start));
Sci_PositionU cursor = 0; Sci_PositionU cursor = 0;
UnicodeChar uniCh = UnicodeChar(); UnicodeChar uniCh = UnicodeChar();
FSharpString fsStr = FSharpString(); FSharpString fsStr = FSharpString();
@ -411,7 +407,7 @@ void SCI_METHOD LexerFSharp::Lex(Sci_PositionU start, Sci_Position length, int i
state = SCE_FSHARP_CHARACTER; state = SCE_FSHARP_CHARACTER;
} else if (MatchStringStart(sc)) { } else if (MatchStringStart(sc)) {
fsStr.startChar = sc.ch; fsStr.startChar = sc.ch;
fsStr.startPos = ZERO_LENGTH; fsStr.startPos = INVALID_POSITION;
if (CanEmbedQuotes(sc)) { if (CanEmbedQuotes(sc)) {
// double quotes after this position should be non-terminating // double quotes after this position should be non-terminating
fsStr.startPos = static_cast<Sci_Position>(sc.currentPos - cursor); fsStr.startPos = static_cast<Sci_Position>(sc.currentPos - cursor);

View File

@ -94,6 +94,16 @@ int GetGDStringState(Accessor &styler, Sci_Position i, Sci_PositionU *nextIndex)
} }
} }
int GetGDStringState(int ch) {
if (ch != '"' && ch != '\'')
return SCE_GD_DEFAULT;
if (ch == '"')
return SCE_GD_STRING;
else
return SCE_GD_CHARACTER;
}
inline bool IsAWordChar(int ch, bool unicodeIdentifiers) { inline bool IsAWordChar(int ch, bool unicodeIdentifiers) {
if (IsASCII(ch)) if (IsASCII(ch))
return (IsAlphaNumeric(ch) || ch == '.' || ch == '_'); return (IsAlphaNumeric(ch) || ch == '.' || ch == '_');
@ -104,6 +114,16 @@ inline bool IsAWordChar(int ch, bool unicodeIdentifiers) {
return IsXidContinue(ch); return IsXidContinue(ch);
} }
inline bool IsANodePathChar(int ch, bool unicodeIdentifiers) {
if (IsASCII(ch))
return (IsAlphaNumeric(ch) || ch == '_' || ch == '/' || ch =='%');
if (!unicodeIdentifiers)
return false;
return IsXidContinue(ch);
}
inline bool IsAWordStart(int ch, bool unicodeIdentifiers) { inline bool IsAWordStart(int ch, bool unicodeIdentifiers) {
if (IsASCII(ch)) if (IsASCII(ch))
return (IsUpperOrLowerCase(ch) || ch == '_'); return (IsUpperOrLowerCase(ch) || ch == '_');
@ -209,6 +229,7 @@ LexicalClass lexicalClasses[] = {
13, "SCE_GD_STRINGEOL", "error literal string", "End of line where string is not closed", 13, "SCE_GD_STRINGEOL", "error literal string", "End of line where string is not closed",
14, "SCE_GD_WORD2", "identifier", "Highlighted identifiers", 14, "SCE_GD_WORD2", "identifier", "Highlighted identifiers",
15, "SCE_GD_ANNOTATION", "annotation", "Annotations", 15, "SCE_GD_ANNOTATION", "annotation", "Annotations",
16, "SCE_GD_NODEPATH", "path", "Node path",
}; };
} }
@ -390,7 +411,9 @@ void SCI_METHOD LexerGDScript::Lex(Sci_PositionU startPos, Sci_Position length,
bool indentGood = true; bool indentGood = true;
Sci_Position startIndicator = sc.currentPos; Sci_Position startIndicator = sc.currentPos;
bool inContinuedString = false; bool inContinuedString = false;
bool percentIsNodePath = false;
int nodePathStringState = SCE_GD_DEFAULT;
for (; sc.More(); sc.Forward()) { for (; sc.More(); sc.Forward()) {
if (sc.atLineStart) { if (sc.atLineStart) {
@ -412,6 +435,7 @@ void SCI_METHOD LexerGDScript::Lex(Sci_PositionU startPos, Sci_Position length,
} }
if (sc.atLineEnd) { if (sc.atLineEnd) {
percentIsNodePath = false;
ProcessLineEnd(sc, inContinuedString); ProcessLineEnd(sc, inContinuedString);
lineCurrent++; lineCurrent++;
if (!sc.More()) if (!sc.More())
@ -479,6 +503,18 @@ void SCI_METHOD LexerGDScript::Lex(Sci_PositionU startPos, Sci_Position length,
if (!IsAWordStart(sc.ch, options.unicodeIdentifiers)) { if (!IsAWordStart(sc.ch, options.unicodeIdentifiers)) {
sc.SetState(SCE_GD_DEFAULT); sc.SetState(SCE_GD_DEFAULT);
} }
} else if (sc.state == SCE_GD_NODEPATH) {
if (nodePathStringState != SCE_GD_DEFAULT) {
if (sc.ch == GetGDStringQuoteChar(nodePathStringState) ) {
nodePathStringState = SCE_GD_DEFAULT;
}
} else {
if (IsGDStringStart(sc.ch)) {
nodePathStringState = GetGDStringState(sc.ch);
} else if (!IsANodePathChar(sc.ch, options.unicodeIdentifiers)) {
sc.SetState(SCE_GD_DEFAULT);
}
}
} else if (IsGDSingleQuoteStringState(sc.state)) { } else if (IsGDSingleQuoteStringState(sc.state)) {
if (sc.ch == '\\') { if (sc.ch == '\\') {
if ((sc.chNext == '\r') && (sc.GetRelative(2) == '\n')) { if ((sc.chNext == '\r') && (sc.GetRelative(2) == '\n')) {
@ -548,7 +584,11 @@ void SCI_METHOD LexerGDScript::Lex(Sci_PositionU startPos, Sci_Position length,
base_n_number = false; base_n_number = false;
sc.SetState(SCE_GD_NUMBER); sc.SetState(SCE_GD_NUMBER);
} }
} else if ((sc.ch == '$') || (sc.ch == '%' && (percentIsNodePath || IsFirstNonWhitespace(sc.currentPos, styler)))) {
percentIsNodePath = false;
sc.SetState(SCE_GD_NODEPATH);
} else if (isoperator(sc.ch) || sc.ch == '`') { } else if (isoperator(sc.ch) || sc.ch == '`') {
percentIsNodePath = !((sc.ch == ')') || (sc.ch == ']') || (sc.ch == '}'));
sc.SetState(SCE_GD_OPERATOR); sc.SetState(SCE_GD_OPERATOR);
} else if (sc.ch == '#') { } else if (sc.ch == '#') {
sc.SetState(sc.chNext == '#' ? SCE_GD_COMMENTBLOCK : SCE_GD_COMMENTLINE); sc.SetState(sc.chNext == '#' ? SCE_GD_COMMENTBLOCK : SCE_GD_COMMENTLINE);

View File

@ -1060,10 +1060,7 @@ Sci_Position SCI_METHOD LexerHTML::WordListSet(int n, const char *wl) {
} }
Sci_Position firstModification = -1; Sci_Position firstModification = -1;
if (wordListN) { if (wordListN) {
WordList wlNew; if (wordListN->Set(wl)) {
wlNew.Set(wl);
if (*wordListN != wlNew) {
wordListN->Set(wl);
firstModification = 0; firstModification = 0;
} }
} }

View File

@ -5,12 +5,12 @@
// Copyright 1998-2001 by Neil Hodgson <neilh@scintilla.org> // Copyright 1998-2001 by Neil Hodgson <neilh@scintilla.org>
// The License.txt file describes the conditions under which this software may be distributed. // The License.txt file describes the conditions under which this software may be distributed.
#include <stdlib.h> #include <cstdlib>
#include <string.h> #include <cassert>
#include <stdio.h> #include <cstring>
#include <stdarg.h> #include <cctype>
#include <assert.h> #include <cstdio>
#include <ctype.h> #include <cstdarg>
#include <string> #include <string>
#include <string_view> #include <string_view>
@ -34,12 +34,12 @@ static inline bool AtEOL(Accessor &styler, Sci_PositionU i) {
} }
static void ColouriseMakeLine( static void ColouriseMakeLine(
char *lineBuffer, const std::string &lineBuffer,
Sci_PositionU lengthLine,
Sci_PositionU startLine, Sci_PositionU startLine,
Sci_PositionU endPos, Sci_PositionU endPos,
Accessor &styler) { Accessor &styler) {
const Sci_PositionU lengthLine = lineBuffer.length();
Sci_PositionU i = 0; Sci_PositionU i = 0;
Sci_Position lastNonSpace = -1; Sci_Position lastNonSpace = -1;
unsigned int state = SCE_MAKE_DEFAULT; unsigned int state = SCE_MAKE_DEFAULT;
@ -118,28 +118,26 @@ static void ColouriseMakeLine(
} }
static void ColouriseMakeDoc(Sci_PositionU startPos, Sci_Position length, int, WordList *[], Accessor &styler) { static void ColouriseMakeDoc(Sci_PositionU startPos, Sci_Position length, int, WordList *[], Accessor &styler) {
char lineBuffer[1024]; std::string lineBuffer;
styler.StartAt(startPos); styler.StartAt(startPos);
styler.StartSegment(startPos); styler.StartSegment(startPos);
Sci_PositionU linePos = 0;
Sci_PositionU startLine = startPos; Sci_PositionU startLine = startPos;
for (Sci_PositionU i = startPos; i < startPos + length; i++) { for (Sci_PositionU i = startPos; i < startPos + length; i++) {
lineBuffer[linePos++] = styler[i]; lineBuffer.push_back(styler[i]);
if (AtEOL(styler, i) || (linePos >= sizeof(lineBuffer) - 1)) { if (AtEOL(styler, i)) {
// End of line (or of line buffer) met, colourise it // End of line (or of line buffer) met, colourise it
lineBuffer[linePos] = '\0'; ColouriseMakeLine(lineBuffer, startLine, i, styler);
ColouriseMakeLine(lineBuffer, linePos, startLine, i, styler); lineBuffer.clear();
linePos = 0;
startLine = i + 1; startLine = i + 1;
} }
} }
if (linePos > 0) { // Last line does not have ending characters if (!lineBuffer.empty()) { // Last line does not have ending characters
ColouriseMakeLine(lineBuffer, linePos, startLine, startPos + length - 1, styler); ColouriseMakeLine(lineBuffer, startLine, startPos + length - 1, styler);
} }
} }
static const char *const emptyWordListDesc[] = { static const char *const emptyWordListDesc[] = {
0 nullptr
}; };
LexerModule lmMake(SCLEX_MAKEFILE, ColouriseMakeDoc, "makefile", 0, emptyWordListDesc); LexerModule lmMake(SCLEX_MAKEFILE, ColouriseMakeDoc, "makefile", nullptr, emptyWordListDesc);

View File

@ -500,10 +500,7 @@ Sci_Position SCI_METHOD LexerPython::WordListSet(int n, const char *wl) {
} }
Sci_Position firstModification = -1; Sci_Position firstModification = -1;
if (wordListN) { if (wordListN) {
WordList wlNew; if (wordListN->Set(wl)) {
wlNew.Set(wl);
if (*wordListN != wlNew) {
wordListN->Set(wl);
firstModification = 0; firstModification = 0;
} }
} }

View File

@ -339,7 +339,7 @@ bool IsValidRegOrQAdjacent(int ch) noexcept {
/* /*
* IsValidRegOrQPrecede * IsValidRegOrQPrecede
* - returns true if ch is a valid preceeding character to put directly before Q / q * - returns true if ch is a valid preceding character to put directly before Q / q
* * ref: Q Language: https://docs.raku.org/language/quoting * * ref: Q Language: https://docs.raku.org/language/quoting
*/ */
bool IsValidRegOrQPrecede(int ch) noexcept { bool IsValidRegOrQPrecede(int ch) noexcept {
@ -469,7 +469,7 @@ bool IsRegexStartAtScPos(StyleContext &sc, int &type, CharacterSet &set) {
/* /*
* IsValidIdentPrecede * IsValidIdentPrecede
* - returns if ch is a valid preceeding char to put directly before an identifier * - returns if ch is a valid preceding char to put directly before an identifier
*/ */
bool IsValidIdentPrecede(int ch) noexcept { bool IsValidIdentPrecede(int ch) noexcept {
return !(IsAlphaNumeric(ch) || ch == '_' || ch == '@' || ch == '$' || ch == '%'); return !(IsAlphaNumeric(ch) || ch == '_' || ch == '@' || ch == '$' || ch == '%');
@ -486,7 +486,7 @@ bool IsValidDelimiter(int ch) noexcept {
/* /*
* GetDelimiterCloseChar * GetDelimiterCloseChar
* - returns the corrisponding close char for a given delimiter (could be the same char) * - returns the corresponding close char for a given delimiter (could be the same char)
*/ */
int GetDelimiterCloseChar(int ch) noexcept { int GetDelimiterCloseChar(int ch) noexcept {
int ch_end = GetBracketCloseChar(ch); int ch_end = GetBracketCloseChar(ch);
@ -498,7 +498,7 @@ int GetDelimiterCloseChar(int ch) noexcept {
/* /*
* GetRepeatCharCount * GetRepeatCharCount
* - returns the occurence count of match * - returns the occurrence count of match
*/ */
Sci_Position GetRepeatCharCount(StyleContext &sc, int chMatch, Sci_Position length) { Sci_Position GetRepeatCharCount(StyleContext &sc, int chMatch, Sci_Position length) {
Sci_Position cnt = 0; Sci_Position cnt = 0;
@ -612,8 +612,8 @@ Sci_Position LengthToNextChar(StyleContext &sc, const Sci_Position length) {
/* /*
* GetRelativeString * GetRelativeString
* - gets a relitive string and sets it in &str * - gets a relative string and sets it in &str
* - resets string before seting * - resets string before setting
*/ */
void GetRelativeString(StyleContext &sc, Sci_Position offset, Sci_Position length, void GetRelativeString(StyleContext &sc, Sci_Position offset, Sci_Position length,
std::string &str) { std::string &str) {
@ -754,7 +754,7 @@ bool LexerRaku::IsOperatorChar(const int ch) {
* FIXME: *still* may not contain all valid characters * FIXME: *still* may not contain all valid characters
*/ */
bool LexerRaku::IsWordChar(const int ch, bool allowNumber) { bool LexerRaku::IsWordChar(const int ch, bool allowNumber) {
// Unicode numbers should not apear in word identifiers // Unicode numbers should not appear in word identifiers
if (ch > 0x7F) { if (ch > 0x7F) {
const CharacterCategory cc = CategoriseCharacter(ch); const CharacterCategory cc = CategoriseCharacter(ch);
switch (cc) { switch (cc) {
@ -1033,20 +1033,20 @@ Sci_Position LexerRaku::LengthToNonWordChar(StyleContext &sc, Sci_Position lengt
*/ */
void SCI_METHOD LexerRaku::Lex(Sci_PositionU startPos, Sci_Position length, int initStyle, IDocument *pAccess) { void SCI_METHOD LexerRaku::Lex(Sci_PositionU startPos, Sci_Position length, int initStyle, IDocument *pAccess) {
LexAccessor styler(pAccess); LexAccessor styler(pAccess);
DelimPair dpEmbeded; // delimiter pair: embeded comments DelimPair dpEmbeded; // delimiter pair: embedded comments
DelimPair dpString; // delimiter pair: string DelimPair dpString; // delimiter pair: string
DelimPair dpRegQ; // delimiter pair: Regex / Q Lang DelimPair dpRegQ; // delimiter pair: Regex / Q Lang
std::string hereDelim; // heredoc delimiter (if in heredoc) std::string hereDelim; // heredoc delimiter (if in heredoc)
int hereState = 0; // heredoc state to use (Q / QQ) int hereState = 0; // heredoc state to use (Q / QQ)
int numState = 0; // number state / type int numState = 0; // number state / type
short cntDecimal = 0; // number decinal count short cntDecimal = 0; // number decimal count
std::string wordLast; // last word seen std::string wordLast; // last word seen
std::string identLast; // last identifier seen std::string identLast; // last identifier seen
std::string adverbLast; // last (single) adverb seen std::string adverbLast; // last (single) adverb seen
WordList lastAdverbs; // last adverbs seen WordList lastAdverbs; // last adverbs seen
Sci_Position len; // temp length value Sci_Position len; // temp length value
char s[100]; // temp char string char s[100]; // temp char string
int typeDetect; // temp type detected (for regex and Q lang) int typeDetect = -1; // temp type detected (for regex and Q lang)
Sci_Position lengthToEnd; // length until the end of range Sci_Position lengthToEnd; // length until the end of range
// Backtrack to safe start position before complex quoted elements // Backtrack to safe start position before complex quoted elements
@ -1216,7 +1216,7 @@ void SCI_METHOD LexerRaku::Lex(Sci_PositionU startPos, Sci_Position length, int
sc.Forward(); sc.Forward();
} else { } else {
sc.SetState(SCE_RAKU_DEFAULT); sc.SetState(SCE_RAKU_DEFAULT);
break; // too many decinal places break; // too many decimal places
} }
} }
switch (numState) { switch (numState) {
@ -1463,7 +1463,7 @@ void SCI_METHOD LexerRaku::Lex(Sci_PositionU startPos, Sci_Position length, int
sc.SetState(hereState); sc.SetState(hereState);
} }
// Reset words: on operator simi-colon OR '}' (end of statement) // Reset words: on operator semi-colon OR '}' (end of statement)
if (sc.state == SCE_RAKU_OPERATOR && (sc.ch == ';' || sc.ch == '}')) { if (sc.state == SCE_RAKU_OPERATOR && (sc.ch == ';' || sc.ch == '}')) {
wordLast.clear(); wordLast.clear();
identLast.clear(); identLast.clear();
@ -1480,11 +1480,11 @@ void SCI_METHOD LexerRaku::Lex(Sci_PositionU startPos, Sci_Position length, int
sc.Forward(); // Condition met for "embedded comment" sc.Forward(); // Condition met for "embedded comment"
dpEmbeded.opener = sc.ch; dpEmbeded.opener = sc.ch;
// Find the opposite (termination) closeing bracket (if any) // Find the opposite (termination) closing bracket (if any)
dpEmbeded.closer[0] = GetBracketCloseChar(dpEmbeded.opener); dpEmbeded.closer[0] = GetBracketCloseChar(dpEmbeded.opener);
if (dpEmbeded.closer[0] > 0) { // Enter "embedded comment" if (dpEmbeded.closer[0] > 0) { // Enter "embedded comment"
// Find multiple opening character occurence // Find multiple opening character occurrence
dpEmbeded.count = GetRepeatCharCount(sc, dpEmbeded.opener, lengthToEnd); dpEmbeded.count = GetRepeatCharCount(sc, dpEmbeded.opener, lengthToEnd);
sc.SetState(SCE_RAKU_COMMENTEMBED); sc.SetState(SCE_RAKU_COMMENTEMBED);
sc.Forward(dpEmbeded.count - 1); // incremented in the next loop sc.Forward(dpEmbeded.count - 1); // incremented in the next loop

File diff suppressed because it is too large Load Diff

View File

@ -5,12 +5,12 @@
// Copyright 2003- by Sean O'Dell <sean@celsoft.com> // Copyright 2003- by Sean O'Dell <sean@celsoft.com>
// The License.txt file describes the conditions under which this software may be distributed. // The License.txt file describes the conditions under which this software may be distributed.
#include <stdlib.h> #include <cstdlib>
#include <string.h> #include <cassert>
#include <stdio.h> #include <cstring>
#include <stdarg.h> #include <cctype>
#include <assert.h> #include <cstdio>
#include <ctype.h> #include <cstdarg>
#include <string> #include <string>
#include <string_view> #include <string_view>
@ -28,12 +28,14 @@
using namespace Lexilla; using namespace Lexilla;
static const char * const yamlWordListDesc[] = { namespace {
const char * const yamlWordListDesc[] = {
"Keywords", "Keywords",
0 nullptr
}; };
static inline bool AtEOL(Accessor &styler, Sci_PositionU i) { inline bool AtEOL(Accessor &styler, Sci_PositionU i) {
return (styler[i] == '\n') || return (styler[i] == '\n') ||
((styler[i] == '\r') && (styler.SafeGetCharAt(i + 1) != '\n')); ((styler[i] == '\r') && (styler.SafeGetCharAt(i + 1) != '\n'));
} }
@ -42,12 +44,12 @@ static inline bool AtEOL(Accessor &styler, Sci_PositionU i) {
* Check for space, tab, line feed, or carriage return. * Check for space, tab, line feed, or carriage return.
* See YAML 1.2 spec sections 5.4. Line Break Characters and 5.5. White Space Characters. * See YAML 1.2 spec sections 5.4. Line Break Characters and 5.5. White Space Characters.
*/ */
static constexpr bool IsWhiteSpaceOrEOL(char ch) noexcept { constexpr bool IsWhiteSpaceOrEOL(char ch) noexcept {
return ch == ' ' || ch == '\t' || ch == '\n' || ch == '\r'; return ch == ' ' || ch == '\t' || ch == '\n' || ch == '\r';
} }
static unsigned int SpaceCount(char* lineBuffer) { unsigned int SpaceCount(char* lineBuffer) noexcept {
if (lineBuffer == NULL) if (lineBuffer == nullptr)
return 0; return 0;
char* headBuffer = lineBuffer; char* headBuffer = lineBuffer;
@ -58,8 +60,8 @@ static unsigned int SpaceCount(char* lineBuffer) {
return static_cast<unsigned int>(headBuffer - lineBuffer); return static_cast<unsigned int>(headBuffer - lineBuffer);
} }
static bool KeywordAtChar(char* lineBuffer, char* startComment, const WordList &keywords) { bool KeywordAtChar(const char* lineBuffer, char* startComment, const WordList &keywords) noexcept {
if (lineBuffer == NULL || startComment <= lineBuffer) if (lineBuffer == nullptr || startComment <= lineBuffer)
return false; return false;
char* endValue = startComment - 1; char* endValue = startComment - 1;
while (endValue >= lineBuffer && *endValue == ' ') while (endValue >= lineBuffer && *endValue == ' ')
@ -81,24 +83,24 @@ static bool KeywordAtChar(char* lineBuffer, char* startComment, const WordList &
#define YAML_STATE_TEXT_PARENT (4 << YAML_STATE_BITSIZE) #define YAML_STATE_TEXT_PARENT (4 << YAML_STATE_BITSIZE)
#define YAML_STATE_TEXT (5 << YAML_STATE_BITSIZE) #define YAML_STATE_TEXT (5 << YAML_STATE_BITSIZE)
static void ColouriseYAMLLine( void ColouriseYAMLLine(
char *lineBuffer, char *lineBuffer,
Sci_PositionU currentLine, Sci_PositionU currentLine,
Sci_PositionU lengthLine, Sci_PositionU lengthLine,
Sci_PositionU startLine, Sci_PositionU startLine,
Sci_PositionU endPos, Sci_PositionU endPos,
WordList &keywords, const WordList &keywords,
Accessor &styler) { Accessor &styler) {
Sci_PositionU i = 0; Sci_PositionU i = 0;
bool bInQuotes = false; bool bInQuotes = false;
unsigned int indentAmount = SpaceCount(lineBuffer); const unsigned int indentAmount = SpaceCount(lineBuffer);
if (currentLine > 0) { if (currentLine > 0) {
int parentLineState = styler.GetLineState(currentLine - 1); const int parentLineState = styler.GetLineState(currentLine - 1);
if ((parentLineState&YAML_STATE_MASK) == YAML_STATE_TEXT || (parentLineState&YAML_STATE_MASK) == YAML_STATE_TEXT_PARENT) { if ((parentLineState&YAML_STATE_MASK) == YAML_STATE_TEXT || (parentLineState&YAML_STATE_MASK) == YAML_STATE_TEXT_PARENT) {
unsigned int parentIndentAmount = parentLineState&(~YAML_STATE_MASK); const unsigned int parentIndentAmount = parentLineState&(~YAML_STATE_MASK);
if (indentAmount > parentIndentAmount) { if (indentAmount > parentIndentAmount) {
styler.SetLineState(currentLine, YAML_STATE_TEXT | parentIndentAmount); styler.SetLineState(currentLine, YAML_STATE_TEXT | parentIndentAmount);
styler.ColourTo(endPos, SCE_YAML_TEXT); styler.ColourTo(endPos, SCE_YAML_TEXT);
@ -189,7 +191,7 @@ static void ColouriseYAMLLine(
styler.ColourTo(endPos, SCE_YAML_COMMENT); styler.ColourTo(endPos, SCE_YAML_COMMENT);
return; return;
} }
Sci_PositionU i2 = i; const Sci_PositionU i2 = i;
while ((i < startComment) && lineBuffer[i]) { while ((i < startComment) && lineBuffer[i]) {
if (!(IsASCII(lineBuffer[i]) && isdigit(lineBuffer[i])) && lineBuffer[i] != '-' if (!(IsASCII(lineBuffer[i]) && isdigit(lineBuffer[i])) && lineBuffer[i] != '-'
&& lineBuffer[i] != '.' && lineBuffer[i] != ',' && lineBuffer[i] != ' ') { && lineBuffer[i] != '.' && lineBuffer[i] != ',' && lineBuffer[i] != ' ') {
@ -213,40 +215,38 @@ static void ColouriseYAMLLine(
styler.ColourTo(endPos, SCE_YAML_DEFAULT); styler.ColourTo(endPos, SCE_YAML_DEFAULT);
} }
static void ColouriseYAMLDoc(Sci_PositionU startPos, Sci_Position length, int, WordList *keywordLists[], Accessor &styler) { void ColouriseYAMLDoc(Sci_PositionU startPos, Sci_Position length, int, WordList *keywordLists[], Accessor &styler) {
char lineBuffer[1024] = ""; std::string lineBuffer;
styler.StartAt(startPos); styler.StartAt(startPos);
styler.StartSegment(startPos); styler.StartSegment(startPos);
Sci_PositionU linePos = 0;
Sci_PositionU startLine = startPos; Sci_PositionU startLine = startPos;
Sci_PositionU endPos = startPos + length; const Sci_PositionU endPos = startPos + length;
Sci_PositionU maxPos = styler.Length(); const Sci_PositionU maxPos = styler.Length();
Sci_PositionU lineCurrent = styler.GetLine(startPos); Sci_PositionU lineCurrent = styler.GetLine(startPos);
for (Sci_PositionU i = startPos; i < maxPos && i < endPos; i++) { for (Sci_PositionU i = startPos; i < maxPos && i < endPos; i++) {
lineBuffer[linePos++] = styler[i]; lineBuffer.push_back(styler[i]);
if (AtEOL(styler, i) || (linePos >= sizeof(lineBuffer) - 1)) { if (AtEOL(styler, i)) {
// End of line (or of line buffer) met, colourise it // End of line (or of line buffer) met, colourise it
lineBuffer[linePos] = '\0'; ColouriseYAMLLine(lineBuffer.data(), lineCurrent, lineBuffer.length(), startLine, i, *keywordLists[0], styler);
ColouriseYAMLLine(lineBuffer, lineCurrent, linePos, startLine, i, *keywordLists[0], styler); lineBuffer.clear();
linePos = 0;
startLine = i + 1; startLine = i + 1;
lineCurrent++; lineCurrent++;
} }
} }
if (linePos > 0) { // Last line does not have ending characters if (!lineBuffer.empty()) { // Last line does not have ending characters
ColouriseYAMLLine(lineBuffer, lineCurrent, linePos, startLine, startPos + length - 1, *keywordLists[0], styler); ColouriseYAMLLine(lineBuffer.data(), lineCurrent, lineBuffer.length(), startLine, startPos + length - 1, *keywordLists[0], styler);
} }
} }
static bool IsCommentLine(Sci_Position line, Accessor &styler) { bool IsCommentLine(Sci_Position line, Accessor &styler) {
Sci_Position pos = styler.LineStart(line); const Sci_Position pos = styler.LineStart(line);
if (styler[pos] == '#') if (styler[pos] == '#')
return true; return true;
return false; return false;
} }
static void FoldYAMLDoc(Sci_PositionU startPos, Sci_Position length, int /*initStyle - unused*/, void FoldYAMLDoc(Sci_PositionU startPos, Sci_Position length, int /*initStyle - unused*/,
WordList *[], Accessor &styler) { WordList *[], Accessor &styler) {
const Sci_Position maxPos = startPos + length; const Sci_Position maxPos = startPos + length;
const Sci_Position maxLines = styler.GetLine(maxPos - 1); // Requested last line const Sci_Position maxLines = styler.GetLine(maxPos - 1); // Requested last line
@ -259,10 +259,10 @@ static void FoldYAMLDoc(Sci_PositionU startPos, Sci_Position length, int /*initS
// at least one line in all cases) // at least one line in all cases)
int spaceFlags = 0; int spaceFlags = 0;
Sci_Position lineCurrent = styler.GetLine(startPos); Sci_Position lineCurrent = styler.GetLine(startPos);
int indentCurrent = styler.IndentAmount(lineCurrent, &spaceFlags, NULL); int indentCurrent = styler.IndentAmount(lineCurrent, &spaceFlags, nullptr);
while (lineCurrent > 0) { while (lineCurrent > 0) {
lineCurrent--; lineCurrent--;
indentCurrent = styler.IndentAmount(lineCurrent, &spaceFlags, NULL); indentCurrent = styler.IndentAmount(lineCurrent, &spaceFlags, nullptr);
if (!(indentCurrent & SC_FOLDLEVELWHITEFLAG) && if (!(indentCurrent & SC_FOLDLEVELWHITEFLAG) &&
(!IsCommentLine(lineCurrent, styler))) (!IsCommentLine(lineCurrent, styler)))
break; break;
@ -285,7 +285,7 @@ static void FoldYAMLDoc(Sci_PositionU startPos, Sci_Position length, int /*initS
int indentNext = indentCurrent; int indentNext = indentCurrent;
if (lineNext <= docLines) { if (lineNext <= docLines) {
// Information about next line is only available if not at end of document // Information about next line is only available if not at end of document
indentNext = styler.IndentAmount(lineNext, &spaceFlags, NULL); indentNext = styler.IndentAmount(lineNext, &spaceFlags, nullptr);
} }
const int comment = foldComment && IsCommentLine(lineCurrent, styler); const int comment = foldComment && IsCommentLine(lineCurrent, styler);
const int comment_start = (comment && !prevComment && (lineNext <= docLines) && const int comment_start = (comment && !prevComment && (lineNext <= docLines) &&
@ -314,7 +314,7 @@ static void FoldYAMLDoc(Sci_PositionU startPos, Sci_Position length, int /*initS
(lineNext <= docLines && IsCommentLine(lineNext, styler)))) { (lineNext <= docLines && IsCommentLine(lineNext, styler)))) {
lineNext++; lineNext++;
indentNext = styler.IndentAmount(lineNext, &spaceFlags, NULL); indentNext = styler.IndentAmount(lineNext, &spaceFlags, nullptr);
} }
const int levelAfterComments = indentNext & SC_FOLDLEVELNUMBERMASK; const int levelAfterComments = indentNext & SC_FOLDLEVELNUMBERMASK;
@ -329,12 +329,12 @@ static void FoldYAMLDoc(Sci_PositionU startPos, Sci_Position length, int /*initS
int skipLevel = levelAfterComments; int skipLevel = levelAfterComments;
while (--skipLine > lineCurrent) { while (--skipLine > lineCurrent) {
int skipLineIndent = styler.IndentAmount(skipLine, &spaceFlags, NULL); const int skipLineIndent = styler.IndentAmount(skipLine, &spaceFlags, nullptr);
if ((skipLineIndent & SC_FOLDLEVELNUMBERMASK) > levelAfterComments) if ((skipLineIndent & SC_FOLDLEVELNUMBERMASK) > levelAfterComments)
skipLevel = levelBeforeComments; skipLevel = levelBeforeComments;
int whiteFlag = skipLineIndent & SC_FOLDLEVELWHITEFLAG; const int whiteFlag = skipLineIndent & SC_FOLDLEVELWHITEFLAG;
styler.SetLevel(skipLine, skipLevel | whiteFlag); styler.SetLevel(skipLine, skipLevel | whiteFlag);
} }
@ -359,4 +359,6 @@ static void FoldYAMLDoc(Sci_PositionU startPos, Sci_Position length, int /*initS
//styler.SetLevel(lineCurrent, indentCurrent); //styler.SetLevel(lineCurrent, indentCurrent);
} }
}
LexerModule lmYAML(SCLEX_YAML, ColouriseYAMLDoc, "yaml", FoldYAMLDoc, yamlWordListDesc); LexerModule lmYAML(SCLEX_YAML, ColouriseYAMLDoc, "yaml", FoldYAMLDoc, yamlWordListDesc);

View File

@ -89,3 +89,14 @@ void StyleContext::GetCurrent(char *s, Sci_PositionU len) {
void StyleContext::GetCurrentLowered(char *s, Sci_PositionU len) { void StyleContext::GetCurrentLowered(char *s, Sci_PositionU len) {
styler.GetRangeLowered(styler.GetStartSegment(), currentPos, s, len); styler.GetRangeLowered(styler.GetStartSegment(), currentPos, s, len);
} }
void StyleContext::GetCurrentString(std::string &string, Transform transform) {
const Sci_PositionU startPos = styler.GetStartSegment();
const Sci_PositionU len = currentPos - styler.GetStartSegment();
string.resize(len);
if (transform == Transform::lower) {
styler.GetRangeLowered(startPos, currentPos, string.data(), len + 1);
} else {
styler.GetRange(startPos, currentPos, string.data(), len + 1);
}
}

View File

@ -183,6 +183,8 @@ public:
bool MatchIgnoreCase2(const char *s); bool MatchIgnoreCase2(const char *s);
void GetCurrent(char *s, Sci_PositionU len); void GetCurrent(char *s, Sci_PositionU len);
void GetCurrentLowered(char *s, Sci_PositionU len); void GetCurrentLowered(char *s, Sci_PositionU len);
enum class Transform { none, lower };
void GetCurrentString(std::string &string, Transform transform);
}; };
} }

View File

@ -9,6 +9,7 @@
#include <cassert> #include <cassert>
#include <cstring> #include <cstring>
#include <string>
#include <algorithm> #include <algorithm>
#include <iterator> #include <iterator>
#include <memory> #include <memory>
@ -182,6 +183,12 @@ bool WordList::InList(const char *s) const noexcept {
return false; return false;
} }
/** convenience overload so can easily call with std::string.
*/
bool WordList::InList(const std::string &s) const noexcept {
return InList(s.c_str());
}
/** similar to InList, but word s can be a substring of keyword. /** similar to InList, but word s can be a substring of keyword.
* eg. the keyword define is defined as def~ine. This means the word must start * eg. the keyword define is defined as def~ine. This means the word must start
* with def to be a keyword, but also defi, defin and define are valid. * with def to be a keyword, but also defi, defin and define are valid.

View File

@ -33,6 +33,7 @@ public:
void Clear() noexcept; void Clear() noexcept;
bool Set(const char *s); bool Set(const char *s);
bool InList(const char *s) const noexcept; bool InList(const char *s) const noexcept;
bool InList(const std::string &s) const noexcept;
bool InListAbbreviated(const char *s, const char marker) const noexcept; bool InListAbbreviated(const char *s, const char marker) const noexcept;
bool InListAbridged(const char *s, const char marker) const noexcept; bool InListAbridged(const char *s, const char marker) const noexcept;
const char *WordAt(int n) const noexcept; const char *WordAt(int n) const noexcept;

View File

@ -0,0 +1,23 @@
@echo off
rem Promote new result files.
rem Find all the *.new files under test\examples and copy them to their expected name without ".new".
rem Run after RunTest.bat if ".new" result files are correct.
pushd ..\test\examples
for /R %%f in (*.new) do (call :moveFile %%f)
popd
goto :eof
:moveFile
set pathWithNew=%1
set directory=%~dp1
set fileWithNew=%~nx1
set fileNoNew=%~n1
set pathNoNew=%pathWithNew:~0,-4%
if exist %pathNoNew% (
echo Move %fileWithNew% to %fileNoNew% in %directory%
) else (
echo New %fileWithNew% to %fileNoNew% in %directory%
)
move %pathWithNew% %pathNoNew%
goto :eof

View File

@ -90,7 +90,7 @@
<ItemDefinitionGroup> <ItemDefinitionGroup>
<ClCompile> <ClCompile>
<WarningLevel>Level4</WarningLevel> <WarningLevel>Level4</WarningLevel>
<PreprocessorDefinitions>WIN32;SCI_LEXER;_CRT_SECURE_NO_DEPRECATE;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>WIN32;_CRT_SECURE_NO_DEPRECATE;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>..\include;..\..\scintilla\include;..\lexlib;</AdditionalIncludeDirectories> <AdditionalIncludeDirectories>..\include;..\..\scintilla\include;..\lexlib;</AdditionalIncludeDirectories>
<BrowseInformation>true</BrowseInformation> <BrowseInformation>true</BrowseInformation>
<MultiProcessorCompilation>true</MultiProcessorCompilation> <MultiProcessorCompilation>true</MultiProcessorCompilation>

View File

@ -15,7 +15,7 @@
<key>CFBundlePackageType</key> <key>CFBundlePackageType</key>
<string>$(PRODUCT_BUNDLE_PACKAGE_TYPE)</string> <string>$(PRODUCT_BUNDLE_PACKAGE_TYPE)</string>
<key>CFBundleShortVersionString</key> <key>CFBundleShortVersionString</key>
<string>5.2.2</string> <string>5.2.4</string>
<key>CFBundleVersion</key> <key>CFBundleVersion</key>
<string>$(CURRENT_PROJECT_VERSION)</string> <string>$(CURRENT_PROJECT_VERSION)</string>
<key>NSHumanReadableCopyright</key> <key>NSHumanReadableCopyright</key>

View File

@ -768,6 +768,7 @@
CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = NO; COPY_PHASE_STRIP = NO;
DEAD_CODE_STRIPPING = YES;
DEBUG_INFORMATION_FORMAT = dwarf; DEBUG_INFORMATION_FORMAT = dwarf;
ENABLE_STRICT_OBJC_MSGSEND = YES; ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES; ENABLE_TESTABILITY = YES;
@ -827,6 +828,7 @@
CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = NO; COPY_PHASE_STRIP = NO;
DEAD_CODE_STRIPPING = YES;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
ENABLE_NS_ASSERTIONS = NO; ENABLE_NS_ASSERTIONS = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES; ENABLE_STRICT_OBJC_MSGSEND = YES;
@ -851,7 +853,8 @@
buildSettings = { buildSettings = {
CLANG_CXX_LANGUAGE_STANDARD = "gnu++17"; CLANG_CXX_LANGUAGE_STANDARD = "gnu++17";
CODE_SIGN_STYLE = Automatic; CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 5.2.2; CURRENT_PROJECT_VERSION = 5.2.4;
DEAD_CODE_STRIPPING = YES;
DEVELOPMENT_TEAM = 4F446KW87E; DEVELOPMENT_TEAM = 4F446KW87E;
DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1; DYLIB_CURRENT_VERSION = 1;
@ -877,7 +880,8 @@
buildSettings = { buildSettings = {
CLANG_CXX_LANGUAGE_STANDARD = "gnu++17"; CLANG_CXX_LANGUAGE_STANDARD = "gnu++17";
CODE_SIGN_STYLE = Automatic; CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 5.2.2; CURRENT_PROJECT_VERSION = 5.2.4;
DEAD_CODE_STRIPPING = YES;
DEVELOPMENT_TEAM = 4F446KW87E; DEVELOPMENT_TEAM = 4F446KW87E;
DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1; DYLIB_CURRENT_VERSION = 1;

View File

@ -4,8 +4,8 @@
#include <windows.h> #include <windows.h>
#define VERSION_LEXILLA "5.2.2" #define VERSION_LEXILLA "5.2.4"
#define VERSION_WORDS 5, 2, 2, 0 #define VERSION_WORDS 5, 2, 4, 0
VS_VERSION_INFO VERSIONINFO VS_VERSION_INFO VERSIONINFO
FILEVERSION VERSION_WORDS FILEVERSION VERSION_WORDS

View File

@ -35,7 +35,7 @@ SUBSYSTEM=-SUBSYSTEM:WINDOWS,10.00
!ENDIF !ENDIF
!ENDIF !ENDIF
CRTFLAGS=-D_CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES=1 -D_CRT_SECURE_NO_DEPRECATE=1 $(ADD_DEFINE) CRTFLAGS=-D_CRT_SECURE_NO_DEPRECATE=1 $(ADD_DEFINE)
CXXFLAGS=-Zi -TP -MP -W4 -EHsc -std:c++17 $(CRTFLAGS) CXXFLAGS=-Zi -TP -MP -W4 -EHsc -std:c++17 $(CRTFLAGS)
CXXDEBUG=-Od -MTd -DDEBUG CXXDEBUG=-Od -MTd -DDEBUG
CXXNDEBUG=-O2 -MT -DNDEBUG -GL CXXNDEBUG=-O2 -MT -DNDEBUG -GL

View File

@ -77,6 +77,13 @@ picture: gives a rough idea of the fold structure: '|' for level greater than 0x
After checking that the .folded.new file is correct, it can be promoted to .folded and After checking that the .folded.new file is correct, it can be promoted to .folded and
committed to the repository. committed to the repository.
An interactive file comparison program like WinMerge (https://winmerge.org/) on
Windows or meld (https://meldmerge.org/) on Linux can help examine differences
between the .styled and .styled.new files or .folded and .folded.new files.
On Windows, the scripts/PromoteNew.bat script can be run to promote all .new result
files to their base names without .new.
Styling and folding tests are first performed on the file as a whole, then the file is lexed Styling and folding tests are first performed on the file as a whole, then the file is lexed
and folded line-by-line. If there are differences between the whole file and line-by-line and folded line-by-line. If there are differences between the whole file and line-by-line
then a message with 'per-line is different' for styling or 'per-line has different folds' will be then a message with 'per-line is different' for styling or 'per-line has different folds' will be
@ -94,6 +101,10 @@ Keywords may be defined with keywords settings like:
keywords.*.cxx;*.c=int char keywords.*.cxx;*.c=int char
keywords2.*.cxx=open keywords2.*.cxx=open
Substyles and substyle identifiers may be defined with settings like:
substyles.cpp.11=1
substylewords.11.1.*.cxx=map string vector
Other settings are treated as lexer or folder properties and forwarded to the lexer/folder: Other settings are treated as lexer or folder properties and forwarded to the lexer/folder:
lexer.cpp.track.preprocessor=1 lexer.cpp.track.preprocessor=1
fold=1 fold=1

View File

@ -120,7 +120,9 @@ void TestDocument::Set(std::string_view sv) {
lineStarts.push_back(pos + 1); lineStarts.push_back(pos + 1);
} }
} }
lineStarts.push_back(text.length()); if (lineStarts.back() != Length()) {
lineStarts.push_back(Length());
}
lineStates.resize(lineStarts.size()); lineStates.resize(lineStarts.size());
lineLevels.resize(lineStarts.size(), 0x400); lineLevels.resize(lineStarts.size(), 0x400);
} }
@ -130,6 +132,10 @@ void TestDocument::Set(std::string_view sv) {
#pragma warning(disable: 26440) #pragma warning(disable: 26440)
#endif #endif
Sci_Position TestDocument::MaxLine() const noexcept {
return lineStarts.size() - 1;
}
int SCI_METHOD TestDocument::Version() const { int SCI_METHOD TestDocument::Version() const {
return Scintilla::dvRelease4; return Scintilla::dvRelease4;
} }
@ -153,8 +159,8 @@ char SCI_METHOD TestDocument::StyleAt(Sci_Position position) const {
} }
Sci_Position SCI_METHOD TestDocument::LineFromPosition(Sci_Position position) const { Sci_Position SCI_METHOD TestDocument::LineFromPosition(Sci_Position position) const {
if (position >= static_cast<Sci_Position>(text.length())) { if (position >= Length()) {
return lineStarts.size() - 1 - 1; return MaxLine();
} }
const std::vector<Sci_Position>::const_iterator it = std::lower_bound(lineStarts.begin(), lineStarts.end(), position); const std::vector<Sci_Position>::const_iterator it = std::lower_bound(lineStarts.begin(), lineStarts.end(), position);
@ -169,7 +175,7 @@ Sci_Position SCI_METHOD TestDocument::LineStart(Sci_Position line) const {
return 0; return 0;
} }
if (line >= static_cast<Sci_Position>(lineStarts.size())) { if (line >= static_cast<Sci_Position>(lineStarts.size())) {
return text.length(); return Length();
} }
return lineStarts.at(line); return lineStarts.at(line);
} }
@ -179,6 +185,9 @@ int SCI_METHOD TestDocument::GetLevel(Sci_Position line) const {
} }
int SCI_METHOD TestDocument::SetLevel(Sci_Position line, int level) { int SCI_METHOD TestDocument::SetLevel(Sci_Position line, int level) {
if (line == static_cast<Sci_Position>(lineLevels.size())) {
return 0x400;
}
return lineLevels.at(line) = level; return lineLevels.at(line) = level;
} }
@ -243,6 +252,11 @@ int SCI_METHOD TestDocument::GetLineIndentation(Sci_Position) {
} }
Sci_Position SCI_METHOD TestDocument::LineEnd(Sci_Position line) const { Sci_Position SCI_METHOD TestDocument::LineEnd(Sci_Position line) const {
const Sci_Position maxLine = MaxLine();
if (line == maxLine || line == maxLine+1) {
return text.length();
}
assert(line < maxLine);
Sci_Position position = LineStart(line + 1); Sci_Position position = LineStart(line + 1);
position--; // Back over CR or LF position--; // Back over CR or LF
// When line terminator is CR+LF, may need to go back one more // When line terminator is CR+LF, may need to go back one more
@ -288,7 +302,7 @@ Sci_Position SCI_METHOD TestDocument::GetRelativePosition(Sci_Position positionS
int SCI_METHOD TestDocument::GetCharacterAndWidth(Sci_Position position, Sci_Position *pWidth) const { int SCI_METHOD TestDocument::GetCharacterAndWidth(Sci_Position position, Sci_Position *pWidth) const {
// TODO: invalid UTF-8 // TODO: invalid UTF-8
if (position >= static_cast<Sci_Position>(text.length())) { if (position >= Length()) {
// Return NULs after document end // Return NULs after document end
if (pWidth) { if (pWidth) {
*pWidth = 1; *pWidth = 1;

View File

@ -27,6 +27,8 @@ public:
TestDocument &operator=(TestDocument&&) = delete; TestDocument &operator=(TestDocument&&) = delete;
virtual ~TestDocument() = default; virtual ~TestDocument() = default;
Sci_Position MaxLine() const noexcept;
int SCI_METHOD Version() const override; int SCI_METHOD Version() const override;
void SCI_METHOD SetErrorStatus(int status) override; void SCI_METHOD SetErrorStatus(int status) override;
Sci_Position SCI_METHOD Length() const override; Sci_Position SCI_METHOD Length() const override;

View File

@ -270,7 +270,9 @@ std::string MarkedDocument(const Scintilla::IDocument *pdoc) {
for (Sci_Position pos = 0; pos < pdoc->Length(); pos++) { for (Sci_Position pos = 0; pos < pdoc->Length(); pos++) {
const char styleNow = pdoc->StyleAt(pos); const char styleNow = pdoc->StyleAt(pos);
if (styleNow != prevStyle) { if (styleNow != prevStyle) {
os << "{" << static_cast<unsigned int>(styleNow) << "}"; const unsigned char uStyleNow = styleNow;
const unsigned int uiStyleNow = uStyleNow;
os << "{" << uiStyleNow << "}";
prevStyle = styleNow; prevStyle = styleNow;
} }
char ch = '\0'; char ch = '\0';
@ -750,10 +752,35 @@ void TestILexer(Scintilla::ILexer5 *plex) {
} }
} }
bool SetProperties(Scintilla::ILexer5 *plex, const PropertyMap &propertyMap, std::filesystem::path path) { bool SetProperties(Scintilla::ILexer5 *plex, const std::string &language, const PropertyMap &propertyMap, std::filesystem::path path) {
assert(plex); assert(plex);
const std::string fileName = path.filename().string(); const std::string fileName = path.filename().string();
if (std::string_view bases = plex->GetSubStyleBases(); !bases.empty()) {
// Allocate a substyle for each possible style
while (!bases.empty()) {
const int baseStyle = bases.front();
// substyles.cpp.11=2
const std::string base = std::to_string(baseStyle);
const std::string substylesForBase = "substyles." + language + "." + base;
std::optional<std::string> substylesN = propertyMap.GetProperty(substylesForBase);
if (substylesN) {
const int substyles = atoi(substylesN->c_str());
const int baseStyleNum = plex->AllocateSubStyles(baseStyle, substyles);
// substylewords.11.1.$(file.patterns.cpp)=std map string vector
for (int kw = 0; kw < substyles; kw++) {
const std::string substyleWords = "substylewords." + base + "." + std::to_string(kw + 1) + ".*";
const std::optional<std::string> keywordN = propertyMap.GetPropertyForFile(substyleWords, fileName);
if (keywordN) {
plex->SetIdentifiers(baseStyleNum + kw, keywordN->c_str());
}
}
}
bases.remove_prefix(1);
}
}
// Set keywords, keywords2, ... keywords9, for this file // Set keywords, keywords2, ... keywords9, for this file
for (int kw = 0; kw < 10; kw++) { for (int kw = 0; kw < 10; kw++) {
std::string kwChoice("keywords"); std::string kwChoice("keywords");
@ -790,6 +817,8 @@ bool SetProperties(Scintilla::ILexer5 *plex, const PropertyMap &propertyMap, std
// Ignore as processed earlier // Ignore as processed earlier
} else if (key.starts_with("keywords")) { } else if (key.starts_with("keywords")) {
// Ignore as processed earlier // Ignore as processed earlier
} else if (key.starts_with("substyle")) {
// Ignore as processed earlier
} else { } else {
plex->PropertySet(key.c_str(), val.c_str()); plex->PropertySet(key.c_str(), val.c_str());
} }
@ -812,12 +841,12 @@ bool TestFile(const std::filesystem::path &path, const PropertyMap &propertyMap)
return false; return false;
} }
if (!SetProperties(plex, propertyMap, path)) { TestILexer(plex);
if (!SetProperties(plex, *language, propertyMap, path)) {
return false; return false;
} }
TestILexer(plex);
std::string text = ReadFile(path); std::string text = ReadFile(path);
if (text.starts_with(BOM)) { if (text.starts_with(BOM)) {
text.erase(0, BOM.length()); text.erase(0, BOM.length());
@ -880,7 +909,7 @@ bool TestFile(const std::filesystem::path &path, const PropertyMap &propertyMap)
if (success) { if (success) {
Scintilla::ILexer5 *plexCRLF = Lexilla::MakeLexer(*language); Scintilla::ILexer5 *plexCRLF = Lexilla::MakeLexer(*language);
SetProperties(plexCRLF, propertyMap, path.filename().string()); SetProperties(plexCRLF, *language, propertyMap, path.filename().string());
success = TestCRLF(path, text, plexCRLF, disablePerLineTests); success = TestCRLF(path, text, plexCRLF, disablePerLineTests);
} }

View File

@ -0,0 +1,11 @@
// SCE_C_WORD2 (16)
second
// SCE_C_IDENTIFIER (11)
Second
// SCE_C_IDENTIFIER (11)
upper
// SCE_C_WORD2 (16)
Upper

View File

@ -0,0 +1,12 @@
0 400 400 // SCE_C_WORD2 (16)
0 400 400 second
1 400 400
0 400 400 // SCE_C_IDENTIFIER (11)
0 400 400 Second
1 400 400
0 400 400 // SCE_C_IDENTIFIER (11)
0 400 400 upper
1 400 400
0 400 400 // SCE_C_WORD2 (16)
0 400 400 Upper
1 400 400

View File

@ -0,0 +1,11 @@
{2}// SCE_C_WORD2 (16)
{16}second{0}
{2}// SCE_C_IDENTIFIER (11)
{11}Second{0}
{2}// SCE_C_IDENTIFIER (11)
{11}upper{0}
{2}// SCE_C_WORD2 (16)
{16}Upper{0}

View File

@ -84,6 +84,15 @@ R"( )"
// escapesequence=27 // escapesequence=27
"\001 \b" "\001 \b"
// identifier substyles.11.1=128
vector
// identifier substyles.11.2=129
std
// commentdockeyword substyles.17.1=130
/** @module */
// Secondary styles inside preprocessor excluded section // Secondary styles inside preprocessor excluded section
#if 0 #if 0
@ -172,4 +181,13 @@ R"( )"
// escapesequence=27 // escapesequence=27
"\001 \b" "\001 \b"
// identifier substyles.75.1=192
vector
// identifier substyles.75.2=193
std
// commentdockeyword substyles.81.1=194
/** @module */
#endif #endif

View File

@ -84,6 +84,15 @@
0 400 400 // escapesequence=27 0 400 400 // escapesequence=27
0 400 400 "\001 \b" 0 400 400 "\001 \b"
1 400 400 1 400 400
0 400 400 // identifier substyles.11.1=128
0 400 400 vector
1 400 400
0 400 400 // identifier substyles.11.2=129
0 400 400 std
1 400 400
0 400 400 // commentdockeyword substyles.17.1=130
0 400 400 /** @module */
1 400 400
0 400 400 // Secondary styles inside preprocessor excluded section 0 400 400 // Secondary styles inside preprocessor excluded section
1 400 400 1 400 400
2 400 401 + #if 0 2 400 401 + #if 0
@ -172,5 +181,14 @@
0 401 401 | // escapesequence=27 0 401 401 | // escapesequence=27
0 401 401 | "\001 \b" 0 401 401 | "\001 \b"
1 401 401 | 1 401 401 |
0 401 401 | // identifier substyles.75.1=192
0 401 401 | vector
1 401 401 |
0 401 401 | // identifier substyles.75.2=193
0 401 401 | std
1 401 401 |
0 401 401 | // commentdockeyword substyles.81.1=194
0 401 401 | /** @module */
1 401 401 |
0 401 400 | #endif 0 401 400 | #endif
1 400 400 1 400 400

View File

@ -84,6 +84,15 @@
{2}// escapesequence=27 {2}// escapesequence=27
{6}"{27}\001{6} {27}\b{6}"{0} {6}"{27}\001{6} {27}\b{6}"{0}
{2}// identifier substyles.11.1=128
{128}vector{0}
{2}// identifier substyles.11.2=129
{129}std{0}
{2}// commentdockeyword substyles.17.1=130
{3}/** {130}@module{3} */{0}
{2}// Secondary styles inside preprocessor excluded section {2}// Secondary styles inside preprocessor excluded section
{0} {0}
{9}#if 0 {9}#if 0
@ -172,4 +181,13 @@
{66}// escapesequence=27 {66}// escapesequence=27
{70}"{91}\001{70} {91}\b{70}"{64} {70}"{91}\001{70} {91}\b{70}"{64}
{66}// identifier substyles.75.1=192
{192}vector{64}
{66}// identifier substyles.75.2=193
{193}std{64}
{66}// commentdockeyword substyles.81.1=194
{67}/** {194}@module{67} */{64}
{9}#endif {9}#endif

View File

@ -1,12 +1,19 @@
# coding: utf-8 # coding: utf-8
lexer.*.cxx=cpp lexer.*.cxx=cpp
keywords.*.cxx=int let uuid keywords.*.cxx=int let uuid
keywords2.*.cxx=second keywords2.*.cxx=second Upper
keywords3.*.cxx=file keywords3.*.cxx=file
keywords4.*.cxx=global keywords4.*.cxx=global
keywords5.*.cxx= keywords5.*.cxx=
keywords6.*.cxx=TODO keywords6.*.cxx=TODO
substyles.cpp.11=2
substylewords.11.1.*.cxx=map string vector
substylewords.11.2.*.cxx=std gsl
substyles.cpp.17=1
substylewords.17.1.*.cxx=module
lexer.cpp.track.preprocessor=1 lexer.cpp.track.preprocessor=1
lexer.cpp.escape.sequence=1 lexer.cpp.escape.sequence=1
# Set options so that AllStyles.cxx can show every style # Set options so that AllStyles.cxx can show every style

View File

@ -0,0 +1,49 @@
Default=0
Default
Comment=1
Another comment
Command=2 diff
diff -u a/cocoa/ScintillaCocoa.mm b/cocoa/ScintillaCocoa.mm
Header=3 ---
--- a/cocoa/ScintillaCocoa.mm 2016-12-30 14:38:22.000000000 -0600
Header=3 +++
+++ b/cocoa/ScintillaCocoa.mm 2017-02-15 08:20:12.000000000 -0600
Position=4 @@
@@ -388,7 +388,8 @@
- (void) idleTriggered: (NSNotification*) notification
{
#pragma unused(notification)
Deleted=5 -
- static_cast<ScintillaCocoa*>(mTarget)->IdleTimerFired();
Added=6 +
+ if (mTarget)
+ static_cast<ScintillaCocoa*>(mTarget)->IdleTimerFired();
}
@end
Changed=7 !
! GdkColor white = { 0, 0xFFFF, 0xFFFF, 0xFFFF};
PatchAdd=8 ++
++ styler.ColourTo(i - 1, StateToPrint);
PatchDelete=9 +-
+- styler.ColourTo(i - 1, StateToPrint);
RemovedPatchAdd=10 -+
-+ styler.ColourTo(i - 1, StateToPrint);
RemovedPatchDelete=11 --
-- styler.ColourTo(i - 1, StateToPrint);
diff -u a/cocoa/ScintillaCocoa.h b/cocoa/ScintillaCocoa.h

View File

@ -0,0 +1,50 @@
0 400 0 Default=0
0 400 0 Default
0 400 0
0 400 0 Comment=1
0 400 0 Another comment
0 400 0
0 400 0 Command=2 diff
2 400 0 + diff -u a/cocoa/ScintillaCocoa.mm b/cocoa/ScintillaCocoa.mm
0 401 0 |
0 401 0 | Header=3 ---
2 401 0 + --- a/cocoa/ScintillaCocoa.mm 2016-12-30 14:38:22.000000000 -0600
0 402 0 |
0 402 0 | Header=3 +++
2 401 0 + +++ b/cocoa/ScintillaCocoa.mm 2017-02-15 08:20:12.000000000 -0600
0 402 0 |
0 402 0 | Position=4 @@
2 402 0 + @@ -388,7 +388,8 @@
0 403 0 |
0 403 0 | - (void) idleTriggered: (NSNotification*) notification
0 403 0 | {
0 403 0 | #pragma unused(notification)
0 403 0 |
0 403 0 | Deleted=5 -
0 403 0 | - static_cast<ScintillaCocoa*>(mTarget)->IdleTimerFired();
0 403 0 |
0 403 0 | Added=6 +
0 403 0 | + if (mTarget)
0 403 0 | + static_cast<ScintillaCocoa*>(mTarget)->IdleTimerFired();
0 403 0 | }
0 403 0 |
0 403 0 | @end
0 403 0 |
0 403 0 | Changed=7 !
0 403 0 | ! GdkColor white = { 0, 0xFFFF, 0xFFFF, 0xFFFF};
0 403 0 |
0 403 0 | PatchAdd=8 ++
0 403 0 | ++ styler.ColourTo(i - 1, StateToPrint);
0 403 0 |
0 403 0 | PatchDelete=9 +-
0 403 0 | +- styler.ColourTo(i - 1, StateToPrint);
0 403 0 |
0 403 0 | RemovedPatchAdd=10 -+
0 403 0 | -+ styler.ColourTo(i - 1, StateToPrint);
0 403 0 |
0 403 0 | RemovedPatchDelete=11 --
0 403 0 | -- styler.ColourTo(i - 1, StateToPrint);
0 403 0 |
2 400 0 + diff -u a/cocoa/ScintillaCocoa.h b/cocoa/ScintillaCocoa.h
0 401 0 |
0 400 0

View File

@ -0,0 +1,49 @@
{1}Default=0
{0} Default
{1}
Comment=1
Another comment
Command=2 diff
{2}diff -u a/cocoa/ScintillaCocoa.mm b/cocoa/ScintillaCocoa.mm
{1}
Header=3 ---
{3}--- a/cocoa/ScintillaCocoa.mm 2016-12-30 14:38:22.000000000 -0600
{1}
Header=3 +++
{3}+++ b/cocoa/ScintillaCocoa.mm 2017-02-15 08:20:12.000000000 -0600
{1}
Position=4 @@
{4}@@ -388,7 +388,8 @@
{1}
{0} - (void) idleTriggered: (NSNotification*) notification
{
#pragma unused(notification)
{1}
Deleted=5 -
{5}- static_cast<ScintillaCocoa*>(mTarget)->IdleTimerFired();
{1}
Added=6 +
{6}+ if (mTarget)
+ static_cast<ScintillaCocoa*>(mTarget)->IdleTimerFired();
{0} }
@end
{1}
Changed=7 !
{7}! GdkColor white = { 0, 0xFFFF, 0xFFFF, 0xFFFF};
{1}
PatchAdd=8 ++
{8}++ styler.ColourTo(i - 1, StateToPrint);
{1}
PatchDelete=9 +-
{9}+- styler.ColourTo(i - 1, StateToPrint);
{1}
RemovedPatchAdd=10 -+
{10}-+ styler.ColourTo(i - 1, StateToPrint);
{1}
RemovedPatchDelete=11 --
{11}-- styler.ColourTo(i - 1, StateToPrint);
{1}
{2}diff -u a/cocoa/ScintillaCocoa.h b/cocoa/ScintillaCocoa.h
{1}

View File

@ -0,0 +1,2 @@
+A 1026-byte line is longer than 1024-byte buffer but doesn't cause problems as diff state determine by short line prefix 3456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456

View File

@ -0,0 +1,3 @@
0 400 0 +A 1026-byte line is longer than 1024-byte buffer but doesn't cause problems as diff state determine by short line prefix 3456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456
0 400 0
0 400 0

View File

@ -0,0 +1,2 @@
{6}+A 1026-byte line is longer than 1024-byte buffer but doesn't cause problems as diff state determine by short line prefix 3456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456
{1}

View File

@ -0,0 +1,2 @@
lexer.*.diff=diff
fold=1

View File

@ -49,3 +49,7 @@ var hilight = 2
@onready @onready
var a = 3 var a = 3
@onready var b = 3 @onready var b = 3
# node-identifier=16
%node
$node

View File

@ -49,4 +49,8 @@
0 400 0 @onready 0 400 0 @onready
0 400 0 var a = 3 0 400 0 var a = 3
0 400 0 @onready var b = 3 0 400 0 @onready var b = 3
1 400 0
0 400 0 # node-identifier=16
0 400 0 %node
0 400 0 $node
1 400 0 1 400 0

View File

@ -49,3 +49,7 @@
{15}@onready{0} {15}@onready{0}
{5}var{0} {11}a{0} {10}={0} {2}3{0} {5}var{0} {11}a{0} {10}={0} {2}3{0}
{15}@onready{0} {5}var{0} {11}b{0} {10}={0} {2}3{0} {15}@onready{0} {5}var{0} {11}b{0} {10}={0} {2}3{0}
{1}# node-identifier=16{0}
{16}%node{0}
{16}$node{0}

View File

@ -0,0 +1,33 @@
# nodepath
$Node
%Node
%node/"n o d e"/%'n o d e'
%"No de"
$/root/ThisNode/%Node % %test
$MainMenuPanel/%Options % %test
%Options % %test
$Node % %test
get_node("%Options") % %test
$"Nod se" % %test
$/test/"No % de"/test % %test
%node/"n o d e"/'n o d e' % %"No De"
"%010d" % 12345
1 % 1
a % b

View File

@ -0,0 +1,34 @@
0 400 0 # nodepath
1 400 0
0 400 0 $Node
1 400 0
0 400 0 %Node
1 400 0
0 400 0 %node/"n o d e"/%'n o d e'
1 400 0
0 400 0 %"No de"
1 400 0
1 400 0
0 400 0 $/root/ThisNode/%Node % %test
1 400 0
0 400 0 $MainMenuPanel/%Options % %test
1 400 0
0 400 0 %Options % %test
1 400 0
0 400 0 $Node % %test
1 400 0
1 400 0
0 400 0 get_node("%Options") % %test
1 400 0
0 400 0 $"Nod se" % %test
1 400 0
0 400 0 $/test/"No % de"/test % %test
1 400 0
0 400 0 %node/"n o d e"/'n o d e' % %"No De"
1 400 0
0 400 0 "%010d" % 12345
1 400 0
0 400 0 1 % 1
1 400 0
0 400 0 a % b
1 400 0

View File

@ -0,0 +1,33 @@
{1}# nodepath{0}
{16}$Node{0}
{16}%Node{0}
{16}%node/"n o d e"/%'n o d e'{0}
{16}%"No de"{0}
{16}$/root/ThisNode/%Node{0} {10}%{0} {16}%test{0}
{16}$MainMenuPanel/%Options{0} {10}%{0} {16}%test{0}
{16}%Options{0} {10}%{0} {16}%test{0}
{16}$Node{0} {10}%{0} {16}%test{0}
{11}get_node{10}({3}"%Options"{10}){0} {10}%{0} {16}%test{0}
{16}$"Nod se"{0} {10}%{0} {16}%test{0}
{16}$/test/"No % de"/test{0} {10}%{0} {16}%test{0}
{16}%node/"n o d e"/'n o d e'{0} {10}%{0} {16}%"No De"{0}
{3}"%010d"{0} {10}%{0} {2}12345{0}
{2}1{0} {10}%{0} {2}1{0}
{11}a{0} {10}%{0} {11}b{0}

View File

@ -0,0 +1,4 @@
# makefile lexer previously used fixed 1024-byte line buffer that would treat text after that as new line
# Long line with 1025 bytes last 2 bytes colored as default 3456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 12345678912345678

View File

@ -0,0 +1,5 @@
0 400 0 # makefile lexer previously used fixed 1024-byte line buffer that would treat text after that as new line
0 400 0
0 400 0 # Long line with 1025 bytes last 2 bytes colored as default 3456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 12345678912345678
0 400 0
0 400 0

View File

@ -0,0 +1,4 @@
{1}# makefile lexer previously used fixed 1024-byte line buffer that would treat text after that as new line
{0}
{1}# Long line with 1025 bytes last 2 bytes colored as default 3456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 12345678912345678
{0}

View File

@ -1,5 +1,5 @@
# Enumerate all styles where possible: 0..31,40..41 # Enumerate all styles where possible: 0..31,40..45
# 22,23,30,31,40,41 are never set and 1 switches rest of file to error state # 30,31,40,45 are never set and 1 switches rest of file to error state
#0 whitespace #0 whitespace
# #
@ -66,14 +66,20 @@ module Module15 end
<<DELIMITER20 <<DELIMITER20
DELIMITER20 DELIMITER20
#21:here doc #21:single quoted heredoc
<<D <<'D'
21:here doc 21:here doc #{1 + 1}
D D
#22:here qq never set #22:double quoted heredoc
<<"D"
22:here doc #{1 + 1}
D
#23:here qw never set #23:back tick quoted heredoc
<<`D`
23:here doc #{1 + 1}
D
#24:q quoted string #24:q quoted string
%q!24:quotes's! %q!24:quotes's!
@ -87,13 +93,25 @@ D
#27:regex #27:regex
%r(27[a-z]/[A-Z]+) %r(27[a-z]/[A-Z]+)
#28:string array #28:interpolable string array
%w(28 cgi.rb complex.rb date.rb) %W(28 cgi.rb complex.rb date.rb #{1} )
#29:demoted keyword do #29:demoted keyword do
while 1 do end while 1 do end
# 30,31,40,41 never set # 30,31,40,45 never set
#41:non-interpolable string array
%w(#{1 + 1})
#42:non-interpolable symbol array
%i(#{1 + 1})
#43:interpolable symbol array
%I(#{1 + 1})
#44:symbol
%s(#{1 + 1})
#19:data section #19:data section
__END__ __END__

View File

@ -1,5 +1,5 @@
0 400 0 # Enumerate all styles where possible: 0..31,40..41 0 400 0 # Enumerate all styles where possible: 0..31,40..45
0 400 0 # 22,23,30,31,40,41 are never set and 1 switches rest of file to error state 0 400 0 # 30,31,40,45 are never set and 1 switches rest of file to error state
1 400 0 1 400 0
0 400 0 #0 whitespace 0 400 0 #0 whitespace
0 400 0 # 0 400 0 #
@ -66,14 +66,20 @@
2 400 0 + <<DELIMITER20 2 400 0 + <<DELIMITER20
0 401 0 | DELIMITER20 0 401 0 | DELIMITER20
1 400 0 1 400 0
0 400 0 #21:here doc 0 400 0 #21:single quoted heredoc
2 400 0 + <<D 2 400 0 + <<'D'
0 401 0 | 21:here doc 0 401 0 | 21:here doc #{1 + 1}
0 401 0 | D 0 401 0 | D
1 400 0 1 400 0
0 400 0 #22:here qq never set 0 400 0 #22:double quoted heredoc
2 400 0 + <<"D"
0 401 0 | 22:here doc #{1 + 1}
0 401 0 | D
1 400 0 1 400 0
0 400 0 #23:here qw never set 0 400 0 #23:back tick quoted heredoc
2 400 0 + <<`D`
0 401 0 | 23:here doc #{1 + 1}
0 401 0 | D
1 400 0 1 400 0
0 400 0 #24:q quoted string 0 400 0 #24:q quoted string
0 400 0 %q!24:quotes's! 0 400 0 %q!24:quotes's!
@ -87,13 +93,25 @@
0 400 0 #27:regex 0 400 0 #27:regex
0 400 0 %r(27[a-z]/[A-Z]+) 0 400 0 %r(27[a-z]/[A-Z]+)
1 400 0 1 400 0
0 400 0 #28:string array 0 400 0 #28:interpolable string array
0 400 0 %w(28 cgi.rb complex.rb date.rb) 0 400 0 %W(28 cgi.rb complex.rb date.rb #{1} )
1 400 0 1 400 0
0 400 0 #29:demoted keyword do 0 400 0 #29:demoted keyword do
0 400 0 while 1 do end 0 400 0 while 1 do end
1 400 0 1 400 0
0 400 0 # 30,31,40,41 never set 0 400 0 # 30,31,40,45 never set
1 400 0
0 400 0 #41:non-interpolable string array
0 400 0 %w(#{1 + 1})
1 400 0
0 400 0 #42:non-interpolable symbol array
0 400 0 %i(#{1 + 1})
1 400 0
0 400 0 #43:interpolable symbol array
0 400 0 %I(#{1 + 1})
1 400 0
0 400 0 #44:symbol
0 400 0 %s(#{1 + 1})
1 400 0 1 400 0
0 400 0 #19:data section 0 400 0 #19:data section
0 400 0 __END__ 0 400 0 __END__

View File

@ -1,5 +1,5 @@
{2}# Enumerate all styles where possible: 0..31,40..41{0} {2}# Enumerate all styles where possible: 0..31,40..45{0}
{2}# 22,23,30,31,40,41 are never set and 1 switches rest of file to error state{0} {2}# 30,31,40,45 are never set and 1 switches rest of file to error state{0}
{2}#0 whitespace{0} {2}#0 whitespace{0}
{2}#{0} {2}#{0}
@ -63,17 +63,23 @@
{2}#19:data section at end of file{0} {2}#19:data section at end of file{0}
{2}#20:here delimiter{0} {2}#20:here delimiter{0}
{10}<<{20}DELIMITER20{21} {10}<<{20}DELIMITER20{22}
{20}DELIMITER20{0} {20}DELIMITER20{0}
{2}#21:here doc{0} {2}#21:single quoted heredoc{0}
{10}<<{20}D{21} {10}<<{20}'D'{21}
21:here doc 21:here doc #{1 + 1}
{20}D{0} {20}D{0}
{2}#22:here qq never set{0} {2}#22:double quoted heredoc{0}
{10}<<{20}"D"{22}
22:here doc {10}#{{4}1{0} {10}+{0} {4}1{10}}{22}
{20}D{0}
{2}#23:here qw never set{0} {2}#23:back tick quoted heredoc{0}
{10}<<{20}`D`{23}
23:here doc {10}#{{4}1{0} {10}+{0} {4}1{10}}{23}
{20}D{0}
{2}#24:q quoted string{0} {2}#24:q quoted string{0}
{24}%q!24:quotes's!{0} {24}%q!24:quotes's!{0}
@ -87,13 +93,25 @@
{2}#27:regex{0} {2}#27:regex{0}
{27}%r(27[a-z]/[A-Z]+){0} {27}%r(27[a-z]/[A-Z]+){0}
{2}#28:string array{0} {2}#28:interpolable string array{0}
{28}%w(28 cgi.rb complex.rb date.rb){0} {28}%W(28 cgi.rb complex.rb date.rb {10}#{{4}1{10}}{28} ){0}
{2}#29:demoted keyword do{0} {2}#29:demoted keyword do{0}
{5}while{0} {4}1{0} {29}do{0} {5}end{0} {5}while{0} {4}1{0} {29}do{0} {5}end{0}
{2}# 30,31,40,41 never set{0} {2}# 30,31,40,45 never set{0}
{2}#41:non-interpolable string array{0}
{41}%w(#{1 + 1}){0}
{2}#42:non-interpolable symbol array{0}
{42}%i(#{1 + 1}){0}
{2}#43:interpolable symbol array{0}
{43}%I({10}#{{4}1{0} {10}+{0} {4}1{10}}{43}){0}
{2}#44:symbol{0}
{44}%s(#{1 + 1}){0}
{2}#19:data section{0} {2}#19:data section{0}
{19}__END__ {19}__END__

View File

@ -0,0 +1,3 @@
# Bad folding when single character ')' in SCE_RB_STRING_QW #132
%W(#{1 + 1})

View File

@ -0,0 +1,4 @@
0 400 0 # Bad folding when single character ')' in SCE_RB_STRING_QW #132
0 400 0 %W(#{1 + 1})
1 400 0
0 400 0

View File

@ -0,0 +1,3 @@
{2}# Bad folding when single character ')' in SCE_RB_STRING_QW #132{0}
{28}%W({10}#{{4}1{0} {10}+{0} {4}1{10}}{28}){0}

View File

@ -0,0 +1,9 @@
a = <<XXX # :nodoc:
heredoc
XXX
puts(<<-ONE, <<-TWO)
content for heredoc one
ONE
content for heredoc two
TWO

View File

@ -0,0 +1,10 @@
2 400 0 + a = <<XXX # :nodoc:
0 401 0 | heredoc
0 401 0 | XXX
1 400 0
2 400 0 + puts(<<-ONE, <<-TWO)
0 401 0 | content for heredoc one
0 401 0 | ONE
0 401 0 | content for heredoc two
0 401 0 | TWO
0 400 0

View File

@ -0,0 +1,9 @@
{11}a{0} {10}={0} {10}<<{20}XXX{0} {2}# :nodoc:{22}
heredoc
{20}XXX{0}
{11}puts{10}(<<{20}-ONE{10},{0} {10}<<{20}-TWO{10}){22}
content for heredoc one
ONE
content for heredoc two
{20}TWO{0}

View File

@ -0,0 +1,23 @@
a = {r: /\w+/, h: <<EOF
heredoc
EOF
}
puts a
def b # :nodoc:
<<EOF
heredoc
EOF
end
def c # :nodoc:
/\w+/
end
puts b
puts c
$stdout . puts <<EOF
heredoc
EOF

View File

@ -0,0 +1,24 @@
2 400 0 + a = {r: /\w+/, h: <<EOF
0 402 0 | heredoc
0 402 0 | EOF
0 401 0 | }
1 400 0
0 400 0 puts a
1 400 0
2 400 0 + def b # :nodoc:
2 401 0 + <<EOF
0 402 0 | heredoc
0 402 0 | EOF
0 401 0 | end
1 400 0
2 400 0 + def c # :nodoc:
0 401 0 | /\w+/
0 401 0 | end
1 400 0
0 400 0 puts b
0 400 0 puts c
1 400 0
2 400 0 + $stdout . puts <<EOF
0 401 0 | heredoc
0 401 0 | EOF
0 400 0

View File

@ -0,0 +1,23 @@
{11}a{0} {10}={0} {10}{{14}r:{0} {12}/\w+/{10},{0} {14}h:{0} {10}<<{20}EOF{22}
heredoc
{20}EOF{0}
{10}}{0}
{11}puts{0} {11}a{0}
{5}def{0} {9}b{0} {2}# :nodoc:{0}
{10}<<{20}EOF{22}
heredoc
{20}EOF{0}
{5}end{0}
{5}def{0} {9}c{0} {2}# :nodoc:{0}
{12}/\w+/{0}
{5}end{0}
{11}puts{0} {11}b{0}
{11}puts{0} {11}c{0}
{13}$stdout{0} {10}.{0} {11}puts{0} {10}<<{20}EOF{22}
heredoc
{20}EOF{0}

View File

@ -0,0 +1,11 @@
"#{1}"#
"#@a"#
"#@@a"#
"#$a"#
"#$?"#
"#$-a1"#
"#$_a1"#
"#$123"#
"#$\"#
"#$""#
a = /#$//#

View File

@ -0,0 +1,12 @@
0 400 0 "#{1}"#
0 400 0 "#@a"#
0 400 0 "#@@a"#
0 400 0 "#$a"#
0 400 0 "#$?"#
0 400 0 "#$-a1"#
0 400 0 "#$_a1"#
0 400 0 "#$123"#
0 400 0 "#$\"#
0 400 0 "#$""#
0 400 0 a = /#$//#
0 400 0

View File

@ -0,0 +1,11 @@
{6}"{10}#{{4}1{10}}{6}"{2}#{0}
{6}"{10}#{16}@a{6}"{2}#{0}
{6}"{10}#{17}@@a{6}"{2}#{0}
{6}"{10}#{13}$a{6}"{2}#{0}
{6}"{10}#{13}$?{6}"{2}#{0}
{6}"{10}#{13}$-a{6}1"{2}#{0}
{6}"{10}#{13}$_a1{6}"{2}#{0}
{6}"{10}#{13}$123{6}"{2}#{0}
{6}"{10}#{13}$\{6}"{2}#{0}
{6}"{10}#{13}$"{6}"{2}#{0}
{11}a{0} {10}={0} {12}/{10}#{13}$/{12}/{2}#{0}

View File

@ -1,8 +1,8 @@
{2}# Test that final \n in indented heredoc (2nd example) is styled as SCE_RB_HERE_Q not SCE_RB_HERE_DELIM{0} {2}# Test that final \n in indented heredoc (2nd example) is styled as SCE_RB_HERE_Q not SCE_RB_HERE_DELIM{0}
{10}<<{20}T{21} {10}<<{20}T{22}
X X
{20}T{0} {20}T{0}
{10}<<{20}-T{21} {10}<<{20}-T{22}
X X
{20}T{0} {20}T{0}

View File

@ -1,13 +1,13 @@
{2}# heredoc method call, other argument{0} {2}# heredoc method call, other argument{0}
{11}puts{0} {10}<<{20}~EOT{10}.{11}chomp{21} {11}puts{0} {10}<<{20}~EOT{10}.{11}chomp{22}
squiggly heredoc squiggly heredoc
{20}EOT{0} {20}EOT{0}
{11}puts{0} {10}<<{20}ONE{10},{0} {5}__FILE__{10},{0} {5}__LINE__{21} {11}puts{0} {10}<<{20}ONE{10},{0} {5}__FILE__{10},{0} {5}__LINE__{22}
content for heredoc one content for heredoc one
{20}ONE{0} {20}ONE{0}
{2}# heredoc prevStyle == SCE_RB_GLOBAL{0} {2}# heredoc prevStyle == SCE_RB_GLOBAL{0}
{13}$stdout{10}.{11}puts{0} {10}<<{20}~EOT{10}.{11}chomp{21} {13}$stdout{10}.{11}puts{0} {10}<<{20}~EOT{10}.{11}chomp{22}
squiggly heredoc squiggly heredoc
{20}EOT{0} {20}EOT{0}

View File

@ -0,0 +1,8 @@
# Issue 124, disambiguating %= which may be a quote or modulo assignment
# %-quoting with '=' as the quote
s = %=3=
puts s
x = 7
# Modulo assignment, equivalent to x = x % 2
x %=2
puts x

View File

@ -0,0 +1,9 @@
0 400 0 # Issue 124, disambiguating %= which may be a quote or modulo assignment
0 400 0 # %-quoting with '=' as the quote
0 400 0 s = %=3=
0 400 0 puts s
0 400 0 x = 7
0 400 0 # Modulo assignment, equivalent to x = x % 2
0 400 0 x %=2
0 400 0 puts x
0 400 0

View File

@ -0,0 +1,8 @@
{2}# Issue 124, disambiguating %= which may be a quote or modulo assignment{0}
{2}# %-quoting with '=' as the quote{0}
{11}s{0} {10}={0} {25}%=3={0}
{11}puts{0} {11}s{0}
{11}x{0} {10}={0} {4}7{0}
{2}# Modulo assignment, equivalent to x = x % 2{0}
{11}x{0} {10}%={4}2{0}
{11}puts{0} {11}x{0}

View File

@ -0,0 +1,4 @@
# makefile lexer previously used fixed 1024-byte line buffer that would treat text after that as new line
# Long line with 1025 bytes last 2 bytes colored as default 3456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 12345678912345678

View File

@ -0,0 +1,5 @@
0 400 0 # makefile lexer previously used fixed 1024-byte line buffer that would treat text after that as new line
1 400 0
0 400 0 # Long line with 1025 bytes last 2 bytes colored as default 3456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 12345678912345678
1 400 0
0 400 0

View File

@ -0,0 +1,4 @@
{1}# makefile lexer previously used fixed 1024-byte line buffer that would treat text after that as new line
{0}
{1}# Long line with 1025 bytes last 2 bytes colored as default 3456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 12345678912345678
{0}

View File

@ -1,10 +1,17 @@
/** @file testWordList.cxx /** @file testWordList.cxx
** Unit Tests for Lexilla internal data structures ** Unit Tests for Lexilla internal data structures
** Tests WordList, WordClassifier, and SubStyles
**/ **/
#include <string.h> #include <string.h>
#include <string>
#include <string_view>
#include <vector>
#include <map>
#include "WordList.h" #include "WordList.h"
#include "SubStyles.h"
#include "catch.hpp" #include "catch.hpp"
@ -28,6 +35,14 @@ TEST_CASE("WordList") {
REQUIRE(!wl.InList("class")); REQUIRE(!wl.InList("class"));
} }
SECTION("StringInList") {
wl.Set("else struct");
std::string sStruct = "struct";
REQUIRE(wl.InList(sStruct));
std::string sClass = "class";
REQUIRE(!wl.InList(sClass));
}
SECTION("InListUnicode") { SECTION("InListUnicode") {
// "cheese" in English // "cheese" in English
// "kase" ('k', 'a with diaeresis', 's', 'e') in German // "kase" ('k', 'a with diaeresis', 's', 'e') in German
@ -104,3 +119,93 @@ TEST_CASE("WordList") {
REQUIRE(wl.InListAbridged("\xd1\x81\xd1\x8b\xd1\x80", '~')); REQUIRE(wl.InListAbridged("\xd1\x81\xd1\x8b\xd1\x80", '~'));
} }
} }
// Test WordClassifier.
TEST_CASE("WordClassifier") {
constexpr int base = 1;
constexpr int key = 10;
constexpr int type = 11;
constexpr int other = 40;
WordClassifier wc(1);
SECTION("Base") {
REQUIRE(wc.Base() == base);
wc.Allocate(key, 2);
REQUIRE(wc.Start() == key);
REQUIRE(wc.Last() == type);
REQUIRE(wc.Length() == 2);
REQUIRE(wc.IncludesStyle(key));
REQUIRE(wc.IncludesStyle(type));
REQUIRE(!wc.IncludesStyle(other));
wc.Clear();
REQUIRE(wc.Base() == base);
REQUIRE(wc.Start() == 0);
REQUIRE(wc.Last() == -1);
REQUIRE(wc.Length() == 0);
}
SECTION("ValueFor") {
wc.Allocate(key, 2);
wc.SetIdentifiers(key, "else if then");
wc.SetIdentifiers(type, "double float int long");
REQUIRE(wc.ValueFor("if") == key);
REQUIRE(wc.ValueFor("double") == type);
REQUIRE(wc.ValueFor("fish") < 0);
wc.RemoveStyle(type);
REQUIRE(wc.ValueFor("double") < 0);
}
}
// Test SubStyles.
TEST_CASE("SubStyles") {
constexpr char bases[] = "\002\005";
constexpr int base = 2;
constexpr int base2 = 5;
constexpr int styleFirst = 0x80;
constexpr int stylesAvailable = 0x40;
constexpr int distanceToSecondary = 0x40;
SubStyles subStyles(bases, styleFirst, stylesAvailable, distanceToSecondary);
SECTION("All") {
REQUIRE(subStyles.DistanceToSecondaryStyles() == distanceToSecondary);
// Before allocation
REQUIRE(subStyles.Start(base) == 0);
const int startSubStyles = subStyles.Allocate(base, 3);
REQUIRE(startSubStyles == styleFirst);
REQUIRE(subStyles.Start(base) == styleFirst);
REQUIRE(subStyles.Length(base) == 3);
REQUIRE(subStyles.BaseStyle(128) == 2);
// Not a substyle so returns argument.
REQUIRE(subStyles.BaseStyle(96) == 96);
REQUIRE(subStyles.FirstAllocated() == styleFirst);
REQUIRE(subStyles.LastAllocated() == styleFirst + 3 - 1);
subStyles.SetIdentifiers(styleFirst, "int long size_t");
const WordClassifier &wc = subStyles.Classifier(base);
REQUIRE(wc.ValueFor("int") == styleFirst);
REQUIRE(wc.ValueFor("double") < 0);
// Add second set of substyles which shouldn't affect first
const int startSecondSet = subStyles.Allocate(base2, 2);
constexpr int expectedStylesSecond = styleFirst + 3;
REQUIRE(startSecondSet == expectedStylesSecond);
REQUIRE(subStyles.Start(base) == styleFirst);
REQUIRE(subStyles.Start(base2) == expectedStylesSecond);
REQUIRE(subStyles.LastAllocated() == styleFirst + 5 - 1);
// Clear and check that earlier call no longer works
subStyles.Free();
REQUIRE(subStyles.Start(base) == 0);
}
}

View File

@ -1 +1 @@
522 524

View File

@ -1,18 +1,6 @@
cd .. cd ..
del/q lexilla.zip del/q lexilla.zip
zip lexilla.zip lexilla\*.* lexilla\*\*.* lexilla\*\*\*.* lexilla\*\*\*\*.* lexilla\*\*\*\*\*.* -x *.bak -x *.o -x *.obj -x *.iobj -x *.dll -x *.exe -x *.a -x *.lib -x *.res -x *.exp -x *.sarif -x *.pdb -x *.ipdb -x *.idb -x *.sbr -x *.ilk zip lexilla.zip lexilla\*.* lexilla\*\*.* lexilla\*\*\*.* lexilla\*\*\*\*.* lexilla\*\*\*\*\*.* ^
zip lexilla.zip -d lexilla/src/ARM64/* -x *.bak *.o *.obj *.iobj *.dll *.exe *.a *.lib *.res *.exp *.sarif *.pdb *.ipdb *.idb *.sbr *.ilk *.tgz ^
zip lexilla.zip -d lexilla/src/x64/* **/__pycache__/* **/Debug/* **/Release/* **/x64/* **/ARM64/* **/cov-int/* **/.vs/* **/.vscode/* @
zip lexilla.zip -d lexilla/src/Release/*
zip lexilla.zip -d lexilla/src/Debug/*
zip lexilla.zip -d lexilla/src/__pycache__/*
zip lexilla.zip -d lexilla/test/ARM64/*
zip lexilla.zip -d lexilla/test/x64/*
zip lexilla.zip -d lexilla/test/Release/*
zip lexilla.zip -d lexilla/test/Debug/*
zip lexilla.zip -d lexilla/test/unit/ARM64/*
zip lexilla.zip -d lexilla/test/unit/x64/*
zip lexilla.zip -d lexilla/test/unit/Release/*
zip lexilla.zip -d lexilla/test/unit/Debug/*
zip lexilla.zip -d lexilla/scripts/__pycache__/*
cd lexilla cd lexilla

View File

@ -231,7 +231,7 @@ Position ScintillaCall::GetStyledText(void *tr) {
return CallPointer(Message::GetStyledText, 0, tr); return CallPointer(Message::GetStyledText, 0, tr);
} }
Position ScintillaCall::GetStyledTextFull(void *tr) { Position ScintillaCall::GetStyledTextFull(TextRangeFull *tr) {
return CallPointer(Message::GetStyledTextFull, 0, tr); return CallPointer(Message::GetStyledTextFull, 0, tr);
} }
@ -1159,7 +1159,7 @@ Position ScintillaCall::FindText(Scintilla::FindOption searchFlags, void *ft) {
return CallPointer(Message::FindText, static_cast<uintptr_t>(searchFlags), ft); return CallPointer(Message::FindText, static_cast<uintptr_t>(searchFlags), ft);
} }
Position ScintillaCall::FindTextFull(Scintilla::FindOption searchFlags, void *ft) { Position ScintillaCall::FindTextFull(Scintilla::FindOption searchFlags, TextToFindFull *ft) {
return CallPointer(Message::FindTextFull, static_cast<uintptr_t>(searchFlags), ft); return CallPointer(Message::FindTextFull, static_cast<uintptr_t>(searchFlags), ft);
} }
@ -1167,7 +1167,7 @@ Position ScintillaCall::FormatRange(bool draw, void *fr) {
return CallPointer(Message::FormatRange, draw, fr); return CallPointer(Message::FormatRange, draw, fr);
} }
Position ScintillaCall::FormatRangeFull(bool draw, void *fr) { Position ScintillaCall::FormatRangeFull(bool draw, RangeToFormatFull *fr) {
return CallPointer(Message::FormatRangeFull, draw, fr); return CallPointer(Message::FormatRangeFull, draw, fr);
} }
@ -1235,7 +1235,7 @@ Position ScintillaCall::GetTextRange(void *tr) {
return CallPointer(Message::GetTextRange, 0, tr); return CallPointer(Message::GetTextRange, 0, tr);
} }
Position ScintillaCall::GetTextRangeFull(void *tr) { Position ScintillaCall::GetTextRangeFull(TextRangeFull *tr) {
return CallPointer(Message::GetTextRangeFull, 0, tr); return CallPointer(Message::GetTextRangeFull, 0, tr);
} }

View File

@ -25,7 +25,7 @@
#include "QuartzTextLayout.h" #include "QuartzTextLayout.h"
NSRect PRectangleToNSRect(const Scintilla::Internal::PRectangle &rc); NSRect PRectangleToNSRect(const Scintilla::Internal::PRectangle &rc);
Scintilla::Internal::PRectangle NSRectToPRectangle(NSRect &rc); Scintilla::Internal::PRectangle NSRectToPRectangle(const NSRect &rc);
CFStringEncoding EncodingFromCharacterSet(bool unicode, Scintilla::CharacterSet characterSet); CFStringEncoding EncodingFromCharacterSet(bool unicode, Scintilla::CharacterSet characterSet);
@interface ScintillaContextMenu : NSMenu { @interface ScintillaContextMenu : NSMenu {

View File

@ -73,10 +73,8 @@ NSRect PRectangleToNSRect(const PRectangle &rc) {
/** /**
* Converts an NSRect as used by the system to a native Scintilla rectangle. * Converts an NSRect as used by the system to a native Scintilla rectangle.
*/ */
PRectangle NSRectToPRectangle(NSRect &rc) { PRectangle NSRectToPRectangle(const NSRect &rc) {
return PRectangle(static_cast<XYPOSITION>(rc.origin.x), static_cast<XYPOSITION>(rc.origin.y), return PRectangle(rc.origin.x, rc.origin.y, NSMaxX(rc), NSMaxY(rc));
static_cast<XYPOSITION>(NSMaxX(rc)),
static_cast<XYPOSITION>(NSMaxY(rc)));
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@ -1288,7 +1286,7 @@ void SurfaceImpl::MeasureWidths(const Font *font_, std::string_view text, XYPOSI
// Switched to MacRoman to make work so treat as single byte encoding. // Switched to MacRoman to make work so treat as single byte encoding.
for (int i=0; i<text.length(); i++) { for (int i=0; i<text.length(); i++) {
CGFloat xPosition = CTLineGetOffsetForStringIndex(mLine, i+1, nullptr); CGFloat xPosition = CTLineGetOffsetForStringIndex(mLine, i+1, nullptr);
positions[i] = static_cast<XYPOSITION>(xPosition); positions[i] = xPosition;
} }
return; return;
} }
@ -1306,7 +1304,7 @@ void SurfaceImpl::MeasureWidths(const Font *font_, std::string_view text, XYPOSI
const int codeUnits = UTF16LengthFromUTF8ByteCount(byteCount); const int codeUnits = UTF16LengthFromUTF8ByteCount(byteCount);
const CGFloat xPosition = linePositions[ui]; const CGFloat xPosition = linePositions[ui];
for (unsigned int bytePos=0; (bytePos<byteCount) && (i<text.length()); bytePos++) { for (unsigned int bytePos=0; (bytePos<byteCount) && (i<text.length()); bytePos++) {
positions[i++] = static_cast<XYPOSITION>(xPosition); positions[i++] = xPosition;
} }
ui += codeUnits; ui += codeUnits;
} }
@ -1322,14 +1320,14 @@ void SurfaceImpl::MeasureWidths(const Font *font_, std::string_view text, XYPOSI
size_t lenChar = DBCSIsLeadByte(mode.codePage, text[i]) ? 2 : 1; size_t lenChar = DBCSIsLeadByte(mode.codePage, text[i]) ? 2 : 1;
CGFloat xPosition = CTLineGetOffsetForStringIndex(mLine, ui+1, NULL); CGFloat xPosition = CTLineGetOffsetForStringIndex(mLine, ui+1, NULL);
for (unsigned int bytePos=0; (bytePos<lenChar) && (i<text.length()); bytePos++) { for (unsigned int bytePos=0; (bytePos<lenChar) && (i<text.length()); bytePos++) {
positions[i++] = static_cast<XYPOSITION>(xPosition); positions[i++] = xPosition;
} }
ui++; ui++;
} }
} else { // Single byte encoding } else { // Single byte encoding
for (int i=0; i<text.length(); i++) { for (int i=0; i<text.length(); i++) {
CGFloat xPosition = CTLineGetOffsetForStringIndex(mLine, i+1, NULL); CGFloat xPosition = CTLineGetOffsetForStringIndex(mLine, i+1, NULL);
positions[i] = static_cast<XYPOSITION>(xPosition); positions[i] = xPosition;
} }
} }
@ -1405,7 +1403,7 @@ void SurfaceImpl::MeasureWidthsUTF8(const Font *font_, std::string_view text, XY
// Switched to MacRoman to make work so treat as single byte encoding. // Switched to MacRoman to make work so treat as single byte encoding.
for (int i=0; i<text.length(); i++) { for (int i=0; i<text.length(); i++) {
CGFloat xPosition = CTLineGetOffsetForStringIndex(mLine, i+1, nullptr); CGFloat xPosition = CTLineGetOffsetForStringIndex(mLine, i+1, nullptr);
positions[i] = static_cast<XYPOSITION>(xPosition); positions[i] = xPosition;
} }
return; return;
} }
@ -1422,7 +1420,7 @@ void SurfaceImpl::MeasureWidthsUTF8(const Font *font_, std::string_view text, XY
const int codeUnits = UTF16LengthFromUTF8ByteCount(byteCount); const int codeUnits = UTF16LengthFromUTF8ByteCount(byteCount);
const CGFloat xPosition = linePositions[ui]; const CGFloat xPosition = linePositions[ui];
for (unsigned int bytePos=0; (bytePos<byteCount) && (i<text.length()); bytePos++) { for (unsigned int bytePos=0; (bytePos<byteCount) && (i<text.length()); bytePos++) {
positions[i++] = static_cast<XYPOSITION>(xPosition); positions[i++] = xPosition;
} }
ui += codeUnits; ui += codeUnits;
} }
@ -1546,8 +1544,8 @@ PRectangle Window::GetPosition() const {
CGFloat screenHeight = ScreenMax(); CGFloat screenHeight = ScreenMax();
// Invert screen positions to match Scintilla // Invert screen positions to match Scintilla
return PRectangle( return PRectangle(
static_cast<XYPOSITION>(NSMinX(rect)), static_cast<XYPOSITION>(screenHeight - NSMaxY(rect)), NSMinX(rect), screenHeight - NSMaxY(rect),
static_cast<XYPOSITION>(NSMaxX(rect)), static_cast<XYPOSITION>(screenHeight - NSMinY(rect))); NSMaxX(rect), screenHeight - NSMinY(rect));
} else { } else {
return PRectangle(0, 0, 1, 1); return PRectangle(0, 0, 1, 1);
} }
@ -1686,8 +1684,8 @@ PRectangle Window::GetMonitorRect(Point) {
CGFloat screenHeight = rect.origin.y + rect.size.height; CGFloat screenHeight = rect.origin.y + rect.size.height;
// Invert screen positions to match Scintilla // Invert screen positions to match Scintilla
PRectangle rcWork( PRectangle rcWork(
static_cast<XYPOSITION>(NSMinX(rect)), static_cast<XYPOSITION>(screenHeight - NSMaxY(rect)), NSMinX(rect), screenHeight - NSMaxY(rect),
static_cast<XYPOSITION>(NSMaxX(rect)), static_cast<XYPOSITION>(screenHeight - NSMinY(rect))); NSMaxX(rect), screenHeight - NSMinY(rect));
PRectangle rcMonitor(rcWork.left - rcPosition.left, PRectangle rcMonitor(rcWork.left - rcPosition.left,
rcWork.top - rcPosition.top, rcWork.top - rcPosition.top,
rcWork.right - rcPosition.left, rcWork.right - rcPosition.left,
@ -2082,7 +2080,7 @@ void ListBoxImpl::Append(char *s, int type) {
} }
NSImage *img = images[@(type)]; NSImage *img = images[@(type)];
if (img) { if (img) {
XYPOSITION widthIcon = static_cast<XYPOSITION>(img.size.width); XYPOSITION widthIcon = img.size.width;
if (widthIcon > maxIconWidth) { if (widthIcon > maxIconWidth) {
[colIcon setHidden: NO]; [colIcon setHidden: NO];
maxIconWidth = widthIcon; maxIconWidth = widthIcon;

View File

@ -15,7 +15,7 @@
<key>CFBundlePackageType</key> <key>CFBundlePackageType</key>
<string>$(PRODUCT_BUNDLE_PACKAGE_TYPE)</string> <string>$(PRODUCT_BUNDLE_PACKAGE_TYPE)</string>
<key>CFBundleShortVersionString</key> <key>CFBundleShortVersionString</key>
<string>5.3.3</string> <string>5.3.4</string>
<key>CFBundleVersion</key> <key>CFBundleVersion</key>
<string>$(CURRENT_PROJECT_VERSION)</string> <string>$(CURRENT_PROJECT_VERSION)</string>
<key>NSHumanReadableCopyright</key> <key>NSHumanReadableCopyright</key>

View File

@ -573,7 +573,7 @@
CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = NO; COPY_PHASE_STRIP = NO;
CURRENT_PROJECT_VERSION = 5.3.3; CURRENT_PROJECT_VERSION = 5.3.4;
DEBUG_INFORMATION_FORMAT = dwarf; DEBUG_INFORMATION_FORMAT = dwarf;
ENABLE_STRICT_OBJC_MSGSEND = YES; ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES; ENABLE_TESTABILITY = YES;
@ -635,7 +635,7 @@
CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = NO; COPY_PHASE_STRIP = NO;
CURRENT_PROJECT_VERSION = 5.3.3; CURRENT_PROJECT_VERSION = 5.3.4;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
ENABLE_NS_ASSERTIONS = NO; ENABLE_NS_ASSERTIONS = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES; ENABLE_STRICT_OBJC_MSGSEND = YES;
@ -665,7 +665,7 @@
CODE_SIGN_IDENTITY = "-"; CODE_SIGN_IDENTITY = "-";
CODE_SIGN_STYLE = Manual; CODE_SIGN_STYLE = Manual;
COMBINE_HIDPI_IMAGES = YES; COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 5.3.3; CURRENT_PROJECT_VERSION = 5.3.4;
DEFINES_MODULE = YES; DEFINES_MODULE = YES;
DEVELOPMENT_TEAM = ""; DEVELOPMENT_TEAM = "";
DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_COMPATIBILITY_VERSION = 1;
@ -699,7 +699,7 @@
CODE_SIGN_IDENTITY = "-"; CODE_SIGN_IDENTITY = "-";
CODE_SIGN_STYLE = Manual; CODE_SIGN_STYLE = Manual;
COMBINE_HIDPI_IMAGES = YES; COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 5.3.3; CURRENT_PROJECT_VERSION = 5.3.4;
DEFINES_MODULE = YES; DEFINES_MODULE = YES;
DEVELOPMENT_TEAM = ""; DEVELOPMENT_TEAM = "";
DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_COMPATIBILITY_VERSION = 1;

View File

@ -83,6 +83,8 @@ extern "C" NSString *ScintillaRecPboardType;
namespace Scintilla::Internal { namespace Scintilla::Internal {
CGContextRef CGContextCurrent();
/** /**
* Main scintilla class, implemented for macOS (Cocoa). * Main scintilla class, implemented for macOS (Cocoa).
*/ */
@ -101,6 +103,8 @@ private:
bool isFirstResponder; bool isFirstResponder;
bool isActive; bool isActive;
Point sizeClient;
bool enteredSetScrollingSize; bool enteredSetScrollingSize;
bool GetPasteboardData(NSPasteboard *board, SelectionText *selectedText); bool GetPasteboardData(NSPasteboard *board, SelectionText *selectedText);
@ -116,6 +120,7 @@ private:
protected: protected:
Point GetVisibleOriginInMain() const override; Point GetVisibleOriginInMain() const override;
Point ClientSize() const override;
PRectangle GetClientRectangle() const override; PRectangle GetClientRectangle() const override;
PRectangle GetClientDrawingRectangle() override; PRectangle GetClientDrawingRectangle() override;
Point ConvertPoint(NSPoint point); Point ConvertPoint(NSPoint point);

View File

@ -399,6 +399,20 @@ const CGFloat paddingHighlightY = 2;
@end @end
//----------------- CGContextCurrent ---------------------------------------------------------------
CGContextRef Scintilla::Internal::CGContextCurrent() {
if (@available(macOS 10.10, *)) {
return [NSGraphicsContext currentContext].CGContext;
} else {
// Use old deprecated API
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
return static_cast<CGContextRef>([NSGraphicsContext currentContext].graphicsPort);
#pragma clang diagnostic pop
}
}
//----------------- ScintillaCocoa ----------------------------------------------------------------- //----------------- ScintillaCocoa -----------------------------------------------------------------
ScintillaCocoa::ScintillaCocoa(ScintillaView *sciView_, SCIContentView *viewContent, SCIMarginView *viewMargin) { ScintillaCocoa::ScintillaCocoa(ScintillaView *sciView_, SCIContentView *viewContent, SCIMarginView *viewMargin) {
@ -712,7 +726,16 @@ SCIContentView *ScintillaCocoa::ContentView() {
Scintilla::Internal::Point ScintillaCocoa::GetVisibleOriginInMain() const { Scintilla::Internal::Point ScintillaCocoa::GetVisibleOriginInMain() const {
NSScrollView *scrollView = ScrollContainer(); NSScrollView *scrollView = ScrollContainer();
NSRect contentRect = scrollView.contentView.bounds; NSRect contentRect = scrollView.contentView.bounds;
return Point(static_cast<XYPOSITION>(contentRect.origin.x), static_cast<XYPOSITION>(contentRect.origin.y)); return Point(contentRect.origin.x, contentRect.origin.y);
}
//--------------------------------------------------------------------------------------------------
/**
* Return the size of the client area which has been cached.
*/
Scintilla::Internal::Point ScintillaCocoa::ClientSize() const {
return sizeClient;
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@ -724,10 +747,7 @@ Scintilla::Internal::Point ScintillaCocoa::GetVisibleOriginInMain() const {
*/ */
PRectangle ScintillaCocoa::GetClientRectangle() const { PRectangle ScintillaCocoa::GetClientRectangle() const {
NSScrollView *scrollView = ScrollContainer(); NSScrollView *scrollView = ScrollContainer();
NSSize size = scrollView.contentView.bounds.size; return NSRectToPRectangle(scrollView.contentView.bounds);
Point origin = GetVisibleOriginInMain();
return PRectangle(origin.x, origin.y, static_cast<XYPOSITION>(origin.x+size.width),
static_cast<XYPOSITION>(origin.y + size.height));
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@ -758,7 +778,7 @@ Scintilla::Internal::Point ScintillaCocoa::ConvertPoint(NSPoint point) {
NSView *container = ContentView(); NSView *container = ContentView();
NSPoint result = [container convertPoint: point fromView: nil]; NSPoint result = [container convertPoint: point fromView: nil];
Scintilla::Internal::Point ptOrigin = GetVisibleOriginInMain(); Scintilla::Internal::Point ptOrigin = GetVisibleOriginInMain();
return Point(static_cast<XYPOSITION>(result.x - ptOrigin.x), static_cast<XYPOSITION>(result.y - ptOrigin.y)); return Point(result.x - ptOrigin.x, result.y - ptOrigin.y);
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@ -1132,7 +1152,7 @@ void ScintillaCocoa::CTPaint(void *gc, NSRect rc) {
- (void) drawRect: (NSRect) needsDisplayInRect { - (void) drawRect: (NSRect) needsDisplayInRect {
if (sci) { if (sci) {
CGContextRef context = (CGContextRef) [NSGraphicsContext currentContext].graphicsPort; CGContextRef context = CGContextCurrent();
sci->CTPaint(context, needsDisplayInRect); sci->CTPaint(context, needsDisplayInRect);
} }
} }
@ -1154,8 +1174,7 @@ void ScintillaCocoa::CTPaint(void *gc, NSRect rc) {
void ScintillaCocoa::CallTipMouseDown(NSPoint pt) { void ScintillaCocoa::CallTipMouseDown(NSPoint pt) {
NSRect rectBounds = ((__bridge NSView *)(ct.wDraw.GetID())).bounds; NSRect rectBounds = ((__bridge NSView *)(ct.wDraw.GetID())).bounds;
Point location(static_cast<XYPOSITION>(pt.x), Point location(pt.x, rectBounds.size.height - pt.y);
static_cast<XYPOSITION>(rectBounds.size.height - pt.y));
ct.MouseClick(location); ct.MouseClick(location);
CallTipClick(); CallTipClick();
} }
@ -1341,7 +1360,7 @@ void ScintillaCocoa::DragScroll() {
return; return;
if ([type compare: NSPasteboardTypeString] == NSOrderedSame) { if ([type compare: NSPasteboardTypeString] == NSOrderedSame) {
[pasteboard setString: (__bridge NSString *)cfsVal forType: NSStringPboardType]; [pasteboard setString: (__bridge NSString *)cfsVal forType: NSPasteboardTypeString];
} else if ([type compare: ScintillaRecPboardType] == NSOrderedSame) { } else if ([type compare: ScintillaRecPboardType] == NSOrderedSame) {
// This is specific to scintilla, allows us to drag rectangular selections around the document. // This is specific to scintilla, allows us to drag rectangular selections around the document.
if (selectedText.rectangular) if (selectedText.rectangular)
@ -1369,7 +1388,16 @@ void ScintillaCocoa::StartDrag() {
// Put the data to be dragged on the drag pasteboard. // Put the data to be dragged on the drag pasteboard.
SelectionText selectedText; SelectionText selectedText;
NSPasteboard *pasteboard = [NSPasteboard pasteboardWithName: NSDragPboard]; NSPasteboard *pasteboard = nil;
if (@available(macOS 10.13, *)) {
pasteboard = [NSPasteboard pasteboardWithName: NSPasteboardNameDrag];
} else {
// Use old deprecated name
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
pasteboard = [NSPasteboard pasteboardWithName: NSDragPboard];
#pragma clang diagnostic pop
}
CopySelectionRange(&selectedText); CopySelectionRange(&selectedText);
SetPasteboardData(pasteboard, selectedText); SetPasteboardData(pasteboard, selectedText);
@ -1550,12 +1578,20 @@ NSDragOperation ScintillaCocoa::DraggingUpdated(id <NSDraggingInfo> info) {
NSPasteboard *pasteboard = [info draggingPasteboard]; NSPasteboard *pasteboard = [info draggingPasteboard];
// Return what type of operation we will perform. Prefer move over copy. // Return what type of operation we will perform. Prefer move over copy.
if ([pasteboard.types containsObject: NSStringPboardType] || if ([pasteboard.types containsObject: NSPasteboardTypeString] ||
[pasteboard.types containsObject: ScintillaRecPboardType]) [pasteboard.types containsObject: ScintillaRecPboardType])
return (sourceDragMask & NSDragOperationMove) ? NSDragOperationMove : NSDragOperationCopy; return (sourceDragMask & NSDragOperationMove) ? NSDragOperationMove : NSDragOperationCopy;
if ([pasteboard.types containsObject: NSFilenamesPboardType]) if (@available(macOS 10.13, *)) {
return (sourceDragMask & NSDragOperationGeneric); if ([pasteboard.types containsObject: NSPasteboardTypeFileURL])
return (sourceDragMask & NSDragOperationGeneric);
} else {
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
if ([pasteboard.types containsObject: NSFilenamesPboardType])
return (sourceDragMask & NSDragOperationGeneric);
#pragma clang diagnostic pop
}
return NSDragOperationNone; return NSDragOperationNone;
} }
@ -1579,22 +1615,38 @@ void ScintillaCocoa::DraggingExited(id <NSDraggingInfo> info) {
bool ScintillaCocoa::PerformDragOperation(id <NSDraggingInfo> info) { bool ScintillaCocoa::PerformDragOperation(id <NSDraggingInfo> info) {
NSPasteboard *pasteboard = [info draggingPasteboard]; NSPasteboard *pasteboard = [info draggingPasteboard];
if ([pasteboard.types containsObject: NSFilenamesPboardType]) { if (@available(macOS 10.13, *)) {
NSArray *files = [pasteboard propertyListForType: NSFilenamesPboardType]; // NSPasteboardTypeFileURL is available for macOS 10.13+, provides NSURLs
for (NSString* uri in files) if ([pasteboard.types containsObject: NSPasteboardTypeFileURL]) {
NotifyURIDropped(uri.UTF8String); NSArray *files = [pasteboard readObjectsForClasses:@[NSURL.class] options:nil];
for (NSURL *uri in files) {
NotifyURIDropped([uri path].UTF8String);
}
return true;
}
} else { } else {
SelectionText text; // Use deprecated NSFilenamesPboardType, provides NSStrings
GetPasteboardData(pasteboard, &text); #pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
if (text.Length() > 0) { if ([pasteboard.types containsObject: NSFilenamesPboardType]) {
NSDragOperation operation = [info draggingSourceOperationMask]; NSArray *files = [pasteboard propertyListForType: NSFilenamesPboardType];
bool moving = (operation & NSDragOperationMove) != 0; for (NSString *uri in files) {
NotifyURIDropped(uri.UTF8String);
DropAt(posDrag, text.Data(), text.Length(), moving, text.rectangular); }
}; }
#pragma clang diagnostic pop
} }
SelectionText text;
GetPasteboardData(pasteboard, &text);
if (text.Length() > 0) {
NSDragOperation operation = [info draggingSourceOperationMask];
bool moving = (operation & NSDragOperationMove) != 0;
DropAt(posDrag, text.Data(), text.Length(), moving, text.rectangular);
};
return true; return true;
} }
@ -1612,8 +1664,8 @@ void ScintillaCocoa::SetPasteboardData(NSPasteboard *board, const SelectionText
return; return;
NSArray *pbTypes = selectedText.rectangular ? NSArray *pbTypes = selectedText.rectangular ?
@[NSStringPboardType, ScintillaRecPboardType] : @[NSPasteboardTypeString, ScintillaRecPboardType] :
@[NSStringPboardType]; @[NSPasteboardTypeString];
[board declareTypes: pbTypes owner: nil]; [board declareTypes: pbTypes owner: nil];
if (selectedText.rectangular) { if (selectedText.rectangular) {
@ -1621,7 +1673,7 @@ void ScintillaCocoa::SetPasteboardData(NSPasteboard *board, const SelectionText
[board setString: (__bridge NSString *)cfsVal forType: ScintillaRecPboardType]; [board setString: (__bridge NSString *)cfsVal forType: ScintillaRecPboardType];
} }
[board setString: (__bridge NSString *)cfsVal forType: NSStringPboardType]; [board setString: (__bridge NSString *)cfsVal forType: NSPasteboardTypeString];
if (cfsVal) if (cfsVal)
CFRelease(cfsVal); CFRelease(cfsVal);
@ -1634,7 +1686,7 @@ void ScintillaCocoa::SetPasteboardData(NSPasteboard *board, const SelectionText
*/ */
bool ScintillaCocoa::GetPasteboardData(NSPasteboard *board, SelectionText *selectedText) { bool ScintillaCocoa::GetPasteboardData(NSPasteboard *board, SelectionText *selectedText) {
NSArray *supportedTypes = @[ScintillaRecPboardType, NSArray *supportedTypes = @[ScintillaRecPboardType,
NSStringPboardType]; NSPasteboardTypeString];
NSString *bestType = [board availableTypeFromArray: supportedTypes]; NSString *bestType = [board availableTypeFromArray: supportedTypes];
NSString *data = [board stringForType: bestType]; NSString *data = [board stringForType: bestType];
@ -1840,7 +1892,7 @@ bool ScintillaCocoa::SyncPaint(void *gc, PRectangle rc) {
* Paint the margin into the SCIMarginView space. * Paint the margin into the SCIMarginView space.
*/ */
void ScintillaCocoa::PaintMargin(NSRect aRect) { void ScintillaCocoa::PaintMargin(NSRect aRect) {
CGContextRef gc = (CGContextRef) [NSGraphicsContext currentContext].graphicsPort; CGContextRef gc = CGContextCurrent();
PRectangle rc = NSRectToPRectangle(aRect); PRectangle rc = NSRectToPRectangle(aRect);
rcPaint = rc; rcPaint = rc;
@ -1988,6 +2040,10 @@ bool ScintillaCocoa::SetScrollingSize() {
void ScintillaCocoa::Resize() { void ScintillaCocoa::Resize() {
SetScrollingSize(); SetScrollingSize();
const PRectangle rcClient = GetClientRectangle();
sizeClient = Point(rcClient.Width(), rcClient.Height());
ChangeSize(); ChangeSize();
} }
@ -2597,10 +2653,11 @@ void ScintillaCocoa::UpdateBaseElements() {
bool changed = false; bool changed = false;
if (@available(macOS 10.14, *)) { if (@available(macOS 10.14, *)) {
NSColor *textBack = [NSColor.textBackgroundColor colorUsingColorSpaceName: NSCalibratedRGBColorSpace]; NSColorSpace *colorSpace = [NSColorSpace genericRGBColorSpace];
NSColor *noFocusBack = [NSColor.unemphasizedSelectedTextBackgroundColor colorUsingColorSpaceName: NSCalibratedRGBColorSpace]; NSColor *textBack = [NSColor.textBackgroundColor colorUsingColorSpace: colorSpace];
NSColor *noFocusBack = [NSColor.unemphasizedSelectedTextBackgroundColor colorUsingColorSpace: colorSpace];
if (vs.selection.layer == Layer::Base) { if (vs.selection.layer == Layer::Base) {
NSColor *selBack = [NSColor.selectedTextBackgroundColor colorUsingColorSpaceName: NSCalibratedRGBColorSpace]; NSColor *selBack = [NSColor.selectedTextBackgroundColor colorUsingColorSpace: colorSpace];
// Additional selection: blend with text background to make weaker version. // Additional selection: blend with text background to make weaker version.
NSColor *modified = [selBack blendedColorWithFraction:0.5 ofColor:textBack]; NSColor *modified = [selBack blendedColorWithFraction:0.5 ofColor:textBack];
changed = vs.SetElementBase(Element::SelectionBack, ColourFromNSColor(selBack)); changed = vs.SetElementBase(Element::SelectionBack, ColourFromNSColor(selBack));
@ -2610,7 +2667,7 @@ void ScintillaCocoa::UpdateBaseElements() {
// Less translucent colour used in dark mode as otherwise less visible // Less translucent colour used in dark mode as otherwise less visible
const int alpha = textBack.brightnessComponent > 0.5 ? 0x40 : 0x60; const int alpha = textBack.brightnessComponent > 0.5 ? 0x40 : 0x60;
// Make a translucent colour that approximates selectedTextBackgroundColor // Make a translucent colour that approximates selectedTextBackgroundColor
NSColor *accent = [NSColor.controlAccentColor colorUsingColorSpaceName: NSCalibratedRGBColorSpace]; NSColor *accent = [NSColor.controlAccentColor colorUsingColorSpace: colorSpace];
const ColourRGBA colourAccent = ColourFromNSColor(accent); const ColourRGBA colourAccent = ColourFromNSColor(accent);
changed = vs.SetElementBase(Element::SelectionBack, ColourRGBA(colourAccent, alpha)); changed = vs.SetElementBase(Element::SelectionBack, ColourRGBA(colourAccent, alpha));
changed = vs.SetElementBase(Element::SelectionAdditionalBack, ColourRGBA(colourAccent, alpha/2)) || changed; changed = vs.SetElementBase(Element::SelectionAdditionalBack, ColourRGBA(colourAccent, alpha/2)) || changed;

View File

@ -314,6 +314,7 @@
HEADER_SEARCH_PATHS = ""; HEADER_SEARCH_PATHS = "";
INFOPLIST_FILE = Info.plist; INFOPLIST_FILE = Info.plist;
INSTALL_PATH = "$(HOME)/Applications"; INSTALL_PATH = "$(HOME)/Applications";
LD_RUNPATH_SEARCH_PATHS = "$(LD_RUNPATH_SEARCH_PATHS_$(IS_MACCATALYST)) @executable_path/../Frameworks";
LIBRARY_SEARCH_PATHS = "$(inherited)"; LIBRARY_SEARCH_PATHS = "$(inherited)";
MACOSX_DEPLOYMENT_TARGET = 10.9; MACOSX_DEPLOYMENT_TARGET = 10.9;
OTHER_LDFLAGS = ""; OTHER_LDFLAGS = "";
@ -341,6 +342,7 @@
HEADER_SEARCH_PATHS = ""; HEADER_SEARCH_PATHS = "";
INFOPLIST_FILE = Info.plist; INFOPLIST_FILE = Info.plist;
INSTALL_PATH = "$(HOME)/Applications"; INSTALL_PATH = "$(HOME)/Applications";
LD_RUNPATH_SEARCH_PATHS = "$(LD_RUNPATH_SEARCH_PATHS_$(IS_MACCATALYST)) @executable_path/../Frameworks";
LIBRARY_SEARCH_PATHS = "$(inherited)"; LIBRARY_SEARCH_PATHS = "$(inherited)";
MACOSX_DEPLOYMENT_TARGET = 10.9; MACOSX_DEPLOYMENT_TARGET = 10.9;
OTHER_LDFLAGS = ""; OTHER_LDFLAGS = "";

View File

@ -197,7 +197,6 @@ static NSCursor *cursorFromEnum(Window::Cursor cursor) {
marginRect.origin.x = x; marginRect.origin.x = x;
marginRect.size.width = width; marginRect.size.width = width;
[self addCursorRect: marginRect cursor: cc]; [self addCursorRect: marginRect cursor: cc];
[cc setOnMouseEntered: YES];
x += width; x += width;
} }
} }
@ -235,7 +234,15 @@ static NSCursor *cursorFromEnum(Window::Cursor cursor) {
trackingArea = nil; trackingArea = nil;
mMarkedTextRange = NSMakeRange(NSNotFound, 0); mMarkedTextRange = NSMakeRange(NSNotFound, 0);
[self registerForDraggedTypes: @[NSStringPboardType, ScintillaRecPboardType, NSFilenamesPboardType]]; if (@available(macOS 10.13, *)) {
[self registerForDraggedTypes: @[NSPasteboardTypeString, ScintillaRecPboardType, NSPasteboardTypeFileURL]];
} else {
// Use old deprecated type
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
[self registerForDraggedTypes: @[NSPasteboardTypeString, ScintillaRecPboardType, NSFilenamesPboardType]];
#pragma clang diagnostic pop
}
// Set up accessibility in the text role // Set up accessibility in the text role
if ([self respondsToSelector: @selector(setAccessibilityElement:)]) { if ([self respondsToSelector: @selector(setAccessibilityElement:)]) {
@ -308,7 +315,6 @@ static NSCursor *cursorFromEnum(Window::Cursor cursor) {
// We only have one cursor rect: our bounds. // We only have one cursor rect: our bounds.
const NSRect visibleBounds = mOwner.backend->GetBounds(); const NSRect visibleBounds = mOwner.backend->GetBounds();
[self addCursorRect: visibleBounds cursor: mCurrentCursor]; [self addCursorRect: visibleBounds cursor: mCurrentCursor];
[mCurrentCursor setOnMouseEntered: YES];
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@ -365,7 +371,7 @@ static NSCursor *cursorFromEnum(Window::Cursor cursor) {
* Gets called by the runtime when the view needs repainting. * Gets called by the runtime when the view needs repainting.
*/ */
- (void) drawRect: (NSRect) rect { - (void) drawRect: (NSRect) rect {
CGContextRef context = (CGContextRef) [NSGraphicsContext currentContext].graphicsPort; CGContextRef context = CGContextCurrent();
if (!mOwner.backend->Draw(rect, context)) { if (!mOwner.backend->Draw(rect, context)) {
dispatch_async(dispatch_get_main_queue(), ^ { dispatch_async(dispatch_get_main_queue(), ^ {
@ -778,14 +784,14 @@ static NSCursor *cursorFromEnum(Window::Cursor cursor) {
// Only snap for positions inside the document - allow outside // Only snap for positions inside the document - allow outside
// for overshoot. // for overshoot.
long lineHeight = mOwner.backend->WndProc(Message::TextHeight, 0, 0); long lineHeight = mOwner.backend->WndProc(Message::TextHeight, 0, 0);
rc.origin.y = std::round(static_cast<XYPOSITION>(rc.origin.y) / lineHeight) * lineHeight; rc.origin.y = std::round(rc.origin.y / lineHeight) * lineHeight;
} }
// Snap to whole points - on retina displays this avoids visual debris // Snap to whole points - on retina displays this avoids visual debris
// when scrolling horizontally. // when scrolling horizontally.
if ((rc.origin.x > 0) && (NSMaxX(rc) < contentRect.size.width)) { if ((rc.origin.x > 0) && (NSMaxX(rc) < contentRect.size.width)) {
// Only snap for positions inside the document - allow outside // Only snap for positions inside the document - allow outside
// for overshoot. // for overshoot.
rc.origin.x = std::round(static_cast<XYPOSITION>(rc.origin.x)); rc.origin.x = std::round(rc.origin.x);
} }
return rc; return rc;
} }
@ -1828,11 +1834,10 @@ static NSCursor *cursorFromEnum(Window::Cursor cursor) {
* Specialized property setter for colors. * Specialized property setter for colors.
*/ */
- (void) setColorProperty: (int) property parameter: (long) parameter value: (NSColor *) value { - (void) setColorProperty: (int) property parameter: (long) parameter value: (NSColor *) value {
if (value.colorSpaceName != NSDeviceRGBColorSpace) NSColor *deviceColor = [value colorUsingColorSpace: [NSColorSpace deviceRGBColorSpace]];
value = [value colorUsingColorSpaceName: NSDeviceRGBColorSpace]; long red = static_cast<long>(deviceColor.redComponent * 255);
long red = static_cast<long>(value.redComponent * 255); long green = static_cast<long>(deviceColor.greenComponent * 255);
long green = static_cast<long>(value.greenComponent * 255); long blue = static_cast<long>(deviceColor.blueComponent * 255);
long blue = static_cast<long>(value.blueComponent * 255);
long color = (blue << 16) + (green << 8) + red; long color = (blue << 16) + (green << 8) + red;
mBackend->WndProc(static_cast<Message>(property), parameter, color); mBackend->WndProc(static_cast<Message>(property), parameter, color);

View File

@ -7982,7 +7982,7 @@ sptr_t CallScintilla(unsigned int iMessage, uptr_t wParam, sptr_t lParam){
<p><b id="SCI_SETLAYOUTTHREADS">SCI_SETLAYOUTTHREADS(int threads)</b><br /> <p><b id="SCI_SETLAYOUTTHREADS">SCI_SETLAYOUTTHREADS(int threads)</b><br />
<b id="SCI_GETLAYOUTTHREADS">SCI_GETLAYOUTTHREADS &rarr; int</b><br /> <b id="SCI_GETLAYOUTTHREADS">SCI_GETLAYOUTTHREADS &rarr; int</b><br />
The time taken to measure text runs on wide lines can be improved by performing the task The time taken to measure text runs on wide lines or when wrapping can be improved by performing the task
concurrently on multiple threads when concurrently on multiple threads when
<a class="seealso" href="#SCI_SUPPORTSFEATURE">SCI_SUPPORTSFEATURE(SC_SUPPORTS_THREAD_SAFE_MEASURE_WIDTHS)</a> <a class="seealso" href="#SCI_SUPPORTSFEATURE">SCI_SUPPORTSFEATURE(SC_SUPPORTS_THREAD_SAFE_MEASURE_WIDTHS)</a>
is available. is available.

View File

@ -26,9 +26,9 @@
<table bgcolor="#CCCCCC" width="100%" cellspacing="0" cellpadding="8" border="0"> <table bgcolor="#CCCCCC" width="100%" cellspacing="0" cellpadding="8" border="0">
<tr> <tr>
<td> <td>
<font size="4"> <a href="https://www.scintilla.org/scintilla533.zip"> <font size="4"> <a href="https://www.scintilla.org/scintilla534.zip">
Windows</a>&nbsp;&nbsp; Windows</a>&nbsp;&nbsp;
<a href="https://www.scintilla.org/scintilla533.tgz"> <a href="https://www.scintilla.org/scintilla534.tgz">
GTK/Linux</a>&nbsp;&nbsp; GTK/Linux</a>&nbsp;&nbsp;
</font> </font>
</td> </td>
@ -42,7 +42,7 @@
containing very few restrictions. containing very few restrictions.
</p> </p>
<h3> <h3>
Release 5.3.3 Release 5.3.4
</h3> </h3>
<h4> <h4>
Source Code Source Code
@ -50,8 +50,8 @@
The source code package contains all of the source code for Scintilla but no binary The source code package contains all of the source code for Scintilla but no binary
executable code and is available in executable code and is available in
<ul> <ul>
<li><a href="https://www.scintilla.org/scintilla533.zip">zip format</a> (1.4M) commonly used on Windows</li> <li><a href="https://www.scintilla.org/scintilla534.zip">zip format</a> (1.4M) commonly used on Windows</li>
<li><a href="https://www.scintilla.org/scintilla533.tgz">tgz format</a> (1.3M) commonly used on Linux and compatible operating systems</li> <li><a href="https://www.scintilla.org/scintilla534.tgz">tgz format</a> (1.3M) commonly used on Linux and compatible operating systems</li>
</ul> </ul>
Instructions for building on both Windows and Linux are included in the readme file. Instructions for building on both Windows and Linux are included in the readme file.
<h4> <h4>

View File

@ -579,6 +579,37 @@
</tr> </tr>
</table> </table>
<h2>Releases</h2> <h2>Releases</h2>
<h3>
<a href="https://www.scintilla.org/scintilla534.zip">Release 5.3.4</a>
</h3>
<ul>
<li>
Released 8 March 2023.
</li>
<li>
Add multithreaded wrap to significantly improve performance of wrapping large files.
</li>
<li>
More typesafe bindings of *Full APIs in ScintillaCall.
<a href="https://sourceforge.net/p/scintilla/feature-requests/1477/">Feature #1477</a>.
</li>
<li>
Fix overlapping of text with line end wrap marker.
<a href="https://sourceforge.net/p/scintilla/bugs/2378/">Bug #2378</a>.
</li>
<li>
Fix clipping of line end wrap symbol for SC_WRAPVISUALFLAGLOC_END_BY_TEXT.
</li>
<li>
Where a multi-byte character contains multiple styles, display each byte as a representation.
This makes it easier to see and fix lexers that change styles mid-character, commonly because
they use fixed size buffers.
</li>
<li>
Fix a potential crash with autocompletion list fill-ups where a SCN_CHARADDED
handler retriggered an autocompletion list, but with no items that match the typed character.
</li>
</ul>
<h3> <h3>
<a href="https://www.scintilla.org/scintilla533.zip">Release 5.3.3</a> <a href="https://www.scintilla.org/scintilla533.zip">Release 5.3.3</a>
</h3> </h3>

View File

@ -9,7 +9,7 @@
<meta name="keywords" content="Scintilla, SciTE, Editing Component, Text Editor" /> <meta name="keywords" content="Scintilla, SciTE, Editing Component, Text Editor" />
<meta name="Description" <meta name="Description"
content="www.scintilla.org is the home of the Scintilla editing component and SciTE text editor application." /> content="www.scintilla.org is the home of the Scintilla editing component and SciTE text editor application." />
<meta name="Date.Modified" content="20230208" /> <meta name="Date.Modified" content="20230308" />
<meta name="viewport" content="width=device-width, initial-scale=1" /> <meta name="viewport" content="width=device-width, initial-scale=1" />
<style type="text/css"> <style type="text/css">
#versionlist { #versionlist {
@ -56,8 +56,8 @@
GTK, and macOS</font> GTK, and macOS</font>
</td> </td>
<td width="40%" align="right"> <td width="40%" align="right">
<font color="#FFCC99" size="3"> Release version 5.3.3<br /> <font color="#FFCC99" size="3"> Release version 5.3.4<br />
Site last modified February 8 2023</font> Site last modified March 8 2023</font>
</td> </td>
<td width="20%"> <td width="20%">
&nbsp; &nbsp;
@ -72,12 +72,12 @@
</tr> </tr>
</table> </table>
<ul id="versionlist"> <ul id="versionlist">
<li>Version 5.3.4 adds multithreaded wrapping.</li>
<li>Version 5.3.3 fixes minor bugs in APIs and platform layers.</li> <li>Version 5.3.3 fixes minor bugs in APIs and platform layers.</li>
<li>Version 5.3.2 adds SCI_REPLACETARGETMINIMAL to modify text without marking unchanged start and end text in change history.</li> <li>Version 5.3.2 adds SCI_REPLACETARGETMINIMAL to modify text without marking unchanged start and end text in change history.</li>
<li>Version 5.3.1 can represent invisible text with a character to simplify editing and provide summarized views.</li> <li>Version 5.3.1 can represent invisible text with a character to simplify editing and provide summarized views.</li>
<li>Version 5.3.0 adds change history.</li> <li>Version 5.3.0 adds change history.</li>
<li>Version 5.2.4 fixes failures on GTK with multi-threaded layout.</li> <li>Version 5.2.4 fixes failures on GTK with multi-threaded layout.</li>
<li>Version 5.2.3 adds 64-bit safe APIs and fixes scrollbar on GTK with Xorg.</li>
</ul> </ul>
<ul id="menu"> <ul id="menu">
<li id="remote1"><a href="https://www.scintilla.org/SciTEImage.html">Screenshot</a></li> <li id="remote1"><a href="https://www.scintilla.org/SciTEImage.html">Screenshot</a></li>

View File

@ -2180,7 +2180,7 @@ void Platform::DebugPrintf(const char *format, ...) noexcept {
char buffer[2000]; char buffer[2000];
va_list pArguments; va_list pArguments;
va_start(pArguments, format); va_start(pArguments, format);
vsprintf(buffer, format, pArguments); vsnprintf(buffer, std::size(buffer), format, pArguments);
va_end(pArguments); va_end(pArguments);
Platform::DebugDisplay(buffer); Platform::DebugDisplay(buffer);
} }

View File

@ -402,6 +402,7 @@ void ScintillaGTK::MapThis() {
wMain.SetCursor(Window::Cursor::arrow); wMain.SetCursor(Window::Cursor::arrow);
scrollbarv.SetCursor(Window::Cursor::arrow); scrollbarv.SetCursor(Window::Cursor::arrow);
scrollbarh.SetCursor(Window::Cursor::arrow); scrollbarh.SetCursor(Window::Cursor::arrow);
SetClientRectangle();
ChangeSize(); ChangeSize();
gdk_window_show(PWindow(wMain)); gdk_window_show(PWindow(wMain));
} catch (...) { } catch (...) {
@ -1061,8 +1062,12 @@ void ScintillaGTK::FullPaint() {
wText.InvalidateAll(); wText.InvalidateAll();
} }
void ScintillaGTK::SetClientRectangle() {
rectangleClient = wMain.GetClientPosition();
}
PRectangle ScintillaGTK::GetClientRectangle() const { PRectangle ScintillaGTK::GetClientRectangle() const {
PRectangle rc = wMain.GetClientPosition(); PRectangle rc = rectangleClient;
if (verticalScrollBarVisible) if (verticalScrollBarVisible)
rc.right -= verticalScrollBarWidth; rc.right -= verticalScrollBarWidth;
if (horizontalScrollBarVisible && !Wrapping()) if (horizontalScrollBarVisible && !Wrapping())
@ -1788,6 +1793,7 @@ void ScintillaGTK::Resize(int width, int height) {
gtk_widget_hide(GTK_WIDGET(PWidget(scrollbarv))); gtk_widget_hide(GTK_WIDGET(PWidget(scrollbarv)));
verticalScrollBarWidth = 0; verticalScrollBarWidth = 0;
} }
SetClientRectangle();
if (IS_WIDGET_MAPPED(PWidget(wMain))) { if (IS_WIDGET_MAPPED(PWidget(wMain))) {
ChangeSize(); ChangeSize();
} else { } else {

View File

@ -33,6 +33,8 @@ class ScintillaGTK : public ScintillaBase {
int verticalScrollBarWidth; int verticalScrollBarWidth;
int horizontalScrollBarHeight; int horizontalScrollBarHeight;
PRectangle rectangleClient;
SelectionText primary; SelectionText primary;
SelectionPosition posPrimary; SelectionPosition posPrimary;
@ -128,6 +130,7 @@ private:
bool HaveMouseCapture() override; bool HaveMouseCapture() override;
bool PaintContains(PRectangle rc) override; bool PaintContains(PRectangle rc) override;
void FullPaint(); void FullPaint();
void SetClientRectangle();
PRectangle GetClientRectangle() const override; PRectangle GetClientRectangle() const override;
void ScrollText(Sci::Line linesToMove) override; void ScrollText(Sci::Line linesToMove) override;
void SetVerticalScrollPos() override; void SetVerticalScrollPos() override;

View File

@ -414,6 +414,7 @@ PositionCache.o: \
../src/CaseFolder.h \ ../src/CaseFolder.h \
../src/Document.h \ ../src/Document.h \
../src/UniConversion.h \ ../src/UniConversion.h \
../src/DBCS.h \
../src/Selection.h \ ../src/Selection.h \
../src/PositionCache.h ../src/PositionCache.h
RESearch.o: \ RESearch.o: \

View File

@ -29,7 +29,6 @@ WARNINGS += -Wno-language-extension-token
# register may be used in glib # register may be used in glib
# This produces a warning since -Wno-register is not valid for C files but it still works # This produces a warning since -Wno-register is not valid for C files but it still works
WARNINGS += -Wno-register WARNINGS += -Wno-register
DEFINES += -D_CRT_SECURE_NO_DEPRECATE
endif endif
# Can choose aspect to sanitize: address and undefined can simply change SANITIZE but for # Can choose aspect to sanitize: address and undefined can simply change SANITIZE but for
# thread also need to create Position Independent Executable -> search online documentation # thread also need to create Position Independent Executable -> search online documentation

Some files were not shown because too many files have changed in this diff Show More