Update to scintilla 5.3.0 and lexilla 5.1.9

Close #12045
This commit is contained in:
Christian Grasser 2022-08-27 09:35:52 +02:00 committed by Don Ho
parent 9455684b42
commit 1646ea6139
143 changed files with 4701 additions and 833 deletions

View File

@ -19,6 +19,7 @@
**.def text
**.manifest text
**.properties text
**.props text
**.session text
**.styled text
**.folded text

View File

@ -9,7 +9,7 @@
<meta name="keywords" content="Scintilla, SciTE, Editing Component, Text Editor" />
<meta name="Description"
content="www.scintilla.org is the home of the Scintilla editing component and SciTE text editor application." />
<meta name="Date.Modified" content="20220710" />
<meta name="Date.Modified" content="20220827" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<style type="text/css">
.logo {
@ -61,8 +61,8 @@
<font color="#FFCC99" size="4"> A library of language lexers for use with Scintilla</font>
</td>
<td width="40%" align="right">
<font color="#FFCC99" size="3">Release version 5.1.8<br />
Site last modified July 10 2022</font>
<font color="#FFCC99" size="3">Release version 5.1.9<br />
Site last modified August 27 2022</font>
</td>
<td width="20%">
&nbsp;
@ -77,6 +77,7 @@
</tr>
</table>
<ul id="versionlist">
<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.7 improves CMake, HTML, Matlab, Raku, Ruby, and VHDL.</li>
<li>Version 5.1.6 improves Markdown and Ruby.</li>

View File

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

View File

@ -580,11 +580,34 @@
<td>cdbdev</td>
<td>Andrey Smolyakov</td>
<td>Knut Leimbert</td>
</tr><tr>
<td>German Aizek</td>
</tr>
</table>
<h2>Releases</h2>
<h3>
<a href="https://www.scintilla.org/lexilla519.zip">Release 5.1.8</a>
<a href="https://www.scintilla.org/lexilla519.zip">Release 5.1.9</a>
</h3>
<ul>
<li>
Released 27 August 2022.
</li>
<li>
Julia: Parse unicode forall and exists as identifiers #42314.
<a href="https://github.com/ScintillaOrg/lexilla/pull/98">Pull request #98</a>.
</li>
<li>
Julia: Parse apostrophe as char and not adjoint after exclamation.
<a href="https://github.com/ScintillaOrg/lexilla/issues/97">Issue #97</a>,
<a href="https://github.com/ScintillaOrg/lexilla/pull/98">Pull request #98</a>.
</li>
<li>
Properties: Don't set header flag for empty section.
<a href="https://github.com/ScintillaOrg/lexilla/issues/96">Issue #96</a>.
</li>
</ul>
<h3>
<a href="https://www.scintilla.org/lexilla518.zip">Release 5.1.8</a>
</h3>
<ul>
<li>

View File

@ -263,8 +263,7 @@ class LinePPState {
}
}
public:
LinePPState() noexcept {
}
LinePPState() noexcept = default;
bool ValidLevel() const noexcept {
return level >= 0 && level < maximumNestingLevel;
}
@ -654,7 +653,7 @@ public:
if (styleActive < sizeLexicalClasses)
returnBuffer += lexicalClasses[styleActive].tags;
else
returnBuffer = "";
returnBuffer.clear();
return returnBuffer.c_str();
}
return "";
@ -883,7 +882,7 @@ void SCI_METHOD LexerCPP::Lex(Sci_PositionU startPos, Sci_Position length, int i
lineCurrent++;
lineEndNext = styler.LineEnd(lineCurrent);
vlls.Add(lineCurrent, preproc);
if (rawStringTerminator != "") {
if (!rawStringTerminator.empty()) {
rawSTNew.Set(lineCurrent-1, rawStringTerminator);
}
}
@ -894,7 +893,7 @@ void SCI_METHOD LexerCPP::Lex(Sci_PositionU startPos, Sci_Position length, int i
lineCurrent++;
lineEndNext = styler.LineEnd(lineCurrent);
vlls.Add(lineCurrent, preproc);
if (rawStringTerminator != "") {
if (!rawStringTerminator.empty()) {
rawSTNew.Set(lineCurrent-1, rawStringTerminator);
}
sc.Forward();
@ -1161,7 +1160,7 @@ void SCI_METHOD LexerCPP::Lex(Sci_PositionU startPos, Sci_Position length, int i
for (size_t termPos=rawStringTerminator.size(); termPos; termPos--)
sc.Forward();
sc.SetState(SCE_C_DEFAULT|activitySet);
rawStringTerminator = "";
rawStringTerminator.clear();
}
break;
case SCE_C_CHARACTER:
@ -1634,7 +1633,7 @@ void LexerCPP::EvaluateTokens(Tokens &tokens, const SymbolTable &preprocessorDef
if (it->second.IsMacro()) {
if ((i + 1 < tokens.size()) && (tokens.at(i + 1) == "(")) {
// Create map of argument name to value
Tokens argumentNames = StringSplit(it->second.arguments, ',');
const Tokens argumentNames = StringSplit(it->second.arguments, ',');
std::map<std::string, std::string> arguments;
size_t arg = 0;
size_t tok = i+2;

View File

@ -136,7 +136,7 @@ int RecogniseErrorListLine(const char *lineBuffer, Sci_PositionU lengthLine, Sci
// HTML tidy style: line 42 column 1
return SCE_ERR_TIDY;
} else if (strstart(lineBuffer, "\tat ") &&
strstr(lineBuffer, "(") &&
strchr(lineBuffer, '(') &&
strstr(lineBuffer, ".java:")) {
// Java stack back trace
return SCE_ERR_JAVA_STACK;

View File

@ -252,9 +252,10 @@ static int is_wc_cat_id_start(uint32_t wc) {
wc == 0x223f || wc == 0x22be || wc == 0x22bf || // ∿, ⊾, ⊿
wc == 0x22a4 || wc == 0x22a5 || //
(wc >= 0x2202 && wc <= 0x2233 &&
(wc >= 0x2200 && wc <= 0x2233 &&
(wc == 0x2202 || wc == 0x2205 || wc == 0x2206 || // ∂, ∅, ∆
wc == 0x2207 || wc == 0x220e || wc == 0x220f || // ∇, ∎, ∏
wc == 0x2200 || wc == 0x2203 || wc == 0x2204 || // ∀, ∃, ∄
wc == 0x2210 || wc == 0x2211 || // ∐, ∑
wc == 0x221e || wc == 0x221f || // ∞, ∟
wc >= 0x222b)) || // ∫, ∬, ∭, ∮, ∯, ∰, ∱, ∲, ∳
@ -1020,6 +1021,7 @@ void SCI_METHOD LexerJulia::Lex(Sci_PositionU startPos, Sci_Position length, int
}
} else if (sc.ch == '!') {
sc.SetState(SCE_JULIA_OPERATOR);
transpose = false;
} else if (sc.ch == '\'') {
if (transpose) {
sc.SetState(SCE_JULIA_OPERATOR);

View File

@ -119,7 +119,7 @@ static void FoldPropsDoc(Sci_PositionU startPos, Sci_Position length, int, WordL
char chNext = styler[startPos];
int styleNext = styler.StyleAt(startPos);
bool headerPoint = false;
int lev;
int levelPrevious = (lineCurrent > 0) ? styler.LevelAt(lineCurrent - 1) : SC_FOLDLEVELBASE;
for (Sci_PositionU i = startPos; i < endPos; i++) {
const char ch = chNext;
@ -134,27 +134,19 @@ static void FoldPropsDoc(Sci_PositionU startPos, Sci_Position length, int, WordL
}
if (atEOL) {
lev = SC_FOLDLEVELBASE;
if (lineCurrent > 0) {
const int levelPrevious = styler.LevelAt(lineCurrent - 1);
if (levelPrevious & SC_FOLDLEVELHEADERFLAG) {
lev = SC_FOLDLEVELBASE + 1;
} else {
lev = levelPrevious & SC_FOLDLEVELNUMBERMASK;
}
}
int lev = levelPrevious & SC_FOLDLEVELNUMBERMASK;
if (headerPoint) {
lev = SC_FOLDLEVELBASE;
lev = SC_FOLDLEVELBASE | SC_FOLDLEVELHEADERFLAG;
if (levelPrevious & SC_FOLDLEVELHEADERFLAG) {
// previous section is empty
styler.SetLevel(lineCurrent - 1, SC_FOLDLEVELBASE);
}
} else if (levelPrevious & SC_FOLDLEVELHEADERFLAG) {
lev += 1;
}
if (visibleChars == 0 && foldCompact)
lev |= SC_FOLDLEVELWHITEFLAG;
if (headerPoint) {
lev |= SC_FOLDLEVELHEADERFLAG;
}
if (lev != styler.LevelAt(lineCurrent)) {
styler.SetLevel(lineCurrent, lev);
}
@ -162,23 +154,18 @@ static void FoldPropsDoc(Sci_PositionU startPos, Sci_Position length, int, WordL
lineCurrent++;
visibleChars = 0;
headerPoint = false;
levelPrevious = lev;
}
if (!isspacechar(ch))
visibleChars++;
}
if (lineCurrent > 0) {
const int levelPrevious = styler.LevelAt(lineCurrent - 1);
if (levelPrevious & SC_FOLDLEVELHEADERFLAG) {
lev = SC_FOLDLEVELBASE + 1;
} else {
lev = levelPrevious & SC_FOLDLEVELNUMBERMASK;
}
} else {
lev = SC_FOLDLEVELBASE;
int level = levelPrevious & SC_FOLDLEVELNUMBERMASK;
if (levelPrevious & SC_FOLDLEVELHEADERFLAG) {
level += 1;
}
int flagsNext = styler.LevelAt(lineCurrent);
styler.SetLevel(lineCurrent, lev | (flagsNext & ~SC_FOLDLEVELNUMBERMASK));
styler.SetLevel(lineCurrent, level | (flagsNext & ~SC_FOLDLEVELNUMBERMASK));
}
static const char *const emptyWordListDesc[] = {

View File

@ -156,12 +156,6 @@ Sci_Position SCI_METHOD LexerVisualProlog::WordListSet(int n, const char *wl) {
return firstModification;
}
// Functor used to truncate history
struct After {
Sci_Position line;
After(Sci_Position line_) : line(line_) {}
};
static bool isLowerLetter(int ch){
return ccLl == CategoriseCharacter(ch);
}

View File

@ -140,6 +140,8 @@
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<Optimization>MaxSpeed</Optimization>
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
</ClCompile>
<Link>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
@ -152,6 +154,8 @@
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<Optimization>MaxSpeed</Optimization>
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
</ClCompile>
<Link>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
@ -164,6 +168,8 @@
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<Optimization>MaxSpeed</Optimization>
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
</ClCompile>
<Link>
<EnableCOMDATFolding>true</EnableCOMDATFolding>

View File

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

View File

@ -851,7 +851,7 @@
buildSettings = {
CLANG_CXX_LANGUAGE_STANDARD = "gnu++17";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 5.1.8;
CURRENT_PROJECT_VERSION = 5.1.9;
DEVELOPMENT_TEAM = 4F446KW87E;
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1;
@ -877,7 +877,7 @@
buildSettings = {
CLANG_CXX_LANGUAGE_STANDARD = "gnu++17";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 5.1.8;
CURRENT_PROJECT_VERSION = 5.1.9;
DEVELOPMENT_TEAM = 4F446KW87E;
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1;

View File

@ -4,8 +4,8 @@
#include <windows.h>
#define VERSION_LEXILLA "5.1.8"
#define VERSION_WORDS 5, 1, 8, 0
#define VERSION_LEXILLA "5.1.9"
#define VERSION_WORDS 5, 1, 9, 0
VS_VERSION_INFO VERSIONINFO
FILEVERSION VERSION_WORDS

View File

@ -332,10 +332,32 @@ std::vector<std::string> StringSplit(const std::string_view &text, int separator
return vs;
}
static constexpr bool IsSpaceOrTab(char ch) noexcept {
constexpr bool IsSpaceOrTab(char ch) noexcept {
return (ch == ' ') || (ch == '\t');
}
void PrintRanges(const std::vector<bool> &v) {
std::cout << " ";
std::optional<size_t> startRange;
for (size_t style = 0; style <= v.size(); style++) {
// Goes one past size so that final range is closed
if ((style < v.size()) && v.at(style)) {
if (!startRange) {
startRange = style;
}
} else if (startRange) {
const size_t endRange = style - 1;
std::cout << *startRange;
if (*startRange != endRange) {
std::cout << "-" << endRange;
}
std::cout << " ";
startRange.reset();
}
}
std::cout << "\n";
}
class PropertyMap {
std::string Evaluate(std::string_view text) {
@ -575,6 +597,7 @@ void StyleLineByLine(TestDocument &doc, Scintilla::ILexer5 *plex) {
}
bool TestCRLF(std::filesystem::path path, const std::string s, Scintilla::ILexer5 *plex, bool disablePerLineTests) {
assert(plex);
bool success = true;
// Convert all line ends to \r\n to check if styles change between \r and \n which makes
// it difficult to test on different platforms when files may have line ends changed.
@ -586,6 +609,7 @@ bool TestCRLF(std::filesystem::path path, const std::string s, Scintilla::ILexer
TestDocument doc;
doc.Set(text);
Scintilla::IDocument *pdoc = &doc;
assert(pdoc);
plex->Lex(0, pdoc->Length(), 0, pdoc);
plex->Fold(0, pdoc->Length(), 0, pdoc);
const auto [styledText, foldedText] = MarkedAndFoldedDocument(pdoc);
@ -613,6 +637,7 @@ bool TestCRLF(std::filesystem::path path, const std::string s, Scintilla::ILexer
TestDocument docUnix;
docUnix.Set(textUnix);
Scintilla::IDocument *pdocUnix = &docUnix;
assert(pdocUnix);
plex->Lex(0, pdocUnix->Length(), 0, pdocUnix);
plex->Fold(0, pdocUnix->Length(), 0, pdocUnix);
auto [styledTextUnix, foldedTextUnix] = MarkedAndFoldedDocument(pdocUnix);
@ -790,6 +815,7 @@ bool TestFile(const std::filesystem::path &path, const PropertyMap &propertyMap)
TestDocument doc;
doc.Set(text);
Scintilla::IDocument *pdoc = &doc;
assert(pdoc);
for (int i = 0; i < repeatLex; i++) {
plex->Lex(0, pdoc->Length(), 0, pdoc);
}
@ -813,13 +839,7 @@ bool TestFile(const std::filesystem::path &path, const PropertyMap &propertyMap)
const unsigned style = pdoc->StyleAt(pos);
used.at(style) = true;
}
std::cout << " ";
for (int style = 0; style < 0x80; style++) {
if (used.at(style)) {
std::cout << style << " ";
}
}
std::cout << "\n";
PrintRanges(used);
}
const std::optional<int> perLineDisable = propertyMap.GetPropertyValue("testlexers.per.line.disable");

View File

@ -0,0 +1,175 @@
// Enumerate all primary styles: 0 to 27 and secondary styles 64 to 91
// default=0
// comment=1
/* */
/* commentline=2 */
// example line
// commentdoc=3
/** */
// number=4
123
// word=5
int
// string=6
"string"
// character=7
'c'
// uuid=8
uuid(3fd43029-1354-42f0-a5be-4a484c9c5250)
// preprocessor=9
#define xxx 1
// operator=10
{}
// identifier=11
identifier
// stringeol=12
"
// verbatim=13
@"verbatim"
// regex=14
(/regex/)
// commentlinedoc=15
/// example
// word2=16
second
// commentdockeyword=17
/** @file */
// commentdockeyworderror=18
/** @wrongkey */
// globalclass=19
global
// stringraw=20
R"( )"
// tripleverbatim=21
""" xx """
// hashquotedstring=22
#" xx "
// preprocessorcomment=23
#define /* comment */
// preprocessorcommentdoc=24
#define /** comment */
// userliteral=25
1_date_
// taskmarker=26
/* TODO: sleep */
// escapesequence=27
"\001 \b"
// Secondary styles inside preprocessor excluded section
#if 0
// default=0
// comment=1
/* */
/* commentline=2 */
// example line
// commentdoc=3
/** */
// number=4
123
// word=5
int
// string=6
"string"
// character=7
'c'
// uuid=8
uuid(3fd43029-1354-42f0-a5be-4a484c9c5250)
// preprocessor=9
#define xxx 1
// operator=10
{}
// identifier=11
identifier
// stringeol=12
"
// verbatim=13
@"verbatim"
// regex=14
(/regex/)
// commentlinedoc=15
/// example
// word2=16
second
// commentdockeyword=17
/** @file */
// commentdockeyworderror=18
/** @wrongkey */
// globalclass=19
global
// stringraw=20
R"( )"
// tripleverbatim=21
""" xx """
// hashquotedstring=22
#" xx "
// preprocessorcomment=23
#define /* comment */
// preprocessorcommentdoc=24
#define /** comment */
// userliteral=25
1_date_
// taskmarker=26
/* TODO: sleep */
// escapesequence=27
"\001 \b"
#endif

View File

@ -0,0 +1,176 @@
0 400 400 // Enumerate all primary styles: 0 to 27 and secondary styles 64 to 91
1 400 400
0 400 400 // default=0
1 400 400
1 400 400
0 400 400 // comment=1
0 400 400 /* */
1 400 400
0 400 400 /* commentline=2 */
0 400 400 // example line
1 400 400
0 400 400 // commentdoc=3
0 400 400 /** */
1 400 400
0 400 400 // number=4
0 400 400 123
1 400 400
0 400 400 // word=5
0 400 400 int
1 400 400
0 400 400 // string=6
0 400 400 "string"
1 400 400
0 400 400 // character=7
0 400 400 'c'
1 400 400
0 400 400 // uuid=8
0 400 400 uuid(3fd43029-1354-42f0-a5be-4a484c9c5250)
1 400 400
0 400 400 // preprocessor=9
0 400 400 #define xxx 1
1 400 400
0 400 400 // operator=10
0 400 400 {}
1 400 400
0 400 400 // identifier=11
0 400 400 identifier
1 400 400
0 400 400 // stringeol=12
0 400 400 "
1 400 400
0 400 400 // verbatim=13
0 400 400 @"verbatim"
1 400 400
0 400 400 // regex=14
0 400 400 (/regex/)
1 400 400
0 400 400 // commentlinedoc=15
0 400 400 /// example
1 400 400
0 400 400 // word2=16
0 400 400 second
1 400 400
0 400 400 // commentdockeyword=17
0 400 400 /** @file */
1 400 400
0 400 400 // commentdockeyworderror=18
0 400 400 /** @wrongkey */
1 400 400
0 400 400 // globalclass=19
0 400 400 global
1 400 400
0 400 400 // stringraw=20
0 400 400 R"( )"
1 400 400
0 400 400 // tripleverbatim=21
0 400 400 """ xx """
1 400 400
0 400 400 // hashquotedstring=22
0 400 400 #" xx "
1 400 400
0 400 400 // preprocessorcomment=23
0 400 400 #define /* comment */
1 400 400
0 400 400 // preprocessorcommentdoc=24
0 400 400 #define /** comment */
1 400 400
0 400 400 // userliteral=25
0 400 400 1_date_
1 400 400
0 400 400 // taskmarker=26
0 400 400 /* TODO: sleep */
1 400 400
0 400 400 // escapesequence=27
0 400 400 "\001 \b"
1 400 400
0 400 400 // Secondary styles inside preprocessor excluded section
1 400 400
2 400 401 + #if 0
1 401 401 |
0 401 401 | // default=0
1 401 401 |
1 401 401 |
0 401 401 | // comment=1
0 401 401 | /* */
1 401 401 |
0 401 401 | /* commentline=2 */
0 401 401 | // example line
1 401 401 |
0 401 401 | // commentdoc=3
0 401 401 | /** */
1 401 401 |
0 401 401 | // number=4
0 401 401 | 123
1 401 401 |
0 401 401 | // word=5
0 401 401 | int
1 401 401 |
0 401 401 | // string=6
0 401 401 | "string"
1 401 401 |
0 401 401 | // character=7
0 401 401 | 'c'
1 401 401 |
0 401 401 | // uuid=8
0 401 401 | uuid(3fd43029-1354-42f0-a5be-4a484c9c5250)
1 401 401 |
0 401 401 | // preprocessor=9
0 401 401 | #define xxx 1
1 401 401 |
0 401 401 | // operator=10
0 401 401 | {}
1 401 401 |
0 401 401 | // identifier=11
0 401 401 | identifier
1 401 401 |
0 401 401 | // stringeol=12
0 401 401 | "
1 401 401 |
0 401 401 | // verbatim=13
0 401 401 | @"verbatim"
1 401 401 |
0 401 401 | // regex=14
0 401 401 | (/regex/)
1 401 401 |
0 401 401 | // commentlinedoc=15
0 401 401 | /// example
1 401 401 |
0 401 401 | // word2=16
0 401 401 | second
1 401 401 |
0 401 401 | // commentdockeyword=17
0 401 401 | /** @file */
1 401 401 |
0 401 401 | // commentdockeyworderror=18
0 401 401 | /** @wrongkey */
1 401 401 |
0 401 401 | // globalclass=19
0 401 401 | global
1 401 401 |
0 401 401 | // stringraw=20
0 401 401 | R"( )"
1 401 401 |
0 401 401 | // tripleverbatim=21
0 401 401 | """ xx """
1 401 401 |
0 401 401 | // hashquotedstring=22
0 401 401 | #" xx "
1 401 401 |
0 401 401 | // preprocessorcomment=23
0 401 401 | #define /* comment */
1 401 401 |
0 401 401 | // preprocessorcommentdoc=24
0 401 401 | #define /** comment */
1 401 401 |
0 401 401 | // userliteral=25
0 401 401 | 1_date_
1 401 401 |
0 401 401 | // taskmarker=26
0 401 401 | /* TODO: sleep */
1 401 401 |
0 401 401 | // escapesequence=27
0 401 401 | "\001 \b"
1 401 401 |
0 401 400 | #endif
1 400 400

View File

@ -0,0 +1,175 @@
{2}// Enumerate all primary styles: 0 to 27 and secondary styles 64 to 91
{0}
{2}// default=0
{0}
{2}// comment=1
{1}/* */{0}
{1}/* commentline=2 */{0}
{2}// example line
{0}
{2}// commentdoc=3
{3}/** */{0}
{2}// number=4
{4}123{0}
{2}// word=5
{5}int{0}
{2}// string=6
{6}"string"{0}
{2}// character=7
{7}'c'{0}
{2}// uuid=8
{5}uuid{10}({8}3fd43029-1354-42f0-a5be-4a484c9c5250{10}){0}
{2}// preprocessor=9
{9}#define xxx 1
{0}
{2}// operator=10
{10}{}{0}
{2}// identifier=11
{11}identifier{0}
{2}// stringeol=12
{12}"
{0}
{2}// verbatim=13
{13}@"verbatim"{0}
{2}// regex=14
{10}({14}/regex/{10}){0}
{2}// commentlinedoc=15
{15}/// example
{0}
{2}// word2=16
{16}second{0}
{2}// commentdockeyword=17
{3}/** {17}@file{3} */{0}
{2}// commentdockeyworderror=18
{3}/** {18}@wrongkey{3} */{0}
{2}// globalclass=19
{19}global{0}
{2}// stringraw=20
{20}R"( )"{0}
{2}// tripleverbatim=21
{21}""" xx """{0}
{2}// hashquotedstring=22
{22}#" xx "{0}
{2}// preprocessorcomment=23
{9}#define {23}/* comment */{9}
{0}
{2}// preprocessorcommentdoc=24
{9}#define {24}/** comment */{9}
{0}
{2}// userliteral=25
{25}1_date_{0}
{2}// taskmarker=26
{1}/* {26}TODO{1}: sleep */{0}
{2}// escapesequence=27
{6}"{27}\001{6} {27}\b{6}"{0}
{2}// Secondary styles inside preprocessor excluded section
{0}
{9}#if 0
{64}
{66}// default=0
{64}
{66}// comment=1
{65}/* */{64}
{65}/* commentline=2 */{64}
{66}// example line
{64}
{66}// commentdoc=3
{67}/** */{64}
{66}// number=4
{68}123{64}
{66}// word=5
{69}int{64}
{66}// string=6
{70}"string"{64}
{66}// character=7
{71}'c'{64}
{66}// uuid=8
{69}uuid{74}({72}3fd43029-1354-42f0-a5be-4a484c9c5250{74}){64}
{66}// preprocessor=9
{73}#define xxx 1
{64}
{66}// operator=10
{74}{}{64}
{66}// identifier=11
{75}identifier{64}
{66}// stringeol=12
{76}"
{64}
{66}// verbatim=13
{77}@"verbatim"{64}
{66}// regex=14
{74}({78}/regex/{74}){64}
{66}// commentlinedoc=15
{79}/// example
{64}
{66}// word2=16
{80}second{64}
{66}// commentdockeyword=17
{67}/** {81}@file{67} */{64}
{66}// commentdockeyworderror=18
{67}/** {82}@wrongkey{67} */{64}
{66}// globalclass=19
{83}global{64}
{66}// stringraw=20
{84}R"( )"{64}
{66}// tripleverbatim=21
{85}""" xx """{64}
{66}// hashquotedstring=22
{86}#" xx "{64}
{66}// preprocessorcomment=23
{73}#define {87}/* comment */{73}
{64}
{66}// preprocessorcommentdoc=24
{73}#define {88}/** comment */{73}
{64}
{66}// userliteral=25
{89}1_date_{64}
{66}// taskmarker=26
{65}/* {90}TODO{65}: sleep */{64}
{66}// escapesequence=27
{70}"{91}\001{70} {91}\b{70}"{64}
{9}#endif

View File

@ -1,9 +1,18 @@
lexer.*.cxx=cpp
keywords.*.cxx=int let
keywords2.*.cxx=
keywords.*.cxx=int let uuid
keywords2.*.cxx=second
keywords3.*.cxx=file
keywords4.*.cxx=global
keywords5.*.cxx=
keywords6.*.cxx=TODO
lexer.cpp.track.preprocessor=1
lexer.cpp.escape.sequence=1
# Set options so that AllStyles.cxx can show every style
styling.within.preprocessor=0
lexer.cpp.triplequoted.strings=1
lexer.cpp.hashquoted.strings=1
fold=1
fold.preprocessor=1
fold.comment=1

View File

@ -0,0 +1,46 @@
(*
(** nested comment 1 **)
(*
nested comment 2
(*
nested comment 3
(*
nested comment 4
(*
nested comment 5
*)
*)
*)
*)
*)
// declare a namespace
// for the module
namespace Issue93
module NestedComments =
open FSharp.Quotations
open FSharp.Quotations.Patterns
// print the arguments
// of an evaluated expression
(* Example:
(*
printArgs <@ 1 + 2 @> ;;
// 1
// 2
*)
*)
let printArgs expr =
let getVal = function Value (v, _) -> downcast v | _ -> null
match expr with
| Call (_, _, args) ->
List.map getVal args |> List.iter (printfn "%A")
| _ ->
printfn "not an evaluated expression"
(* Example:
(*
let constExpr = <@ true @> ;;
printArgs constExpr ;;
*)
*)
// Prints:
// "not an evaluated expression"

View File

@ -0,0 +1,47 @@
2 400 401 + (*
0 401 401 | (** nested comment 1 **)
2 401 402 + (*
0 402 402 | nested comment 2
2 402 403 + (*
0 403 403 | nested comment 3
2 403 404 + (*
0 404 404 | nested comment 4
2 404 405 + (*
0 405 405 | nested comment 5
0 405 404 | *)
0 404 403 | *)
0 403 402 | *)
0 402 401 | *)
0 401 400 | *)
2 400 401 + // declare a namespace
0 401 400 | // for the module
0 400 400 namespace Issue93
1 400 400
0 400 400 module NestedComments =
2 400 401 + open FSharp.Quotations
0 401 400 | open FSharp.Quotations.Patterns
2 400 401 + // print the arguments
0 401 400 | // of an evaluated expression
2 400 401 + (* Example:
2 401 402 + (*
0 402 402 | printArgs <@ 1 + 2 @> ;;
0 402 402 | // 1
0 402 402 | // 2
0 402 401 | *)
0 401 400 | *)
0 400 400 let printArgs expr =
0 400 400 let getVal = function Value (v, _) -> downcast v | _ -> null
0 400 400 match expr with
0 400 400 | Call (_, _, args) ->
0 400 400 List.map getVal args |> List.iter (printfn "%A")
0 400 400 | _ ->
0 400 400 printfn "not an evaluated expression"
2 400 401 + (* Example:
2 401 402 + (*
0 402 402 | let constExpr = <@ true @> ;;
0 402 402 | printArgs constExpr ;;
0 402 401 | *)
0 401 400 | *)
2 400 401 + // Prints:
0 401 400 | // "not an evaluated expression"
1 400 400

View File

@ -0,0 +1,46 @@
{8}(*
(** nested comment 1 **)
(*
nested comment 2
(*
nested comment 3
(*
nested comment 4
(*
nested comment 5
*)
*)
*)
*)
*){0}
{9}// declare a namespace{0}
{9}// for the module{0}
{1}namespace{0} {6}Issue93{0}
{1}module{0} {6}NestedComments{0} {12}={0}
{1}open{0} {3}FSharp{0}.{6}Quotations{0}
{1}open{0} {3}FSharp{0}.{6}Quotations{0}.{6}Patterns{0}
{9}// print the arguments{0}
{9}// of an evaluated expression{0}
{8}(* Example:
(*
printArgs <@ 1 + 2 @> ;;
// 1
// 2
*)
*){0}
{1}let{0} {6}printArgs{0} {6}expr{0} {12}={0}
{1}let{0} {6}getVal{0} {12}={0} {1}function{0} {6}Value{0} {12}({6}v{12},{0} {6}_{12}){0} {12}->{0} {1}downcast{0} {6}v{0} {12}|{0} {6}_{0} {12}->{0} {1}null{0}
{1}match{0} {6}expr{0} {1}with{0}
{12}|{0} {6}Call{0} {12}({6}_{12},{0} {6}_{12},{0} {6}args{12}){0} {12}->{0}
{3}List{0}.{2}map{0} {6}getVal{0} {6}args{0} {12}|>{0} {3}List{0}.{2}iter{0} {12}({2}printfn{0} {15}"{19}%A{15}"{12}){0}
{12}|{0} {6}_{0} {12}->{0}
{2}printfn{0} {15}"not an evaluated expression"{0}
{8}(* Example:
(*
let constExpr = <@ true @> ;;
printArgs constExpr ;;
*)
*){0}
{9}// Prints:{0}
{9}// "not an evaluated expression"{0}

View File

@ -0,0 +1,26 @@
/* Comment (2), followed by Default (0) */
/* File does not include Line Comment (1) as that causes \r\n failures in test runner */
/* Global (3) 'G4C' */
G4C MyGui
/* String (8) */
Window 10 10 200 300 "My window"
/* Event (4) */
xOnLoad
/* Command (7) */
GuiOpen MyGui
xButton 10 10 100 20 "Double it!"
/* Attribute (5) */
attr frame sunk
Input "Enter a number" var
/* Control (6) 'if', Operator (9) '$', '>', '=' */
if $var > 9999
var = 9999
endif
var2 = $($var * 2)
MsgBox "$var times 2 equals $var2" OK/INFO
GuiQuit #this

View File

@ -0,0 +1,27 @@
0 401 0 | /* Comment (2), followed by Default (0) */
1 401 0 |
0 401 0 | /* File does not include Line Comment (1) as that causes \r\n failures in test runner */
1 401 0 |
0 401 0 | /* Global (3) 'G4C' */
2 400 0 + G4C MyGui
1 401 0 |
0 401 0 | /* String (8) */
2 400 0 + Window 10 10 200 300 "My window"
1 401 0 |
0 401 0 | /* Event (4) */
2 400 0 + xOnLoad
0 401 0 | /* Command (7) */
0 401 0 | GuiOpen MyGui
1 401 0 |
2 400 0 + xButton 10 10 100 20 "Double it!"
0 401 0 | /* Attribute (5) */
0 401 0 | attr frame sunk
0 401 0 | Input "Enter a number" var
0 401 0 | /* Control (6) 'if', Operator (9) '$', '>', '=' */
0 401 0 | if $var > 9999
0 401 0 | var = 9999
0 401 0 | endif
0 401 0 | var2 = $($var * 2)
0 401 0 | MsgBox "$var times 2 equals $var2" OK/INFO
0 401 0 | GuiQuit #this
0 401 0 |

View File

@ -0,0 +1,26 @@
{2}/* Comment (2), followed by Default (0) */{0}
{2}/* File does not include Line Comment (1) as that causes \r\n failures in test runner */{0}
{2}/* Global (3) 'G4C' */{0}
{3}G4C{0} MyGui
{2}/* String (8) */{0}
{3}Window{0} 10 10 200 300 {8}"My window"{0}
{2}/* Event (4) */{0}
{4}xOnLoad{0}
{2}/* Command (7) */{0}
{7}GuiOpen{0} MyGui
{3}xButton{0} 10 10 100 20 {8}"Double it!"{0}
{2}/* Attribute (5) */{0}
{5}attr{0} frame sunk
{7}Input{0} {8}"Enter a number"{0} var
{2}/* Control (6) 'if', Operator (9) '$', '>', '=' */{0}
{6}if{0} {9}${0}var {9}>{0} 9999
var {9}={0} 9999
{6}endif{0}
var2 {9}={0} {9}${0}({9}${0}var * 2)
{7}MsgBox{0} {8}"$var times 2 equals $var2"{0} OK/INFO
{7}GuiQuit{0} #this

View File

@ -0,0 +1,13 @@
lexer.*.gui=gui4cli
fold=1
#global
keywords.*.gui=G4C WINDOW XBUTTON
#event
keywords2.*.gui=XONCLOSE XONLVDIR XONLOAD
#attribute
keywords3.*.gui=ATTR
#control
keywords4.*.gui=IF ELSE ENDIF GOSUB
#command
keywords5.*.gui=GUIOPEN GUIQUIT INPUT MSGBOX SETWINTITLE

View File

@ -14,6 +14,11 @@ end
@enum Unicode α=1 β=2
res = [i for i in 1:10]
=1; =2; =3;
t!'#'
t!='#'
t[]!='#'
#= Dummy function =#
test_fun²(:sym, true, raw"test", `echo 1`)

View File

@ -14,6 +14,11 @@
0 400 400 @enum Unicode α=1 β=2
0 400 400
0 400 400 res = [√i for i in 1:10]
0 400 400 ∀=1; ∃=2; ∄=3;
0 400 400
0 400 400 t!'#'
0 400 400 t!='#'
0 400 400 t[]!='#'
0 400 400
0 400 400 #= Dummy function =#
0 400 400 test_fun²(:sym, true, raw"test", `echo 1`)

View File

@ -14,6 +14,11 @@ For test only
{12}@enum{0} {9}Unicode{0} {9}α{7}={2}1{0} {9}β{7}={2}2{0}
{9}res{0} {7}={0} {8}[{7}√{9}i{0} {3}for{0} {9}i{0} {3}in{0} {2}1{7}:{2}10{8}]{0}
{9}∀{7}={2}1{7};{0} {9}∃{7}={2}2{7};{0} {9}∄{7}={2}3{7};{0}
{9}t!{7}'{1}#'{0}
{9}t!{7}={6}'#'{0}
{9}t{8}[]{7}!={6}'#'{0}
{1}#= Dummy function =#{0}
{9}test_fun²{8}({11}:sym{7},{0} {5}true{7},{0} {15}raw{10}"test"{7},{0} {16}`echo 1`{8}){0}

View File

@ -0,0 +1,52 @@
-- Enumerate all styles: 0 to 16
/* block comment = 1*/
-- whitespace = 0
-- spaces
-- line comment = 2
-- number = 3
376
-- string = 4
'a string'
-- operator = 5
()
INTERSECT
-- identifier = 6
ProductID;
-- variable = 7
@Variable;
-- column name = 8
"COLUMN";
-- statement = 9
PRINT
-- datatype = 10
int
-- systable = 11
sysobjects
-- global variable = 12
@@ERROR
-- function = 13
object_id
-- stored procedure = 14
sp_fulltext_database
-- default (preferencing data type) = 15
x --
-- column name 2 = 16
[COLUMN];

View File

@ -0,0 +1,53 @@
0 400 0 -- Enumerate all styles: 0 to 16
1 400 0
0 400 0 /* block comment = 1*/
1 400 0
0 400 0 -- whitespace = 0
0 400 0 -- spaces
1 400 0
0 400 0 -- line comment = 2
1 400 0
0 400 0 -- number = 3
0 400 0 376
1 400 0
0 400 0 -- string = 4
0 400 0 'a string'
1 400 0
0 400 0 -- operator = 5
0 400 0 ()
0 400 0 INTERSECT
1 400 0
0 400 0 -- identifier = 6
0 400 0 ProductID;
1 400 0
0 400 0 -- variable = 7
0 400 0 @Variable;
1 400 0
0 400 0 -- column name = 8
0 400 0 "COLUMN";
1 400 0
0 400 0 -- statement = 9
0 400 0 PRINT
1 400 0
0 400 0 -- datatype = 10
0 400 0 int
1 400 0
0 400 0 -- systable = 11
0 400 0 sysobjects
1 400 0
0 400 0 -- global variable = 12
0 400 0 @@ERROR
1 400 0
0 400 0 -- function = 13
0 400 0 object_id
1 400 0
0 400 0 -- stored procedure = 14
0 400 0 sp_fulltext_database
1 400 0
0 400 0 -- default (preferencing data type) = 15
0 400 0 x --
1 400 0
0 400 0 -- column name 2 = 16
0 400 0 [COLUMN];
1 400 0
0 400 0

View File

@ -0,0 +1,52 @@
{2}-- Enumerate all styles: 0 to 16{0}
{1}/* block comment = 1*/{0}
{2}-- whitespace = 0{0}
{2}-- spaces{0}
{2}-- line comment = 2{0}
{2}-- number = 3{0}
{3}376{0}
{2}-- string = 4{0}
{4}'a string'{0}
{2}-- operator = 5{0}
{5}(){0}
{5}INTERSECT{0}
{2}-- identifier = 6{0}
{6}ProductID{5};{0}
{2}-- variable = 7{0}
{7}@Variable{5};{0}
{2}-- column name = 8{0}
{8}"COLUMN"{5};{0}
{2}-- statement = 9{0}
{9}PRINT{0}
{2}-- datatype = 10{0}
{10}int{0}
{2}-- systable = 11{0}
{11}sysobjects{0}
{2}-- global variable = 12{0}
{12}@@ERROR{0}
{2}-- function = 13{0}
{13}object_id{0}
{2}-- stored procedure = 14{0}
{14}sp_fulltext_database{0}
{2}-- default (preferencing data type) = 15{0}
{6}x{15} {2}--{0}
{2}-- column name 2 = 16{0}
{16}[COLUMN]{5};{0}

View File

@ -0,0 +1,8 @@
/**
/*
GitHub Issue 87
/*
/****** Object: Table [dbo].[Issue87] Script Date: 04/06/2022 8:07:57 PM ******/
*/
*/
*/

View File

@ -0,0 +1,9 @@
2 400 0 + /**
0 401 0 | /*
0 401 0 | GitHub Issue 87
0 401 0 | /*
0 401 0 | /****** Object: Table [dbo].[Issue87] Script Date: 04/06/2022 8:07:57 PM ******/
0 401 0 | */
0 401 0 | */
0 401 0 | */
0 400 0

View File

@ -0,0 +1,8 @@
{1}/**
/*
GitHub Issue 87
/*
/****** Object: Table [dbo].[Issue87] Script Date: 04/06/2022 8:07:57 PM ******/
*/
*/
*/{0}

View File

@ -0,0 +1,4 @@
CREATE TABLE TestTable (
col
CHAR(3)
);

View File

@ -0,0 +1,5 @@
0 400 0 CREATE TABLE TestTable (
0 400 0 col
0 400 0 CHAR(3)
0 400 0 );
0 400 0

View File

@ -0,0 +1,4 @@
{9}CREATE{0} {9}TABLE{0} {6}TestTable{15} {5}({0}
{6}col{15}
{10}CHAR{5}({3}3{5}){0}
{5});{0}

View File

@ -0,0 +1,25 @@
lexer.*.tsql=mssql
fold=1
fold.comment=1
# statement
keywords.*.tsql=and as begin by create declare distinct drop else end exists from go if in insert into is inner \
join like not null on order print procedure return select set table use values where while
# data type
keywords2.*.tsql=char int
# System table
keywords3.*.tsql=sysobjects
# global variables
keywords4.*.tsql=error
# functions
keywords5.*.tsql=ascii char object_id
# System stored procedures
keywords6.*.tsql=sp_fulltext_database
# operators
keywords7.*.tsql=intersect

View File

@ -0,0 +1,104 @@
/* This file contains snippets of Transact-SQL that exercise various aspects of the language. */
/**
/*
AllStyles.tsql
/*
/****** Object: Database [AllStyles] Script Date: 06/16/2022 10:56:35 PM ******/
*/
*/
*/
IF (1 = FULLTEXTSERVICEPROPERTY('IsFullTextInstalled'))
BEGIN
EXEC sp_fulltext_database @action = 'enable';
END
USE AllStyles;
GO
SELECT *
FROM Production.Product
ORDER BY Name ASC;
-- Alternate way.
USE AllStyles;
GO
SELECT p.*
FROM Production.Product AS p
ORDER BY Name ASC;
GO
SELECT "COLUMN" FROM "TABLE"
SELECT "COLUMN" int FROM "TABLE"
SELECT schema_name
(tab.schema_id) AS schema_name
-- retrieve the name, too
,tab.name
FROM sys.tables AS tab;
SELECT DISTINCT Name
FROM Production.Product AS p
WHERE EXISTS
(SELECT *
FROM Production.ProductModel AS pm
WHERE p.ProductModelID = pm.ProductModelID
AND pm.Name LIKE 'Long-Sleeve Logo Jersey%');
SELECT DISTINCT p.LastName, p.FirstName
FROM Person.Person AS p
JOIN HumanResources.Employee AS e
ON e.BusinessEntityID = p.BusinessEntityID WHERE 5000.00 IN
(SELECT Bonus
FROM Sales.SalesPerson AS sp
WHERE e.BusinessEntityID = sp.BusinessEntityID);
CREATE PROCEDURE findjobs @nm sysname = NULL
AS
IF @nm IS NULL
BEGIN
PRINT 'You must give a user name'
RETURN
END
ELSE
BEGIN
SELECT o.name, o.id, o.uid
FROM sysobjects o INNER JOIN master.syslogins l
ON o.uid = l.sid
WHERE l.name = @nm
END;
CREATE TABLE TestTable (cola INT, colb CHAR(3));
-- Declare the variable to be used.
DECLARE @MyCounter INT;
-- Initialize the variable.
SET @MyCounter = 0;
WHILE (@MyCounter < 26)
BEGIN;
-- Insert a row into the table.
INSERT INTO TestTable VALUES
-- Use the variable to provide the integer value
-- for cola. Also use it to generate a unique letter
-- for each row. Use the ASCII function to get the
-- integer value of 'a'. Add @MyCounter. Use CHAR to
-- convert the sum back to the character @MyCounter
-- characters after 'a'.
(@MyCounter,
CHAR( ( @MyCounter + ASCII('a') ) )
);
-- Increment the variable to count this iteration
-- of the loop.
SET @MyCounter = @MyCounter + 1;
END;
IF @@ERROR = 547
BEGIN
PRINT N'A check constraint violation occurred.';
END
GO
USE [AllStyles].[dbo].[test]
GO
SELECT ProductID
FROM Production.Product
INTERSECT
SELECT ProductID
FROM Production.WorkOrder ;

View File

@ -0,0 +1,105 @@
0 400 0 /* This file contains snippets of Transact-SQL that exercise various aspects of the language. */
2 400 0 + /**
0 401 0 | /*
0 401 0 | AllStyles.tsql
0 401 0 | /*
0 401 0 | /****** Object: Database [AllStyles] Script Date: 06/16/2022 10:56:35 PM ******/
0 401 0 | */
0 401 0 | */
0 401 0 | */
0 400 0 IF (1 = FULLTEXTSERVICEPROPERTY('IsFullTextInstalled'))
2 400 0 + BEGIN
0 401 0 | EXEC sp_fulltext_database @action = 'enable';
0 401 0 | END
0 400 0 USE AllStyles;
0 400 0 GO
0 400 0 SELECT *
0 400 0 FROM Production.Product
0 400 0 ORDER BY Name ASC;
0 400 0 -- Alternate way.
0 400 0 USE AllStyles;
0 400 0 GO
0 400 0 SELECT p.*
0 400 0 FROM Production.Product AS p
0 400 0 ORDER BY Name ASC;
0 400 0 GO
1 400 0
0 400 0 SELECT "COLUMN" FROM "TABLE"
0 400 0 SELECT "COLUMN" int FROM "TABLE"
1 400 0
0 400 0 SELECT schema_name
0 400 0 (tab.schema_id) AS schema_name
0 400 0 -- retrieve the name, too
0 400 0 ,tab.name
0 400 0 FROM sys.tables AS tab;
1 400 0
0 400 0 SELECT DISTINCT Name
0 400 0 FROM Production.Product AS p
0 400 0 WHERE EXISTS
0 400 0 (SELECT *
0 400 0 FROM Production.ProductModel AS pm
0 400 0 WHERE p.ProductModelID = pm.ProductModelID
0 400 0 AND pm.Name LIKE 'Long-Sleeve Logo Jersey%');
1 400 0
0 400 0 SELECT DISTINCT p.LastName, p.FirstName
0 400 0 FROM Person.Person AS p
0 400 0 JOIN HumanResources.Employee AS e
0 400 0 ON e.BusinessEntityID = p.BusinessEntityID WHERE 5000.00 IN
0 400 0 (SELECT Bonus
0 400 0 FROM Sales.SalesPerson AS sp
0 400 0 WHERE e.BusinessEntityID = sp.BusinessEntityID);
1 400 0
0 400 0 CREATE PROCEDURE findjobs @nm sysname = NULL
0 400 0 AS
0 400 0 IF @nm IS NULL
2 400 0 + BEGIN
0 401 0 | PRINT 'You must give a user name'
0 401 0 | RETURN
0 401 0 | END
0 400 0 ELSE
2 400 0 + BEGIN
0 401 0 | SELECT o.name, o.id, o.uid
0 401 0 | FROM sysobjects o INNER JOIN master.syslogins l
0 401 0 | ON o.uid = l.sid
0 401 0 | WHERE l.name = @nm
0 401 0 | END;
1 400 0
0 400 0 CREATE TABLE TestTable (cola INT, colb CHAR(3));
0 400 0 -- Declare the variable to be used.
0 400 0 DECLARE @MyCounter INT;
1 400 0
0 400 0 -- Initialize the variable.
0 400 0 SET @MyCounter = 0;
0 400 0 WHILE (@MyCounter < 26)
2 400 0 + BEGIN;
0 401 0 | -- Insert a row into the table.
0 401 0 | INSERT INTO TestTable VALUES
0 401 0 | -- Use the variable to provide the integer value
0 401 0 | -- for cola. Also use it to generate a unique letter
0 401 0 | -- for each row. Use the ASCII function to get the
0 401 0 | -- integer value of 'a'. Add @MyCounter. Use CHAR to
0 401 0 | -- convert the sum back to the character @MyCounter
0 401 0 | -- characters after 'a'.
0 401 0 | (@MyCounter,
0 401 0 | CHAR( ( @MyCounter + ASCII('a') ) )
0 401 0 | );
0 401 0 | -- Increment the variable to count this iteration
0 401 0 | -- of the loop.
0 401 0 | SET @MyCounter = @MyCounter + 1;
0 401 0 | END;
1 400 0
0 400 0 IF @@ERROR = 547
2 400 0 + BEGIN
0 401 0 | PRINT N'A check constraint violation occurred.';
0 401 0 | END
0 400 0 GO
1 400 0
0 400 0 USE [AllStyles].[dbo].[test]
0 400 0 GO
1 400 0
0 400 0 SELECT ProductID
0 400 0 FROM Production.Product
0 400 0 INTERSECT
0 400 0 SELECT ProductID
0 400 0 FROM Production.WorkOrder ;
0 400 0

View File

@ -0,0 +1,104 @@
{1}/* This file contains snippets of Transact-SQL that exercise various aspects of the language. */{0}
{1}/**
/*
AllStyles.tsql
/*
/****** Object: Database [AllStyles] Script Date: 06/16/2022 10:56:35 PM ******/
*/
*/
*/{0}
{9}IF{0} {5}({3}1{0} {5}={0} {6}FULLTEXTSERVICEPROPERTY{5}({4}'IsFullTextInstalled'{5})){0}
{9}BEGIN{0}
{6}EXEC{15} {14}sp_fulltext_database{0} {7}@action{15} {5}={0} {4}'enable'{5};{0}
{9}END{0}
{9}USE{0} {6}AllStyles{5};{0}
{9}GO{0}
{9}SELECT{0} {5}*{0}
{9}FROM{0} {6}Production.Product{15}
{9}ORDER{0} {9}BY{0} {6}Name{15} {6}ASC{5};{0}
{2}-- Alternate way.{0}
{9}USE{0} {6}AllStyles{5};{0}
{9}GO{0}
{9}SELECT{0} {6}p.{5}*{0}
{9}FROM{0} {6}Production.Product{15} {9}AS{0} {6}p{15}
{9}ORDER{0} {9}BY{0} {6}Name{15} {6}ASC{5};{0}
{9}GO{0}
{9}SELECT{0} {8}"COLUMN"{15} {9}FROM{0} {8}"TABLE"{15}
{9}SELECT{0} {8}"COLUMN"{15} {10}int{0} {9}FROM{0} {8}"TABLE"{15}
{9}SELECT{0} {6}schema_name{15}
{5}({6}tab.schema_id{5}){0} {9}AS{0} {6}schema_name{15}
{2}-- retrieve the name, too{0}
{5},{6}tab.name{15}
{9}FROM{0} {6}sys.tables{15} {9}AS{0} {6}tab{5};{0}
{9}SELECT{0} {9}DISTINCT{0} {6}Name{15}
{9}FROM{0} {6}Production.Product{15} {9}AS{0} {6}p{15}
{9}WHERE{0} {9}EXISTS{0}
{5}({9}SELECT{0} {5}*{0}
{9}FROM{0} {6}Production.ProductModel{15} {9}AS{0} {6}pm{15}
{9}WHERE{0} {6}p.ProductModelID{15} {5}={0} {6}pm.ProductModelID{15}
{9}AND{0} {6}pm.Name{15} {9}LIKE{0} {4}'Long-Sleeve Logo Jersey%'{5});{0}
{9}SELECT{0} {9}DISTINCT{0} {6}p.LastName{5},{0} {6}p.FirstName{15}
{9}FROM{0} {6}Person.Person{15} {9}AS{0} {6}p{15}
{9}JOIN{0} {6}HumanResources.Employee{15} {9}AS{0} {6}e{15}
{9}ON{0} {6}e.BusinessEntityID{15} {5}={0} {6}p.BusinessEntityID{15} {9}WHERE{0} {3}5000.00{0} {9}IN{0}
{5}({9}SELECT{0} {6}Bonus{15}
{9}FROM{0} {6}Sales.SalesPerson{15} {9}AS{0} {6}sp{15}
{9}WHERE{0} {6}e.BusinessEntityID{15} {5}={0} {6}sp.BusinessEntityID{5});{0}
{9}CREATE{0} {9}PROCEDURE{0} {6}findjobs{0} {7}@nm{15} {6}sysname{15} {5}={0} {9}NULL{0}
{9}AS{0}
{9}IF{0} {7}@nm{15} {9}IS{0} {9}NULL{0}
{9}BEGIN{0}
{9}PRINT{0} {4}'You must give a user name'{0}
{9}RETURN{0}
{9}END{0}
{9}ELSE{0}
{9}BEGIN{0}
{9}SELECT{0} {6}o.name{5},{0} {6}o.id{5},{0} {6}o.uid{15}
{9}FROM{0} {11}sysobjects{0} {6}o{15} {9}INNER{0} {9}JOIN{0} {6}master.syslogins{15} {6}l{15}
{9}ON{0} {6}o.uid{15} {5}={0} {6}l.sid{15}
{9}WHERE{0} {6}l.name{15} {5}={0} {7}@nm{15}
{9}END{5};{0}
{9}CREATE{0} {9}TABLE{0} {6}TestTable{15} {5}({6}cola{15} {10}INT{5},{0} {6}colb{15} {10}CHAR{5}({3}3{5}));{0}
{2}-- Declare the variable to be used.{0}
{9}DECLARE{0} {7}@MyCounter{15} {10}INT{5};{0}
{2}-- Initialize the variable.{0}
{9}SET{0} {7}@MyCounter{15} {5}={0} {3}0{5};{0}
{9}WHILE{0} {5}({7}@MyCounter{15} {5}<{0} {3}26{5}){0}
{9}BEGIN{5};{0}
{2}-- Insert a row into the table.{0}
{9}INSERT{0} {9}INTO{0} {6}TestTable{15} {9}VALUES{0}
{2}-- Use the variable to provide the integer value{0}
{2}-- for cola. Also use it to generate a unique letter{0}
{2}-- for each row. Use the ASCII function to get the{0}
{2}-- integer value of 'a'. Add @MyCounter. Use CHAR to{0}
{2}-- convert the sum back to the character @MyCounter{0}
{2}-- characters after 'a'.{0}
{5}({7}@MyCounter{5},{0}
{13}CHAR{5}({0} {5}({0} {7}@MyCounter{15} {5}+{0} {13}ASCII{5}({4}'a'{5}){0} {5}){0} {5}){0}
{5});{0}
{2}-- Increment the variable to count this iteration{0}
{2}-- of the loop.{0}
{9}SET{0} {7}@MyCounter{15} {5}={0} {7}@MyCounter{15} {5}+{0} {3}1{5};{0}
{9}END{5};{0}
{9}IF{0} {12}@@ERROR{0} {5}={0} {3}547{0}
{9}BEGIN{0}
{9}PRINT{0} {6}N{4}'A check constraint violation occurred.'{5};{0}
{9}END{0}
{9}GO{0}
{9}USE{0} {16}[AllStyles]{5}.{16}[dbo]{5}.{16}[test]{15}
{9}GO{0}
{9}SELECT{0} {6}ProductID{15}
{9}FROM{0} {6}Production.Product{15}
{5}INTERSECT{0}
{9}SELECT{0} {6}ProductID{15}
{9}FROM{0} {6}Production.WorkOrder{15} {5};{0}

View File

@ -0,0 +1,9 @@
<# Tests for PowerShell #>
<# Backticks should escape in double quoted strings #>
$double_quote_str_esc_1 = "`"XXX`""
$double_quote_str_esc_2 = "This `"string`" `$useses `r`n Backticks '``'"
<# Backticks should be ignored in quoted strings #>
$single_quote_str_esc_1 = 'XXX`'
$single_quote_str_esc_2 = 'XXX```'

View File

@ -0,0 +1,10 @@
0 400 400 <# Tests for PowerShell #>
1 400 400
0 400 400 <# Backticks should escape in double quoted strings #>
0 400 400 $double_quote_str_esc_1 = "`"XXX`""
0 400 400 $double_quote_str_esc_2 = "This `"string`" `$useses `r`n Backticks '``'"
1 400 400
0 400 400 <# Backticks should be ignored in quoted strings #>
0 400 400 $single_quote_str_esc_1 = 'XXX`'
0 400 400 $single_quote_str_esc_2 = 'XXX```'
0 400 0

View File

@ -0,0 +1,9 @@
{13}<# Tests for PowerShell #>{0}
{13}<# Backticks should escape in double quoted strings #>{0}
{5}$double_quote_str_esc_1{0} {6}={0} {2}"`"XXX`""{0}
{5}$double_quote_str_esc_2{0} {6}={0} {2}"This `"string`" `$useses `r`n Backticks '``'"{0}
{13}<# Backticks should be ignored in quoted strings #>{0}
{5}$single_quote_str_esc_1{0} {6}={0} {3}'XXX`'{0}
{5}$single_quote_str_esc_2{0} {6}={0} {3}'XXX```'{0}

View File

@ -0,0 +1,7 @@
lexer.*.ps1=powershell
fold=1
keywords.*.ps1=if else in local
keywords2.*.ps1=write-host write-output
keywords3.*.ps1=cd chdir cat
keywords4.*.ps1=mkdir prompt

View File

@ -0,0 +1,5 @@
; comment
[empty section]
[normal section]
@=default
key=value

View File

@ -0,0 +1,6 @@
0 400 0 ; comment
0 400 0 [empty section]
2 400 0 + [normal section]
0 401 0 | @=default
0 401 0 | key=value
0 401 0 |

View File

@ -0,0 +1,5 @@
{1}; comment
{2}[empty section]
[normal section]
{4}@{0}=default
{5}key{3}={0}value

View File

@ -1,2 +1,3 @@
lexer.*.session=props
lexer.*.props=props
fold=1

View File

@ -0,0 +1,57 @@
% SCE_VISUALPROLOG_KEY_MAJOR (1)
goal
% SCE_VISUALPROLOG_KEY_MINOR (2)
procedure
% SCE_VISUALPROLOG_KEY_DIRECTIVE (3)
#include
% SCE_VISUALPROLOG_COMMENT_BLOCK (4)
/**
SCE_VISUALPROLOG_COMMENT_KEY (6)
@detail
SCE_VISUALPROLOG_COMMENT_KEY_ERROR (7)
@unknown
/* SCE_VISUALPROLOG_IDENTIFIER (8)
SCE_VISUALPROLOG_VARIABLE (9)
SCE_VISUALPROLOG_ANONYMOUS (10)
SCE_VISUALPROLOG_NUMBER (11)
SCE_VISUALPROLOG_OPERATOR (12) */ */
singleton -->
[S],
{
string_lower(S, L),
atom_codes(L, Bytes),
sort(0, @=<, Bytes, [95, _discard])
}.
% SCE_VISUALPROLOG_COMMENT_LINE (5)
% @detail
% @unknown
% SCE_VISUALPROLOG_STRING (16)
"string"
'string'
% ISO Prolog back-quoted string
`string`
% SCE_VISUALPROLOG_STRING_ESCAPE (17)
"\n"
'\uAB12'
% SCE_VISUALPROLOG_STRING_ESCAPE_ERROR (18)
"\ "
% SCE_VISUALPROLOG_STRING_EOL_OPEN (19)
"open string
% Not implemented for ISO/SWI-Prolog:
% SCE_VISUALPROLOG_STRING_VERBATIM
% SCE_VISUALPROLOG_STRING_VERBATIM_SPECIAL
% SCE_VISUALPROLOG_STRING_VERBATIM_EOL
@"verbatim string"
@"""special"" verbatim string"
@"multi-line
verbatim
string"

View File

@ -0,0 +1,58 @@
0 400 400 % SCE_VISUALPROLOG_KEY_MAJOR (1)
0 400 400 goal
0 400 400
0 400 400 % SCE_VISUALPROLOG_KEY_MINOR (2)
0 400 400 procedure
0 400 400
0 400 400 % SCE_VISUALPROLOG_KEY_DIRECTIVE (3)
0 400 400 #include
0 400 400
0 400 400 % SCE_VISUALPROLOG_COMMENT_BLOCK (4)
0 400 400 /**
0 400 400 SCE_VISUALPROLOG_COMMENT_KEY (6)
0 400 400 @detail
0 400 400 SCE_VISUALPROLOG_COMMENT_KEY_ERROR (7)
0 400 400 @unknown
0 400 400 /* SCE_VISUALPROLOG_IDENTIFIER (8)
0 400 400 SCE_VISUALPROLOG_VARIABLE (9)
0 400 400 SCE_VISUALPROLOG_ANONYMOUS (10)
0 400 400 SCE_VISUALPROLOG_NUMBER (11)
0 400 400 SCE_VISUALPROLOG_OPERATOR (12) */ */
0 400 400 singleton -->
0 400 400 [S],
2 400 401 + {
0 401 401 | string_lower(S, L),
0 401 401 | atom_codes(L, Bytes),
0 401 401 | sort(0, @=<, Bytes, [95, _discard])
0 401 400 | }.
0 400 400
0 400 400 % SCE_VISUALPROLOG_COMMENT_LINE (5)
0 400 400 % @detail
0 400 400 % @unknown
0 400 400
0 400 400 % SCE_VISUALPROLOG_STRING (16)
0 400 400 "string"
0 400 400 'string'
0 400 400 % ISO Prolog back-quoted string
0 400 400 `string`
0 400 400
0 400 400 % SCE_VISUALPROLOG_STRING_ESCAPE (17)
0 400 400 "\n"
0 400 400 '\uAB12'
0 400 400
0 400 400 % SCE_VISUALPROLOG_STRING_ESCAPE_ERROR (18)
0 400 400 "\ "
0 400 400
0 400 400 % SCE_VISUALPROLOG_STRING_EOL_OPEN (19)
0 400 400 "open string
0 400 400
0 400 400 % Not implemented for ISO/SWI-Prolog:
0 400 400 % SCE_VISUALPROLOG_STRING_VERBATIM
0 400 400 % SCE_VISUALPROLOG_STRING_VERBATIM_SPECIAL
0 400 400 % SCE_VISUALPROLOG_STRING_VERBATIM_EOL
0 400 400 @"verbatim string"
0 400 400 @"""special"" verbatim string"
0 400 400 @"multi-line
0 400 400 verbatim
0 400 400 string"
1 400 400

View File

@ -0,0 +1,57 @@
{5}% SCE_VISUALPROLOG_KEY_MAJOR (1){0}
{1}goal{0}
{5}% SCE_VISUALPROLOG_KEY_MINOR (2){0}
{2}procedure{0}
{5}% SCE_VISUALPROLOG_KEY_DIRECTIVE (3){0}
{3}#include{0}
{5}% SCE_VISUALPROLOG_COMMENT_BLOCK (4){0}
{4}/**
SCE_VISUALPROLOG_COMMENT_KEY (6)
{6}@detail{4}
SCE_VISUALPROLOG_COMMENT_KEY_ERROR (7)
{7}@unknown{4}
/* SCE_VISUALPROLOG_IDENTIFIER (8)
SCE_VISUALPROLOG_VARIABLE (9)
SCE_VISUALPROLOG_ANONYMOUS (10)
SCE_VISUALPROLOG_NUMBER (11)
SCE_VISUALPROLOG_OPERATOR (12) */ */{0}
{8}singleton{0} {12}-->{0}
{12}[{9}S{12}],{0}
{12}{{0}
{1}string_lower{12}({9}S{12},{0} {9}L{12}),{0}
{1}atom_codes{12}({9}L{12},{0} {9}Bytes{12}),{0}
{1}sort{12}({11}0{12},{0} {12}@=<,{0} {9}Bytes{12},{0} {12}[{11}95{12},{0} {10}_discard{12}]){0}
{12}}.{0}
{5}% SCE_VISUALPROLOG_COMMENT_LINE (5){0}
{5}% {6}@detail{0}
{5}% {7}@unknown{0}
{5}% SCE_VISUALPROLOG_STRING (16){0}
{16}"string"{0}
{16}'string'{0}
{5}% ISO Prolog back-quoted string{0}
{16}`string`{0}
{5}% SCE_VISUALPROLOG_STRING_ESCAPE (17){0}
{16}"{17}\n{16}"{0}
{16}'{17}\uAB12{16}'{0}
{5}% SCE_VISUALPROLOG_STRING_ESCAPE_ERROR (18){0}
{16}"{18}\ {16}"{0}
{5}% SCE_VISUALPROLOG_STRING_EOL_OPEN (19){0}
{16}"open string{19}
{0}
{5}% Not implemented for ISO/SWI-Prolog:{0}
{5}% SCE_VISUALPROLOG_STRING_VERBATIM{0}
{5}% SCE_VISUALPROLOG_STRING_VERBATIM_SPECIAL{0}
{5}% SCE_VISUALPROLOG_STRING_VERBATIM_EOL{0}
{12}@{16}"verbatim string"{0}
{12}@{16}"""special"" verbatim string"{0}
{12}@{16}"multi-line{19}
{0} {8}verbatim{0}
{8}string{16}"{19}

View File

@ -0,0 +1,52 @@
% SCE_VISUALPROLOG_KEY_MAJOR (1)
goal
% SCE_VISUALPROLOG_KEY_MINOR (2)
procedure
% SCE_VISUALPROLOG_KEY_DIRECTIVE (3)
#include
% SCE_VISUALPROLOG_COMMENT_BLOCK (4)
/**
SCE_VISUALPROLOG_COMMENT_KEY (6)
@detail
SCE_VISUALPROLOG_COMMENT_KEY_ERROR (7)
@unknown
/* SCE_VISUALPROLOG_IDENTIFIER (8)
SCE_VISUALPROLOG_VARIABLE (9)
SCE_VISUALPROLOG_ANONYMOUS (10)
SCE_VISUALPROLOG_NUMBER (11)
SCE_VISUALPROLOG_OPERATOR (12) */ */
lambda = {
(A) = { (B, _discard) = A*B+1 }
}.
% SCE_VISUALPROLOG_COMMENT_LINE (5)
% @detail
% @unknown
% SCE_VISUALPROLOG_STRING (16)
"string"
'string'
% SCE_VISUALPROLOG_STRING_ESCAPE (17)
"\n"
'\uAB12'
% SCE_VISUALPROLOG_STRING_ESCAPE_ERROR (18)
"\ "
% SCE_VISUALPROLOG_STRING_EOL_OPEN (19)
"open string
% SCE_VISUALPROLOG_STRING_VERBATIM (20)
@"verbatim string"
% SCE_VISUALPROLOG_STRING_VERBATIM_SPECIAL (21)
@"""special"" verbatim string"
% SCE_VISUALPROLOG_STRING_VERBATIM_EOL (22)
@"multi-line
verbatim
string"

View File

@ -0,0 +1,53 @@
0 400 400 % SCE_VISUALPROLOG_KEY_MAJOR (1)
0 400 400 goal
0 400 400
0 400 400 % SCE_VISUALPROLOG_KEY_MINOR (2)
0 400 400 procedure
0 400 400
0 400 400 % SCE_VISUALPROLOG_KEY_DIRECTIVE (3)
0 400 400 #include
0 400 400
0 400 400 % SCE_VISUALPROLOG_COMMENT_BLOCK (4)
0 400 400 /**
0 400 400 SCE_VISUALPROLOG_COMMENT_KEY (6)
0 400 400 @detail
0 400 400 SCE_VISUALPROLOG_COMMENT_KEY_ERROR (7)
0 400 400 @unknown
0 400 400 /* SCE_VISUALPROLOG_IDENTIFIER (8)
0 400 400 SCE_VISUALPROLOG_VARIABLE (9)
0 400 400 SCE_VISUALPROLOG_ANONYMOUS (10)
0 400 400 SCE_VISUALPROLOG_NUMBER (11)
0 400 400 SCE_VISUALPROLOG_OPERATOR (12) */ */
2 400 401 + lambda = {
0 401 401 | (A) = { (B, _discard) = A*B+1 }
0 401 400 | }.
0 400 400
0 400 400 % SCE_VISUALPROLOG_COMMENT_LINE (5)
0 400 400 % @detail
0 400 400 % @unknown
0 400 400
0 400 400 % SCE_VISUALPROLOG_STRING (16)
0 400 400 "string"
0 400 400 'string'
0 400 400
0 400 400 % SCE_VISUALPROLOG_STRING_ESCAPE (17)
0 400 400 "\n"
0 400 400 '\uAB12'
0 400 400
0 400 400 % SCE_VISUALPROLOG_STRING_ESCAPE_ERROR (18)
0 400 400 "\ "
0 400 400
0 400 400 % SCE_VISUALPROLOG_STRING_EOL_OPEN (19)
0 400 400 "open string
0 400 400
0 400 400 % SCE_VISUALPROLOG_STRING_VERBATIM (20)
0 400 400 @"verbatim string"
0 400 400
0 400 400 % SCE_VISUALPROLOG_STRING_VERBATIM_SPECIAL (21)
0 400 400 @"""special"" verbatim string"
0 400 400
0 400 400 % SCE_VISUALPROLOG_STRING_VERBATIM_EOL (22)
0 400 400 @"multi-line
0 400 400 verbatim
0 400 400 string"
1 400 400

View File

@ -0,0 +1,52 @@
{5}% SCE_VISUALPROLOG_KEY_MAJOR (1){0}
{1}goal{0}
{5}% SCE_VISUALPROLOG_KEY_MINOR (2){0}
{2}procedure{0}
{5}% SCE_VISUALPROLOG_KEY_DIRECTIVE (3){0}
{3}#include{0}
{5}% SCE_VISUALPROLOG_COMMENT_BLOCK (4){0}
{4}/**
SCE_VISUALPROLOG_COMMENT_KEY (6)
{6}@detail{4}
SCE_VISUALPROLOG_COMMENT_KEY_ERROR (7)
{7}@unknown{4}
/* SCE_VISUALPROLOG_IDENTIFIER (8)
SCE_VISUALPROLOG_VARIABLE (9)
SCE_VISUALPROLOG_ANONYMOUS (10)
SCE_VISUALPROLOG_NUMBER (11)
SCE_VISUALPROLOG_OPERATOR (12) */ */{0}
{8}lambda{0} {12}={0} {12}{{0}
{12}({9}A{12}){0} {12}={0} {12}{{0} {12}({9}B{12},{0} {10}_discard{12}){0} {12}={0} {9}A{12}*{9}B{12}+{11}1{0} {12}}{0}
{12}}.{0}
{5}% SCE_VISUALPROLOG_COMMENT_LINE (5){0}
{5}% {6}@detail{0}
{5}% {7}@unknown{0}
{5}% SCE_VISUALPROLOG_STRING (16){0}
{16}"string"{0}
{16}'string'{0}
{5}% SCE_VISUALPROLOG_STRING_ESCAPE (17){0}
{16}"{17}\n{16}"{0}
{16}'{17}\uAB12{16}'{0}
{5}% SCE_VISUALPROLOG_STRING_ESCAPE_ERROR (18){0}
{16}"{18}\ {16}"{0}
{5}% SCE_VISUALPROLOG_STRING_EOL_OPEN (19){0}
{16}"open string{19}
{0}
{5}% SCE_VISUALPROLOG_STRING_VERBATIM (20){0}
{20}@"verbatim string"{0}
{5}% SCE_VISUALPROLOG_STRING_VERBATIM_SPECIAL (21){0}
{20}@"{21}""{20}special{21}""{20} verbatim string"{0}
{5}% SCE_VISUALPROLOG_STRING_VERBATIM_EOL (22){0}
{20}@"multi-line{22}
{20} verbatim{22}
{20} string"{0}

View File

@ -0,0 +1,29 @@
lexer.*.pro;*.pl=visualprolog
fold=1
# Visual Prolog properties
match AllStyles.pro
lexer.visualprolog.verbatim.strings=1
lexer.visualprolog.backquoted.strings=0
# ISO/SWI-Prolog properties
match AllStyles.pl
lexer.visualprolog.verbatim.strings=0
lexer.visualprolog.backquoted.strings=1
# major keywords
keywords.*.pro;*.pl=goal namespace interface class implement open inherits supports resolve delegate \
monitor constants domains predicates constructors properties clauses facts string_lower atom_codes sort
# minor keywords
keywords2.*.pro;*.pl=any binary binaryNonAtomic boolean char compareResult factDB guard handle integer64 \
integerNative language null pointer real real32 stdcall string8 symbol apicall c thiscall prolog \
digits if then elseif else endif foreach do try catch finally erroneous failure procedure determ multi \
nondeterm anyflow and or externally from div mod rem quot in orelse otherwise unsigned unsigned64 \
unsignedNative
# directives
keywords3.*.pro;*.pl=include bininclude requires orrequires error message export externally options
# documentation keywords
keywords4.*.pro;*.pl=short detail end exception withdomain

View File

@ -1 +1 @@
518
519

View File

@ -1151,6 +1151,14 @@ Position ScintillaCall::FormatRangeFull(bool draw, void *fr) {
return CallPointer(Message::FormatRangeFull, draw, fr);
}
void ScintillaCall::SetChangeHistory(Scintilla::ChangeHistoryOption changeHistory) {
Call(Message::SetChangeHistory, static_cast<uintptr_t>(changeHistory));
}
ChangeHistoryOption ScintillaCall::ChangeHistory() {
return static_cast<Scintilla::ChangeHistoryOption>(Call(Message::GetChangeHistory));
}
Line ScintillaCall::FirstVisibleLine() {
return Call(Message::GetFirstVisibleLine);
}
@ -1215,6 +1223,10 @@ void ScintillaCall::HideSelection(bool hide) {
Call(Message::HideSelection, hide);
}
bool ScintillaCall::SelectionHidden() {
return Call(Message::GetSelectionHidden);
}
int ScintillaCall::PointXFromPosition(Position pos) {
return static_cast<int>(Call(Message::PointXFromPosition, 0, pos));
}

View File

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

View File

@ -7,6 +7,8 @@
objects = {
/* Begin PBXBuildFile section */
2807B4EA28964CA40063A31A /* ChangeHistory.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 2807B4E828964CA40063A31A /* ChangeHistory.cxx */; };
2807B4EB28964CA40063A31A /* ChangeHistory.h in Headers */ = {isa = PBXBuildFile; fileRef = 2807B4E928964CA40063A31A /* ChangeHistory.h */; };
282936DF24E2D55D00C84BA2 /* QuartzTextLayout.h in Headers */ = {isa = PBXBuildFile; fileRef = 282936D324E2D55D00C84BA2 /* QuartzTextLayout.h */; };
282936E024E2D55D00C84BA2 /* InfoBar.mm in Sources */ = {isa = PBXBuildFile; fileRef = 282936D424E2D55D00C84BA2 /* InfoBar.mm */; };
282936E124E2D55D00C84BA2 /* QuartzTextStyleAttribute.h in Headers */ = {isa = PBXBuildFile; fileRef = 282936D524E2D55D00C84BA2 /* QuartzTextStyleAttribute.h */; };
@ -103,6 +105,8 @@
/* End PBXBuildFile section */
/* Begin PBXFileReference section */
2807B4E828964CA40063A31A /* ChangeHistory.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ChangeHistory.cxx; path = ../../src/ChangeHistory.cxx; sourceTree = "<group>"; };
2807B4E928964CA40063A31A /* ChangeHistory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ChangeHistory.h; path = ../../src/ChangeHistory.h; sourceTree = "<group>"; };
282936D324E2D55D00C84BA2 /* QuartzTextLayout.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = QuartzTextLayout.h; path = ../QuartzTextLayout.h; sourceTree = "<group>"; };
282936D424E2D55D00C84BA2 /* InfoBar.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = InfoBar.mm; path = ../InfoBar.mm; sourceTree = "<group>"; };
282936D524E2D55D00C84BA2 /* QuartzTextStyleAttribute.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = QuartzTextStyleAttribute.h; path = ../QuartzTextStyleAttribute.h; sourceTree = "<group>"; };
@ -246,6 +250,8 @@
2829372524E2D58700C84BA2 /* CaseFolder.h */,
2829372624E2D58700C84BA2 /* CellBuffer.cxx */,
2829371924E2D58600C84BA2 /* CellBuffer.h */,
2807B4E828964CA40063A31A /* ChangeHistory.cxx */,
2807B4E928964CA40063A31A /* ChangeHistory.h */,
28EA9CAA255894B4007710C4 /* CharacterCategoryMap.cxx */,
28EA9CAC255894B4007710C4 /* CharacterCategoryMap.h */,
28EA9CAB255894B4007710C4 /* CharacterType.cxx */,
@ -404,6 +410,7 @@
282936E224E2D55D00C84BA2 /* ScintillaCocoa.h in Headers */,
2829373524E2D58800C84BA2 /* Style.h in Headers */,
282936E424E2D55D00C84BA2 /* PlatCocoa.h in Headers */,
2807B4EB28964CA40063A31A /* ChangeHistory.h in Headers */,
2829376C24E2D58800C84BA2 /* Selection.h in Headers */,
2829376124E2D58800C84BA2 /* ScintillaBase.h in Headers */,
2829373824E2D58800C84BA2 /* RESearch.h in Headers */,
@ -504,6 +511,7 @@
2829375524E2D58800C84BA2 /* EditModel.cxx in Sources */,
2829375124E2D58800C84BA2 /* ContractionState.cxx in Sources */,
2829374924E2D58800C84BA2 /* CallTip.cxx in Sources */,
2807B4EA28964CA40063A31A /* ChangeHistory.cxx in Sources */,
2829375824E2D58800C84BA2 /* CharClassify.cxx in Sources */,
2829373324E2D58800C84BA2 /* LineMarker.cxx in Sources */,
2829374E24E2D58800C84BA2 /* KeyMap.cxx in Sources */,
@ -565,7 +573,7 @@
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = NO;
CURRENT_PROJECT_VERSION = 5.2.4;
CURRENT_PROJECT_VERSION = 5.3.0;
DEBUG_INFORMATION_FORMAT = dwarf;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
@ -627,7 +635,7 @@
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = NO;
CURRENT_PROJECT_VERSION = 5.2.4;
CURRENT_PROJECT_VERSION = 5.3.0;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
ENABLE_NS_ASSERTIONS = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
@ -657,7 +665,7 @@
CODE_SIGN_IDENTITY = "-";
CODE_SIGN_STYLE = Manual;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 5.2.4;
CURRENT_PROJECT_VERSION = 5.3.0;
DEFINES_MODULE = YES;
DEVELOPMENT_TEAM = "";
DYLIB_COMPATIBILITY_VERSION = 1;
@ -691,7 +699,7 @@
CODE_SIGN_IDENTITY = "-";
CODE_SIGN_STYLE = Manual;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 5.2.4;
CURRENT_PROJECT_VERSION = 5.3.0;
DEFINES_MODULE = YES;
DEVELOPMENT_TEAM = "";
DYLIB_COMPATIBILITY_VERSION = 1;

View File

@ -1457,8 +1457,8 @@ void ScintillaCocoa::StartDrag() {
si.SetMode(CurrentSurfaceMode());
std::unique_ptr<SurfaceImpl> sw = si.AllocatePixMapImplementation(static_cast<int>(client.Width()), static_cast<int>(client.Height()));
const bool lastHideSelection = view.hideSelection;
view.hideSelection = true;
const bool lastSelectionVisible = vs.selection.visible;
vs.selection.visible = false;
PRectangle imageRect = rcSel;
paintState = PaintState::painting;
paintingAllText = true;
@ -1466,7 +1466,7 @@ void ScintillaCocoa::StartDrag() {
CGContextTranslateCTM(gcsw, -client.left, -client.top);
Paint(sw.get(), client);
paintState = PaintState::notPainting;
view.hideSelection = lastHideSelection;
vs.selection.visible = lastSelectionVisible;
std::unique_ptr<SurfaceImpl> pixmap = si.AllocatePixMapImplementation(static_cast<int>(imageRect.Width()),
static_cast<int>(imageRect.Height()));

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB

After

Width:  |  Height:  |  Size: 24 KiB

View File

@ -129,7 +129,7 @@
<h1>Scintilla Documentation</h1>
<p>Last edited 15 May 2022 NH</p>
<p>Last edited 26 August 2022 NH</p>
<p style="background:#90F0C0">Scintilla 5 has moved the lexers from Scintilla into a new
<a href="Lexilla.html">Lexilla</a> project.<br />
@ -345,149 +345,139 @@
</tr>
<tr>
<td>&cir; <a class="toc" href="#ChangeHistory">Change history</a></td>
<td>&cir; <a class="toc" href="#SelectionAndInformation">Selection and information</a></td>
<td>&cir; <a class="toc" href="#ByCharacterOrCodeUnit">By character or UTF-16 code unit</a></td>
<td>&cir; <a class="toc" href="#MultipleSelectionAndVirtualSpace">Multiple Selection and Virtual Space</a></td>
</tr>
<tr>
<td>&cir; <a class="toc" href="#MultipleSelectionAndVirtualSpace">Multiple Selection and Virtual Space</a></td>
<td>&cir; <a class="toc" href="#ScrollingAndAutomaticScrolling">Scrolling and automatic scrolling</a></td>
<td>&cir; <a class="toc" href="#WhiteSpace">White space</a></td>
<td>&cir; <a class="toc" href="#Cursor">Cursor</a></td>
</tr>
<tr>
<td>&cir; <a class="toc" href="#Cursor">Cursor</a></td>
<td>&cir; <a class="toc" href="#MouseCapture">Mouse capture</a></td>
<td>&cir; <a class="toc" href="#LineEndings">Line endings</a></td>
<td>&cir; <a class="toc" href="#Words">Words</a></td>
</tr>
<tr>
<td>&cir; <a class="toc" href="#Words">Words</a></td>
<td>&cir; <a class="toc" href="#Styling">Styling</a></td>
<td>&cir; <a class="toc" href="#StyleDefinition">Style definition</a></td>
<td>&cir; <a class="toc" href="#ElementColours">Element colours</a></td>
</tr>
<tr>
<td>&cir; <a class="toc" href="#ElementColours">Element colours</a></td>
<td>&cir; <a class="toc" href="#CaretAndSelectionStyles">Selection, caret, and hotspot styles</a></td>
<td>&cir; <a class="toc" href="#CharacterRepresentations">Character representations</a></td>
<td>&cir; <a class="toc" href="#Margins">Margins</a></td>
</tr>
<tr>
<td>&cir; <a class="toc" href="#Margins">Margins</a></td>
<td>&cir; <a class="toc" href="#Annotations">Annotations</a></td>
<td>&cir; <a class="toc" href="#OtherSettings">Other settings</a></td>
<td>&cir; <a class="toc" href="#BraceHighlighting">Brace highlighting</a></td>
</tr>
<tr>
<td>&cir; <a class="toc" href="#BraceHighlighting">Brace highlighting</a></td>
<td>&cir; <a class="toc" href="#TabsAndIndentationGuides">Tabs and Indentation
Guides</a></td>
<td>&cir; <a class="toc" href="#Markers">Markers</a></td>
<td>&cir; <a class="toc" href="#Indicators">Indicators</a></td>
</tr>
<tr>
<td>&cir; <a class="toc" href="#Indicators">Indicators</a></td>
<td>&cir; <a class="toc" href="#Autocompletion">Autocompletion</a></td>
<td>&cir; <a class="toc" href="#UserLists">User lists</a></td>
<td>&cir; <a class="toc" href="#CallTips">Call tips</a></td>
</tr>
<tr>
<td>&cir; <a class="toc" href="#CallTips">Call tips</a></td>
<td>&cir; <a class="toc" href="#KeyboardCommands">Keyboard commands</a></td>
<td>&cir; <a class="toc" href="#KeyBindings">Key bindings</a></td>
<td>&cir; <a class="toc" href="#PopupEditMenu">Popup edit menu</a></td>
</tr>
<tr>
<td>&cir; <a class="toc" href="#PopupEditMenu">Popup edit menu</a></td>
<td>&cir; <a class="toc" href="#MacroRecording">Macro recording</a></td>
<td>&cir; <a class="toc" href="#Printing">Printing</a></td>
<td>&cir; <a class="toc" href="#DirectAccess">Direct access</a></td>
</tr>
<tr>
<td>&cir; <a class="toc" href="#DirectAccess">Direct access</a></td>
<td>&cir; <a class="toc" href="#MultipleViews">Multiple views</a></td>
<td>&cir; <a class="toc" href="#BackgroundLoadSave">Background loading and saving</a></td>
<td>&cir; <a class="toc" href="#Folding">Folding</a></td>
</tr>
<tr>
<td>&cir; <a class="toc" href="#Folding">Folding</a></td>
<td>&cir; <a class="toc" href="#LineWrapping">Line wrapping</a></td>
<td>&cir; <a class="toc" href="#Zooming">Zooming</a></td>
<td>&cir; <a class="toc" href="#LongLines">Long lines</a></td>
</tr>
<tr>
<td>&cir; <a class="toc" href="#LongLines">Long lines</a></td>
<td>&cir; <a class="toc" href="#Accessibility">Accessibility</a></td>
<td>&cir; <a class="toc" href="#Lexer">Lexer</a></td>
<td>&cir; <a class="toc" href="#LexerObjects">Lexer objects</a></td>
</tr>
<tr>
<td>&cir; <a class="toc" href="#LexerObjects">Lexer objects</a></td>
<td>&cir; <a class="toc" href="#Notifications">Notifications</a></td>
<td>&cir; <a class="toc" href="#Images">Images</a></td>
<td>&cir; <a class="toc" href="#GTK">GTK</a></td>
</tr>
<tr>
<td>&cir; <a class="toc" href="#GTK">GTK</a></td>
<td>&cir; <a class="toc" href="#ProvisionalMessages"><span class="provisional">Provisional messages</span></a></td>
<td>&cir; <a class="toc" href="#DeprecatedMessages">Deprecated messages</a></td>
<td>&cir; <a class="toc" href="#EditMessagesNeverSupportedByScintilla">Edit messages never
supported by Scintilla</a></td>
</tr>
<tr>
<td>&cir; <a class="toc" href="#EditMessagesNeverSupportedByScintilla">Edit messages never
supported by Scintilla</a></td>
<td>&cir; <a class="toc" href="#RemovedFeatures">Removed features</a></td>
<td>&cir; <a class="toc" href="#BuildingScintilla">Building Scintilla</a></td>
</tr>
<tr>
<td>&cir; <a class="toc" href="#EndOfLineAnnotations">End of Line Annotations</a></td>
</tr>
</tbody>
</table>
@ -1063,7 +1053,7 @@ struct Sci_TextRangeFull {
</code>
<p><b id="SCI_FINDTEXT">SCI_FINDTEXT(int searchFlags, <a class="jump" href="#Sci_TextToFind">Sci_TextToFind</a> *ft) &rarr; position</b><br />
<b id="SCI_FINDTEXT">SCI_FINDTEXTFULL(int searchFlags, <a class="jump" href="#Sci_TextToFindFull">Sci_TextToFindFull</a> *ft) &rarr; position</b><br />
<b id="SCI_FINDTEXTFULL">SCI_FINDTEXTFULL(int searchFlags, <a class="jump" href="#Sci_TextToFindFull">Sci_TextToFindFull</a> *ft) &rarr; position</b><br />
These messages search for text in the document. They do not use or move the current selection.
The <a class="jump" href="#searchFlags"><code class="parameter">searchFlags</code></a> argument controls the
search type, which includes regular expression searches.</p>
@ -1343,6 +1333,173 @@ struct Sci_TextToFindFull {
Coalescing treats coalescible container actions as transparent so will still only group together insertions that
look like typing or deletions that look like multiple uses of the Backspace or Delete keys.
</p>
<h2 id="ChangeHistory">Change history</h2>
<p>Scintilla can display document changes (modified, saved, ...) in the margin or in the text.</p>
<p><img src="ChangeHistory.png" alt="Change history markers and indicators." /></p>
<p>The image shows the default visuals which can be altered by the application.
In the text, inserted characters appear with coloured underlines and points where characters were deleted are shown with small triangles.
The margin shows a block indicating the overall state of the line, prioritising the more consequential modified states.
The states are
modified (<span style="color:#FF8000">orange</span>),
saved (<span style="color:#00A000">green</span>),
saved then reverted to modified (<span style="color:#A0C000">green-yellow</span>),
and saved then reverted to original (<span style="color:#40A0BF">cyan</span>).
</p>
<p>This feature uses a moderate amount of memory proportional to the amount of modifications made.
On huge documents, this could be significant so could be disabled when it would cause excessive memory use.</p>
<code><a class="message" href="#SCI_SETCHANGEHISTORY">SCI_SETCHANGEHISTORY(int changeHistory)</a><br />
<a class="message" href="#SCI_GETCHANGEHISTORY">SCI_GETCHANGEHISTORY &rarr; int</a><br />
</code>
<p><b id="SCI_SETCHANGEHISTORY">SCI_SETCHANGEHISTORY(int changeHistory)</b><br />
<b id="SCI_GETCHANGEHISTORY">SCI_GETCHANGEHISTORY &rarr; int</b><br />
<code>SCI_SETCHANGEHISTORY</code> turns this feature on and off and determines whether changes are visible in
the margin or text or both.</p>
<p>Change history depends on the undo history and can only be enabled when undo history is enabled and empty.
It should be enabled once when a file is loaded after calling
<a class="seealso" href="#SCI_SETUNDOCOLLECTION">SCI_SETUNDOCOLLECTION(true)</a> and
<a class="seealso" href="#SCI_SETSAVEPOINT">SCI_SETSAVEPOINT</a>.</p>
<p>The <code class="parameter">changeHistory</code> argument can be a combination of:</p>
<table class="standard" summary="Change history state">
<tbody valign="top">
<tr>
<th align="left"><code>SC_CHANGE_HISTORY_DISABLED</code></th>
<td>0</td>
<td>The default: change history turned off.</td>
</tr>
<tr>
<th align="left"><code>SC_CHANGE_HISTORY_ENABLED</code></th>
<td>1</td>
<td>Track changes to the document.</td>
</tr>
<tr>
<th align="left"><code>SC_CHANGE_HISTORY_MARKERS</code></th>
<td>2</td>
<td>Display changes in the margin using the <code>SC_MARKNUM_HISTORY</code> markers.</td>
</tr>
<tr>
<th align="left"><code>SC_CHANGE_HISTORY_INDICATORS</code></th>
<td>4</td>
<td>Display changes in the text using the <code>INDICATOR_HISTORY</code> indicators.</td>
</tr>
</tbody>
</table>
<p>There are default visuals assigned to each history marker and indicator but these may be overridden by the application.</p>
<p>Markers:</p>
<table class="standard" summary="Change history markers">
<tbody valign="top">
<tr>
<th align="left"><code>SC_MARKNUM_HISTORY_REVERTED_TO_ORIGIN</code></th>
<td>21</td>
<td>A change was made to this line and saved but then reverted to its original state.
This line is different to its state on disk.</td>
</tr>
<tr>
<th align="left"><code>SC_MARKNUM_HISTORY_SAVED</code></th>
<td>22</td>
<td>This line was modified and saved. This line is the same as its state on disk.</td>
</tr>
<tr>
<th align="left"><code>SC_MARKNUM_HISTORY_MODIFIED</code></th>
<td>23</td>
<td>This line was modified but not yet saved. This line is different to its state on disk.</td>
</tr>
<tr>
<th align="left"><code>SC_MARKNUM_HISTORY_REVERTED_TO_MODIFIED</code></th>
<td>24</td>
<td>A change was made to this line and saved but then reverted but not to its original state.
This line is different to its state on disk.</td>
</tr>
</tbody>
</table>
<p>Indicators:</p>
<table class="standard" summary="Change history indicators">
<tbody valign="top">
<tr>
<th align="left"><code>INDICATOR_HISTORY_REVERTED_TO_ORIGIN_INSERTION</code></th>
<td>36</td>
<td>Text was deleted and saved but then reverted to its original state.
This text is not present on disk.</td>
</tr>
<tr>
<th align="left"><code>INDICATOR_HISTORY_REVERTED_TO_ORIGIN_DELETION</code></th>
<td>37</td>
<td>Text was inserted and saved but then reverted to its original state.
This range is different to its state on disk.</td>
</tr>
<tr>
<th align="left"><code>INDICATOR_HISTORY_SAVED_INSERTION</code></th>
<td>38</td>
<td>Text was inserted and saved. This text is the same as on disk.</td>
</tr>
<tr>
<th align="left"><code>INDICATOR_HISTORY_SAVED_DELETION</code></th>
<td>39</td>
<td>Text was deleted and saved. This range is the same as on disk.</td>
</tr>
<tr>
<th align="left"><code>INDICATOR_HISTORY_MODIFIED_INSERTION</code></th>
<td>40</td>
<td>Text was inserted but not yet saved. This text is not present on disk.</td>
</tr>
<tr>
<th align="left"><code>INDICATOR_HISTORY_MODIFIED_DELETION</code></th>
<td>41</td>
<td>Text was deleted but not yet saved. This range is different to its state on disk.</td>
</tr>
<tr>
<th align="left"><code>INDICATOR_HISTORY_REVERTED_TO_MODIFIED_INSERTION</code></th>
<td>42</td>
<td>Text was deleted and saved but then reverted but not to its original state.
This text is not present on disk.</td>
</tr>
<tr>
<th align="left"><code>INDICATOR_HISTORY_REVERTED_TO_MODIFIED_DELETION</code></th>
<td>43</td>
<td>Text was inserted and saved but then reverted but not to its original state.
This range is different to its state on disk.</td>
</tr>
</tbody>
</table>
<h2 id="SelectionAndInformation">Selection and information</h2>
<p>Scintilla maintains a selection that stretches between two points, the anchor and the
@ -1382,6 +1539,7 @@ struct Sci_TextToFindFull {
<a class="message" href="#SCI_POINTXFROMPOSITION">SCI_POINTXFROMPOSITION(&lt;unused&gt;, position pos) &rarr; int</a><br />
<a class="message" href="#SCI_POINTYFROMPOSITION">SCI_POINTYFROMPOSITION(&lt;unused&gt;, position pos) &rarr; int</a><br />
<a class="message" href="#SCI_HIDESELECTION">SCI_HIDESELECTION(bool hide)</a><br />
<a class="message" href="#SCI_GETSELECTIONHIDDEN">SCI_GETSELECTIONHIDDEN &rarr; bool</a><br />
<a class="message" href="#SCI_GETSELTEXT">SCI_GETSELTEXT(&lt;unused&gt;, char *text) &rarr; position</a><br />
<a class="message" href="#SCI_GETCURLINE">SCI_GETCURLINE(position length, char *text) &rarr; position</a><br />
<a class="message" href="#SCI_SELECTIONISRECTANGLE">SCI_SELECTIONISRECTANGLE &rarr; bool</a><br />
@ -1651,10 +1809,11 @@ struct Sci_TextToFindFull {
in the document.</p>
<p><b id="SCI_HIDESELECTION">SCI_HIDESELECTION(bool hide)</b><br />
<b id="SCI_GETSELECTIONHIDDEN">SCI_GETSELECTIONHIDDEN &rarr; bool</b><br />
The normal state is to make the selection visible by drawing it as set by <a class="message"
href="#SCI_SETSELFORE"><code>SCI_SETSELFORE</code></a> and <a class="message"
href="#SCI_SETSELBACK"><code>SCI_SETSELBACK</code></a>. However, if you hide the selection, it
is drawn as normal text.</p>
href="#SCI_SETSELFORE"><code>SCI_SETSELFORE</code></a>, <a class="message"
href="#SCI_SETSELBACK"><code>SCI_SETSELBACK</code></a>, and related calls.
However, if you hide the selection, it is drawn as normal text.</p>
<p><b id="SCI_CHOOSECARETX">SCI_CHOOSECARETX</b><br />
Scintilla remembers the x value of the last position horizontally moved to explicitly by the
@ -2900,7 +3059,9 @@ struct Sci_TextToFindFull {
</p>
<p><b id="SCI_GETMAXLINESTATE">SCI_GETMAXLINESTATE &rarr; int</b><br />
This returns the last line that has any line state.</p>
This returns the last line that has any line state.
This has been made less useful by an optimization that always allocates for all lines if any line's state was set.
It can still distinguish cases where line state was never set for any lines.</p>
<h2 id="StyleDefinition">Style definition</h2>
@ -4986,7 +5147,10 @@ struct Sci_TextToFindFull {
Scintilla in folding margins, and have symbolic names of the form <code>SC_MARKNUM_</code>*,
for example <code>SC_MARKNUM_FOLDEROPEN</code>.</p>
<p>Marker numbers 0 to 24 have no pre-defined function; you can use them to mark syntax errors
<p>Marker numbers 21 to 24 are used for <a class="jump" href="#ChangeHistory">Change history</a> if that is enabled but are
otherwise free for application use.</p>
<p>Marker numbers 0 to 20 have no pre-defined function; you can use them to mark syntax errors
or the current point of execution, break points, or whatever you need marking. If you do not
need folding, you can use all 32 for any purpose you wish.</p>
@ -5055,8 +5219,9 @@ struct Sci_TextToFindFull {
<code>SC_MARK_LEFTRECT</code>,
<code>SC_MARK_FULLRECT</code>,
<code>SC_MARK_BOOKMARK</code>,
<code>SC_MARK_VERTICALBOOKMARK</code>, and
<code>SC_MARK_UNDERLINE</code>.
<code>SC_MARK_VERTICALBOOKMARK</code>,
<code>SC_MARK_UNDERLINE</code>, and
<code>SC_MARK_BAR</code>.
</p>
<p>The <code>SC_MARK_BACKGROUND</code> marker changes the background colour of the line only.
@ -5372,11 +5537,14 @@ struct Sci_TextToFindFull {
They may also be invisible when used to track pieces of content for the application as <code>INDIC_HIDDEN</code>.</p>
<p>The <code>SCI_INDIC*</code> messages allow you to get and set the visual appearance of the
indicators. They all use an <code class="parameter">indicator</code> argument in the range 0 to <code>INDICATOR_MAX</code>(35)
indicators. They all use an <code class="parameter">indicator</code> argument in the range 0 to <code>INDICATOR_MAX</code>(43)
to set the indicator to style. To prevent interference the set of indicators is divided up into a range for use
by lexers (0..7) a range for use by containers
(8=<code>INDICATOR_CONTAINER</code> .. 31=<code>INDICATOR_IME-1</code>)
and a range for IME indicators (32=<code>INDICATOR_IME</code> .. 35=<code>INDICATOR_IME_MAX</code>).</p>
a range for IME indicators (32=<code>INDICATOR_IME</code> .. 35=<code>INDICATOR_IME_MAX</code>)
and a range for <a class="jump" href="#ChangeHistory">Change history</a>
(36=<code>INDICATOR_HISTORY_REVERTED_TO_ORIGIN_INSERTION</code> ..
43=<code>INDICATOR_HISTORY_REVERTED_TO_MODIFIED_DELETION</code>).</p>
<p>The <code>INDICATOR_*</code> values used for dividing up indicators
were previously <code>INDIC_CONTAINER</code>, <code>INDIC_IME</code>,
@ -5619,7 +5787,9 @@ struct Sci_TextToFindFull {
<td>A 2-pixel thick underline located at the bottom of the line to try to avoid touching the character base.
Each side is inset 1 pixel so that different indicators in this style covering a range appear isolated.
This is similar to an appearance used for the target in Asian language input composition.</td>
This is similar to an appearance used for the target in Asian language input composition.
The translucency of this indicator can be changed with
<a class="seealso" href="#SCI_INDICSETOUTLINEALPHA">SCI_INDICSETOUTLINEALPHA</a>.</td>
</tr>
<tr>
@ -5656,6 +5826,14 @@ struct Sci_TextToFindFull {
<td>Draw a triangle below the centre of the first character of the indicator range.</td>
</tr>
<tr>
<td align="left"><code>INDIC_POINT_TOP</code></td>
<td align="center">22</td>
<td>Draw a triangle above the start of the indicator range..</td>
</tr>
</tbody>
</table>
@ -7413,6 +7591,12 @@ sptr_t CallScintilla(unsigned int iMessage, uptr_t wParam, sptr_t lParam){
<td align="left">Toggle between contracted and expanded.</td>
</tr>
<tr>
<td align="left">SC_FOLDACTION_CONTRACT_EVERY_LEVEL</td>
<td align="left">4</td>
<td align="left">Used for SCI_FOLDALL only, can be combined with SC_FOLDACTION_CONTRACT or SC_FOLDACTION_TOGGLE to contract all levels instead of only top-level.</td>
</tr>
</tbody>
</table>

View File

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

View File

@ -570,9 +570,64 @@
<td>Arkadiusz Michalski</td>
<td>Christian Schmitz</td>
<td>Michael Berlenz</td>
<td>Jacky Yang</td>
</tr>
</table>
<h2>Releases</h2>
<h3>
<a href="https://www.scintilla.org/scintilla530.zip">Release 5.3.0</a>
</h3>
<ul>
<li>
Released 27 August 2022.
</li>
<li>
Added change history which can display document changes (modified, saved, ...)
in the margin or in the text.
</li>
<li>
Add SC_MARK_BAR marker and INDIC_POINT_TOP indicator.
SC_MARK_BAR is an outlined and filled rectangle that takes the full height of the line and 1/3
of the margin width.
To give a connected appearance, it displays even on wrapped lines and draws end caps on the first and last line.
INDIC_POINT_TOP is the same as INDIC_POINT but draws at the top of the line instead of the bottom.
INDIC_POINT and INDIC_POINTCHARACTER were tweaked to be 1 pixel taller and 2 pixels wider in
two-phase draw mode to be clearer.
The translucency of INDIC_COMPOSITIONTHICK can be changed with SCI_INDICSETOUTLINEALPHA.
</li>
<li>
Improve drawing of rounded rectangles on Direct2D.
</li>
<li>
Line state optimized to avoid excess allocations by always allocating for every line.
This makes SCI_GETMAXLINESTATE less useful although it can still distinguish cases
where line state was never set for any lines.
<a href="https://sourceforge.net/p/scintilla/feature-requests/1441/">Feature #1441</a>.
</li>
<li>
Add SC_FOLDACTION_CONTRACT_EVERY_LEVEL option to contract every level for
SCI_FOLDALL.
<a href="https://sourceforge.net/p/scintilla/bugs/2340/">Bug #2340</a>.
</li>
<li>
Enable multiline regex for gcc and clang when REGEX_MULTILINE defined.
This requires gcc 11.3 or clang 14.
<a href="https://sourceforge.net/p/scintilla/bugs/2338/">Bug #2338</a>.
</li>
<li>
Stop including STYLE_CALLTIP when calculating line height.
Allows a large font to be used for calltips without affecting text display.
<a href="https://sourceforge.net/p/scintilla/bugs/2341/">Bug #2341</a>.
</li>
<li>
Fix incorrect display of selection when printing in some modes.
<a href="https://sourceforge.net/p/scintilla/bugs/2335/">Bug #2335</a>.
</li>
<li>
Fix crash on Qt when showing autocompletion and the caret isn't on a screen.
Move autocompletion onto screen when above it.
</li>
</ul>
<h3>
<a href="https://www.scintilla.org/scintilla524.zip">Release 5.2.4</a>
</h3>

View File

@ -9,7 +9,7 @@
<meta name="keywords" content="Scintilla, SciTE, Editing Component, Text Editor" />
<meta name="Description"
content="www.scintilla.org is the home of the Scintilla editing component and SciTE text editor application." />
<meta name="Date.Modified" content="20220710" />
<meta name="Date.Modified" content="20220827" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<style type="text/css">
#versionlist {
@ -56,8 +56,8 @@
GTK, and macOS</font>
</td>
<td width="40%" align="right">
<font color="#FFCC99" size="3"> Release version 5.2.4<br />
Site last modified July 10 2022</font>
<font color="#FFCC99" size="3"> Release version 5.3.0<br />
Site last modified August 27 2022</font>
</td>
<td width="20%">
&nbsp;
@ -72,6 +72,7 @@
</tr>
</table>
<ul id="versionlist">
<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.3 adds 64-bit safe APIs and fixes scrollbar on GTK with Xorg.</li>
<li>Version 5.2.2 on GTK, scroll horizontally with Shift + Scroll Wheel.</li>

View File

@ -138,8 +138,21 @@ CellBuffer.o: \
../src/Position.h \
../src/SplitVector.h \
../src/Partitioning.h \
../src/RunStyles.h \
../src/SparseVector.h \
../src/ChangeHistory.h \
../src/CellBuffer.h \
../src/UniConversion.h
ChangeHistory.o: \
../src/ChangeHistory.cxx \
../include/ScintillaTypes.h \
../src/Debugging.h \
../src/Position.h \
../src/SplitVector.h \
../src/Partitioning.h \
../src/RunStyles.h \
../src/SparseVector.h \
../src/ChangeHistory.h
CharacterCategoryMap.o: \
../src/CharacterCategoryMap.cxx \
../src/CharacterCategoryMap.h

View File

@ -128,6 +128,7 @@ SRC_OBJS = \
CaseConvert.o \
CaseFolder.o \
CellBuffer.o \
ChangeHistory.o \
CharacterCategoryMap.o \
CharacterType.o \
CharClassify.o \

View File

@ -152,7 +152,12 @@ typedef sptr_t (*SciFnDirectStatus)(sptr_t ptr, unsigned int iMessage, uptr_t wP
#define SC_MARK_RGBAIMAGE 30
#define SC_MARK_BOOKMARK 31
#define SC_MARK_VERTICALBOOKMARK 32
#define SC_MARK_BAR 33
#define SC_MARK_CHARACTER 10000
#define SC_MARKNUM_HISTORY_REVERTED_TO_ORIGIN 21
#define SC_MARKNUM_HISTORY_SAVED 22
#define SC_MARKNUM_HISTORY_MODIFIED 23
#define SC_MARKNUM_HISTORY_REVERTED_TO_MODIFIED 24
#define SC_MARKNUM_FOLDEREND 25
#define SC_MARKNUM_FOLDEROPENMID 26
#define SC_MARKNUM_FOLDERMIDTAIL 27
@ -353,7 +358,8 @@ typedef sptr_t (*SciFnDirectStatus)(sptr_t ptr, unsigned int iMessage, uptr_t wP
#define INDIC_POINTCHARACTER 19
#define INDIC_GRADIENT 20
#define INDIC_GRADIENTCENTRE 21
#define INDIC_EXPLORERLINK 22
#define INDIC_POINT_TOP 22
#define INDIC_EXPLORERLINK 23
#define INDIC_CONTAINER 8
#define INDIC_IME 32
#define INDIC_IME_MAX 35
@ -361,7 +367,15 @@ typedef sptr_t (*SciFnDirectStatus)(sptr_t ptr, unsigned int iMessage, uptr_t wP
#define INDICATOR_CONTAINER 8
#define INDICATOR_IME 32
#define INDICATOR_IME_MAX 35
#define INDICATOR_MAX 35
#define INDICATOR_HISTORY_REVERTED_TO_ORIGIN_INSERTION 36
#define INDICATOR_HISTORY_REVERTED_TO_ORIGIN_DELETION 37
#define INDICATOR_HISTORY_SAVED_INSERTION 38
#define INDICATOR_HISTORY_SAVED_DELETION 39
#define INDICATOR_HISTORY_MODIFIED_INSERTION 40
#define INDICATOR_HISTORY_MODIFIED_DELETION 41
#define INDICATOR_HISTORY_REVERTED_TO_MODIFIED_INSERTION 42
#define INDICATOR_HISTORY_REVERTED_TO_MODIFIED_DELETION 43
#define INDICATOR_MAX 43
#define SCI_INDICSETSTYLE 2080
#define SCI_INDICGETSTYLE 2081
#define SCI_INDICSETFORE 2082
@ -478,6 +492,12 @@ typedef sptr_t (*SciFnDirectStatus)(sptr_t ptr, unsigned int iMessage, uptr_t wP
#define SCI_FINDTEXTFULL 2196
#define SCI_FORMATRANGE 2151
#define SCI_FORMATRANGEFULL 2777
#define SC_CHANGE_HISTORY_DISABLED 0
#define SC_CHANGE_HISTORY_ENABLED 1
#define SC_CHANGE_HISTORY_MARKERS 2
#define SC_CHANGE_HISTORY_INDICATORS 4
#define SCI_SETCHANGEHISTORY 2780
#define SCI_GETCHANGEHISTORY 2781
#define SCI_GETFIRSTVISIBLELINE 2152
#define SCI_GETLINE 2153
#define SCI_GETLINECOUNT 2154
@ -492,6 +512,7 @@ typedef sptr_t (*SciFnDirectStatus)(sptr_t ptr, unsigned int iMessage, uptr_t wP
#define SCI_GETTEXTRANGE 2162
#define SCI_GETTEXTRANGEFULL 2039
#define SCI_HIDESELECTION 2163
#define SCI_GETSELECTIONHIDDEN 2088
#define SCI_POINTXFROMPOSITION 2164
#define SCI_POINTYFROMPOSITION 2165
#define SCI_LINEFROMPOSITION 2166
@ -578,6 +599,7 @@ typedef sptr_t (*SciFnDirectStatus)(sptr_t ptr, unsigned int iMessage, uptr_t wP
#define SC_FOLDACTION_CONTRACT 0
#define SC_FOLDACTION_EXPAND 1
#define SC_FOLDACTION_TOGGLE 2
#define SC_FOLDACTION_CONTRACT_EVERY_LEVEL 4
#define SCI_FOLDLINE 2237
#define SCI_FOLDCHILDREN 2238
#define SCI_EXPANDCHILDREN 2239

View File

@ -358,6 +358,7 @@ val SC_MARK_UNDERLINE=29
val SC_MARK_RGBAIMAGE=30
val SC_MARK_BOOKMARK=31
val SC_MARK_VERTICALBOOKMARK=32
val SC_MARK_BAR=33
val SC_MARK_CHARACTER=10000
@ -385,7 +386,11 @@ ali SC_MARK_RGBAIMAGE=RGBA_IMAGE
ali SC_MARK_VERTICALBOOKMARK=VERTICAL_BOOKMARK
enu MarkerOutline=SC_MARKNUM_
# Markers used for outlining column.
# Markers used for outlining and change history columns.
val SC_MARKNUM_HISTORY_REVERTED_TO_ORIGIN=21
val SC_MARKNUM_HISTORY_SAVED=22
val SC_MARKNUM_HISTORY_MODIFIED=23
val SC_MARKNUM_HISTORY_REVERTED_TO_MODIFIED=24
val SC_MARKNUM_FOLDEREND=25
val SC_MARKNUM_FOLDEROPENMID=26
val SC_MARKNUM_FOLDERMIDTAIL=27
@ -842,6 +847,7 @@ val INDIC_POINT=18
val INDIC_POINTCHARACTER=19
val INDIC_GRADIENT=20
val INDIC_GRADIENTCENTRE=21
val INDIC_POINT_TOP=22
# INDIC_CONTAINER, INDIC_IME, INDIC_IME_MAX, and INDIC_MAX are indicator numbers,
# not IndicatorStyles so should not really be in the INDIC_ enumeration.
@ -855,7 +861,15 @@ enu IndicatorNumbers=INDICATOR_
val INDICATOR_CONTAINER=8
val INDICATOR_IME=32
val INDICATOR_IME_MAX=35
val INDICATOR_MAX=35
val INDICATOR_HISTORY_REVERTED_TO_ORIGIN_INSERTION=36
val INDICATOR_HISTORY_REVERTED_TO_ORIGIN_DELETION=37
val INDICATOR_HISTORY_SAVED_INSERTION=38
val INDICATOR_HISTORY_SAVED_DELETION=39
val INDICATOR_HISTORY_MODIFIED_INSERTION=40
val INDICATOR_HISTORY_MODIFIED_DELETION=41
val INDICATOR_HISTORY_REVERTED_TO_MODIFIED_INSERTION=42
val INDICATOR_HISTORY_REVERTED_TO_MODIFIED_DELETION=43
val INDICATOR_MAX=43
ali INDIC_TT=T_T
ali INDIC_ROUNDBOX=ROUND_BOX
@ -1224,6 +1238,18 @@ fun position FormatRange=2151(bool draw, formatrange fr)
# Draw the document into a display context such as a printer.
fun position FormatRangeFull=2777(bool draw, formatrangefull fr)
enu ChangeHistoryOption=SC_CHANGE_HISTORY_
val SC_CHANGE_HISTORY_DISABLED=0
val SC_CHANGE_HISTORY_ENABLED=1
val SC_CHANGE_HISTORY_MARKERS=2
val SC_CHANGE_HISTORY_INDICATORS=4
# Enable or disable change history.
set void SetChangeHistory=2780(ChangeHistoryOption changeHistory,)
# Report change history status.
get ChangeHistoryOption GetChangeHistory=2781(,)
# Retrieve the display line at the top of the display.
get line GetFirstVisibleLine=2152(,)
@ -1271,6 +1297,9 @@ fun position GetTextRangeFull=2039(, textrangefull tr)
# Draw the selection either highlighted or in normal (non-highlighted) style.
fun void HideSelection=2163(bool hide,)
#Is the selection visible or hidden?
get bool GetSelectionHidden=2088(,)
# Retrieve the x value of the point in the window where a position is displayed.
fun int PointXFromPosition=2164(, position pos)
@ -1534,6 +1563,7 @@ enu FoldAction=SC_FOLDACTION_
val SC_FOLDACTION_CONTRACT=0
val SC_FOLDACTION_EXPAND=1
val SC_FOLDACTION_TOGGLE=2
val SC_FOLDACTION_CONTRACT_EVERY_LEVEL=4
# Expand or contract a fold header.
fun void FoldLine=2237(line line, FoldAction action)

View File

@ -326,6 +326,8 @@ public:
Position FindTextFull(Scintilla::FindOption searchFlags, void *ft);
Position FormatRange(bool draw, void *fr);
Position FormatRangeFull(bool draw, void *fr);
void SetChangeHistory(Scintilla::ChangeHistoryOption changeHistory);
Scintilla::ChangeHistoryOption ChangeHistory();
Line FirstVisibleLine();
Position GetLine(Line line, char *text);
std::string GetLine(Line line);
@ -342,6 +344,7 @@ public:
Position GetTextRange(void *tr);
Position GetTextRangeFull(void *tr);
void HideSelection(bool hide);
bool SelectionHidden();
int PointXFromPosition(Position pos);
int PointYFromPosition(Position pos);
Line LineFromPosition(Position pos);

View File

@ -261,6 +261,8 @@ enum class Message {
FindTextFull = 2196,
FormatRange = 2151,
FormatRangeFull = 2777,
SetChangeHistory = 2780,
GetChangeHistory = 2781,
GetFirstVisibleLine = 2152,
GetLine = 2153,
GetLineCount = 2154,
@ -275,6 +277,7 @@ enum class Message {
GetTextRange = 2162,
GetTextRangeFull = 2039,
HideSelection = 2163,
GetSelectionHidden = 2088,
PointXFromPosition = 2164,
PointYFromPosition = 2165,
LineFromPosition = 2166,

View File

@ -82,6 +82,8 @@ struct NotifyHeader {
Notification code;
};
enum class Message; // Declare in case ScintillaMessages.h not included
struct NotificationData {
NotifyHeader nmhdr;
Position position;

View File

@ -86,10 +86,15 @@ enum class MarkerSymbol {
RgbaImage = 30,
Bookmark = 31,
VerticalBookmark = 32,
Bar = 33,
Character = 10000,
};
enum class MarkerOutline {
HistoryRevertedToOrigin = 21,
HistorySaved = 22,
HistoryModified = 23,
HistoryRevertedToModified = 24,
FolderEnd = 25,
FolderOpenMid = 26,
FolderMidTail = 27,
@ -213,14 +218,23 @@ enum class IndicatorStyle {
PointCharacter = 19,
Gradient = 20,
GradientCentre = 21,
ExplorerLink = 22,
PointTop = 22,
ExplorerLink = 23,
};
enum class IndicatorNumbers {
Container = 8,
Ime = 32,
ImeMax = 35,
Max = 35,
HistoryRevertedToOriginInsertion = 36,
HistoryRevertedToOriginDeletion = 37,
HistorySavedInsertion = 38,
HistorySavedDeletion = 39,
HistoryModifiedInsertion = 40,
HistoryModifiedDeletion = 41,
HistoryRevertedToModifiedInsertion = 42,
HistoryRevertedToModifiedDeletion = 43,
Max = 43,
};
enum class IndicValue {
@ -264,6 +278,13 @@ enum class FindOption {
Cxx11RegEx = 0x00800000,
};
enum class ChangeHistoryOption {
Disabled = 0,
Enabled = 1,
Markers = 2,
Indicators = 4,
};
enum class FoldLevel {
None = 0x0,
Base = 0x400,
@ -282,6 +303,7 @@ enum class FoldAction {
Contract = 0,
Expand = 1,
Toggle = 2,
ContractEveryLevel = 4,
};
enum class AutomaticFold {
@ -797,6 +819,15 @@ constexpr KeyMod operator&(KeyMod a, KeyMod b) noexcept {
return static_cast<KeyMod>(static_cast<int>(a) & static_cast<int>(b));
}
constexpr KeyMod ModifierFlags(bool shift, bool ctrl, bool alt, bool meta=false, bool super=false) noexcept {
return
(shift ? KeyMod::Shift : KeyMod::Norm) |
(ctrl ? KeyMod::Ctrl : KeyMod::Norm) |
(alt ? KeyMod::Alt : KeyMod::Norm) |
(meta ? KeyMod::Meta : KeyMod::Norm) |
(super ? KeyMod::Super : KeyMod::Norm);
}
// Test if an enum class value has some bit flag(s) of test set.
template <typename T>
constexpr bool FlagSet(T value, T test) {

View File

@ -13,7 +13,7 @@ TEMPLATE = lib
CONFIG += lib_bundle
CONFIG += c++1z
VERSION = 5.2.4
VERSION = 5.3.0
SOURCES += \
ScintillaEdit.cpp \
@ -47,6 +47,7 @@ SOURCES += \
../../src/CharClassify.cxx \
../../src/CharacterType.cxx \
../../src/CharacterCategoryMap.cxx \
../../src/ChangeHistory.cxx \
../../src/CellBuffer.cxx \
../../src/CaseFolder.cxx \
../../src/CaseConvert.cxx \

View File

@ -790,6 +790,9 @@ QRect ScreenRectangleForPoint(QPoint posGlobal)
{
#if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0)
const QScreen *screen = QGuiApplication::screenAt(posGlobal);
if (!screen) {
screen = QGuiApplication::primaryScreen();
}
return screen->availableGeometry();
#else
const QDesktopWidget *desktop = QApplication::desktop();
@ -840,6 +843,8 @@ void Window::SetPositionRelative(PRectangle rc, const Window *relativeTo)
ox = rectDesk.right() - sizex;
if (oy + sizey > rectDesk.bottom())
oy = rectDesk.bottom() - sizey;
if (oy < rectDesk.top())
oy = rectDesk.top();
Q_ASSERT(wid);
window(wid)->move(ox, oy);

View File

@ -257,7 +257,7 @@ void ScintillaEditBase::keyPressEvent(QKeyEvent *event)
bool consumed = false;
bool added = sqt->KeyDownWithModifiers(static_cast<Keys>(key),
ScintillaQt::ModifierFlags(shift, ctrl, alt),
ModifierFlags(shift, ctrl, alt),
&consumed) != 0;
if (!consumed)
consumed = added;
@ -331,7 +331,7 @@ void ScintillaEditBase::mousePressEvent(QMouseEvent *event)
bool alt = QApplication::keyboardModifiers() & Qt::AltModifier;
#endif
sqt->ButtonDownWithModifiers(pos, time.elapsed(), ScintillaQt::ModifierFlags(shift, ctrl, alt));
sqt->ButtonDownWithModifiers(pos, time.elapsed(), ModifierFlags(shift, ctrl, alt));
}
if (event->button() == Qt::RightButton) {
@ -373,7 +373,7 @@ void ScintillaEditBase::mouseMoveEvent(QMouseEvent *event)
bool alt = QApplication::keyboardModifiers() & Qt::AltModifier;
#endif
const KeyMod modifiers = ScintillaQt::ModifierFlags(shift, ctrl, alt);
const KeyMod modifiers = ModifierFlags(shift, ctrl, alt);
sqt->ButtonMoveWithModifiers(pos, time.elapsed(), modifiers);
}
@ -826,5 +826,5 @@ KeyMod ScintillaEditBase::ModifiersOfKeyboard()
const bool ctrl = QApplication::keyboardModifiers() & Qt::ControlModifier;
const bool alt = QApplication::keyboardModifiers() & Qt::AltModifier;
return ScintillaQt::ModifierFlags(shift, ctrl, alt);
return ModifierFlags(shift, ctrl, alt);
}

View File

@ -12,7 +12,7 @@ TEMPLATE = lib
CONFIG += lib_bundle
CONFIG += c++1z
VERSION = 5.2.4
VERSION = 5.3.0
SOURCES += \
PlatQt.cpp \
@ -44,6 +44,7 @@ SOURCES += \
../../src/CharClassify.cxx \
../../src/CharacterType.cxx \
../../src/CharacterCategoryMap.cxx \
../../src/ChangeHistory.cxx \
../../src/CellBuffer.cxx \
../../src/CaseFolder.cxx \
../../src/CaseConvert.cxx \
@ -78,6 +79,7 @@ HEADERS += \
../../src/CharClassify.h \
../../src/CharacterType.h \
../../src/CharacterCategoryMap.h \
../../src/ChangeHistory.h \
../../src/CellBuffer.h \
../../src/CaseFolder.h \
../../src/CaseConvert.h \

View File

@ -61,6 +61,12 @@ def convertIFaceTypeToC(t):
return "Sci_TextToFind *"
elif t == "formatrange":
return "Sci_RangeToFormat *"
elif t == "textrangefull":
return "Sci_TextRangeFull *"
elif t == "findtextfull":
return "Sci_TextToFindFull *"
elif t == "formatrangefull":
return "Sci_RangeToFormatFull *"
elif Face.IsEnumeration(t):
return "int "
return t + " "

View File

@ -119,6 +119,7 @@
#include "RunStyles.h"
#include "SparseVector.h"
#include "ContractionState.h"
#include "ChangeHistory.h"
#include "CellBuffer.h"
#include "PerLine.h"
#include "CallTip.h"

View File

@ -27,6 +27,9 @@
#include "Position.h"
#include "SplitVector.h"
#include "Partitioning.h"
#include "RunStyles.h"
#include "SparseVector.h"
#include "ChangeHistory.h"
#include "CellBuffer.h"
#include "UniConversion.h"
@ -91,6 +94,11 @@ using namespace Scintilla::Internal;
template <typename POS>
class LineStartIndex {
// line_cast(): cast Sci::Line to either 32-bit or 64-bit value
// This avoids warnings from Visual C++ Code Analysis and shortens code
static constexpr POS line_cast(Sci::Line pos) noexcept {
return static_cast<POS>(pos);
}
public:
int refCount;
Partitioning<POS> starts;
@ -98,20 +106,13 @@ public:
LineStartIndex() : refCount(0), starts(4) {
// Minimal initial allocation
}
// Deleted so LineStartIndex objects can not be copied.
LineStartIndex(const LineStartIndex &) = delete;
LineStartIndex(LineStartIndex &&) = delete;
void operator=(const LineStartIndex &) = delete;
void operator=(LineStartIndex &&) = delete;
virtual ~LineStartIndex() {
}
bool Allocate(Sci::Line lines) {
refCount++;
Sci::Position length = starts.PositionFromPartition(starts.Partitions());
for (Sci::Line line = starts.Partitions(); line < lines; line++) {
// Produce an ascending sequence that will be filled in with correct widths later
length++;
starts.InsertPartition(static_cast<POS>(line), static_cast<POS>(length));
starts.InsertPartition(line_cast(line), line_cast(length));
}
return refCount == 1;
}
@ -126,12 +127,12 @@ public:
return refCount > 0;
}
Sci::Position LineWidth(Sci::Line line) const noexcept {
return starts.PositionFromPartition(static_cast<POS>(line) + 1) -
starts.PositionFromPartition(static_cast<POS>(line));
return starts.PositionFromPartition(line_cast(line) + 1) -
starts.PositionFromPartition(line_cast(line));
}
void SetLineWidth(Sci::Line line, Sci::Position width) noexcept {
const Sci::Position widthCurrent = LineWidth(line);
starts.InsertText(static_cast<POS>(line), static_cast<POS>(width - widthCurrent));
starts.InsertText(line_cast(line), line_cast(width - widthCurrent));
}
void AllocateLines(Sci::Line lines) {
if (lines > starts.Partitions()) {
@ -141,9 +142,9 @@ public:
void InsertLines(Sci::Line line, Sci::Line lines) {
// Insert multiple lines with each temporarily 1 character wide.
// The line widths will be fixed up by later measuring code.
const POS lineAsPos = static_cast<POS>(line);
const POS lineAsPos = line_cast(line);
const POS lineStart = starts.PositionFromPartition(lineAsPos - 1) + 1;
for (POS l = 0; l < static_cast<POS>(lines); l++) {
for (POS l = 0; l < line_cast(lines); l++) {
starts.InsertPartition(lineAsPos + l, lineStart + l);
}
}
@ -163,16 +164,21 @@ class LineVector : public ILineVector {
| (startsUTF16.Active() ? LineCharacterIndexType::Utf16 : LineCharacterIndexType::None);
}
// pos_cast(): cast Sci::Line and Sci::Position to either 32-bit or 64-bit value
// This avoids warnings from Visual C++ Code Analysis and shortens code
static constexpr POS pos_cast(Sci::Position pos) noexcept {
return static_cast<POS>(pos);
}
// line_from_pos_cast(): return 32-bit or 64-bit value as Sci::Line
// This avoids warnings from Visual C++ Code Analysis and shortens code
static constexpr Sci::Line line_from_pos_cast(POS line) noexcept {
return static_cast<Sci::Line>(line);
}
public:
LineVector() : starts(256), perLine(nullptr), activeIndices(LineCharacterIndexType::None) {
}
// Deleted so LineVector objects can not be copied.
LineVector(const LineVector &) = delete;
LineVector(LineVector &&) = delete;
LineVector &operator=(const LineVector &) = delete;
LineVector &operator=(LineVector &&) = delete;
~LineVector() override {
}
void Init() override {
starts.DeleteAll();
if (perLine) {
@ -185,11 +191,11 @@ public:
perLine = pl;
}
void InsertText(Sci::Line line, Sci::Position delta) noexcept override {
starts.InsertText(static_cast<POS>(line), static_cast<POS>(delta));
starts.InsertText(pos_cast(line), pos_cast(delta));
}
void InsertLine(Sci::Line line, Sci::Position position, bool lineStart) override {
const POS lineAsPos = static_cast<POS>(line);
starts.InsertPartition(lineAsPos, static_cast<POS>(position));
const POS lineAsPos = pos_cast(line);
starts.InsertPartition(lineAsPos, pos_cast(position));
if (activeIndices != LineCharacterIndexType::None) {
if (FlagSet(activeIndices, LineCharacterIndexType::Utf32)) {
startsUTF32.InsertLines(line, 1);
@ -205,7 +211,7 @@ public:
}
}
void InsertLines(Sci::Line line, const Sci::Position *positions, size_t lines, bool lineStart) override {
const POS lineAsPos = static_cast<POS>(line);
const POS lineAsPos = pos_cast(line);
if constexpr (sizeof(Sci::Position) == sizeof(POS)) {
starts.InsertPartitions(lineAsPos, positions, lines);
} else {
@ -226,22 +232,22 @@ public:
}
}
void SetLineStart(Sci::Line line, Sci::Position position) noexcept override {
starts.SetPartitionStartPosition(static_cast<POS>(line), static_cast<POS>(position));
starts.SetPartitionStartPosition(pos_cast(line), pos_cast(position));
}
void RemoveLine(Sci::Line line) override {
starts.RemovePartition(static_cast<POS>(line));
starts.RemovePartition(pos_cast(line));
if (FlagSet(activeIndices, LineCharacterIndexType::Utf32)) {
startsUTF32.starts.RemovePartition(static_cast<POS>(line));
startsUTF32.starts.RemovePartition(pos_cast(line));
}
if (FlagSet(activeIndices, LineCharacterIndexType::Utf16)) {
startsUTF16.starts.RemovePartition(static_cast<POS>(line));
startsUTF16.starts.RemovePartition(pos_cast(line));
}
if (perLine) {
perLine->RemoveLine(line);
}
}
Sci::Line Lines() const noexcept override {
return static_cast<Sci::Line>(starts.Partitions());
return line_from_pos_cast(starts.Partitions());
}
void AllocateLines(Sci::Line lines) override {
if (lines > Lines()) {
@ -255,17 +261,17 @@ public:
}
}
Sci::Line LineFromPosition(Sci::Position pos) const noexcept override {
return static_cast<Sci::Line>(starts.PartitionFromPosition(static_cast<POS>(pos)));
return line_from_pos_cast(starts.PartitionFromPosition(pos_cast(pos)));
}
Sci::Position LineStart(Sci::Line line) const noexcept override {
return starts.PositionFromPartition(static_cast<POS>(line));
return starts.PositionFromPartition(pos_cast(line));
}
void InsertCharacters(Sci::Line line, CountWidths delta) noexcept override {
if (FlagSet(activeIndices, LineCharacterIndexType::Utf32)) {
startsUTF32.starts.InsertText(static_cast<POS>(line), static_cast<POS>(delta.WidthUTF32()));
startsUTF32.starts.InsertText(pos_cast(line), pos_cast(delta.WidthUTF32()));
}
if (FlagSet(activeIndices, LineCharacterIndexType::Utf16)) {
startsUTF16.starts.InsertText(static_cast<POS>(line), static_cast<POS>(delta.WidthUTF16()));
startsUTF16.starts.InsertText(pos_cast(line), pos_cast(delta.WidthUTF16()));
}
}
void SetLineCharactersWidth(Sci::Line line, CountWidths width) noexcept override {
@ -308,16 +314,16 @@ public:
}
Sci::Position IndexLineStart(Sci::Line line, LineCharacterIndexType lineCharacterIndex) const noexcept override {
if (lineCharacterIndex == LineCharacterIndexType::Utf32) {
return startsUTF32.starts.PositionFromPartition(static_cast<POS>(line));
return startsUTF32.starts.PositionFromPartition(pos_cast(line));
} else {
return startsUTF16.starts.PositionFromPartition(static_cast<POS>(line));
return startsUTF16.starts.PositionFromPartition(pos_cast(line));
}
}
Sci::Line LineFromPositionIndex(Sci::Position pos, LineCharacterIndexType lineCharacterIndex) const noexcept override {
if (lineCharacterIndex == LineCharacterIndexType::Utf32) {
return static_cast<Sci::Line>(startsUTF32.starts.PartitionFromPosition(static_cast<POS>(pos)));
return line_from_pos_cast(startsUTF32.starts.PartitionFromPosition(pos_cast(pos)));
} else {
return static_cast<Sci::Line>(startsUTF16.starts.PartitionFromPosition(static_cast<POS>(pos)));
return line_from_pos_cast(startsUTF16.starts.PartitionFromPosition(pos_cast(pos)));
}
}
};
@ -329,9 +335,6 @@ Action::Action() noexcept {
mayCoalesce = false;
}
Action::~Action() {
}
void Action::Create(ActionType at_, Sci::Position position_, const char *data_, Sci::Position lenData_, bool mayCoalesce_) {
data = nullptr;
position = position_;
@ -379,9 +382,6 @@ UndoHistory::UndoHistory() {
actions[currentAction].Create(ActionType::start);
}
UndoHistory::~UndoHistory() {
}
void UndoHistory::EnsureUndoRoom() {
// Have to test that there is room for 2 more actions in the array
// as two actions may be created by the calling function
@ -399,12 +399,17 @@ const char *UndoHistory::AppendAction(ActionType at, Sci::Position position, con
// actions[currentAction - 1].position, actions[currentAction - 1].lenData);
if (currentAction < savePoint) {
savePoint = -1;
if (!detach) {
detach = currentAction;
}
} else if (detach && (*detach > currentAction)) {
detach = currentAction;
}
int oldCurrentAction = currentAction;
if (currentAction >= 1) {
if (0 == undoSequenceDepth) {
// Top level actions may not always be coalesced
int targetAct = -1;
ptrdiff_t targetAct = -1;
const Action *actPrevious = &(actions[currentAction + targetAct]);
// Container actions may forward the coalesce state of Scintilla Actions.
while ((actPrevious->at == ActionType::container) && actPrevious->mayCoalesce) {
@ -506,12 +511,29 @@ void UndoHistory::DeleteUndoHistory() {
void UndoHistory::SetSavePoint() noexcept {
savePoint = currentAction;
detach.reset();
}
bool UndoHistory::IsSavePoint() const noexcept {
return savePoint == currentAction;
}
bool UndoHistory::BeforeSavePoint() const noexcept {
return (savePoint < 0) || (savePoint > currentAction);
}
bool UndoHistory::BeforeReachableSavePoint() const noexcept {
return (savePoint >= 0) && !detach && (savePoint > currentAction);
}
bool UndoHistory::AfterSavePoint() const noexcept {
return (savePoint >= 0) && (savePoint <= currentAction);
}
bool UndoHistory::AfterDetachPoint() const noexcept {
return detach && (*detach < currentAction);
}
void UndoHistory::TentativeStart() {
tentativePoint = currentAction;
}
@ -598,8 +620,7 @@ CellBuffer::CellBuffer(bool hasStyles_, bool largeDocument_) :
plv = std::make_unique<LineVector<int>>();
}
CellBuffer::~CellBuffer() {
}
CellBuffer::~CellBuffer() noexcept = default;
char CellBuffer::CharAt(Sci::Position position) const noexcept {
return substance.ValueAt(position);
@ -686,6 +707,9 @@ const char *CellBuffer::InsertString(Sci::Position position, const char *s, Sci:
}
BasicInsertString(position, s, insertLength);
if (changeHistory) {
changeHistory->Insert(position, insertLength, collectingUndo, uh.BeforeReachableSavePoint());
}
}
return data;
}
@ -734,6 +758,11 @@ const char *CellBuffer::DeleteChars(Sci::Position position, Sci::Position delete
data = uh.AppendAction(ActionType::remove, position, data, deleteLength, startSequence);
}
if (changeHistory) {
changeHistory->DeleteRangeSavingHistory(position, deleteLength,
uh.BeforeReachableSavePoint(), uh.AfterDetachPoint());
}
BasicDeleteChars(position, deleteLength);
}
return data;
@ -849,6 +878,9 @@ bool CellBuffer::HasStyles() const noexcept {
void CellBuffer::SetSavePoint() {
uh.SetSavePoint();
if (changeHistory) {
changeHistory->SetSavePoint();
}
}
bool CellBuffer::IsSavePoint() const noexcept {
@ -1308,14 +1340,24 @@ const Action &CellBuffer::GetUndoStep() const {
void CellBuffer::PerformUndoStep() {
const Action &actionStep = uh.GetUndoStep();
if (changeHistory && uh.BeforeSavePoint()) {
changeHistory->StartReversion();
}
if (actionStep.at == ActionType::insert) {
if (substance.Length() < actionStep.lenData) {
throw std::runtime_error(
"CellBuffer::PerformUndoStep: deletion must be less than document length.");
}
if (changeHistory) {
changeHistory->DeleteRange(actionStep.position, actionStep.lenData,
uh.BeforeSavePoint() && !uh.AfterDetachPoint());
}
BasicDeleteChars(actionStep.position, actionStep.lenData);
} else if (actionStep.at == ActionType::remove) {
BasicInsertString(actionStep.position, actionStep.data.get(), actionStep.lenData);
if (changeHistory) {
changeHistory->UndoDeleteStep(actionStep.position, actionStep.lenData, uh.AfterDetachPoint());
}
}
uh.CompletedUndoStep();
}
@ -1336,9 +1378,57 @@ void CellBuffer::PerformRedoStep() {
const Action &actionStep = uh.GetRedoStep();
if (actionStep.at == ActionType::insert) {
BasicInsertString(actionStep.position, actionStep.data.get(), actionStep.lenData);
if (changeHistory) {
changeHistory->Insert(actionStep.position, actionStep.lenData, collectingUndo,
uh.BeforeSavePoint() && !uh.AfterDetachPoint());
}
} else if (actionStep.at == ActionType::remove) {
if (changeHistory) {
changeHistory->DeleteRangeSavingHistory(actionStep.position, actionStep.lenData,
uh.BeforeReachableSavePoint(), uh.AfterDetachPoint());
}
BasicDeleteChars(actionStep.position, actionStep.lenData);
}
if (changeHistory && uh.AfterSavePoint()) {
changeHistory->EndReversion();
}
uh.CompletedRedoStep();
}
void CellBuffer::ChangeHistorySet(bool set) {
if (set) {
if (!changeHistory) {
changeHistory = std::make_unique<ChangeHistory>(Length());
}
} else {
changeHistory.reset();
}
}
int CellBuffer::EditionAt(Sci::Position pos) const noexcept {
if (changeHistory) {
return changeHistory->EditionAt(pos);
}
return 0;
}
Sci::Position CellBuffer::EditionEndRun(Sci::Position pos) const noexcept {
if (changeHistory) {
return changeHistory->EditionEndRun(pos);
}
return Length();
}
unsigned int CellBuffer::EditionDeletesAt(Sci::Position pos) const noexcept {
if (changeHistory) {
return changeHistory->EditionDeletesAt(pos);
}
return 0;
}
Sci::Position CellBuffer::EditionNextDelete(Sci::Position pos) const noexcept {
if (changeHistory) {
return changeHistory->EditionNextDelete(pos);
}
return Length() + 1;
}

View File

@ -20,6 +20,7 @@ public:
virtual void RemoveLine(Sci::Line line)=0;
};
class ChangeHistory;
/**
* The line vector contains information about each of the lines in a cell buffer.
*/
@ -39,13 +40,6 @@ public:
bool mayCoalesce;
Action() noexcept;
// Deleted so Action objects can not be copied.
Action(const Action &other) = delete;
Action &operator=(const Action &other) = delete;
Action &operator=(const Action &&other) = delete;
// Move constructor allows vector to be resized without reallocating.
Action(Action &&other) noexcept = default;
~Action();
void Create(ActionType at_, Sci::Position position_=0, const char *data_=nullptr, Sci::Position lenData_=0, bool mayCoalesce_=true);
void Clear() noexcept;
};
@ -60,17 +54,12 @@ class UndoHistory {
int undoSequenceDepth;
int savePoint;
int tentativePoint;
std::optional<int> detach;
void EnsureUndoRoom();
public:
UndoHistory();
// Deleted so UndoHistory objects can not be copied.
UndoHistory(const UndoHistory &) = delete;
UndoHistory(UndoHistory &&) = delete;
void operator=(const UndoHistory &) = delete;
void operator=(UndoHistory &&) = delete;
~UndoHistory();
const char *AppendAction(ActionType at, Sci::Position position, const char *data, Sci::Position lengthData, bool &startSequence, bool mayCoalesce=true);
@ -83,6 +72,10 @@ public:
/// the buffer was saved. Undo and redo can move over the save point.
void SetSavePoint() noexcept;
bool IsSavePoint() const noexcept;
bool BeforeSavePoint() const noexcept;
bool BeforeReachableSavePoint() const noexcept;
bool AfterSavePoint() const noexcept;
bool AfterDetachPoint() const noexcept;
// Tentative actions are used for input composition so that it can be undone cleanly
void TentativeStart();
@ -146,6 +139,8 @@ private:
bool collectingUndo;
UndoHistory uh;
std::unique_ptr<ChangeHistory> changeHistory;
std::unique_ptr<ILineVector> plv;
bool UTF8LineEndOverlaps(Sci::Position position) const noexcept;
@ -163,9 +158,9 @@ public:
// Deleted so CellBuffer objects can not be copied.
CellBuffer(const CellBuffer &) = delete;
CellBuffer(CellBuffer &&) = delete;
void operator=(const CellBuffer &) = delete;
void operator=(CellBuffer &&) = delete;
~CellBuffer();
CellBuffer &operator=(const CellBuffer &) = delete;
CellBuffer &operator=(CellBuffer &&) = delete;
~CellBuffer() noexcept;
/// Retrieving positions outside the range of the buffer works and returns 0
char CharAt(Sci::Position position) const noexcept;
@ -237,6 +232,12 @@ public:
int StartRedo();
const Action &GetRedoStep() const;
void PerformRedoStep();
void ChangeHistorySet(bool set);
[[nodiscard]] int EditionAt(Sci::Position pos) const noexcept;
[[nodiscard]] Sci::Position EditionEndRun(Sci::Position pos) const noexcept;
[[nodiscard]] unsigned int EditionDeletesAt(Sci::Position pos) const noexcept;
[[nodiscard]] Sci::Position EditionNextDelete(Sci::Position pos) const noexcept;
};
}

View File

@ -0,0 +1,422 @@
// Scintilla source code edit control
/** @file ChangeHistory.cxx
** Manages a history of changes in a document.
**/
// Copyright 2022 by Neil Hodgson <neilh@scintilla.org>
// The License.txt file describes the conditions under which this software may be distributed.
#include <cstddef>
#include <cstdlib>
#include <cassert>
#include <stdexcept>
#include <vector>
#include <set>
#include <algorithm>
#include <memory>
#include "ScintillaTypes.h"
#include "Debugging.h"
#include "Position.h"
#include "SplitVector.h"
#include "Partitioning.h"
#include "RunStyles.h"
#include "SparseVector.h"
#include "ChangeHistory.h"
namespace Scintilla::Internal {
void ChangeStack::Clear() noexcept {
steps.clear();
insertions.clear();
}
void ChangeStack::AddStep() {
steps.push_back(0);
}
void ChangeStack::PushDeletion(Sci::Position positionDeletion, int edition) {
steps.back()++;
insertions.push_back({ positionDeletion, 0, edition, InsertionSpan::Direction::deletion });
}
void ChangeStack::PushInsertion(Sci::Position positionInsertion, Sci::Position length, int edition) {
steps.back()++;
insertions.push_back({ positionInsertion, length, edition, InsertionSpan::Direction::insertion });
};
size_t ChangeStack::PopStep() noexcept {
const size_t spans = steps.back();
steps.pop_back();
return spans;
}
InsertionSpan ChangeStack::PopSpan() noexcept {
const InsertionSpan span = insertions.back();
insertions.pop_back();
return span;
}
void ChangeStack::SetSavePoint() noexcept {
// Switch changeUnsaved to changeSaved
for (InsertionSpan &x : insertions) {
if (x.edition == changeModified) {
x.edition = changeSaved;
}
}
}
void ChangeLog::Clear(Sci::Position length) {
changeStack.Clear();
insertEdition.DeleteAll();
deleteEdition.DeleteAll();
InsertSpace(0, length);
}
void ChangeLog::InsertSpace(Sci::Position position, Sci::Position insertLength) {
assert(insertEdition.Length() == deleteEdition.Length());
insertEdition.InsertSpace(position, insertLength);
deleteEdition.InsertSpace(position, insertLength);
}
void ChangeLog::DeleteRange(Sci::Position position, Sci::Position deleteLength) {
insertEdition.DeleteRange(position, deleteLength);
const EditionSetOwned &editions = deleteEdition.ValueAt(position);
if (editions) {
const EditionSet savedEditions = *editions;
deleteEdition.DeleteRange(position, deleteLength);
EditionSetOwned reset = std::make_unique<EditionSet>(savedEditions);
deleteEdition.SetValueAt(position, std::move(reset));
} else {
deleteEdition.DeleteRange(position, deleteLength);
}
assert(insertEdition.Length() == deleteEdition.Length());
}
void ChangeLog::Insert(Sci::Position start, Sci::Position length, int edition) {
insertEdition.FillRange(start, edition, length);
}
void ChangeLog::CollapseRange(Sci::Position position, Sci::Position deleteLength) {
const Sci::Position positionMax = position + deleteLength;
Sci::Position positionDeletion = position + 1;
while (positionDeletion <= positionMax) {
const EditionSetOwned &editions = deleteEdition.ValueAt(positionDeletion);
if (editions) {
for (const int ed : *editions) {
PushDeletionAt(position, ed);
}
EditionSetOwned empty;
deleteEdition.SetValueAt(positionDeletion, std::move(empty));
}
positionDeletion = deleteEdition.PositionNext(positionDeletion);
}
}
void ChangeLog::PushDeletionAt(Sci::Position position, int edition) {
if (!deleteEdition.ValueAt(position)) {
deleteEdition.SetValueAt(position, std::make_unique<EditionSet>());
}
deleteEdition.ValueAt(position)->push_back(edition);
}
void ChangeLog::InsertFrontDeletionAt(Sci::Position position, int edition) {
if (!deleteEdition.ValueAt(position)) {
deleteEdition.SetValueAt(position, std::make_unique<EditionSet>());
}
const EditionSetOwned &editions = deleteEdition.ValueAt(position);
editions->insert(editions->begin(), edition);
}
void ChangeLog::SaveRange(Sci::Position position, Sci::Position length) {
// Save insertEdition range into undo stack
changeStack.AddStep();
Sci::Position positionInsertion = position;
const ptrdiff_t editionStart = insertEdition.ValueAt(positionInsertion);
if (editionStart == 0) {
positionInsertion = insertEdition.EndRun(positionInsertion);
}
const Sci::Position positionMax = position + length;
while (positionInsertion < positionMax) {
const Sci::Position positionEndInsertion = insertEdition.EndRun(positionInsertion);
changeStack.PushInsertion(positionInsertion, std::min(positionEndInsertion, positionMax) - positionInsertion,
insertEdition.ValueAt(positionInsertion));
positionInsertion = insertEdition.EndRun(positionEndInsertion);
}
Sci::Position positionDeletion = position + 1;
while (positionDeletion <= positionMax) {
const EditionSetOwned &editions = deleteEdition.ValueAt(positionDeletion);
if (editions) {
for (const int ed : *editions) {
changeStack.PushDeletion(positionDeletion, ed);
}
}
positionDeletion = deleteEdition.PositionNext(positionDeletion);
}
}
void ChangeLog::PopDeletion(Sci::Position position, Sci::Position deleteLength) {
// Just performed InsertSpace(position, deleteLength) so *this* element in
// deleteEdition moved forward by deleteLength
EditionSetOwned eso = deleteEdition.Extract(position + deleteLength);
deleteEdition.SetValueAt(position, std::move(eso));
const EditionSetOwned &editions = deleteEdition.ValueAt(position);
assert(editions);
editions->pop_back();
const size_t inserts = changeStack.PopStep();
for (size_t i = 0; i < inserts; i++) {
const InsertionSpan span = changeStack.PopSpan();
if (span.direction == InsertionSpan::Direction::insertion) {
insertEdition.FillRange(span.start, span.edition, span.length);
} else {
assert(editions);
assert(editions->back() == span.edition);
editions->pop_back();
InsertFrontDeletionAt(span.start, span.edition);
}
}
if (editions->empty()) {
deleteEdition.SetValueAt(position, EditionSetOwned{});
}
}
void ChangeLog::SaveHistoryForDelete(Sci::Position position, Sci::Position deleteLength) {
assert(position >= 0);
assert(deleteLength >= 0);
assert(position + deleteLength <= Length());
SaveRange(position, deleteLength);
CollapseRange(position, deleteLength);
}
void ChangeLog::DeleteRangeSavingHistory(Sci::Position position, Sci::Position deleteLength) {
SaveHistoryForDelete(position, deleteLength);
DeleteRange(position, deleteLength);
}
void ChangeLog::SetSavePoint() {
// Switch changeUnsaved to changeSaved
changeStack.SetSavePoint();
const Sci::Position length = insertEdition.Length();
for (Sci::Position startRun = 0; startRun < length;) {
const Sci::Position endRun = insertEdition.EndRun(startRun);
if (insertEdition.ValueAt(startRun) == changeModified) {
insertEdition.FillRange(startRun, changeSaved, endRun - startRun);
}
startRun = endRun;
}
for (Sci::Position positionDeletion = 0; positionDeletion <= length;) {
const EditionSetOwned &editions = deleteEdition.ValueAt(positionDeletion);
if (editions) {
for (int &ed : *editions) {
if (ed == changeModified) {
ed = changeSaved;
}
}
}
positionDeletion = deleteEdition.PositionNext(positionDeletion);
}
}
Sci::Position ChangeLog::Length() const noexcept {
return insertEdition.Length();
}
size_t ChangeLog::DeletionCount(Sci::Position start, Sci::Position length) const noexcept {
const Sci::Position end = start + length;
size_t count = 0;
while (start <= end) {
const EditionSetOwned &editions = deleteEdition.ValueAt(start);
if (editions) {
count += editions->size();
}
start = deleteEdition.PositionNext(start);
}
return count;
}
void ChangeLog::Check() const noexcept {
assert(insertEdition.Length() == deleteEdition.Length());
}
ChangeHistory::ChangeHistory(Sci::Position length) {
changeLog.Clear(length);
}
void ChangeHistory::Insert(Sci::Position position, Sci::Position insertLength, bool collectingUndo, bool beforeSave) {
Check();
changeLog.InsertSpace(position, insertLength);
const int edition = collectingUndo ? (beforeSave ? changeSaved : changeModified) :
changeOriginal;
changeLog.Insert(position, insertLength, edition);
if (changeLogReversions) {
changeLogReversions->InsertSpace(position, insertLength);
if (beforeSave) {
changeLogReversions->PopDeletion(position, insertLength);
}
}
Check();
}
void ChangeHistory::DeleteRange(Sci::Position position, Sci::Position deleteLength, bool reverting) {
Check();
assert(DeletionCount(position, deleteLength-1) == 0);
changeLog.DeleteRange(position, deleteLength);
if (changeLogReversions) {
changeLogReversions->DeleteRangeSavingHistory(position, deleteLength);
if (reverting) {
changeLogReversions->PushDeletionAt(position, 1);
}
}
Check();
}
void ChangeHistory::DeleteRangeSavingHistory(Sci::Position position, Sci::Position deleteLength, bool beforeSave, bool isDetached) {
changeLog.DeleteRangeSavingHistory(position, deleteLength);
changeLog.PushDeletionAt(position, beforeSave ? changeSaved : changeModified);
if (changeLogReversions) {
if (isDetached) {
changeLogReversions->SaveHistoryForDelete(position, deleteLength);
}
changeLogReversions->DeleteRange(position, deleteLength);
}
Check();
}
void ChangeHistory::StartReversion() {
if (!changeLogReversions) {
changeLogReversions = std::make_unique<ChangeLog>();
changeLogReversions->Clear(changeLog.Length());
}
Check();
}
void ChangeHistory::EndReversion() noexcept {
changeLogReversions.reset();
Check();
}
void ChangeHistory::SetSavePoint() {
changeLog.SetSavePoint();
EndReversion();
}
void ChangeHistory::UndoDeleteStep(Sci::Position position, Sci::Position deleteLength, bool isDetached) {
Check();
changeLog.InsertSpace(position, deleteLength);
changeLog.PopDeletion(position, deleteLength);
if (changeLogReversions) {
changeLogReversions->InsertSpace(position, deleteLength);
if (!isDetached) {
changeLogReversions->Insert(position, deleteLength, 1);
}
}
Check();
}
Sci::Position ChangeHistory::Length() const noexcept {
return changeLog.Length();
}
void ChangeHistory::SetEpoch(int epoch) noexcept {
historicEpoch = epoch;
}
void ChangeHistory::EditionCreateHistory(Sci::Position start, Sci::Position length) {
if (start <= changeLog.Length()) {
if (length) {
changeLog.insertEdition.FillRange(start, historicEpoch, length);
} else {
changeLog.PushDeletionAt(start, historicEpoch);
}
}
}
// Editions:
// <0 History
// 0 Original unchanged
// 1 Reverted to origin
// 2 Saved
// 3 Unsaved
// 4 Reverted to change
int ChangeHistory::EditionAt(Sci::Position pos) const noexcept {
const int edition = changeLog.insertEdition.ValueAt(pos);
if (changeLogReversions) {
const int editionReversion = changeLogReversions->insertEdition.ValueAt(pos);
if (editionReversion) {
if (edition < 0)
return 1;
return edition ? 4 : 1;
}
}
return edition;
}
Sci::Position ChangeHistory::EditionEndRun(Sci::Position pos) const noexcept {
if (changeLogReversions) {
assert(changeLogReversions->Length() == changeLog.Length());
const Sci::Position nextReversion = changeLogReversions->insertEdition.EndRun(pos);
const Sci::Position next = changeLog.insertEdition.EndRun(pos);
return std::min(next, nextReversion);
}
return changeLog.insertEdition.EndRun(pos);
}
// Produce a 4-bit value from the deletions at a position
unsigned int ChangeHistory::EditionDeletesAt(Sci::Position pos) const noexcept {
unsigned int editionSet = 0;
const EditionSetOwned &editionSetDeletions = changeLog.deleteEdition.ValueAt(pos);
if (editionSetDeletions) {
for (const unsigned int ed : *editionSetDeletions) {
editionSet = editionSet | (1u << (ed-1));
}
}
if (changeLogReversions) {
const EditionSetOwned &editionSetReversions = changeLogReversions->deleteEdition.ValueAt(pos);
if (editionSetReversions) {
// If there is no saved or modified -> revertedToOrigin
if (!(editionSet & (bitSaved | bitModified))) {
editionSet = editionSet | bitRevertedToOriginal;
} else {
editionSet = editionSet | bitRevertedToModified;
}
}
}
return editionSet;
}
Sci::Position ChangeHistory::EditionNextDelete(Sci::Position pos) const noexcept {
const Sci::Position next = changeLog.deleteEdition.PositionNext(pos);
if (changeLogReversions) {
const Sci::Position nextReversion = changeLogReversions->deleteEdition.PositionNext(pos);
return std::min(next, nextReversion);
}
return next;
}
size_t ChangeHistory::DeletionCount(Sci::Position start, Sci::Position length) const noexcept {
return changeLog.DeletionCount(start, length);
}
EditionSet ChangeHistory::DeletionsAt(Sci::Position pos) const {
const EditionSetOwned &editions = changeLog.deleteEdition.ValueAt(pos);
if (editions) {
return *editions;
}
return {};
}
void ChangeHistory::Check() noexcept {
changeLog.Check();
if (changeLogReversions) {
changeLogReversions->Check();
assert(changeLogReversions->Length() == changeLog.Length());
}
}
}

View File

@ -0,0 +1,112 @@
// Scintilla source code edit control
/** @file ChangeHistory.h
** Manages a history of changes in a document.
**/
// Copyright 2022 by Neil Hodgson <neilh@scintilla.org>
// The License.txt file describes the conditions under which this software may be distributed.
#ifndef CHANGEHISTORY_H
#define CHANGEHISTORY_H
namespace Scintilla::Internal {
constexpr int changeOriginal = 0;
constexpr int changeRevertedOriginal = 1;
constexpr int changeSaved = 2;
constexpr int changeModified = 3;
constexpr int changeRevertedToChange = 4;
// As bit flags
constexpr unsigned int bitRevertedToOriginal = 1;
constexpr unsigned int bitSaved = 2;
constexpr unsigned int bitModified = 4;
constexpr unsigned int bitRevertedToModified = 8;
struct InsertionSpan {
Sci::Position start;
Sci::Position length;
int edition;
enum class Direction { insertion, deletion } direction;
};
using EditionSet = std::vector<int>;
using EditionSetOwned = std::unique_ptr<EditionSet>;
class ChangeStack {
std::vector<size_t> steps;
std::vector<InsertionSpan> insertions;
public:
void Clear() noexcept;
void AddStep();
void PushDeletion(Sci::Position positionDeletion, int edition);
void PushInsertion(Sci::Position positionInsertion, Sci::Position length, int edition);
[[nodiscard]] size_t PopStep() noexcept;
[[nodiscard]] InsertionSpan PopSpan() noexcept;
void SetSavePoint() noexcept;
};
struct ChangeLog {
ChangeStack changeStack;
RunStyles<Sci::Position, int> insertEdition;
SparseVector<EditionSetOwned> deleteEdition;
void Clear(Sci::Position length);
void InsertSpace(Sci::Position position, Sci::Position insertLength);
void DeleteRange(Sci::Position position, Sci::Position deleteLength);
void Insert(Sci::Position start, Sci::Position length, int edition);
void CollapseRange(Sci::Position position, Sci::Position deleteLength);
void PushDeletionAt(Sci::Position position, int edition);
void InsertFrontDeletionAt(Sci::Position position, int edition);
void SaveRange(Sci::Position position, Sci::Position length);
void PopDeletion(Sci::Position position, Sci::Position deleteLength);
void SaveHistoryForDelete(Sci::Position position, Sci::Position deleteLength);
void DeleteRangeSavingHistory(Sci::Position position, Sci::Position deleteLength);
void SetSavePoint();
Sci::Position Length() const noexcept;
[[nodiscard]] size_t DeletionCount(Sci::Position start, Sci::Position length) const noexcept;
void Check() const noexcept;
};
enum class ReversionState { clear, reverting, detached };
class ChangeHistory {
ChangeLog changeLog;
std::unique_ptr<ChangeLog> changeLogReversions;
int historicEpoch = -1;
public:
ChangeHistory(Sci::Position length=0);
void Insert(Sci::Position position, Sci::Position insertLength, bool collectingUndo, bool beforeSave);
void DeleteRange(Sci::Position position, Sci::Position deleteLength, bool reverting);
void DeleteRangeSavingHistory(Sci::Position position, Sci::Position deleteLength, bool beforeSave, bool isDetached);
void StartReversion();
void EndReversion() noexcept;
void SetSavePoint();
void UndoDeleteStep(Sci::Position position, Sci::Position deleteLength, bool isDetached);
[[nodiscard]] Sci::Position Length() const noexcept;
// Setting up history before this session
void SetEpoch(int epoch) noexcept;
void EditionCreateHistory(Sci::Position start, Sci::Position length);
// Queries for drawing
[[nodiscard]] int EditionAt(Sci::Position pos) const noexcept;
[[nodiscard]] Sci::Position EditionEndRun(Sci::Position pos) const noexcept;
[[nodiscard]] unsigned int EditionDeletesAt(Sci::Position pos) const noexcept;
[[nodiscard]] Sci::Position EditionNextDelete(Sci::Position pos) const noexcept;
// Testing - not used by Scintilla
[[nodiscard]] size_t DeletionCount(Sci::Position start, Sci::Position length) const noexcept;
EditionSet DeletionsAt(Sci::Position pos) const;
void Check() noexcept;
};
}
#endif

View File

@ -51,14 +51,14 @@ class ContractionState final : public IContractionState {
void InsertLine(Sci::Line lineDoc);
void DeleteLine(Sci::Line lineDoc);
// line_cast(): cast Sci::Line to either 32-bit or 64-bit value
// This avoids warnings from Visual C++ Code Analysis and shortens code
static constexpr LINE line_cast(Sci::Line line) noexcept {
return static_cast<LINE>(line);
}
public:
ContractionState() noexcept;
// Deleted so ContractionState objects can not be copied.
ContractionState(const ContractionState &) = delete;
void operator=(const ContractionState &) = delete;
ContractionState(ContractionState &&) = delete;
void operator=(ContractionState &&) = delete;
~ContractionState() override;
void Clear() noexcept override;
@ -80,6 +80,7 @@ public:
bool GetExpanded(Sci::Line lineDoc) const noexcept override;
bool SetExpanded(Sci::Line lineDoc, bool isExpanded) override;
bool ExpandAll() override;
Sci::Line ContractedNext(Sci::Line lineDocStart) const noexcept override;
int GetHeight(Sci::Line lineDoc) const noexcept override;
@ -94,9 +95,6 @@ template <typename LINE>
ContractionState<LINE>::ContractionState() noexcept : linesInDocument(1) {
}
template <typename LINE>
ContractionState<LINE>::~ContractionState() = default;
template <typename LINE>
void ContractionState<LINE>::EnsureData() {
if (OneToOne()) {
@ -114,7 +112,7 @@ void ContractionState<LINE>::InsertLine(Sci::Line lineDoc) {
if (OneToOne()) {
linesInDocument++;
} else {
const LINE lineDocCast = static_cast<LINE>(lineDoc);
const LINE lineDocCast = line_cast(lineDoc);
visible->InsertSpace(lineDocCast, 1);
visible->SetValueAt(lineDocCast, 1);
expanded->InsertSpace(lineDocCast, 1);
@ -124,7 +122,7 @@ void ContractionState<LINE>::InsertLine(Sci::Line lineDoc) {
foldDisplayTexts->InsertSpace(lineDocCast, 1);
foldDisplayTexts->SetValueAt(lineDocCast, nullptr);
const Sci::Line lineDisplay = DisplayFromDoc(lineDoc);
displayLines->InsertPartition(lineDocCast, static_cast<LINE>(lineDisplay));
displayLines->InsertPartition(lineDocCast, line_cast(lineDisplay));
displayLines->InsertText(lineDocCast, 1);
}
}
@ -134,7 +132,7 @@ void ContractionState<LINE>::DeleteLine(Sci::Line lineDoc) {
if (OneToOne()) {
linesInDocument--;
} else {
const LINE lineDocCast = static_cast<LINE>(lineDoc);
const LINE lineDocCast = line_cast(lineDoc);
if (GetVisible(lineDoc)) {
displayLines->InsertText(lineDocCast, -heights->ValueAt(lineDocCast));
}
@ -170,7 +168,7 @@ Sci::Line ContractionState<LINE>::LinesDisplayed() const noexcept {
if (OneToOne()) {
return linesInDocument;
} else {
return displayLines->PositionFromPartition(static_cast<LINE>(LinesInDoc()));
return displayLines->PositionFromPartition(line_cast(LinesInDoc()));
}
}
@ -181,7 +179,7 @@ Sci::Line ContractionState<LINE>::DisplayFromDoc(Sci::Line lineDoc) const noexce
} else {
if (lineDoc > displayLines->Partitions())
lineDoc = displayLines->Partitions();
return displayLines->PositionFromPartition(static_cast<LINE>(lineDoc));
return displayLines->PositionFromPartition(line_cast(lineDoc));
}
}
@ -199,9 +197,9 @@ Sci::Line ContractionState<LINE>::DocFromDisplay(Sci::Line lineDisplay) const no
return 0;
}
if (lineDisplay > LinesDisplayed()) {
return displayLines->PartitionFromPosition(static_cast<LINE>(LinesDisplayed()));
return displayLines->PartitionFromPosition(line_cast(LinesDisplayed()));
}
const Sci::Line lineDoc = displayLines->PartitionFromPosition(static_cast<LINE>(lineDisplay));
const Sci::Line lineDoc = displayLines->PartitionFromPosition(line_cast(lineDisplay));
PLATFORM_ASSERT(GetVisible(lineDoc));
return lineDoc;
}
@ -210,7 +208,7 @@ Sci::Line ContractionState<LINE>::DocFromDisplay(Sci::Line lineDisplay) const no
template <typename LINE>
void ContractionState<LINE>::InsertLines(Sci::Line lineDoc, Sci::Line lineCount) {
if (OneToOne()) {
linesInDocument += static_cast<LINE>(lineCount);
linesInDocument += line_cast(lineCount);
} else {
for (Sci::Line l = 0; l < lineCount; l++) {
InsertLine(lineDoc + l);
@ -222,7 +220,7 @@ void ContractionState<LINE>::InsertLines(Sci::Line lineDoc, Sci::Line lineCount)
template <typename LINE>
void ContractionState<LINE>::DeleteLines(Sci::Line lineDoc, Sci::Line lineCount) {
if (OneToOne()) {
linesInDocument -= static_cast<LINE>(lineCount);
linesInDocument -= line_cast(lineCount);
} else {
for (Sci::Line l = 0; l < lineCount; l++) {
DeleteLine(lineDoc);
@ -238,7 +236,7 @@ bool ContractionState<LINE>::GetVisible(Sci::Line lineDoc) const noexcept {
} else {
if (lineDoc >= visible->Length())
return true;
return visible->ValueAt(static_cast<LINE>(lineDoc)) == 1;
return visible->ValueAt(line_cast(lineDoc)) == 1;
}
}
@ -248,23 +246,26 @@ bool ContractionState<LINE>::SetVisible(Sci::Line lineDocStart, Sci::Line lineDo
return false;
} else {
EnsureData();
Sci::Line delta = 0;
Check();
if ((lineDocStart <= lineDocEnd) && (lineDocStart >= 0) && (lineDocEnd < LinesInDoc())) {
bool changed = false;
for (Sci::Line line = lineDocStart; line <= lineDocEnd; line++) {
if (GetVisible(line) != isVisible) {
const int heightLine = heights->ValueAt(static_cast<LINE>(line));
changed = true;
const int heightLine = heights->ValueAt(line_cast(line));
const int difference = isVisible ? heightLine : -heightLine;
visible->SetValueAt(static_cast<LINE>(line), isVisible ? 1 : 0);
displayLines->InsertText(static_cast<LINE>(line), difference);
delta += difference;
displayLines->InsertText(line_cast(line), difference);
}
}
if (changed) {
visible->FillRange(line_cast(lineDocStart), isVisible ? 1 : 0,
line_cast(lineDocEnd - lineDocStart) + 1);
}
Check();
return changed;
} else {
return false;
}
Check();
return delta != 0;
}
}
@ -304,7 +305,7 @@ bool ContractionState<LINE>::GetExpanded(Sci::Line lineDoc) const noexcept {
return true;
} else {
Check();
return expanded->ValueAt(static_cast<LINE>(lineDoc)) == 1;
return expanded->ValueAt(line_cast(lineDoc)) == 1;
}
}
@ -314,8 +315,8 @@ bool ContractionState<LINE>::SetExpanded(Sci::Line lineDoc, bool isExpanded) {
return false;
} else {
EnsureData();
if (isExpanded != (expanded->ValueAt(static_cast<LINE>(lineDoc)) == 1)) {
expanded->SetValueAt(static_cast<LINE>(lineDoc), isExpanded ? 1 : 0);
if (isExpanded != (expanded->ValueAt(line_cast(lineDoc)) == 1)) {
expanded->SetValueAt(line_cast(lineDoc), isExpanded ? 1 : 0);
Check();
return true;
} else {
@ -325,16 +326,28 @@ bool ContractionState<LINE>::SetExpanded(Sci::Line lineDoc, bool isExpanded) {
}
}
template <typename LINE>
bool ContractionState<LINE>::ExpandAll() {
if (OneToOne()) {
return false;
} else {
const LINE lines = expanded->Length();
const bool changed = expanded->FillRange(0, 1, lines).changed;
Check();
return changed;
}
}
template <typename LINE>
Sci::Line ContractionState<LINE>::ContractedNext(Sci::Line lineDocStart) const noexcept {
if (OneToOne()) {
return -1;
} else {
Check();
if (!expanded->ValueAt(static_cast<LINE>(lineDocStart))) {
if (!expanded->ValueAt(line_cast(lineDocStart))) {
return lineDocStart;
} else {
const Sci::Line lineDocNextChange = expanded->EndRun(static_cast<LINE>(lineDocStart));
const Sci::Line lineDocNextChange = expanded->EndRun(line_cast(lineDocStart));
if (lineDocNextChange < LinesInDoc())
return lineDocNextChange;
else
@ -348,7 +361,7 @@ int ContractionState<LINE>::GetHeight(Sci::Line lineDoc) const noexcept {
if (OneToOne()) {
return 1;
} else {
return heights->ValueAt(static_cast<LINE>(lineDoc));
return heights->ValueAt(line_cast(lineDoc));
}
}
@ -362,9 +375,9 @@ bool ContractionState<LINE>::SetHeight(Sci::Line lineDoc, int height) {
EnsureData();
if (GetHeight(lineDoc) != height) {
if (GetVisible(lineDoc)) {
displayLines->InsertText(static_cast<LINE>(lineDoc), height - GetHeight(lineDoc));
displayLines->InsertText(line_cast(lineDoc), height - GetHeight(lineDoc));
}
heights->SetValueAt(static_cast<LINE>(lineDoc), height);
heights->SetValueAt(line_cast(lineDoc), height);
Check();
return true;
} else {
@ -378,7 +391,7 @@ bool ContractionState<LINE>::SetHeight(Sci::Line lineDoc, int height) {
template <typename LINE>
void ContractionState<LINE>::ShowAll() noexcept {
const LINE lines = static_cast<LINE>(LinesInDoc());
const LINE lines = line_cast(LinesInDoc());
Clear();
linesInDocument = lines;
}

View File

@ -36,6 +36,7 @@ public:
virtual bool GetExpanded(Sci::Line lineDoc) const noexcept=0;
virtual bool SetExpanded(Sci::Line lineDoc, bool isExpanded)=0;
virtual bool ExpandAll()=0;
virtual Sci::Line ContractedNext(Sci::Line lineDocStart) const noexcept =0;
virtual int GetHeight(Sci::Line lineDoc) const noexcept=0;

View File

@ -34,6 +34,13 @@ namespace {
template <typename POS>
class Decoration : public IDecoration {
int indicator;
// pos_cast(): cast Sci::Position to either 32-bit or 64-bit value
// This avoids warnings from Visual C++ Code Analysis and shortens code
static constexpr POS pos_cast(Sci::Position pos) noexcept {
return static_cast<POS>(pos);
}
public:
RunStyles<POS, int> rs;
@ -50,19 +57,19 @@ public:
return rs.Length();
}
int ValueAt(Sci::Position position) const noexcept override {
return rs.ValueAt(static_cast<POS>(position));
return rs.ValueAt(pos_cast(position));
}
Sci::Position StartRun(Sci::Position position) const noexcept override {
return rs.StartRun(static_cast<POS>(position));
return rs.StartRun(pos_cast(position));
}
Sci::Position EndRun(Sci::Position position) const noexcept override {
return rs.EndRun(static_cast<POS>(position));
return rs.EndRun(pos_cast(position));
}
void SetValueAt(Sci::Position position, int value) override {
rs.SetValueAt(static_cast<POS>(position), value);
rs.SetValueAt(pos_cast(position), value);
}
void InsertSpace(Sci::Position position, Sci::Position insertLength) override {
rs.InsertSpace(static_cast<POS>(position), static_cast<POS>(insertLength));
rs.InsertSpace(pos_cast(position), pos_cast(insertLength));
}
Sci::Position Runs() const noexcept override {
return rs.Runs();
@ -85,6 +92,13 @@ class DecorationList : public IDecorationList {
void Delete(int indicator);
void DeleteAnyEmpty();
void SetView();
// pos_cast(): cast Sci::Position to either 32-bit or 64-bit value
// This avoids warnings from Visual C++ Code Analysis and shortens code
static constexpr POS pos_cast(Sci::Position pos) noexcept {
return static_cast<POS>(pos);
}
public:
DecorationList();
@ -96,7 +110,7 @@ public:
void SetCurrentIndicator(int indicator) override;
int GetCurrentIndicator() const noexcept override { return currentIndicator; }
void SetCurrentValue(int value) override;
void SetCurrentValue(int value) noexcept override;
int GetCurrentValue() const noexcept override { return currentValue; }
// Returns changed=true if some values may have changed
@ -139,7 +153,7 @@ template <typename POS>
Decoration<POS> *DecorationList<POS>::Create(int indicator, Sci::Position length) {
currentIndicator = indicator;
std::unique_ptr<Decoration<POS>> decoNew = std::make_unique<Decoration<POS>>(indicator);
decoNew->rs.InsertSpace(0, static_cast<POS>(length));
decoNew->rs.InsertSpace(0, pos_cast(length));
typename std::vector<std::unique_ptr<Decoration<POS>>>::iterator it = std::lower_bound(
decorationList.begin(), decorationList.end(), decoNew,
@ -172,7 +186,7 @@ void DecorationList<POS>::SetCurrentIndicator(int indicator) {
}
template <typename POS>
void DecorationList<POS>::SetCurrentValue(int value) {
void DecorationList<POS>::SetCurrentValue(int value) noexcept {
currentValue = value ? value : 1;
}
@ -185,9 +199,9 @@ FillResult<Sci::Position> DecorationList<POS>::FillRange(Sci::Position position,
}
}
// Converting result from POS to Sci::Position as callers not polymorphic.
const FillResult<POS> frInPOS = current->rs.FillRange(static_cast<POS>(position), value, static_cast<POS>(fillLength));
const FillResult<POS> frInPOS = current->rs.FillRange(pos_cast(position), value, pos_cast(fillLength));
const FillResult<Sci::Position> fr { frInPOS.changed, frInPOS.position, frInPOS.fillLength };
if (current->Empty()) {
if (current->Empty()) {
Delete(currentIndicator);
}
return fr;
@ -198,9 +212,9 @@ void DecorationList<POS>::InsertSpace(Sci::Position position, Sci::Position inse
const bool atEnd = position == lengthDocument;
lengthDocument += insertLength;
for (const std::unique_ptr<Decoration<POS>> &deco : decorationList) {
deco->rs.InsertSpace(static_cast<POS>(position), static_cast<POS>(insertLength));
deco->rs.InsertSpace(pos_cast(position), pos_cast(insertLength));
if (atEnd) {
deco->rs.FillRange(static_cast<POS>(position), 0, static_cast<POS>(insertLength));
deco->rs.FillRange(pos_cast(position), 0, pos_cast(insertLength));
}
}
}
@ -209,7 +223,7 @@ template <typename POS>
void DecorationList<POS>::DeleteRange(Sci::Position position, Sci::Position deleteLength) {
lengthDocument -= deleteLength;
for (const std::unique_ptr<Decoration<POS>> &deco : decorationList) {
deco->rs.DeleteRange(static_cast<POS>(position), static_cast<POS>(deleteLength));
deco->rs.DeleteRange(pos_cast(position), pos_cast(deleteLength));
}
DeleteAnyEmpty();
if (decorationList.size() != decorationView.size()) {
@ -253,7 +267,7 @@ template <typename POS>
int DecorationList<POS>::AllOnFor(Sci::Position position) const noexcept {
int mask = 0;
for (const std::unique_ptr<Decoration<POS>> &deco : decorationList) {
if (deco->rs.ValueAt(static_cast<POS>(position))) {
if (deco->rs.ValueAt(pos_cast(position))) {
if (deco->Indicator() < static_cast<int>(Scintilla::IndicatorNumbers::Ime)) {
mask |= 1u << deco->Indicator();
}
@ -266,7 +280,7 @@ template <typename POS>
int DecorationList<POS>::ValueAt(int indicator, Sci::Position position) noexcept {
const Decoration<POS> *deco = DecorationFromIndicator(indicator);
if (deco) {
return deco->rs.ValueAt(static_cast<POS>(position));
return deco->rs.ValueAt(pos_cast(position));
}
return 0;
}
@ -275,7 +289,7 @@ template <typename POS>
Sci::Position DecorationList<POS>::Start(int indicator, Sci::Position position) noexcept {
const Decoration<POS> *deco = DecorationFromIndicator(indicator);
if (deco) {
return deco->rs.StartRun(static_cast<POS>(position));
return deco->rs.StartRun(pos_cast(position));
}
return 0;
}
@ -284,7 +298,7 @@ template <typename POS>
Sci::Position DecorationList<POS>::End(int indicator, Sci::Position position) noexcept {
const Decoration<POS> *deco = DecorationFromIndicator(indicator);
if (deco) {
return deco->rs.EndRun(static_cast<POS>(position));
return deco->rs.EndRun(pos_cast(position));
}
return 0;
}

View File

@ -32,7 +32,7 @@ public:
virtual void SetCurrentIndicator(int indicator) = 0;
virtual int GetCurrentIndicator() const noexcept = 0;
virtual void SetCurrentValue(int value) = 0;
virtual void SetCurrentValue(int value) noexcept = 0;
virtual int GetCurrentValue() const noexcept = 0;
// Returns with changed=true if some values may have changed

View File

@ -339,8 +339,32 @@ void Document::TentativeUndo() {
}
}
int Document::GetMark(Sci::Line line) const noexcept {
return Markers()->MarkValue(line);
int Document::GetMark(Sci::Line line, bool includeChangeHistory) const {
int marksHistory = 0;
if (includeChangeHistory && (line < LinesTotal())) {
int marksEdition = 0;
const Sci::Position start = LineStart(line);
const Sci::Position lineNext = LineStart(line + 1);
for (Sci::Position position = start; position < lineNext;) {
const int edition = EditionAt(position);
if (edition) {
marksEdition |= 1 << (edition-1);
}
position = EditionEndRun(position);
}
const Sci::Position lineEnd = LineEnd(line);
for (Sci::Position position = start; position <= lineEnd;) {
marksEdition |= EditionDeletesAt(position);
position = EditionNextDelete(position);
}
/* Bits: RevertedToOrigin, Saved, Modified, RevertedToModified */
constexpr unsigned int editionShift = static_cast<unsigned int>(MarkerOutline::HistoryRevertedToOrigin);
marksHistory = marksEdition << editionShift;
}
return marksHistory | Markers()->MarkValue(line);
}
Sci::Line Document::MarkerNext(Sci::Line lineStart, int mask) const noexcept {
@ -348,7 +372,7 @@ Sci::Line Document::MarkerNext(Sci::Line lineStart, int mask) const noexcept {
}
int Document::AddMark(Sci::Line line, int markerNum) {
if (line >= 0 && line <= LinesTotal()) {
if (line >= 0 && line < LinesTotal()) {
const int prev = Markers()->AddMark(line, markerNum, LinesTotal());
const DocModification mh(ModificationFlags::ChangeMarker, LineStart(line), 0, 0, nullptr, line);
NotifyModified(mh);
@ -359,7 +383,7 @@ int Document::AddMark(Sci::Line line, int markerNum) {
}
void Document::AddMarkSet(Sci::Line line, int valueSet) {
if (line < 0 || line > LinesTotal()) {
if (line < 0 || line >= LinesTotal()) {
return;
}
unsigned int m = valueSet;
@ -2424,7 +2448,7 @@ void Document::SetLexInterface(std::unique_ptr<LexInterface> pLexInterface) noex
}
int SCI_METHOD Document::SetLineState(Sci_Position line, int state) {
const int statePrevious = States()->SetLineState(line, state);
const int statePrevious = States()->SetLineState(line, state, LinesTotal());
if (state != statePrevious) {
const DocModification mh(ModificationFlags::ChangeLineState, LineStart(line), 0, 0, nullptr,
static_cast<Sci::Line>(line));
@ -3162,6 +3186,10 @@ Sci::Position Cxx11RegexFindText(const Document *doc, Sci::Position minPos, Sci:
if (!caseSensitive)
flagsRe = flagsRe | std::regex::icase;
#if defined(REGEX_MULTILINE) && !defined(_MSC_VER)
flagsRe = flagsRe | std::regex::multiline;
#endif
// Clear the RESearch so can fill in matches
search.Clear();

View File

@ -383,6 +383,12 @@ public:
void TentativeUndo();
bool TentativeActive() const noexcept { return cb.TentativeActive(); }
void ChangeHistorySet(bool set) { cb.ChangeHistorySet(set); }
[[nodiscard]] int EditionAt(Sci::Position pos) const noexcept { return cb.EditionAt(pos); }
[[nodiscard]] Sci::Position EditionEndRun(Sci::Position pos) const noexcept { return cb.EditionEndRun(pos); }
[[nodiscard]] unsigned int EditionDeletesAt(Sci::Position pos) const noexcept { return cb.EditionDeletesAt(pos); }
[[nodiscard]] Sci::Position EditionNextDelete(Sci::Position pos) const noexcept { return cb.EditionNextDelete(pos); }
const char * SCI_METHOD BufferPointer() override { return cb.BufferPointer(); }
const char *RangePointer(Sci::Position position, Sci::Position rangeLength) noexcept { return cb.RangePointer(position, rangeLength); }
Sci::Position GapPosition() const noexcept { return cb.GapPosition(); }
@ -414,7 +420,7 @@ public:
void GetStyleRange(unsigned char *buffer, Sci::Position position, Sci::Position lengthRetrieve) const {
cb.GetStyleRange(buffer, position, lengthRetrieve);
}
int GetMark(Sci::Line line) const noexcept;
int GetMark(Sci::Line line, bool includeChangeHistory) const;
Sci::Line MarkerNext(Sci::Line lineStart, int mask) const noexcept;
int AddMark(Sci::Line line, int markerNum);
void AddMarkSet(Sci::Line line, int valueSet);

View File

@ -126,3 +126,7 @@ InSelection EditModel::LineEndInSelection(Sci::Line lineDoc) const {
const Sci::Position posAfterLineEnd = pdoc->LineStart(lineDoc + 1);
return sel.InSelectionForEOL(posAfterLineEnd);
}
int EditModel::GetMark(Sci::Line line) const {
return pdoc->GetMark(line, FlagSet(changeHistoryOption, ChangeHistoryOption::Markers));
}

View File

@ -49,6 +49,8 @@ public:
bool hotspotSingleLine;
Sci::Position hoverIndicatorPos;
Scintilla::ChangeHistoryOption changeHistoryOption = Scintilla::ChangeHistoryOption::Disabled;
// Wrapping support
int wrapWidth;
@ -61,7 +63,7 @@ public:
EditModel &operator=(const EditModel &) = delete;
EditModel &operator=(EditModel &&) = delete;
virtual ~EditModel();
virtual Sci::Line TopLineOfMain() const = 0;
virtual Sci::Line TopLineOfMain() const noexcept = 0;
virtual Point GetVisibleOriginInMain() const = 0;
virtual Sci::Line LinesOnScreen() const = 0;
bool BidirectionalEnabled() const noexcept;
@ -71,6 +73,7 @@ public:
const char *GetDefaultFoldDisplayText() const noexcept;
const char *GetFoldDisplayText(Sci::Line lineDoc) const noexcept;
InSelection LineEndInSelection(Sci::Line lineDoc) const;
[[nodiscard]] int GetMark(Sci::Line line) const;
};
}

View File

@ -185,7 +185,6 @@ void Hexits(char *hexits, int ch) noexcept {
EditView::EditView() {
tabWidthMinimumPixels = 2; // needed for calculating tab stops for fractional proportional fonts
hideSelection = false;
drawOverstrikeCaret = true;
bufferedDraw = true;
phasesDraw = PhasesDraw::Two;
@ -537,7 +536,7 @@ void EditView::LayoutLine(const EditModel &model, Surface *surface, const ViewSt
segments.push_back(bfLayout.Next());
}
std::fill(&ll->positions[0], &ll->positions[numCharsInLine], 0.0f);
ll->ClearPositions();
if (!segments.empty()) {
@ -688,8 +687,7 @@ void EditView::LayoutLine(const EditModel &model, Surface *surface, const ViewSt
}
}
lastLineStart = lastGoodBreak;
ll->lines++;
ll->SetLineStart(ll->lines, static_cast<int>(lastLineStart));
ll->AddLineStart(lastLineStart);
startOffset = ll->positions[lastLineStart];
// take into account the space for start wrap mark and indent
startOffset += width - ll->wrapIndent;
@ -713,7 +711,7 @@ void EditView::UpdateBidiData(const EditModel &model, const ViewStyle &vstyle, L
ll->bidiData->stylesFonts[ll->numCharsInLine].reset();
for (int charsInLine = 0; charsInLine < ll->numCharsInLine; charsInLine++) {
const int charWidth = UTF8DrawBytes(reinterpret_cast<unsigned char *>(&ll->chars[charsInLine]), ll->numCharsInLine - charsInLine);
const int charWidth = UTF8DrawBytes(&ll->chars[charsInLine], ll->numCharsInLine - charsInLine);
const Representation *repr = model.reprs.RepresentationFromCharacter(std::string_view(&ll->chars[charsInLine], charWidth));
ll->bidiData->widthReprs[charsInLine] = 0.0f;
@ -1076,7 +1074,7 @@ void EditView::DrawEOL(Surface *surface, const EditModel &model, const ViewStyle
rcSegment.right = xEol + xStart + virtualSpace;
const ColourRGBA backgroundFill = background.value_or(vsDraw.styles[ll->styles[ll->numCharsInLine]].back);
surface->FillRectangleAligned(rcSegment, backgroundFill);
if (!hideSelection && (vsDraw.selection.layer == Layer::Base)) {
if (vsDraw.selection.visible && (vsDraw.selection.layer == Layer::Base)) {
const SelectionSegment virtualSpaceRange(SelectionPosition(model.pdoc->LineEnd(line)),
SelectionPosition(model.pdoc->LineEnd(line),
model.sel.VirtualSpaceFor(model.pdoc->LineEnd(line))));
@ -1098,7 +1096,7 @@ void EditView::DrawEOL(Surface *surface, const EditModel &model, const ViewStyle
}
InSelection eolInSelection = InSelection::inNone;
if (!hideSelection && lastSubLine) {
if (vsDraw.selection.visible && lastSubLine) {
eolInSelection = model.LineEndInSelection(line);
}
@ -1240,14 +1238,13 @@ static void DrawIndicator(int indicNum, Sci::Position startPos, Sci::Position en
int value, bool bidiEnabled, int tabWidthMinimumPixels) {
const XYPOSITION subLineStart = ll->positions[ll->LineStart(subLine)];
const XYPOSITION horizontalOffset = xStart - subLineStart;
std::vector<PRectangle> rectangles;
const PRectangle rcIndic(
ll->positions[startPos] + xStart - subLineStart,
rcLine.top + vsDraw.maxAscent,
ll->positions[endPos] + xStart - subLineStart,
rcLine.top + vsDraw.maxAscent + 3);
const XYPOSITION left = ll->XInLine(startPos) + horizontalOffset;
const XYPOSITION right = ll->XInLine(endPos) + horizontalOffset;
const PRectangle rcIndic(left, rcLine.top + vsDraw.maxAscent, right, rcLine.top + vsDraw.maxAscent + 3);
if (bidiEnabled) {
ScreenLine screenLine(ll, subLine, vsDraw, rcLine.right - xStart, tabWidthMinimumPixels);
@ -1271,7 +1268,7 @@ static void DrawIndicator(int indicNum, Sci::Position startPos, Sci::Position en
// Allow full descent space for character indicators
rcFirstCharacter.bottom = rcLine.top + vsDraw.maxAscent + vsDraw.maxDescent;
if (secondCharacter >= 0) {
rcFirstCharacter.right = ll->positions[secondCharacter] + xStart - subLineStart;
rcFirstCharacter.right = ll->XInLine(secondCharacter) + horizontalOffset;
} else {
// Indicator continued from earlier line so make an empty box and don't draw
rcFirstCharacter.right = rcFirstCharacter.left;
@ -1290,24 +1287,20 @@ static void DrawIndicators(Surface *surface, const EditModel &model, const ViewS
for (const IDecoration *deco : model.pdoc->decorations->View()) {
if (under == vsDraw.indicators[deco->Indicator()].under) {
Sci::Position startPos = posLineStart + lineStart;
if (!deco->ValueAt(startPos)) {
startPos = deco->EndRun(startPos);
}
while ((startPos < posLineEnd) && (deco->ValueAt(startPos))) {
while (startPos < posLineEnd) {
const Range rangeRun(deco->StartRun(startPos), deco->EndRun(startPos));
const Sci::Position endPos = std::min(rangeRun.end, posLineEnd);
const bool hover = vsDraw.indicators[deco->Indicator()].IsDynamic() &&
rangeRun.ContainsCharacter(model.hoverIndicatorPos);
const int value = deco->ValueAt(startPos);
const Indicator::State state = hover ? Indicator::State::hover : Indicator::State::normal;
const Sci::Position posSecond = model.pdoc->MovePositionOutsideChar(rangeRun.First() + 1, 1);
DrawIndicator(deco->Indicator(), startPos - posLineStart, endPos - posLineStart,
surface, vsDraw, ll, xStart, rcLine, posSecond - posLineStart, subLine, state,
value, model.BidirectionalEnabled(), tabWidthMinimumPixels);
startPos = endPos;
if (!deco->ValueAt(startPos)) {
startPos = deco->EndRun(startPos);
if (value) {
const bool hover = vsDraw.indicators[deco->Indicator()].IsDynamic() &&
rangeRun.ContainsCharacter(model.hoverIndicatorPos);
const Indicator::State state = hover ? Indicator::State::hover : Indicator::State::normal;
const Sci::Position posSecond = model.pdoc->MovePositionOutsideChar(rangeRun.First() + 1, 1);
DrawIndicator(deco->Indicator(), startPos - posLineStart, endPos - posLineStart,
surface, vsDraw, ll, xStart, rcLine, posSecond - posLineStart, subLine, state,
value, model.BidirectionalEnabled(), tabWidthMinimumPixels);
}
startPos = endPos;
}
}
}
@ -1318,21 +1311,55 @@ static void DrawIndicators(Surface *surface, const EditModel &model, const ViewS
const int braceIndicator = (model.bracesMatchStyle == StyleBraceLight) ? vsDraw.braceHighlightIndicator : vsDraw.braceBadLightIndicator;
if (under == vsDraw.indicators[braceIndicator].under) {
const Range rangeLine(posLineStart + lineStart, posLineEnd);
if (rangeLine.ContainsCharacter(model.braces[0])) {
const Sci::Position braceOffset = model.braces[0] - posLineStart;
if (braceOffset < ll->numCharsInLine) {
const Sci::Position secondOffset = model.pdoc->MovePositionOutsideChar(model.braces[0] + 1, 1) - posLineStart;
DrawIndicator(braceIndicator, braceOffset, braceOffset + 1, surface, vsDraw, ll, xStart, rcLine, secondOffset,
subLine, Indicator::State::normal, 1, model.BidirectionalEnabled(), tabWidthMinimumPixels);
for (size_t brace = 0; brace <= 1; brace++) {
if (rangeLine.ContainsCharacter(model.braces[brace])) {
const Sci::Position braceOffset = model.braces[brace] - posLineStart;
if (braceOffset < ll->numCharsInLine) {
const Sci::Position braceEnd = model.pdoc->MovePositionOutsideChar(model.braces[brace] + 1, 1) - posLineStart;
DrawIndicator(braceIndicator, braceOffset, braceEnd,
surface, vsDraw, ll, xStart, rcLine, braceEnd, subLine, Indicator::State::normal,
1, model.BidirectionalEnabled(), tabWidthMinimumPixels);
}
}
}
if (rangeLine.ContainsCharacter(model.braces[1])) {
const Sci::Position braceOffset = model.braces[1] - posLineStart;
if (braceOffset < ll->numCharsInLine) {
const Sci::Position secondOffset = model.pdoc->MovePositionOutsideChar(model.braces[1] + 1, 1) - posLineStart;
DrawIndicator(braceIndicator, braceOffset, braceOffset + 1, surface, vsDraw, ll, xStart, rcLine, secondOffset,
subLine, Indicator::State::normal, 1, model.BidirectionalEnabled(), tabWidthMinimumPixels);
}
}
if (FlagSet(model.changeHistoryOption, ChangeHistoryOption::Indicators)) {
// Draw editions
constexpr int indexHistory = static_cast<int>(IndicatorNumbers::HistoryRevertedToOriginInsertion);
{
// Draw insertions
Sci::Position startPos = posLineStart + lineStart;
while (startPos < posLineEnd) {
const Range rangeRun(startPos, model.pdoc->EditionEndRun(startPos));
const Sci::Position endPos = std::min(rangeRun.end, posLineEnd);
const int edition = model.pdoc->EditionAt(startPos);
if (edition != 0) {
const int indicator = (edition - 1) * 2 + indexHistory;
const Sci::Position posSecond = model.pdoc->MovePositionOutsideChar(rangeRun.First() + 1, 1);
DrawIndicator(indicator, startPos - posLineStart, endPos - posLineStart,
surface, vsDraw, ll, xStart, rcLine, posSecond - posLineStart, subLine, Indicator::State::normal,
1, model.BidirectionalEnabled(), tabWidthMinimumPixels);
}
startPos = endPos;
}
}
{
// Draw deletions
Sci::Position startPos = posLineStart + lineStart;
while (startPos <= posLineEnd) {
const unsigned int editions = model.pdoc->EditionDeletesAt(startPos);
const Sci::Position posSecond = model.pdoc->MovePositionOutsideChar(startPos + 1, 1);
for (unsigned int edition=0; edition<4; edition++) {
if (editions & (1 << edition)) {
const int indicator = edition * 2 + indexHistory + 1;
DrawIndicator(indicator, startPos - posLineStart, posSecond - posLineStart,
surface, vsDraw, ll, xStart, rcLine, posSecond - posLineStart, subLine, Indicator::State::normal,
1, model.BidirectionalEnabled(), tabWidthMinimumPixels);
}
}
startPos = model.pdoc->EditionNextDelete(startPos);
}
}
}
@ -1354,7 +1381,7 @@ void EditView::DrawFoldDisplayText(Surface *surface, const EditModel &model, con
const int widthFoldDisplayText = static_cast<int>(surface->WidthText(fontText, foldDisplayText));
InSelection eolInSelection = InSelection::inNone;
if (!hideSelection) {
if (vsDraw.selection.visible) {
eolInSelection = model.LineEndInSelection(line);
}
@ -1364,7 +1391,7 @@ void EditView::DrawFoldDisplayText(Surface *surface, const EditModel &model, con
rcSegment.left = xStart + static_cast<XYPOSITION>(ll->positions[ll->numCharsInLine] - subLineStart) + virtualSpace + vsDraw.aveCharWidth;
rcSegment.right = rcSegment.left + static_cast<XYPOSITION>(widthFoldDisplayText);
const std::optional<ColourRGBA> background = vsDraw.Background(model.pdoc->GetMark(line), model.caret.active, ll->containsCaret);
const std::optional<ColourRGBA> background = vsDraw.Background(model.GetMark(line), model.caret.active, ll->containsCaret);
const std::optional<ColourRGBA> selectionFore = SelectionForeground(model, vsDraw, eolInSelection);
const ColourRGBA textFore = selectionFore.value_or(vsDraw.styles[StyleFoldDisplayText].fore);
const ColourRGBA textBack = TextBackground(model, vsDraw, ll, background, eolInSelection,
@ -1491,7 +1518,7 @@ void EditView::DrawEOLAnnotationText(Surface *surface, const EditModel &model, c
}
rcSegment.right = rcSegment.left + static_cast<XYPOSITION>(widthEOLAnnotationText);
const std::optional<ColourRGBA> background = vsDraw.Background(model.pdoc->GetMark(line), model.caret.active, ll->containsCaret);
const std::optional<ColourRGBA> background = vsDraw.Background(model.GetMark(line), model.caret.active, ll->containsCaret);
const ColourRGBA textFore = vsDraw.styles[style].fore;
const ColourRGBA textBack = TextBackground(model, vsDraw, ll, background, InSelection::inNone,
false, static_cast<int>(style), -1);
@ -1684,7 +1711,7 @@ void EditView::DrawCarets(Surface *surface, const EditModel &model, const ViewSt
Sci::Line lineDoc, int xStart, PRectangle rcLine, int subLine) const {
// When drag is active it is the only caret drawn
const bool drawDrag = model.posDrag.IsValid();
if (hideSelection && !drawDrag)
if (!vsDraw.selection.visible && !drawDrag)
return;
const Sci::Position posLineStart = model.pdoc->LineStart(lineDoc);
// For each selection draw
@ -1787,7 +1814,9 @@ void EditView::DrawCarets(Surface *surface, const EditModel &model, const ViewSt
}
}
static void DrawWrapIndentAndMarker(Surface *surface, const ViewStyle &vsDraw, const LineLayout *ll,
namespace {
void DrawWrapIndentAndMarker(Surface *surface, const ViewStyle &vsDraw, const LineLayout *ll,
int xStart, PRectangle rcLine, std::optional<ColourRGBA> background, DrawWrapMarkerFn customDrawWrapMarker,
bool caretActive) {
// default bgnd here..
@ -1827,7 +1856,7 @@ static void DrawWrapIndentAndMarker(Surface *surface, const ViewStyle &vsDraw, c
// such that, if the caret is inside the main selection, the beginning or end of that selection
// is at the end of a text segment.
// This function should only be called if iDoc is within the main selection.
static InSelection CharacterInCursesSelection(Sci::Position iDoc, const EditModel &model, const ViewStyle &vsDraw) {
InSelection CharacterInCursesSelection(Sci::Position iDoc, const EditModel &model, const ViewStyle &vsDraw) noexcept {
const SelectionPosition &posCaret = model.sel.RangeMain().caret;
const bool caretAtStart = posCaret < model.sel.RangeMain().anchor && posCaret.Position() == iDoc;
const bool caretAtEnd = posCaret > model.sel.RangeMain().anchor &&
@ -1836,6 +1865,8 @@ static InSelection CharacterInCursesSelection(Sci::Position iDoc, const EditMode
return (caretAtStart || caretAtEnd) ? InSelection::inNone : InSelection::inMain;
}
}
void EditView::DrawBackground(Surface *surface, const EditModel &model, const ViewStyle &vsDraw, const LineLayout *ll,
PRectangle rcLine, Range lineRange, Sci::Position posLineStart, int xStart,
int subLine, std::optional<ColourRGBA> background) const {
@ -1870,7 +1901,7 @@ void EditView::DrawBackground(Surface *surface, const EditModel &model, const Vi
if (rcSegment.right > rcLine.right)
rcSegment.right = rcLine.right;
InSelection inSelection = hideSelection ? InSelection::inNone : model.sel.CharacterInSelection(iDoc);
InSelection inSelection = vsDraw.selection.visible ? model.sel.CharacterInSelection(iDoc) : InSelection::inNone;
if (FlagSet(vsDraw.caret.style, CaretStyle::Curses) && (inSelection == InSelection::inMain))
inSelection = CharacterInCursesSelection(iDoc, model, vsDraw);
const bool inHotspot = model.hotspot.Valid() && model.hotspot.ContainsCharacter(iDoc);
@ -1942,7 +1973,7 @@ static void DrawEdgeLine(Surface *surface, const ViewStyle &vsDraw, const LineLa
// Draw underline mark as part of background if on base layer
static void DrawMarkUnderline(Surface *surface, const EditModel &model, const ViewStyle &vsDraw,
Sci::Line line, PRectangle rcLine) {
int marks = model.pdoc->GetMark(line);
int marks = model.GetMark(line);
for (int markBit = 0; (markBit < 32) && marks; markBit++) {
if ((marks & 1) && (vsDraw.markers[markBit].markType == MarkerSymbol::Underline) &&
(vsDraw.markers[markBit].layer == Layer::Base)) {
@ -2029,7 +2060,7 @@ static void DrawTranslucentLineState(Surface *surface, const EditModel &model, c
surface->FillRectangleAligned(rcLine, *vsDraw.ElementColour(Element::CaretLineBack));
}
}
const int marksOfLine = model.pdoc->GetMark(line);
const int marksOfLine = model.GetMark(line);
int marksDrawnInText = marksOfLine & vsDraw.maskDrawInText;
for (int markBit = 0; (markBit < 32) && marksDrawnInText; markBit++) {
if ((marksDrawnInText & 1) && (vsDraw.markers[markBit].layer == layer)) {
@ -2105,11 +2136,11 @@ void EditView::DrawForeground(Surface *surface, const EditModel &model, const Vi
hover = rangeRun.ContainsCharacter(model.hoverIndicatorPos);
}
if (hover) {
if (indicator.sacHover.style == IndicatorStyle::TextFore || (indicator.sacHover.style == IndicatorStyle::ExplorerLink)) {
if (indicator.sacHover.style == IndicatorStyle::TextFore) {
textFore = indicator.sacHover.fore;
}
} else {
if (indicator.sacNormal.style == IndicatorStyle::TextFore || (indicator.sacNormal.style == IndicatorStyle::ExplorerLink)) {
if (indicator.sacNormal.style == IndicatorStyle::TextFore) {
if (FlagSet(indicator.Flags(), IndicFlag::ValueFore))
textFore = ColourRGBA::FromRGB(indicatorValue & static_cast<int>(IndicValue::Mask));
else
@ -2119,7 +2150,7 @@ void EditView::DrawForeground(Surface *surface, const EditModel &model, const Vi
}
}
}
InSelection inSelection = hideSelection ? InSelection::inNone : model.sel.CharacterInSelection(iDoc);
InSelection inSelection = vsDraw.selection.visible ? model.sel.CharacterInSelection(iDoc) : InSelection::inNone;
if (FlagSet(vsDraw.caret.style, CaretStyle::Curses) && (inSelection == InSelection::inMain))
inSelection = CharacterInCursesSelection(iDoc, model, vsDraw);
const std::optional<ColourRGBA> selectionFore = SelectionForeground(model, vsDraw, inSelection);
@ -2319,7 +2350,7 @@ void EditView::DrawLine(Surface *surface, const EditModel &model, const ViewStyl
}
// See if something overrides the line background colour.
const std::optional<ColourRGBA> background = vsDraw.Background(model.pdoc->GetMark(line), model.caret.active, ll->containsCaret);
const std::optional<ColourRGBA> background = vsDraw.Background(model.GetMark(line), model.caret.active, ll->containsCaret);
const Sci::Position posLineStart = model.pdoc->LineStart(line);
@ -2357,7 +2388,7 @@ void EditView::DrawLine(Surface *surface, const EditModel &model, const ViewStyl
}
if (FlagSet(phase, DrawPhase::text)) {
if (!hideSelection) {
if (vsDraw.selection.visible) {
DrawTranslucentSelection(surface, model, vsDraw, ll, line, rcLine, subLine, lineRange, xStart, tabWidthMinimumPixels, Layer::UnderText);
}
DrawTranslucentLineState(surface, model, vsDraw, ll, line, rcLine, subLine, Layer::UnderText);
@ -2386,7 +2417,7 @@ void EditView::DrawLine(Surface *surface, const EditModel &model, const ViewStyl
DrawMarkUnderline(surface, model, vsDraw, line, rcLine);
}
if (!hideSelection && FlagSet(phase, DrawPhase::selectionTranslucent)) {
if (vsDraw.selection.visible && FlagSet(phase, DrawPhase::selectionTranslucent)) {
DrawTranslucentSelection(surface, model, vsDraw, ll, line, rcLine, subLine, lineRange, xStart, tabWidthMinimumPixels, Layer::OverText);
}
@ -2523,7 +2554,7 @@ void EditView::PaintText(Surface *surfaceWindow, const EditModel &model, PRectan
durLayout += ep.Duration(true);
#endif
if (ll) {
ll->containsCaret = !hideSelection && (lineDoc == lineCaret)
ll->containsCaret = vsDraw.selection.visible && (lineDoc == lineCaret)
&& (ll->lines == 1 || !vsDraw.caretLine.subLine || ll->InLine(caretOffset, subLine));
PRectangle rcLine = rcTextArea;
@ -2633,11 +2664,11 @@ void EditView::PaintText(Surface *surfaceWindow, const EditModel &model, PRectan
void EditView::FillLineRemainder(Surface *surface, const EditModel &model, const ViewStyle &vsDraw, const LineLayout *ll,
Sci::Line line, PRectangle rcArea, int subLine) const {
InSelection eolInSelection = InSelection::inNone;
if ((!hideSelection) && (subLine == (ll->lines - 1))) {
if (vsDraw.selection.visible && (subLine == (ll->lines - 1))) {
eolInSelection = model.LineEndInSelection(line);
}
const std::optional<ColourRGBA> background = vsDraw.Background(model.pdoc->GetMark(line), model.caret.active, ll->containsCaret);
const std::optional<ColourRGBA> background = vsDraw.Background(model.GetMark(line), model.caret.active, ll->containsCaret);
if (eolInSelection && vsDraw.selection.eolFilled && (line < model.pdoc->LinesTotal() - 1) && (vsDraw.selection.layer == Layer::Base)) {
surface->FillRectangleAligned(rcArea, Fill(SelectionBackground(model, vsDraw, eolInSelection).Opaque()));
@ -2696,14 +2727,9 @@ Sci::Position EditView::FormatRange(bool draw, CharacterRangeFull chrg, Rectangl
// If this ever gets changed, cached pixmap would need to be recreated if technology != Technology::Default
vsPrint.viewIndentationGuides = IndentView::None;
// Don't show the selection when printing
vsPrint.selection.visible = false;
vsPrint.elementColours.clear();
vsPrint.elementBaseColours.clear();
// Set all selection background colours to be transparent.
constexpr ColourRGBA transparent(0xc0, 0xc0, 0xc0, 0x0);
vsPrint.elementBaseColours[Element::SelectionBack] = transparent;
vsPrint.elementBaseColours[Element::SelectionAdditionalBack] = transparent;
vsPrint.elementBaseColours[Element::SelectionSecondaryBack] = transparent;
vsPrint.elementBaseColours[Element::SelectionInactiveBack] = transparent;
vsPrint.caretLine.alwaysShow = false;
// Don't highlight matching braces using indicators
vsPrint.braceHighlightIndicatorSet = false;

View File

@ -56,7 +56,6 @@ public:
std::unique_ptr<LineTabstops> ldTabstops;
int tabWidthMinimumPixels;
bool hideSelection;
bool drawOverstrikeCaret; // used by the curses platform
/** In bufferedDraw mode, graphics operations are drawn to a pixmap and then copied to

View File

@ -263,7 +263,7 @@ void Editor::DropGraphics() noexcept {
view.DropGraphics();
}
void Editor::InvalidateStyleData() {
void Editor::InvalidateStyleData() noexcept {
stylesValid = false;
vs.technology = technology;
DropGraphics();
@ -289,13 +289,17 @@ void Editor::RefreshStyleData() {
}
}
bool Editor::HasMarginWindow() const noexcept {
return wMargin.Created();
}
Point Editor::GetVisibleOriginInMain() const {
return Point(0, 0);
}
PointDocument Editor::DocumentPointFromView(Point ptView) const {
PointDocument ptDocument(ptView);
if (wMargin.GetID()) {
if (HasMarginWindow()) {
const Point ptOrigin = GetVisibleOriginInMain();
ptDocument.x += ptOrigin.x;
ptDocument.y += ptOrigin.y;
@ -306,8 +310,8 @@ PointDocument Editor::DocumentPointFromView(Point ptView) const {
return ptDocument;
}
Sci::Line Editor::TopLineOfMain() const {
if (wMargin.GetID())
Sci::Line Editor::TopLineOfMain() const noexcept {
if (HasMarginWindow())
return 0;
else
return topLine;
@ -432,7 +436,7 @@ Sci::Position Editor::PositionFromLineX(Sci::Line lineDoc, int x) {
return SPositionFromLineX(lineDoc, x).Position();
}
Sci::Line Editor::LineFromLocation(Point pt) const {
Sci::Line Editor::LineFromLocation(Point pt) const noexcept {
return pcs->DocFromDisplay(static_cast<int>(pt.y) / vs.lineHeight + topLine);
}
@ -485,7 +489,7 @@ void Editor::Redraw() {
//Platform::DebugPrintf("Redraw all\n");
const PRectangle rcClient = GetClientRectangle();
wMain.InvalidateRectangle(rcClient);
if (wMargin.GetID()) {
if (HasMarginWindow()) {
wMargin.InvalidateAll();
} else if (paintState == PaintState::notPainting) {
redrawPendingText = true;
@ -494,12 +498,12 @@ void Editor::Redraw() {
void Editor::RedrawSelMargin(Sci::Line line, bool allAfter) {
const bool markersInText = vs.maskInLine || vs.maskDrawInText;
if (!wMargin.GetID() || markersInText) { // May affect text area so may need to abandon and retry
if (!HasMarginWindow() || markersInText) { // May affect text area so may need to abandon and retry
if (AbandonPaint()) {
return;
}
}
if (wMargin.GetID() && markersInText) {
if (HasMarginWindow() && markersInText) {
Redraw();
return;
}
@ -532,7 +536,7 @@ void Editor::RedrawSelMargin(Sci::Line line, bool allAfter) {
if (rcMarkers.Empty())
return;
}
if (wMargin.GetID()) {
if (HasMarginWindow()) {
const Point ptOrigin = GetVisibleOriginInMain();
rcMarkers.Move(-ptOrigin.x, -ptOrigin.y);
wMargin.InvalidateRectangle(rcMarkers);
@ -570,7 +574,7 @@ void Editor::InvalidateRange(Sci::Position start, Sci::Position end) {
RedrawRect(RectangleFromRange(Range(start, end), view.LinesOverlap() ? vs.lineOverlap : 0));
}
Sci::Position Editor::CurrentPosition() const {
Sci::Position Editor::CurrentPosition() const noexcept {
return sel.MainCaret();
}
@ -578,11 +582,11 @@ bool Editor::SelectionEmpty() const noexcept {
return sel.Empty();
}
SelectionPosition Editor::SelectionStart() {
SelectionPosition Editor::SelectionStart() noexcept {
return sel.RangeMain().Start();
}
SelectionPosition Editor::SelectionEnd() {
SelectionPosition Editor::SelectionEnd() noexcept {
return sel.RangeMain().End();
}
@ -809,7 +813,7 @@ bool Editor::RangeContainsProtected(Sci::Position start, Sci::Position end) cons
return false;
}
bool Editor::SelectionContainsProtected() const {
bool Editor::SelectionContainsProtected() const noexcept {
for (size_t r=0; r<sel.Count(); r++) {
if (RangeContainsProtected(sel.Range(r).Start().Position(),
sel.Range(r).End().Position())) {
@ -1937,9 +1941,7 @@ SelectionPosition Editor::RealizeVirtualSpace(const SelectionPosition &position)
}
void Editor::AddChar(char ch) {
char s[2];
s[0] = ch;
s[1] = '\0';
const char s[1] {ch};
InsertCharacter(std::string_view(s, 1), CharacterSource::DirectInput);
}
@ -2356,15 +2358,6 @@ void Editor::DelCharBack(bool allowLineStartDeletion) {
ShowCaretAtCurrentPosition();
}
KeyMod Editor::ModifierFlags(bool shift, bool ctrl, bool alt, bool meta, bool super) noexcept {
return
(shift ? KeyMod::Shift : KeyMod::Norm) |
(ctrl ? KeyMod::Ctrl : KeyMod::Norm) |
(alt ? KeyMod::Alt : KeyMod::Norm) |
(meta ? KeyMod::Meta : KeyMod::Norm) |
(super ? KeyMod::Super : KeyMod::Norm);
}
void Editor::NotifyFocus(bool focus) {
NotificationData scn = {};
scn.nmhdr.code = focus ? Notification::FocusIn : Notification::FocusOut;
@ -2405,6 +2398,9 @@ void Editor::NotifySavePoint(bool isSavePoint) {
NotificationData scn = {};
if (isSavePoint) {
scn.nmhdr.code = Notification::SavePointReached;
if (changeHistoryOption != ChangeHistoryOption::Disabled) {
Redraw();
}
} else {
scn.nmhdr.code = Notification::SavePointLeft;
}
@ -2733,6 +2729,9 @@ void Editor::NotifyModified(Document *, DocModification mh, void *) {
QueueIdleWork(WorkItems::style, mh.position + mh.length);
}
InvalidateRange(mh.position, mh.position + mh.length);
if (FlagSet(changeHistoryOption, ChangeHistoryOption::Markers)) {
RedrawSelMargin(pdoc->SciLineFromPosition(mh.position));
}
}
}
}
@ -4174,7 +4173,7 @@ Sci::Position Editor::FindTextFull(
* while still setting the selection to found text so the find/select
* operation is self-contained.
*/
void Editor::SearchAnchor() {
void Editor::SearchAnchor() noexcept {
searchAnchor = SelectionStart().Position();
}
@ -4780,7 +4779,7 @@ void Editor::RightButtonDownWithModifiers(Point pt, unsigned int, KeyMod modifie
return;
}
bool Editor::PositionIsHotspot(Sci::Position position) const {
bool Editor::PositionIsHotspot(Sci::Position position) const noexcept {
return vs.styles[pdoc->StyleIndexAt(position)].hotspot;
}
@ -5267,7 +5266,7 @@ bool Editor::PaintContains(PRectangle rc) {
}
bool Editor::PaintContainsMargin() {
if (wMargin.GetID()) {
if (HasMarginWindow()) {
// With separate margin view, paint of text view
// never contains margin.
return false;
@ -5414,18 +5413,23 @@ void Editor::SetEOLAnnotationVisible(EOLAnnotationVisible visible) {
Sci::Line Editor::ExpandLine(Sci::Line line) {
const Sci::Line lineMaxSubord = pdoc->GetLastChild(line);
line++;
Sci::Line lineStart = line;
while (line <= lineMaxSubord) {
pcs->SetVisible(line, line, true);
const FoldLevel level = pdoc->GetFoldLevel(line);
if (LevelIsHeader(level)) {
pcs->SetVisible(lineStart, line, true);
if (pcs->GetExpanded(line)) {
line = ExpandLine(line);
} else {
line = pdoc->GetLastChild(line);
}
lineStart = line + 1;
}
line++;
}
if (lineStart <= lineMaxSubord) {
pcs->SetVisible(lineStart, lineMaxSubord, true);
}
return lineMaxSubord;
}
@ -5573,35 +5577,40 @@ void Editor::EnsureLineVisible(Sci::Line lineDoc, bool enforcePolicy) {
void Editor::FoldAll(FoldAction action) {
const Sci::Line maxLine = pdoc->LinesTotal();
const bool contractAll = FlagSet(action, FoldAction::ContractEveryLevel);
action = static_cast<FoldAction>(static_cast<int>(action) & ~static_cast<int>(FoldAction::ContractEveryLevel));
bool expanding = action == FoldAction::Expand;
if (!expanding) {
pdoc->EnsureStyledTo(pdoc->Length());
}
Sci::Line line = 0;
if (action == FoldAction::Toggle) {
// Discover current state
for (Sci::Line lineSeek = 0; lineSeek < maxLine; lineSeek++) {
if (LevelIsHeader(pdoc->GetFoldLevel(lineSeek))) {
expanding = !pcs->GetExpanded(lineSeek);
for (; line < maxLine; line++) {
if (LevelIsHeader(pdoc->GetFoldLevel(line))) {
expanding = !pcs->GetExpanded(line);
break;
}
}
}
if (expanding) {
pcs->SetVisible(0, maxLine-1, true);
for (Sci::Line line = 0; line < maxLine; line++) {
if (!pcs->GetExpanded(line)) {
SetFoldExpanded(line, true);
}
}
pcs->ExpandAll();
} else {
for (Sci::Line line = 0; line < maxLine; line++) {
for (; line < maxLine; line++) {
const FoldLevel level = pdoc->GetFoldLevel(line);
if (LevelIsHeader(level) &&
(FoldLevel::Base == LevelNumberPart(level))) {
SetFoldExpanded(line, false);
const Sci::Line lineMaxSubord = pdoc->GetLastChild(line);
if (lineMaxSubord > line) {
pcs->SetVisible(line + 1, lineMaxSubord, false);
if (LevelIsHeader(level)) {
if (FoldLevel::Base == LevelNumberPart(level)) {
SetFoldExpanded(line, false);
const Sci::Line lineMaxSubord = pdoc->GetLastChild(line);
if (lineMaxSubord > line) {
pcs->SetVisible(line + 1, lineMaxSubord, false);
if (!contractAll) {
line = lineMaxSubord;
}
}
} else if (contractAll) {
SetFoldExpanded(line, false);
}
}
}
@ -6322,10 +6331,14 @@ sptr_t Editor::WndProc(Message iMessage, uptr_t wParam, sptr_t lParam) {
}
case Message::HideSelection:
view.hideSelection = wParam != 0;
vs.selection.visible = wParam == 0;
Redraw();
break;
case Message::GetSelectionHidden:
return !vs.selection.visible;
break;
case Message::FormatRange:
case Message::FormatRangeFull:
return FormatRange(iMessage, wParam, lParam);
@ -7166,14 +7179,14 @@ sptr_t Editor::WndProc(Message iMessage, uptr_t wParam, sptr_t lParam) {
break;
case Message::MarkerGet:
return pdoc->GetMark(LineFromUPtr(wParam));
return GetMark(LineFromUPtr(wParam));
case Message::MarkerNext:
return pdoc->MarkerNext(LineFromUPtr(wParam), static_cast<int>(lParam));
case Message::MarkerPrevious: {
for (Sci::Line iLine = LineFromUPtr(wParam); iLine >= 0; iLine--) {
if ((pdoc->GetMark(iLine) & lParam) != 0)
if ((GetMark(iLine) & lParam) != 0)
return iLine;
}
}
@ -8344,6 +8357,14 @@ sptr_t Editor::WndProc(Message iMessage, uptr_t wParam, sptr_t lParam) {
case Message::GetGapPosition:
return pdoc->GapPosition();
case Message::SetChangeHistory:
changeHistoryOption = static_cast<ChangeHistoryOption>(wParam);
pdoc->ChangeHistorySet(wParam & 1);
break;
case Message::GetChangeHistory:
return static_cast<sptr_t>(changeHistoryOption);
case Message::SetExtraAscent:
vs.extraAscent = static_cast<int>(wParam);
InvalidateStyleRedraw();

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