Update to Scintilla 5.3.2 and Lexilla 5.2.1
update to https://www.scintilla.org/scintilla532.zip with: Released 6 December 2022. Add SCI_REPLACETARGETMINIMAL to change text without causing unchanged prefix and suffix to be marked as modified in change history. Draw background colour for EOL annotations with standard and boxed visuals. Add SCI_GETSTYLEDTEXTFULL to support 64-bit document positions on Win32 replacing SCI_GETSTYLEDTEXT which is not safe for huge documents. Feature #1455. Send SCN_AUTOCCOMPLETED for SCI_AUTOCSHOW triggering insertion because of SCI_AUTOCSETCHOOSESINGLE mode. Feature #1459. Change 'paragraph up' commands SCI_PARAUP and SCI_PARAUPEXTEND to go to the start position of the paragraph containing the caret. Only if the caret is already at the start of the paragraph will it go to the start of the previous paragraph. Bug #2363. Change release compilation optimization option to favour speed over space. -O2 for MSVC and -O3 for gcc and clang. On Win32, avoid blurry display with DirectWrite in GDI scaling mode. Bug #2344. On Win32, use the top-level window to find the monitor for DirectWrite rendering parameters. Temporarily switch DPI awareness to find correct monitor in GDI scaling mode. Bug #2344. On Qt, implement SCI_SETRECTANGULARSELECTIONMODIFIER for all platforms. On Qt, allow string form XPM images for SCI_REGISTERIMAGE. and https://www.scintilla.org/lexilla521.zip with Released 6 December 2022. Update to Unicode 14. Feature #1461. Change default compilation optimization option to favour speed over space. -O2 for MSVC and -O3 for gcc and clang. Batch: Fix comments starting inside strings. Issue #115. F#: Lex signed numeric literals more accurately. Issue #110, Issue #111. F#: Add specifiers for 64-bit integer and floating point literals. Issue #112. Markdown: Stop styling numbers at line start in PRECHAR style. Issue #117. PowerShell: Recognise numeric literals more accurately. Issue #118. Close #12624
This commit is contained in:
parent
27e19089d2
commit
fc61868cf2
Binary file not shown.
Binary file not shown.
|
@ -7,12 +7,12 @@ jobs:
|
|||
|
||||
runs-on: macos-11
|
||||
|
||||
strategy:
|
||||
strategy:
|
||||
matrix:
|
||||
cpp_compiler: [clang++]
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/checkout@v3
|
||||
- name: Install Scintilla source
|
||||
run: |
|
||||
(cd .. && wget --no-verbose https://www.scintilla.org/scintilla500.zip)
|
||||
|
|
|
@ -8,8 +8,8 @@ jobs:
|
|||
runs-on: windows-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Preparing nmake
|
||||
- uses: actions/checkout@v3
|
||||
- name: Preparing nmake
|
||||
uses: ilammy/msvc-dev-cmd@v1
|
||||
with:
|
||||
arch: x64
|
||||
|
|
|
@ -7,12 +7,12 @@ jobs:
|
|||
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
strategy:
|
||||
strategy:
|
||||
matrix:
|
||||
cpp_compiler: [g++, clang++]
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/checkout@v3
|
||||
- name: Install Scintilla source
|
||||
run: |
|
||||
(cd .. && wget --no-verbose https://www.scintilla.org/scintilla500.zip)
|
||||
|
|
|
@ -1 +1 @@
|
|||
@del /S /Q *.a *.aps *.bsc *.dll *.dsw *.exe *.idb *.ilc *.ild *.ilf *.ilk *.ils *.lib *.map *.ncb *.obj *.o *.opt *.ipdb *.pdb *.plg *.res *.sbr *.tds *.exp *.tlog >NUL:
|
||||
@del /S /Q *.a *.aps *.bsc *.dll *.dsw *.exe *.idb *.ilc *.ild *.ilf *.ilk *.ils *.lib *.map *.ncb *.obj *.o *.opt *.ipdb *.pdb *.plg *.res *.sbr *.tds *.exp *.tlog *.lastbuildstate >NUL:
|
||||
|
|
|
@ -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="20221012" />
|
||||
<meta name="Date.Modified" content="20221206" />
|
||||
<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.2.0<br />
|
||||
Site last modified October 12 2022</font>
|
||||
<font color="#FFCC99" size="3">Release version 5.2.1<br />
|
||||
Site last modified December 6 2022</font>
|
||||
</td>
|
||||
<td width="20%">
|
||||
|
||||
|
@ -77,6 +77,7 @@
|
|||
</tr>
|
||||
</table>
|
||||
<ul id="versionlist">
|
||||
<li>Version 5.2.1 improves Batch, F#, Markdown, and PowerShell.</li>
|
||||
<li>Version 5.2.0 improves PowerShell and R.</li>
|
||||
<li>Version 5.1.9 improves Julia and Properties.</li>
|
||||
<li>Version 5.1.8 improves F#, MS SQL, PowerShell, and Visual Prolog.</li>
|
||||
|
|
|
@ -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/lexilla520.zip">
|
||||
<font size="4"> <a href="https://www.scintilla.org/lexilla521.zip">
|
||||
Windows</a>
|
||||
<a href="https://www.scintilla.org/lexilla520.tgz">
|
||||
<a href="https://www.scintilla.org/lexilla521.tgz">
|
||||
GTK/Linux</a>
|
||||
</font>
|
||||
</td>
|
||||
|
@ -42,7 +42,7 @@
|
|||
containing very few restrictions.
|
||||
</p>
|
||||
<h3>
|
||||
Release 5.2.0
|
||||
Release 5.2.1
|
||||
</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/lexilla520.zip">zip format</a> (1.2M) commonly used on Windows</li>
|
||||
<li><a href="https://www.scintilla.org/lexilla520.tgz">tgz format</a> (0.9M) commonly used on Linux and compatible operating systems</li>
|
||||
<li><a href="https://www.scintilla.org/lexilla521.zip">zip format</a> (1.2M) commonly used on Windows</li>
|
||||
<li><a href="https://www.scintilla.org/lexilla521.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>
|
||||
|
|
|
@ -585,6 +585,43 @@
|
|||
</tr>
|
||||
</table>
|
||||
<h2>Releases</h2>
|
||||
<h3>
|
||||
<a href="https://www.scintilla.org/lexilla521.zip">Release 5.2.1</a>
|
||||
</h3>
|
||||
<ul>
|
||||
<li>
|
||||
Released 6 December 2022.
|
||||
</li>
|
||||
<li>
|
||||
Update to Unicode 14.
|
||||
<a href="https://sourceforge.net/p/scintilla/feature-requests/1461/">Feature #1461</a>.
|
||||
</li>
|
||||
<li>
|
||||
Change default compilation optimization option to favour speed over space.
|
||||
-O2 for MSVC and -O3 for gcc and clang.
|
||||
</li>
|
||||
<li>
|
||||
Batch: Fix comments starting inside strings.
|
||||
<a href="https://github.com/ScintillaOrg/lexilla/issues/115">Issue #115</a>.
|
||||
</li>
|
||||
<li>
|
||||
F#: Lex signed numeric literals more accurately.
|
||||
<a href="https://github.com/ScintillaOrg/lexilla/issues/110">Issue #110</a>,
|
||||
<a href="https://github.com/ScintillaOrg/lexilla/issues/111">Issue #111</a>.
|
||||
</li>
|
||||
<li>
|
||||
F#: Add specifiers for 64-bit integer and floating point literals.
|
||||
<a href="https://github.com/ScintillaOrg/lexilla/issues/112">Issue #112</a>.
|
||||
</li>
|
||||
<li>
|
||||
Markdown: Stop styling numbers at line start in PRECHAR style.
|
||||
<a href="https://github.com/ScintillaOrg/lexilla/issues/117">Issue #117</a>.
|
||||
</li>
|
||||
<li>
|
||||
PowerShell: Recognise numeric literals more accurately.
|
||||
<a href="https://github.com/ScintillaOrg/lexilla/issues/118">Issue #118</a>.
|
||||
</li>
|
||||
</ul>
|
||||
<h3>
|
||||
<a href="https://www.scintilla.org/lexilla520.zip">Release 5.2.0</a>
|
||||
</h3>
|
||||
|
@ -1804,7 +1841,7 @@
|
|||
</li>
|
||||
<li>
|
||||
SciTE supports changing caret style via caret.style property.
|
||||
<a href="https://sourceforge.net/p/scintilla/feature-requests/1264/">Feature #1624</a>.
|
||||
<a href="https://sourceforge.net/p/scintilla/feature-requests/1264/">Feature #1264</a>.
|
||||
</li>
|
||||
<li>
|
||||
Lexer added for .NET's Common Intermediate Language CIL.
|
||||
|
@ -2303,15 +2340,15 @@
|
|||
</li>
|
||||
<li>
|
||||
Minor undefined behaviour fixed.
|
||||
<a href="https://sourceforge.net/p/scintilla/bugs/1978">Bug #1978</a>.
|
||||
<a href="https://sourceforge.net/p/scintilla/bugs/1978/">Bug #1978</a>.
|
||||
</li>
|
||||
<li>
|
||||
On Cocoa, improve scrolling on macOS 10.12.
|
||||
<a href="https://sourceforge.net/p/scintilla/bugs/1885">Bug #1885</a>.
|
||||
<a href="https://sourceforge.net/p/scintilla/bugs/1885/">Bug #1885</a>.
|
||||
</li>
|
||||
<li>
|
||||
On Cocoa, fix line selection by clicking in the margin when scrolled.
|
||||
<a href="https://sourceforge.net/p/scintilla/bugs/1971">Bug #1971</a>.
|
||||
<a href="https://sourceforge.net/p/scintilla/bugs/1971/">Bug #1971</a>.
|
||||
</li>
|
||||
</ul>
|
||||
<h3>
|
||||
|
@ -2396,7 +2433,7 @@
|
|||
</li>
|
||||
<li>
|
||||
On GTK+ fix drawing problems including incorrect scrollbar redrawing and flickering of text.
|
||||
<a href="https://sourceforge.net/p/scintilla/bugs/1876">Bug #1876</a>.
|
||||
<a href="https://sourceforge.net/p/scintilla/bugs/1876/">Bug #1876</a>.
|
||||
</li>
|
||||
<li>
|
||||
On Linux, both for GTK+ and Qt, the default modifier key for rectangular selection is now Alt.
|
||||
|
@ -2407,7 +2444,7 @@
|
|||
<li>
|
||||
On Cocoa, fix doCommandBySelector but avoid double effect of 'delete'
|
||||
key.
|
||||
<a href="https://sourceforge.net/p/scintilla/bugs/1958">Bug #1958</a>.
|
||||
<a href="https://sourceforge.net/p/scintilla/bugs/1958/">Bug #1958</a>.
|
||||
</li>
|
||||
<li>
|
||||
On Qt, the updateUi signal includes the 'updated' flags.
|
||||
|
@ -5460,7 +5497,7 @@
|
|||
</li>
|
||||
<li>
|
||||
Added ncurses platform definitions. Implementation is maintained separately as
|
||||
<a href="https://foicica.com/scinterm/">Scinterm</a>.
|
||||
<a href="https://orbitalquark.github.io/scinterm">Scinterm</a>.
|
||||
</li>
|
||||
</ul>
|
||||
<h3>
|
||||
|
|
|
@ -74,15 +74,21 @@ bool textQuoted(const char *lineBuffer, Sci_PositionU endPos) {
|
|||
char strBuffer[1024];
|
||||
strncpy(strBuffer, lineBuffer, endPos);
|
||||
strBuffer[endPos] = '\0';
|
||||
char *pQuote;
|
||||
pQuote = strchr(strBuffer, '"');
|
||||
bool CurrentStatus = false;
|
||||
while (pQuote != NULL)
|
||||
{
|
||||
if (!IsEscaped(strBuffer, pQuote - strBuffer)) {
|
||||
CurrentStatus = !CurrentStatus;
|
||||
const char strQuotes[] = "\"'";
|
||||
const size_t strLength = strlen(strQuotes);
|
||||
for (size_t i = 0; i < strLength; i++) {
|
||||
const char *pQuote = strchr(strBuffer, strQuotes[i]);
|
||||
while (pQuote != NULL)
|
||||
{
|
||||
if (!IsEscaped(strBuffer, pQuote - strBuffer)) {
|
||||
CurrentStatus = !CurrentStatus;
|
||||
}
|
||||
pQuote = strchr(pQuote + 1, strQuotes[i]);
|
||||
}
|
||||
if (CurrentStatus) {
|
||||
break;
|
||||
}
|
||||
pQuote = strchr(pQuote + 1, '"');
|
||||
}
|
||||
return CurrentStatus;
|
||||
}
|
||||
|
@ -196,9 +202,11 @@ void ColouriseBatchDoc(
|
|||
// Check for Comment - return if found
|
||||
if (continueProcessing) {
|
||||
if ((CompareCaseInsensitive(wordBuffer, "rem") == 0) || (wordBuffer[0] == ':' && wordBuffer[1] == ':')) {
|
||||
styler.ColourTo(startLine + offset - strlen(wordBuffer) - 1, SCE_BAT_DEFAULT);
|
||||
styler.ColourTo(endPos, SCE_BAT_COMMENT);
|
||||
break;
|
||||
if ((offset == wbl) || !textQuoted(lineBuffer, offset - wbl)) {
|
||||
styler.ColourTo(startLine + offset - wbl - 1, SCE_BAT_DEFAULT);
|
||||
styler.ColourTo(endPos, SCE_BAT_COMMENT);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
// Check for Separator
|
||||
|
|
|
@ -28,6 +28,11 @@
|
|||
#include "LexerModule.h"
|
||||
/***************************************/
|
||||
|
||||
#if defined(__clang__) && !defined(__APPLE__)
|
||||
// Disable warning for numNonBlank
|
||||
#pragma clang diagnostic ignored "-Wunused-but-set-variable"
|
||||
#endif
|
||||
|
||||
using namespace Lexilla;
|
||||
|
||||
/***********************************************/
|
||||
|
|
|
@ -253,6 +253,12 @@ void SCI_METHOD LexerDMIS::Lex(Sci_PositionU startPos, Sci_Position lengthDoc, i
|
|||
char tmpStr[MAX_STR_LEN];
|
||||
memset(tmpStr, 0, MAX_STR_LEN*sizeof(char));
|
||||
scCTX.GetCurrent(tmpStr, (MAX_STR_LEN-1));
|
||||
// The following strncpy is copying from a string back onto itself which is weird and causes warnings
|
||||
// but is harmless so turn off the warning
|
||||
#if defined(__GNUC__) && !defined(__APPLE__)
|
||||
// Disable warning for strncpy
|
||||
#pragma GCC diagnostic ignored "-Wrestrict"
|
||||
#endif
|
||||
strncpy(tmpStr, this->UpperCase(tmpStr), (MAX_STR_LEN-1));
|
||||
|
||||
if (this->m_minorWords.InList(tmpStr)) {
|
||||
|
|
|
@ -96,8 +96,8 @@ const CharacterSet setClosingTokens = CharacterSet(CharacterSet::setNone, ")}]")
|
|||
const CharacterSet setFormatSpecs = CharacterSet(CharacterSet::setNone, ".%aAbBcdeEfFgGiMoOstuxX0123456789");
|
||||
const CharacterSet setDotNetFormatSpecs = CharacterSet(CharacterSet::setNone, "cCdDeEfFgGnNpPxX");
|
||||
const CharacterSet setFormatFlags = CharacterSet(CharacterSet::setNone, ".-+0 ");
|
||||
const CharacterSet numericMetaChars1 = CharacterSet(CharacterSet::setNone, "_IbeEflmnosuxy");
|
||||
const CharacterSet numericMetaChars2 = CharacterSet(CharacterSet::setNone, "lnsy");
|
||||
const CharacterSet numericMetaChars1 = CharacterSet(CharacterSet::setNone, "_uU");
|
||||
const CharacterSet numericMetaChars2 = CharacterSet(CharacterSet::setNone, "fFIlLmMnsy");
|
||||
std::map<int, int> numericPrefixes = { { 'b', 2 }, { 'o', 8 }, { 'x', 16 } };
|
||||
constexpr Sci_Position ZERO_LENGTH = -1;
|
||||
|
||||
|
@ -283,9 +283,13 @@ inline bool IsNumber(StyleContext &cxt, const int base = 10) {
|
|||
(IsADigit(cxt.GetRelative(-2), base) && numericMetaChars2.Contains(cxt.ch));
|
||||
}
|
||||
|
||||
inline bool IsFloat(const StyleContext &cxt) {
|
||||
return (cxt.ch == '.' && IsADigit(cxt.chPrev)) ||
|
||||
((cxt.ch == '+' || cxt.ch == '-' ) && IsADigit(cxt.chNext));
|
||||
inline bool IsFloat(StyleContext &cxt) {
|
||||
if (cxt.MatchIgnoreCase("e+") || cxt.MatchIgnoreCase("e-")) {
|
||||
cxt.Forward();
|
||||
return true;
|
||||
}
|
||||
return ((cxt.chPrev == '.' && IsADigit(cxt.ch)) ||
|
||||
(IsADigit(cxt.chPrev) && (cxt.ch == '.' || numericMetaChars2.Contains(cxt.ch))));
|
||||
}
|
||||
|
||||
inline bool IsLineEnd(StyleContext &cxt, const Sci_Position offset) {
|
||||
|
@ -357,14 +361,8 @@ Sci_Position SCI_METHOD LexerFSharp::WordListSet(int n, const char *wl) {
|
|||
if (n < WORDLIST_SIZE) {
|
||||
wordListN = &keywords[n];
|
||||
}
|
||||
if (wordListN) {
|
||||
WordList wlNew;
|
||||
wlNew.Set(wl);
|
||||
|
||||
if (*wordListN != wlNew) {
|
||||
wordListN->Set(wl);
|
||||
firstModification = 0;
|
||||
}
|
||||
if (wordListN && wordListN->Set(wl)) {
|
||||
firstModification = 0;
|
||||
}
|
||||
return firstModification;
|
||||
}
|
||||
|
@ -428,12 +426,6 @@ void SCI_METHOD LexerFSharp::Lex(Sci_PositionU start, Sci_Position length, int i
|
|||
} else if (IsADigit(sc.ch, currentBase) ||
|
||||
((sc.ch == '+' || sc.ch == '-') && IsADigit(sc.chNext))) {
|
||||
state = SCE_FSHARP_NUMBER;
|
||||
if (sc.ch == '0') {
|
||||
const int prefix = sc.chNext;
|
||||
if (numericPrefixes.find(prefix) != numericPrefixes.end()) {
|
||||
currentBase = numericPrefixes[prefix];
|
||||
}
|
||||
}
|
||||
} else if (setOperators.Contains(sc.ch) &&
|
||||
// don't use operator style in async keywords (e.g. `return!`)
|
||||
!(sc.ch == '!' && iswordstart(sc.chPrev)) &&
|
||||
|
@ -586,8 +578,7 @@ void SCI_METHOD LexerFSharp::Lex(Sci_PositionU start, Sci_Position length, int i
|
|||
break;
|
||||
case SCE_FSHARP_OPERATOR:
|
||||
// special-case "()" and "[]" tokens as KEYWORDS - RR
|
||||
if (setClosingTokens.Contains(sc.ch) &&
|
||||
((sc.ch == ')' && sc.chPrev == '(') || (sc.ch == ']' && sc.chPrev == '['))) {
|
||||
if ((sc.ch == ')' && sc.chPrev == '(') || (sc.ch == ']' && sc.chPrev == '[')) {
|
||||
sc.ChangeState(SCE_FSHARP_KEYWORD);
|
||||
colorSpan++;
|
||||
} else {
|
||||
|
@ -596,6 +587,18 @@ void SCI_METHOD LexerFSharp::Lex(Sci_PositionU start, Sci_Position length, int i
|
|||
state = SCE_FSHARP_DEFAULT;
|
||||
break;
|
||||
case SCE_FSHARP_NUMBER:
|
||||
if ((setOperators.Contains(sc.chPrev) || IsASpaceOrTab(sc.chPrev)) && sc.ch == '0') {
|
||||
if (numericPrefixes.find(sc.chNext) != numericPrefixes.end()) {
|
||||
currentBase = numericPrefixes[sc.chNext];
|
||||
sc.Forward(2);
|
||||
}
|
||||
} else if ((setOperators.Contains(sc.GetRelative(-2)) || IsASpaceOrTab(sc.GetRelative(-2))) &&
|
||||
sc.chPrev == '0') {
|
||||
if (numericPrefixes.find(sc.ch) != numericPrefixes.end()) {
|
||||
currentBase = numericPrefixes[sc.ch];
|
||||
sc.Forward();
|
||||
}
|
||||
}
|
||||
state = (IsNumber(sc, currentBase) || IsFloat(sc))
|
||||
? SCE_FSHARP_NUMBER
|
||||
// change style even when operators aren't spaced
|
||||
|
|
|
@ -387,6 +387,9 @@ static void ColorizeMarkdownDoc(Sci_PositionU startPos, Sci_Position length, int
|
|||
sc.SetState(SCE_MARKDOWN_OLIST_ITEM);
|
||||
sc.Forward(digitCount + 1);
|
||||
sc.SetState(SCE_MARKDOWN_DEFAULT);
|
||||
} else {
|
||||
// a textual number at the margin should be plain text
|
||||
sc.SetState(SCE_MARKDOWN_DEFAULT);
|
||||
}
|
||||
}
|
||||
// Alternate Ordered list
|
||||
|
|
|
@ -33,6 +33,41 @@ static inline bool IsAWordChar(int ch) noexcept {
|
|||
return ch >= 0x80 || isalnum(ch) || ch == '-' || ch == '_';
|
||||
}
|
||||
|
||||
static bool IsNumericLiteral(int chPrev, int ch, int chNext) {
|
||||
// integers
|
||||
if (ch >= '0' && ch <= '9') {
|
||||
return true;
|
||||
}
|
||||
// hex 0x or a-f
|
||||
if ((ch == 'x' && chPrev == '0') || (ch >= 'a' && ch <= 'f')) {
|
||||
return true;
|
||||
}
|
||||
// decimal point
|
||||
if (ch == '.' && chNext != '.') {
|
||||
return true;
|
||||
}
|
||||
// optional -/+ sign after exponent
|
||||
if ((ch == '+' || ch == '-') && chPrev == 'e') {
|
||||
return true;
|
||||
}
|
||||
// suffix
|
||||
switch (ch) {
|
||||
//case 'b': see hex
|
||||
case 'g':
|
||||
case 'k':
|
||||
case 'l':
|
||||
case 'm':
|
||||
case 'n':
|
||||
case 'p':
|
||||
case 's':
|
||||
case 't':
|
||||
case 'u':
|
||||
case 'y':
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
static void ColourisePowerShellDoc(Sci_PositionU startPos, Sci_Position length, int initStyle,
|
||||
WordList *keywordlists[], Accessor &styler) {
|
||||
|
||||
|
@ -99,8 +134,14 @@ static void ColourisePowerShellDoc(Sci_PositionU startPos, Sci_Position length,
|
|||
sc.SetState(SCE_POWERSHELL_DEFAULT);
|
||||
}
|
||||
} else if (sc.state == SCE_POWERSHELL_NUMBER) {
|
||||
if (!IsADigit(sc.ch)) {
|
||||
sc.SetState(SCE_POWERSHELL_DEFAULT);
|
||||
if (!IsNumericLiteral(MakeLowerCase(sc.chPrev),
|
||||
MakeLowerCase(sc.ch),
|
||||
MakeLowerCase(sc.chNext))) {
|
||||
if (sc.MatchLineEnd() || IsASpaceOrTab(sc.ch) || isoperator(sc.ch)) {
|
||||
sc.SetState(SCE_POWERSHELL_DEFAULT);
|
||||
} else {
|
||||
sc.ChangeState(SCE_POWERSHELL_IDENTIFIER);
|
||||
}
|
||||
}
|
||||
} else if (sc.state == SCE_POWERSHELL_VARIABLE) {
|
||||
if (!IsAWordChar(sc.ch)) {
|
||||
|
@ -146,7 +187,7 @@ static void ColourisePowerShellDoc(Sci_PositionU startPos, Sci_Position length,
|
|||
sc.SetState(SCE_POWERSHELL_HERE_CHARACTER);
|
||||
} else if (sc.ch == '$') {
|
||||
sc.SetState(SCE_POWERSHELL_VARIABLE);
|
||||
} else if (IsADigit(sc.ch) || (sc.ch == '.' && IsADigit(sc.chNext))) {
|
||||
} else if (IsADigit(sc.ch) || (sc.chPrev != '.' && sc.ch == '.' && IsADigit(sc.chNext))) {
|
||||
sc.SetState(SCE_POWERSHELL_NUMBER);
|
||||
} else if (isoperator(sc.ch)) {
|
||||
sc.SetState(SCE_POWERSHELL_OPERATOR);
|
||||
|
|
|
@ -20,7 +20,7 @@ namespace {
|
|||
|
||||
const int catRanges[] = {
|
||||
//++Autogenerated -- start of section automatically generated
|
||||
// Created with Python 3.9.4, Unicode 13.0.0
|
||||
// Created with Python 3.11.0, Unicode 14.0.0
|
||||
25,
|
||||
1046,
|
||||
1073,
|
||||
|
@ -683,8 +683,7 @@ const int catRanges[] = {
|
|||
49669,
|
||||
50033,
|
||||
50074,
|
||||
50109,
|
||||
50129,
|
||||
50097,
|
||||
50180,
|
||||
51203,
|
||||
51236,
|
||||
|
@ -749,11 +748,16 @@ const int catRanges[] = {
|
|||
68605,
|
||||
68612,
|
||||
68989,
|
||||
69124,
|
||||
69908,
|
||||
69924,
|
||||
70141,
|
||||
70170,
|
||||
70237,
|
||||
70405,
|
||||
70660,
|
||||
71357,
|
||||
71364,
|
||||
71965,
|
||||
72293,
|
||||
71971,
|
||||
72005,
|
||||
72794,
|
||||
72805,
|
||||
73830,
|
||||
|
@ -986,6 +990,7 @@ const int catRanges[] = {
|
|||
99645,
|
||||
99652,
|
||||
100189,
|
||||
100229,
|
||||
100260,
|
||||
100293,
|
||||
100390,
|
||||
|
@ -998,6 +1003,8 @@ const int catRanges[] = {
|
|||
101117,
|
||||
101124,
|
||||
101245,
|
||||
101284,
|
||||
101341,
|
||||
101380,
|
||||
101445,
|
||||
101533,
|
||||
|
@ -1034,7 +1041,7 @@ const int catRanges[] = {
|
|||
104925,
|
||||
105126,
|
||||
105213,
|
||||
105412,
|
||||
105380,
|
||||
105469,
|
||||
105476,
|
||||
105541,
|
||||
|
@ -1287,12 +1294,12 @@ const int catRanges[] = {
|
|||
187940,
|
||||
188221,
|
||||
188420,
|
||||
188861,
|
||||
188868,
|
||||
188997,
|
||||
189117,
|
||||
189444,
|
||||
189094,
|
||||
189149,
|
||||
189412,
|
||||
190021,
|
||||
190086,
|
||||
190129,
|
||||
190205,
|
||||
190468,
|
||||
|
@ -1328,7 +1335,7 @@ const int catRanges[] = {
|
|||
196849,
|
||||
196965,
|
||||
197082,
|
||||
197117,
|
||||
197093,
|
||||
197128,
|
||||
197469,
|
||||
197636,
|
||||
|
@ -1403,7 +1410,7 @@ const int catRanges[] = {
|
|||
218629,
|
||||
219079,
|
||||
219109,
|
||||
219197,
|
||||
219645,
|
||||
221189,
|
||||
221318,
|
||||
221348,
|
||||
|
@ -1416,13 +1423,14 @@ const int catRanges[] = {
|
|||
223301,
|
||||
223334,
|
||||
223396,
|
||||
223645,
|
||||
223677,
|
||||
223752,
|
||||
224081,
|
||||
224309,
|
||||
224613,
|
||||
224917,
|
||||
225213,
|
||||
225201,
|
||||
225277,
|
||||
225285,
|
||||
225350,
|
||||
225380,
|
||||
|
@ -1487,8 +1495,6 @@ const int catRanges[] = {
|
|||
241441,
|
||||
242531,
|
||||
243717,
|
||||
245597,
|
||||
245605,
|
||||
245760,
|
||||
245793,
|
||||
245824,
|
||||
|
@ -1850,7 +1856,7 @@ const int catRanges[] = {
|
|||
266755,
|
||||
267197,
|
||||
267283,
|
||||
268317,
|
||||
268349,
|
||||
268805,
|
||||
269223,
|
||||
269349,
|
||||
|
@ -2030,9 +2036,7 @@ const int catRanges[] = {
|
|||
357085,
|
||||
357109,
|
||||
360448,
|
||||
361981,
|
||||
361985,
|
||||
363517,
|
||||
363520,
|
||||
363553,
|
||||
363584,
|
||||
|
@ -2233,7 +2237,16 @@ const int catRanges[] = {
|
|||
378993,
|
||||
379413,
|
||||
379473,
|
||||
379517,
|
||||
379565,
|
||||
379598,
|
||||
379629,
|
||||
379662,
|
||||
379693,
|
||||
379726,
|
||||
379757,
|
||||
379790,
|
||||
379820,
|
||||
379869,
|
||||
380949,
|
||||
381789,
|
||||
381813,
|
||||
|
@ -2321,8 +2334,6 @@ const int catRanges[] = {
|
|||
425988,
|
||||
636949,
|
||||
638980,
|
||||
1310653,
|
||||
1310724,
|
||||
1311395,
|
||||
1311428,
|
||||
1348029,
|
||||
|
@ -2566,7 +2577,8 @@ const int catRanges[] = {
|
|||
1374113,
|
||||
1374144,
|
||||
1374177,
|
||||
1374237,
|
||||
1374208,
|
||||
1374241,
|
||||
1374272,
|
||||
1374305,
|
||||
1374336,
|
||||
|
@ -2574,6 +2586,18 @@ const int catRanges[] = {
|
|||
1374496,
|
||||
1374529,
|
||||
1374589,
|
||||
1374720,
|
||||
1374753,
|
||||
1374813,
|
||||
1374817,
|
||||
1374877,
|
||||
1374881,
|
||||
1374912,
|
||||
1374945,
|
||||
1374976,
|
||||
1375009,
|
||||
1375069,
|
||||
1375811,
|
||||
1375904,
|
||||
1375937,
|
||||
1375972,
|
||||
|
@ -2759,19 +2783,20 @@ const int catRanges[] = {
|
|||
2058429,
|
||||
2058436,
|
||||
2061908,
|
||||
2062429,
|
||||
2062461,
|
||||
2062948,
|
||||
2074574,
|
||||
2074605,
|
||||
2074653,
|
||||
2074645,
|
||||
2075140,
|
||||
2077213,
|
||||
2077252,
|
||||
2079005,
|
||||
2079221,
|
||||
2079261,
|
||||
2080260,
|
||||
2080659,
|
||||
2080693,
|
||||
2080733,
|
||||
2080773,
|
||||
2081297,
|
||||
2081517,
|
||||
|
@ -2961,13 +2986,34 @@ const int catRanges[] = {
|
|||
2139652,
|
||||
2141341,
|
||||
2141681,
|
||||
2141725,
|
||||
2141696,
|
||||
2142077,
|
||||
2142080,
|
||||
2142589,
|
||||
2142592,
|
||||
2142845,
|
||||
2142848,
|
||||
2142941,
|
||||
2142945,
|
||||
2143325,
|
||||
2143329,
|
||||
2143837,
|
||||
2143841,
|
||||
2144093,
|
||||
2144097,
|
||||
2144189,
|
||||
2146308,
|
||||
2156285,
|
||||
2156548,
|
||||
2157277,
|
||||
2157572,
|
||||
2157853,
|
||||
2158595,
|
||||
2158813,
|
||||
2158819,
|
||||
2160189,
|
||||
2160195,
|
||||
2160509,
|
||||
2162692,
|
||||
2162909,
|
||||
2162948,
|
||||
|
@ -3087,6 +3133,10 @@ const int catRanges[] = {
|
|||
2222634,
|
||||
2222769,
|
||||
2222941,
|
||||
2223620,
|
||||
2224197,
|
||||
2224337,
|
||||
2224477,
|
||||
2225668,
|
||||
2226346,
|
||||
2226589,
|
||||
|
@ -3101,7 +3151,11 @@ const int catRanges[] = {
|
|||
2230749,
|
||||
2230858,
|
||||
2231496,
|
||||
2231837,
|
||||
2231813,
|
||||
2231844,
|
||||
2231909,
|
||||
2231972,
|
||||
2232029,
|
||||
2232293,
|
||||
2232390,
|
||||
2232420,
|
||||
|
@ -3112,7 +3166,8 @@ const int catRanges[] = {
|
|||
2234225,
|
||||
2234298,
|
||||
2234321,
|
||||
2234461,
|
||||
2234437,
|
||||
2234493,
|
||||
2234810,
|
||||
2234845,
|
||||
2234884,
|
||||
|
@ -3288,7 +3343,8 @@ const int catRanges[] = {
|
|||
2283206,
|
||||
2283237,
|
||||
2283268,
|
||||
2283325,
|
||||
2283313,
|
||||
2283357,
|
||||
2283528,
|
||||
2283869,
|
||||
2285572,
|
||||
|
@ -3303,7 +3359,8 @@ const int catRanges[] = {
|
|||
2287434,
|
||||
2287505,
|
||||
2287605,
|
||||
2287645,
|
||||
2287620,
|
||||
2287869,
|
||||
2293764,
|
||||
2295174,
|
||||
2295269,
|
||||
|
@ -3377,7 +3434,7 @@ const int catRanges[] = {
|
|||
2315172,
|
||||
2315217,
|
||||
2315389,
|
||||
2316292,
|
||||
2315780,
|
||||
2318141,
|
||||
2326532,
|
||||
2326845,
|
||||
|
@ -3461,6 +3518,9 @@ const int catRanges[] = {
|
|||
2395837,
|
||||
2396164,
|
||||
2402461,
|
||||
2486788,
|
||||
2489905,
|
||||
2489981,
|
||||
2490372,
|
||||
2524669,
|
||||
2524698,
|
||||
|
@ -3474,7 +3534,10 @@ const int catRanges[] = {
|
|||
2968584,
|
||||
2968925,
|
||||
2969041,
|
||||
2969117,
|
||||
2969092,
|
||||
2971645,
|
||||
2971656,
|
||||
2971997,
|
||||
2972164,
|
||||
2973149,
|
||||
2973189,
|
||||
|
@ -3523,8 +3586,14 @@ const int catRanges[] = {
|
|||
3250909,
|
||||
3252228,
|
||||
3252541,
|
||||
3538435,
|
||||
3538589,
|
||||
3538595,
|
||||
3538845,
|
||||
3538851,
|
||||
3538941,
|
||||
3538948,
|
||||
3548157,
|
||||
3548285,
|
||||
3549700,
|
||||
3549821,
|
||||
3550340,
|
||||
|
@ -3544,6 +3613,12 @@ const int catRanges[] = {
|
|||
3642353,
|
||||
3642394,
|
||||
3642525,
|
||||
3792901,
|
||||
3794397,
|
||||
3794437,
|
||||
3795197,
|
||||
3795477,
|
||||
3799197,
|
||||
3801109,
|
||||
3808989,
|
||||
3809301,
|
||||
|
@ -3560,7 +3635,7 @@ const int catRanges[] = {
|
|||
3813781,
|
||||
3814725,
|
||||
3814869,
|
||||
3816765,
|
||||
3816829,
|
||||
3817493,
|
||||
3819589,
|
||||
3819701,
|
||||
|
@ -3676,6 +3751,10 @@ const int catRanges[] = {
|
|||
3888157,
|
||||
3888165,
|
||||
3888669,
|
||||
3923969,
|
||||
3924292,
|
||||
3924321,
|
||||
3924989,
|
||||
3932165,
|
||||
3932413,
|
||||
3932421,
|
||||
|
@ -3696,12 +3775,23 @@ const int catRanges[] = {
|
|||
3942852,
|
||||
3942901,
|
||||
3942941,
|
||||
3953156,
|
||||
3954117,
|
||||
3954173,
|
||||
3954692,
|
||||
3956101,
|
||||
3956232,
|
||||
3956573,
|
||||
3956723,
|
||||
3956765,
|
||||
3996676,
|
||||
3996925,
|
||||
3996932,
|
||||
3997085,
|
||||
3997092,
|
||||
3997181,
|
||||
3997188,
|
||||
3997693,
|
||||
3997700,
|
||||
4004029,
|
||||
4004074,
|
||||
|
@ -3823,7 +3913,7 @@ const int catRanges[] = {
|
|||
4095860,
|
||||
4096021,
|
||||
4119325,
|
||||
4119573,
|
||||
4119477,
|
||||
4119997,
|
||||
4120085,
|
||||
4120509,
|
||||
|
@ -3833,6 +3923,8 @@ const int catRanges[] = {
|
|||
4127549,
|
||||
4127765,
|
||||
4128157,
|
||||
4128277,
|
||||
4128317,
|
||||
4128789,
|
||||
4129181,
|
||||
4129301,
|
||||
|
@ -3846,27 +3938,27 @@ const int catRanges[] = {
|
|||
4134421,
|
||||
4134493,
|
||||
4136981,
|
||||
4140861,
|
||||
4140885,
|
||||
4143517,
|
||||
4143541,
|
||||
4147869,
|
||||
4148245,
|
||||
4148701,
|
||||
4148757,
|
||||
4148925,
|
||||
4149013,
|
||||
4149117,
|
||||
4149181,
|
||||
4149269,
|
||||
4149501,
|
||||
4149781,
|
||||
4150589,
|
||||
4150717,
|
||||
4150805,
|
||||
4151037,
|
||||
4151165,
|
||||
4151317,
|
||||
4151421,
|
||||
4151517,
|
||||
4151829,
|
||||
4152061,
|
||||
4152157,
|
||||
4152341,
|
||||
4152605,
|
||||
4152853,
|
||||
4153085,
|
||||
4153365,
|
||||
4158077,
|
||||
4158101,
|
||||
|
@ -3874,9 +3966,9 @@ const int catRanges[] = {
|
|||
4161032,
|
||||
4161373,
|
||||
4194308,
|
||||
5561309,
|
||||
5561373,
|
||||
5562372,
|
||||
5695165,
|
||||
5695293,
|
||||
5695492,
|
||||
5702621,
|
||||
5702660,
|
||||
|
|
|
@ -46,6 +46,7 @@
|
|||
#include <iterator>
|
||||
#include <functional>
|
||||
#include <memory>
|
||||
#include <regex>
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
#include <fstream>
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
<key>CFBundlePackageType</key>
|
||||
<string>$(PRODUCT_BUNDLE_PACKAGE_TYPE)</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>5.2.0</string>
|
||||
<string>5.2.1</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>$(CURRENT_PROJECT_VERSION)</string>
|
||||
<key>NSHumanReadableCopyright</key>
|
||||
|
|
|
@ -851,7 +851,7 @@
|
|||
buildSettings = {
|
||||
CLANG_CXX_LANGUAGE_STANDARD = "gnu++17";
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
CURRENT_PROJECT_VERSION = 5.2.0;
|
||||
CURRENT_PROJECT_VERSION = 5.2.1;
|
||||
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.2.0;
|
||||
CURRENT_PROJECT_VERSION = 5.2.1;
|
||||
DEVELOPMENT_TEAM = 4F446KW87E;
|
||||
DYLIB_COMPATIBILITY_VERSION = 1;
|
||||
DYLIB_CURRENT_VERSION = 1;
|
||||
|
|
|
@ -4,8 +4,8 @@
|
|||
|
||||
#include <windows.h>
|
||||
|
||||
#define VERSION_LEXILLA "5.2.0"
|
||||
#define VERSION_WORDS 5, 2, 0, 0
|
||||
#define VERSION_LEXILLA "5.2.1"
|
||||
#define VERSION_WORDS 5, 2, 1, 0
|
||||
|
||||
VS_VERSION_INFO VERSIONINFO
|
||||
FILEVERSION VERSION_WORDS
|
||||
|
|
|
@ -38,7 +38,7 @@ SUBSYSTEM=-SUBSYSTEM:WINDOWS,10.00
|
|||
CRTFLAGS=-D_CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES=1 -D_CRT_SECURE_NO_DEPRECATE=1 $(ADD_DEFINE)
|
||||
CXXFLAGS=-Zi -TP -MP -W4 -EHsc -std:c++17 $(CRTFLAGS)
|
||||
CXXDEBUG=-Od -MTd -DDEBUG
|
||||
CXXNDEBUG=-O1 -MT -DNDEBUG -GL
|
||||
CXXNDEBUG=-O2 -MT -DNDEBUG -GL
|
||||
NAME=-Fo
|
||||
LDFLAGS=-OPT:REF -LTCG -IGNORE:4197 -DEBUG $(SUBSYSTEM) $(CETCOMPAT)
|
||||
LDDEBUG=
|
||||
|
|
|
@ -79,7 +79,7 @@ vpath %.h ../src ../include ../../scintilla/include ../lexlib
|
|||
vpath %.cxx ../src ../lexlib ../lexers
|
||||
|
||||
DEFINES += -D$(if $(DEBUG),DEBUG,NDEBUG)
|
||||
BASE_FLAGS += $(if $(DEBUG),-g,-Os)
|
||||
BASE_FLAGS += $(if $(DEBUG),-g,-O3)
|
||||
|
||||
INCLUDES = -I ../include -I $(SCINTILLA_INCLUDE) -I ../src -I ../lexlib
|
||||
LDFLAGS += -shared
|
||||
|
|
|
@ -750,9 +750,10 @@ void TestILexer(Scintilla::ILexer5 *plex) {
|
|||
}
|
||||
}
|
||||
|
||||
void SetProperties(Scintilla::ILexer5 *plex, const PropertyMap &propertyMap, std::string_view fileName) {
|
||||
bool SetProperties(Scintilla::ILexer5 *plex, const PropertyMap &propertyMap, std::filesystem::path path) {
|
||||
assert(plex);
|
||||
|
||||
const std::string fileName = path.filename().string();
|
||||
// Set keywords, keywords2, ... keywords9, for this file
|
||||
for (int kw = 0; kw < 10; kw++) {
|
||||
std::string kwChoice("keywords");
|
||||
|
@ -762,7 +763,24 @@ void SetProperties(Scintilla::ILexer5 *plex, const PropertyMap &propertyMap, std
|
|||
kwChoice.append(".*");
|
||||
std::optional<std::string> keywordN = propertyMap.GetPropertyForFile(kwChoice, fileName);
|
||||
if (keywordN) {
|
||||
plex->WordListSet(kw, keywordN->c_str());
|
||||
// New lexer object has all word lists empty so check null effect from setting empty
|
||||
const Sci_Position changedEmpty = plex->WordListSet(kw, "");
|
||||
if (changedEmpty != -1) {
|
||||
std::cout << path.string() << ":1: does not return -1 for null WordListSet(" << kw << ")\n";
|
||||
return false;
|
||||
}
|
||||
const Sci_Position changedAt = plex->WordListSet(kw, keywordN->c_str());
|
||||
if (keywordN->empty()) {
|
||||
if (changedAt != -1) {
|
||||
std::cout << path.string() << ":1: does not return -1 for WordListSet(" << kw << ") to same empty" << "\n";
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
if (changedAt == -1) {
|
||||
std::cout << path.string() << ":1: returns -1 for WordListSet(" << kw << ")\n";
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -776,6 +794,8 @@ void SetProperties(Scintilla::ILexer5 *plex, const PropertyMap &propertyMap, std
|
|||
plex->PropertySet(key.c_str(), val.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
@ -792,7 +812,9 @@ bool TestFile(const std::filesystem::path &path, const PropertyMap &propertyMap)
|
|||
return false;
|
||||
}
|
||||
|
||||
SetProperties(plex, propertyMap, path.filename().string());
|
||||
if (!SetProperties(plex, propertyMap, path)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
TestILexer(plex);
|
||||
|
||||
|
|
|
@ -5,5 +5,5 @@ keywords.*.ps1=break if else in local
|
|||
keywords2.*.ps1=write-host write-output
|
||||
keywords3.*.ps1=cd chdir cat
|
||||
keywords4.*.ps1=mkdir prompt get-verb
|
||||
keywords5.*.ps1=lexilla
|
||||
keywords5.*.ps1=lexilla 7z
|
||||
keywords6.*.ps1=synopsis
|
||||
|
|
|
@ -44,7 +44,7 @@ endif
|
|||
vpath %.cxx ../access
|
||||
|
||||
DEFINES += -D$(if $(DEBUG),DEBUG,NDEBUG)
|
||||
BASE_FLAGS += $(if $(DEBUG),-g,-Os)
|
||||
BASE_FLAGS += $(if $(DEBUG),-g,-O3)
|
||||
|
||||
INCLUDES = -I ../../scintilla/include -I ../include -I ../access
|
||||
BASE_FLAGS += $(WARNINGS)
|
||||
|
|
|
@ -14,7 +14,7 @@ LIBS = ../bin/liblexilla.lib
|
|||
!IFDEF DEBUG
|
||||
DEBUG_OPTIONS = -Zi -DEBUG -Od -MTd -DDEBUG $(STATIC_FLAG)
|
||||
!ELSE
|
||||
DEBUG_OPTIONS = -O1 -MT -DNDEBUG $(STATIC_FLAG) -GL
|
||||
DEBUG_OPTIONS = -O2 -MT -DNDEBUG $(STATIC_FLAG) -GL
|
||||
!ENDIF
|
||||
|
||||
CXXFLAGS = /EHsc /std:c++latest $(DEBUG_OPTIONS) $(INCLUDEDIRS)
|
||||
|
|
|
@ -1 +1 @@
|
|||
520
|
||||
521
|
|
@ -130,6 +130,10 @@ Position ScintillaCall::ReplaceTargetRE(std::string_view text) {
|
|||
return CallString(Message::ReplaceTargetRE, text.length(), text.data());
|
||||
}
|
||||
|
||||
Position ScintillaCall::ReplaceTargetMinimal(std::string_view text) {
|
||||
return CallString(Message::ReplaceTargetMinimal, text.length(), text.data());
|
||||
}
|
||||
|
||||
Position ScintillaCall::SearchInTarget(std::string_view text) {
|
||||
return CallString(Message::SearchInTarget, text.length(), text.data());
|
||||
}
|
||||
|
@ -227,6 +231,10 @@ Position ScintillaCall::GetStyledText(void *tr) {
|
|||
return CallPointer(Message::GetStyledText, 0, tr);
|
||||
}
|
||||
|
||||
Position ScintillaCall::GetStyledTextFull(void *tr) {
|
||||
return CallPointer(Message::GetStyledTextFull, 0, tr);
|
||||
}
|
||||
|
||||
bool ScintillaCall::CanRedo() {
|
||||
return Call(Message::CanRedo);
|
||||
}
|
||||
|
@ -1415,6 +1423,10 @@ Position ScintillaCall::ReplaceTargetRE(Position length, const char *text) {
|
|||
return CallString(Message::ReplaceTargetRE, length, text);
|
||||
}
|
||||
|
||||
Position ScintillaCall::ReplaceTargetMinimal(Position length, const char *text) {
|
||||
return CallString(Message::ReplaceTargetMinimal, length, text);
|
||||
}
|
||||
|
||||
Position ScintillaCall::SearchInTarget(Position length, const char *text) {
|
||||
return CallString(Message::SearchInTarget, length, text);
|
||||
}
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
<key>CFBundlePackageType</key>
|
||||
<string>$(PRODUCT_BUNDLE_PACKAGE_TYPE)</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>5.3.1</string>
|
||||
<string>5.3.2</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>$(CURRENT_PROJECT_VERSION)</string>
|
||||
<key>NSHumanReadableCopyright</key>
|
||||
|
|
|
@ -573,7 +573,7 @@
|
|||
CLANG_WARN_UNREACHABLE_CODE = YES;
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
COPY_PHASE_STRIP = NO;
|
||||
CURRENT_PROJECT_VERSION = 5.3.1;
|
||||
CURRENT_PROJECT_VERSION = 5.3.2;
|
||||
DEBUG_INFORMATION_FORMAT = dwarf;
|
||||
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||
ENABLE_TESTABILITY = YES;
|
||||
|
@ -635,7 +635,7 @@
|
|||
CLANG_WARN_UNREACHABLE_CODE = YES;
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
COPY_PHASE_STRIP = NO;
|
||||
CURRENT_PROJECT_VERSION = 5.3.1;
|
||||
CURRENT_PROJECT_VERSION = 5.3.2;
|
||||
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
|
||||
ENABLE_NS_ASSERTIONS = NO;
|
||||
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||
|
@ -665,7 +665,7 @@
|
|||
CODE_SIGN_IDENTITY = "-";
|
||||
CODE_SIGN_STYLE = Manual;
|
||||
COMBINE_HIDPI_IMAGES = YES;
|
||||
CURRENT_PROJECT_VERSION = 5.3.1;
|
||||
CURRENT_PROJECT_VERSION = 5.3.2;
|
||||
DEFINES_MODULE = YES;
|
||||
DEVELOPMENT_TEAM = "";
|
||||
DYLIB_COMPATIBILITY_VERSION = 1;
|
||||
|
@ -699,7 +699,7 @@
|
|||
CODE_SIGN_IDENTITY = "-";
|
||||
CODE_SIGN_STYLE = Manual;
|
||||
COMBINE_HIDPI_IMAGES = YES;
|
||||
CURRENT_PROJECT_VERSION = 5.3.1;
|
||||
CURRENT_PROJECT_VERSION = 5.3.2;
|
||||
DEFINES_MODULE = YES;
|
||||
DEVELOPMENT_TEAM = "";
|
||||
DYLIB_COMPATIBILITY_VERSION = 1;
|
||||
|
|
|
@ -1 +1 @@
|
|||
@del /S /Q *.a *.aps *.bsc *.dll *.dsw *.exe *.idb *.ilc *.ild *.ilf *.ilk *.ils *.lib *.map *.ncb *.obj *.o *.opt *.ipdb *.pdb *.plg *.res *.sbr *.tds *.exp *.tlog >NUL:
|
||||
@del /S /Q *.a *.aps *.bsc *.dll *.dsw *.exe *.idb *.ilc *.ild *.ilf *.ilk *.ils *.lib *.map *.ncb *.obj *.o *.opt *.ipdb *.pdb *.plg *.res *.sbr *.tds *.exp *.tlog *.lastbuildstate >NUL:
|
||||
|
|
|
@ -129,7 +129,7 @@
|
|||
|
||||
<h1>Scintilla Documentation</h1>
|
||||
|
||||
<p>Last edited 1 October 2022 NH</p>
|
||||
<p>Last edited 15 November 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 />
|
||||
|
@ -275,7 +275,7 @@
|
|||
|
||||
<td>Colours are set using the RGBA format (Red, Green, Blue, Alpha).
|
||||
This is similar to <a class="seealso" href="#colour">colour</a> but with a byte
|
||||
of <a class="seealso" href="#colour">alpha</a> added. They are combined as:
|
||||
of <a class="seealso" href="#alpha">alpha</a> added. They are combined as:
|
||||
red | (green << 8) | (blue << 16) | (alpha << 24).
|
||||
Fully opaque uses an alpha of 255.
|
||||
</tr>
|
||||
|
@ -536,6 +536,7 @@
|
|||
<a class="message" href="#SCI_GETSTYLEAT">SCI_GETSTYLEAT(position pos) → int</a><br />
|
||||
<a class="message" href="#SCI_GETSTYLEINDEXAT">SCI_GETSTYLEINDEXAT(position pos) → int</a><br />
|
||||
<a class="message" href="#SCI_GETSTYLEDTEXT">SCI_GETSTYLEDTEXT(<unused>, Sci_TextRange *tr) → position</a><br />
|
||||
<a class="message" href="#SCI_GETSTYLEDTEXTFULL">SCI_GETSTYLEDTEXTFULL(<unused>, Sci_TextRangeFull *tr) → position</a><br />
|
||||
<a class="message" href="#SCI_RELEASEALLEXTENDEDSTYLES">SCI_RELEASEALLEXTENDEDSTYLES</a><br />
|
||||
<a class="message" href="#SCI_ALLOCATEEXTENDEDSTYLES">SCI_ALLOCATEEXTENDEDSTYLES(int numberStyles) → int</a><br />
|
||||
<a class="message" href="#SCI_TARGETASUTF8">SCI_TARGETASUTF8(<unused>, char *s) → position</a><br />
|
||||
|
@ -623,15 +624,19 @@
|
|||
<a class="seealso" href="#SCI_GETSTYLEDTEXT">SCI_GETSTYLEDTEXT</a>,
|
||||
<a class="seealso" href="#SCI_GETTEXT">SCI_GETTEXT</a></code></p>
|
||||
|
||||
<p><b id="SCI_GETSTYLEDTEXT">SCI_GETSTYLEDTEXT(<unused>, <a class="jump" href="#Sci_TextRange">Sci_TextRange</a> *tr) → position</b><br />
|
||||
<p>
|
||||
<b id="SCI_GETSTYLEDTEXT">SCI_GETSTYLEDTEXT(<unused>, <a class="jump" href="#Sci_TextRange">Sci_TextRange</a> *tr) → position</b><br />
|
||||
<b id="SCI_GETSTYLEDTEXTFULL">SCI_GETSTYLEDTEXTFULL(<unused>, <a class="jump" href="#Sci_TextRangeFull">Sci_TextRangeFull</a> *tr) → position</b><br />
|
||||
This collects styled text into a buffer using two bytes for each cell, with the character at
|
||||
the lower address of each pair and the style byte at the upper address. Characters between the
|
||||
positions <code>cpMin</code> and <code>cpMax</code> are copied to <code>lpstrText</code> (see
|
||||
<code>struct Sci_TextRange</code> in <code>Scintilla.h</code>). Two 0 bytes are added to the end of
|
||||
<code>struct Sci_TextRange</code> and <code>struct Sci_TextRangeFull</code> in <code>Scintilla.h</code>). Two 0 bytes are added to the end of
|
||||
the text, so the buffer that <code>lpstrText</code> points at must be at least
|
||||
<code>2*(cpMax-cpMin)+2</code> bytes long. No check is made for sensible values of
|
||||
<code>cpMin</code> or <code>cpMax</code>. Positions outside the document return character codes
|
||||
and style bytes of 0.</p>
|
||||
<p><code>SCI_GETSTYLEDTEXTFULL</code> uses 64-bit positions on all platforms so is safe for documents larger than 2GB.
|
||||
It should always be used in preference to <code>SCI_GETSTYLEDTEXT</code> which will be deprecated in a future release.</p>
|
||||
|
||||
<p>See also: <code><a class="seealso" href="#SCI_GETSELTEXT">SCI_GETSELTEXT</a>,
|
||||
<a class="seealso" href="#SCI_GETLINE">SCI_GETLINE</a>,
|
||||
|
@ -717,7 +722,7 @@
|
|||
and <code>CHARRANGE</code>, so that older code that treats Scintilla as a RichEdit will
|
||||
work.</p>
|
||||
<p>In a future release, these types will be deprecated.
|
||||
<a class="seealso" href="#SCI_MARGINSETSTYLEOFFSET">SCI_GETTEXTRANGEFULL</a>, <code>Sci_TextRangeFull</code>
|
||||
<a class="seealso" href="#SCI_GETTEXTRANGEFULL">SCI_GETTEXTRANGEFULL</a>, <code>Sci_TextRangeFull</code>
|
||||
and <code>Sci_CharacterRangeFull</code> should be used instead.</p>
|
||||
<pre>
|
||||
typedef long Sci_PositionCR;
|
||||
|
@ -816,6 +821,7 @@ struct Sci_TextRangeFull {
|
|||
<a class="message" href="#SCI_SEARCHINTARGET">SCI_SEARCHINTARGET(position length, const char *text) → position</a><br />
|
||||
<a class="message" href="#SCI_GETTARGETTEXT">SCI_GETTARGETTEXT(<unused>, char *text) → position</a><br />
|
||||
<a class="message" href="#SCI_REPLACETARGET">SCI_REPLACETARGET(position length, const char *text) → position</a><br />
|
||||
<a class="message" href="#SCI_REPLACETARGETMINIMAL">SCI_REPLACETARGETMINIMAL(position length, const char *text) → position</a><br />
|
||||
<a class="message" href="#SCI_REPLACETARGETRE">SCI_REPLACETARGETRE(position length, const char *text) → position</a><br />
|
||||
<a class="message" href="#SCI_GETTAG">SCI_GETTAG(int tagNumber, char *tagValue) → int</a><br />
|
||||
</code>
|
||||
|
@ -865,9 +871,21 @@ struct Sci_TextRangeFull {
|
|||
<p><b id="SCI_REPLACETARGET">SCI_REPLACETARGET(position length, const char *text) → position</b><br />
|
||||
If <code class="parameter">length</code> is -1, <code class="parameter">text</code> is a zero terminated string, otherwise
|
||||
<code class="parameter">length</code> sets the number of character to replace the target with.
|
||||
After replacement, the target range refers to the replacement text.
|
||||
The return value
|
||||
is the length of the replacement string.<br />
|
||||
After replacement, the target range refers to the replacement text.
|
||||
The return value is the length of the replacement string.<br />
|
||||
Note that the recommended way to delete text in the document is to set the target to the text to be removed,
|
||||
and to perform a replace target with an empty string.</p>
|
||||
|
||||
<p><b id="SCI_REPLACETARGETMINIMAL">SCI_REPLACETARGETMINIMAL(position length, const char *text) → position</b><br />
|
||||
This is similar to <a class="message" href="#SCI_REPLACETARGET"><code>SCI_REPLACETARGET</code></a>
|
||||
but tries to minimize change history when the current target text shares a common prefix or suffix with the replacement.
|
||||
Only the text that is actually different is marked as changed.
|
||||
This might be used when automatically reformatting some text
|
||||
so that the whole area formatted doesn't show change marks.
|
||||
If <code class="parameter">length</code> is -1, <code class="parameter">text</code> is a zero terminated string, otherwise
|
||||
<code class="parameter">length</code> sets the number of character to replace the target with.
|
||||
After replacement, the target range refers to the replacement text.
|
||||
The return value is the length of the replacement string.<br />
|
||||
Note that the recommended way to delete text in the document is to set the target to the text to be removed,
|
||||
and to perform a replace target with an empty string.</p>
|
||||
|
||||
|
@ -877,8 +895,8 @@ struct Sci_TextRangeFull {
|
|||
characters to use. The replacement string is formed from the text string with any sequences of
|
||||
<code>\1</code> through <code>\9</code> replaced by tagged matches from the most recent regular
|
||||
expression search. <code>\0</code> is replaced with all the matched text from the most recent search.
|
||||
After replacement, the target range refers to the replacement text.
|
||||
The return value is the length of the replacement string.</p>
|
||||
After replacement, the target range refers to the replacement text.
|
||||
The return value is the length of the replacement string.</p>
|
||||
|
||||
<p><b id="SCI_GETTAG">SCI_GETTAG(int tagNumber, char *tagValue NUL-terminated) → int</b><br />
|
||||
Discover what text was matched by tagged expressions in a regular expression search.
|
||||
|
@ -1739,11 +1757,12 @@ struct Sci_TextToFindFull {
|
|||
If the text argument is NULL(0) then the length that should be allocated
|
||||
to store the entire current line is returned.</p>
|
||||
|
||||
<p>See also: <code><a class="seealso" href="#SCI_GETSELTEXT">SCI_GETSELTEXT</a>, <a
|
||||
class="seealso" href="#SCI_GETLINE">SCI_GETLINE</a>, <a class="seealso"
|
||||
href="#SCI_GETTEXT">SCI_GETTEXT</a>, <a class="seealso"
|
||||
href="#SCI_GETSTYLEDTEXT">SCI_GETSTYLEDTEXT</a>, <a class="seealso"
|
||||
href="#SCI_GETTEXTRANGE">SCI_GETTEXTRANGE</a></code></p>
|
||||
<p>See also: <code
|
||||
<a class="seealso" href="#SCI_GETSELTEXT">SCI_GETSELTEXT</a>,
|
||||
<a class="seealso" href="#SCI_GETLINE">SCI_GETLINE</a>,
|
||||
<a class="seealso" href="#SCI_GETTEXT">SCI_GETTEXT</a>,
|
||||
<a class="seealso" href="#SCI_GETSTYLEDTEXT">SCI_GETSTYLEDTEXT</a>,
|
||||
<a class="seealso" href="#SCI_GETTEXTRANGE">SCI_GETTEXTRANGE</a></code></p>
|
||||
|
||||
<p><b id="SCI_SELECTIONISRECTANGLE">SCI_SELECTIONISRECTANGLE → bool</b><br />
|
||||
This returns 1 if the current selection is in rectangle mode, 0 if not.</p>
|
||||
|
@ -4895,7 +4914,7 @@ struct Sci_TextToFindFull {
|
|||
<p>If the call succeeded <code>SCI_GETBIDIRECTIONAL</code> will return the same value otherwise
|
||||
<code>SC_BIDIRECTIONAL_DISABLED</code> (0) is returned.
|
||||
</p>
|
||||
<p>Opaque selection drawing (<a class="seealso" href="#SCI_SETSELECTIONLAYER">SC_LAYER_BASE</a>)
|
||||
<p>Opaque selection drawing (<a class="seealso" href="#SCI_SETSELECTIONLAYER">SCI_SETSELECTIONLAYER(SC_LAYER_BASE)</a>)
|
||||
is not supported in bidirectional mode.
|
||||
Use <code>SC_LAYER_UNDER_TEXT</code> or <code>SC_LAYER_OVER_TEXT</code> instead.
|
||||
</p>
|
||||
|
@ -5494,10 +5513,10 @@ struct Sci_TextToFindFull {
|
|||
<p><b id="SCI_MARKERADD">SCI_MARKERADD(line line, int markerNumber) → int</b><br />
|
||||
This message adds marker number <code class="parameter">markerNumber</code> to a line. The message returns -1 if
|
||||
this fails (illegal line number, out of memory) or it returns a marker handle number that
|
||||
identifies the added marker. You can use this returned handle with <a class="seealso"
|
||||
href="#SCI_MARKERLINEFROMHANDLE"><code>SCI_MARKERLINEFROMHANDLE</code></a> to find where a
|
||||
marker is after moving or combining lines and with <a class="message"
|
||||
href="#SCI_MARKERDELETEHANDLE"><code>SCI_MARKERDELETEHANDLE</code></a> to delete the marker
|
||||
identifies the added marker. You can use this returned handle with
|
||||
<a class="seealso" href="#SCI_MARKERLINEFROMHANDLE"><code>SCI_MARKERLINEFROMHANDLE</code></a> to find where a
|
||||
marker is after moving or combining lines and with
|
||||
<a class="message" href="#SCI_MARKERDELETEHANDLE"><code>SCI_MARKERDELETEHANDLE</code></a> to delete the marker
|
||||
based on its handle. The message does not check the value of markerNumber, nor does it
|
||||
check if the line already contains the marker.</p>
|
||||
|
||||
|
@ -5716,7 +5735,7 @@ struct Sci_TextToFindFull {
|
|||
<td>A rectangle with rounded corners around the text using translucent drawing with the
|
||||
interior usually more transparent than the border. You can use
|
||||
<a class="seealso" href="#SCI_INDICSETALPHA">SCI_INDICSETALPHA</a> and
|
||||
<a class="seealso" href="#SCI_INDICSETOUTLINEALPHA">SCI_INDICSETOUTLINEALPHA</a>
|
||||
<a class="seealso" href="#SCI_INDICSETOUTLINEALPHA">SCI_INDICSETOUTLINEALPHA</a>
|
||||
to control the alpha transparency values. The default alpha values are 30 for fill colour and 50 for outline colour.</td>
|
||||
</tr>
|
||||
|
||||
|
@ -5728,7 +5747,7 @@ struct Sci_TextToFindFull {
|
|||
<td>A rectangle around the text using translucent drawing with the
|
||||
interior usually more transparent than the border. You can use
|
||||
<a class="seealso" href="#SCI_INDICSETALPHA">SCI_INDICSETALPHA</a> and
|
||||
<a class="seealso" href="#SCI_INDICSETOUTLINEALPHA">SCI_INDICSETOUTLINEALPHA</a>
|
||||
<a class="seealso" href="#SCI_INDICSETOUTLINEALPHA">SCI_INDICSETOUTLINEALPHA</a>
|
||||
to control the alpha transparency values. The default alpha values are 30 for fill colour and 50 for outline colour.
|
||||
This indicator does not colour the top pixel of the line so that indicators on contiguous lines are visually distinct
|
||||
and disconnected.</td>
|
||||
|
@ -5896,7 +5915,7 @@ struct Sci_TextToFindFull {
|
|||
On many systems a half pixel value will appear as a fainter line but it allows drawing very thin lines on systems with multiple physical pixels
|
||||
per logical pixel.
|
||||
Half (logical) pixel lines are available on macOS with 'retina' displays,
|
||||
see <a class="seealso" href="#SCI_SUPPORTSFEATURE">SC_SUPPORTS_PIXEL_DIVISIONS</a>.</p>
|
||||
see <a class="seealso" href="#SCI_SUPPORTSFEATURE">SCI_SUPPORTSFEATURE(SC_SUPPORTS_PIXEL_DIVISIONS)</a>.</p>
|
||||
|
||||
<p><b id="SCI_INDICSETALPHA">SCI_INDICSETALPHA(int indicator, <a class="jump" href="#alpha">alpha</a> alpha)</b><br />
|
||||
<b id="SCI_INDICGETALPHA">SCI_INDICGETALPHA(int indicator) → int</b><br />
|
||||
|
@ -6208,8 +6227,8 @@ struct Sci_TextToFindFull {
|
|||
<b id="SCI_AUTOCGETAUTOHIDE">SCI_AUTOCGETAUTOHIDE → bool</b><br />
|
||||
By default, the list is cancelled if there are no viable matches (the user has typed
|
||||
characters that no longer match a list entry). If you want to keep displaying the original
|
||||
list, set <code class="parameter">autoHide</code> to <code>false</code>. This also effects <a class="seealso"
|
||||
href="#SCI_AUTOCSELECT"><code>SCI_AUTOCSELECT</code></a>.</p>
|
||||
list, set <code class="parameter">autoHide</code> to <code>false</code>. This also effects
|
||||
<a class="seealso" href="#SCI_AUTOCSELECT"><code>SCI_AUTOCSELECT</code></a>.</p>
|
||||
|
||||
<p><b id="SCI_AUTOCSETDROPRESTOFWORD">SCI_AUTOCSETDROPRESTOFWORD(bool dropRestOfWord)</b><br />
|
||||
<b id="SCI_AUTOCGETDROPRESTOFWORD">SCI_AUTOCGETDROPRESTOFWORD → bool</b><br />
|
||||
|
@ -7201,7 +7220,7 @@ sptr_t CallScintilla(unsigned int iMessage, uptr_t wParam, sptr_t lParam){
|
|||
<p>For many applications lexing documents larger than 4GB will be too sluggish so
|
||||
<code>SC_DOCUMENTOPTION_STYLES_NONE</code>
|
||||
and the null lexer <code>"null"</code> can be used. Another approach is to turn on idle styling with
|
||||
<a class="seealso" href="#SCI_SETIDLESTYLING"><code>SCI_SETIDLESTYLING</code></a>.
|
||||
<code><a class="seealso" href="#SCI_SETIDLESTYLING">SCI_SETIDLESTYLING</code></a>.
|
||||
</p>
|
||||
|
||||
<table class="standard" summary="Document options">
|
||||
|
@ -7964,7 +7983,7 @@ sptr_t CallScintilla(unsigned int iMessage, uptr_t wParam, sptr_t lParam){
|
|||
<b id="SCI_GETLAYOUTTHREADS">SCI_GETLAYOUTTHREADS → int</b><br />
|
||||
The time taken to measure text runs on wide lines can be improved by performing the task
|
||||
concurrently on multiple threads when
|
||||
<a class="seealso" href="#SCI_SUPPORTSFEATURE">SC_SUPPORTS_THREAD_SAFE_MEASURE_WIDTHS</a>
|
||||
<a class="seealso" href="#SCI_SUPPORTSFEATURE">SCI_SUPPORTSFEATURE(SC_SUPPORTS_THREAD_SAFE_MEASURE_WIDTHS)</a>
|
||||
is available.
|
||||
This can be a dramatic improvement - a 4 core processor is often able to reduce text layout time to just over one
|
||||
quarter of the single-threaded time.</p>
|
||||
|
@ -8222,8 +8241,8 @@ sptr_t CallScintilla(unsigned int iMessage, uptr_t wParam, sptr_t lParam){
|
|||
<code>SCI_SETILEXER</code> allows setting a lexer as an <code>ILexer5*</code>.
|
||||
The lexer may be implemented by an application or a shared library such as Lexilla.</p>
|
||||
|
||||
<p>To test if your lexer assignment worked, use <a class="seealso"
|
||||
href="#SCI_GETLEXER"><code>SCI_GETLEXER</code></a> before and after setting the new lexer to
|
||||
<p>To test if your lexer assignment worked, use <a class="seealso" href="#SCI_GETLEXER"><code>SCI_GETLEXER</code></a>
|
||||
before and after setting the new lexer to
|
||||
see if the lexer number changed.</p>
|
||||
|
||||
<p><code>SCI_GETLEXERLANGUAGE</code> retrieves the name of the lexer.</p>
|
||||
|
@ -8712,10 +8731,8 @@ struct SCNotification {
|
|||
form:</p>
|
||||
<pre>
|
||||
startPos = <a class="seealso" href="#SCI_GETENDSTYLED">SCI_GETENDSTYLED</a>()
|
||||
lineNumber = <a class="seealso"
|
||||
href="#SCI_LINEFROMPOSITION">SCI_LINEFROMPOSITION</a>(startPos);
|
||||
startPos = <a class="seealso"
|
||||
href="#SCI_POSITIONFROMLINE">SCI_POSITIONFROMLINE</a>(lineNumber);
|
||||
lineNumber = <a class="seealso" href="#SCI_LINEFROMPOSITION">SCI_LINEFROMPOSITION</a>(startPos);
|
||||
startPos = <a class="seealso" href="#SCI_POSITIONFROMLINE">SCI_POSITIONFROMLINE</a>(lineNumber);
|
||||
MyStyleRoutine(startPos, SCNotification.position);
|
||||
</pre>
|
||||
|
||||
|
@ -9155,8 +9172,8 @@ href="#SCI_POSITIONFROMLINE">SCI_POSITIONFROMLINE</a>(lineNumber);
|
|||
<td align="right">0x100000</td>
|
||||
|
||||
<td>Text is about to be inserted. The handler may change the text being inserted by calling
|
||||
<a class="seealso" href="#SCI_CHANGEINSERTION">SCI_CHANGEINSERTION</a>.
|
||||
No other modifications may be made in this handler.</td>
|
||||
<a class="seealso" href="#SCI_CHANGEINSERTION">SCI_CHANGEINSERTION</a>.
|
||||
No other modifications may be made in this handler.</td>
|
||||
|
||||
<td><code>position, length, text</code></td>
|
||||
</tr>
|
||||
|
@ -9597,6 +9614,16 @@ for line = lineStart to lineEnd do SCI_ENSUREVISIBLE(line) next
|
|||
triggered the completion. ch is 0.</td>
|
||||
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="left"><code>SC_AC_SINGLE_CHOICE</code></td>
|
||||
|
||||
<td align="center">6</td>
|
||||
|
||||
<td>There was only a single choice in the list and 'choose single' mode was active as set by
|
||||
<code>
|
||||
<a class="seealso" href="#SCI_AUTOCSETCHOOSESINGLE">SCI_AUTOCSETCHOOSESINGLE</a></code>. ch is 0.</td>
|
||||
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
|
|
|
@ -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/scintilla531.zip">
|
||||
<font size="4"> <a href="https://www.scintilla.org/scintilla532.zip">
|
||||
Windows</a>
|
||||
<a href="https://www.scintilla.org/scintilla531.tgz">
|
||||
<a href="https://www.scintilla.org/scintilla532.tgz">
|
||||
GTK/Linux</a>
|
||||
</font>
|
||||
</td>
|
||||
|
@ -42,7 +42,7 @@
|
|||
containing very few restrictions.
|
||||
</p>
|
||||
<h3>
|
||||
Release 5.3.1
|
||||
Release 5.3.2
|
||||
</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/scintilla531.zip">zip format</a> (1.4M) commonly used on Windows</li>
|
||||
<li><a href="https://www.scintilla.org/scintilla531.tgz">tgz format</a> (1.2M) commonly used on Linux and compatible operating systems</li>
|
||||
<li><a href="https://www.scintilla.org/scintilla532.zip">zip format</a> (1.4M) commonly used on Windows</li>
|
||||
<li><a href="https://www.scintilla.org/scintilla532.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>
|
||||
|
|
|
@ -574,9 +574,61 @@
|
|||
</tr><tr>
|
||||
<td>Reinhard Nißl</td>
|
||||
<td>Ferdinand Oeinck</td>
|
||||
<td>Michael Heath</td>
|
||||
</tr>
|
||||
</table>
|
||||
<h2>Releases</h2>
|
||||
<h3>
|
||||
<a href="https://www.scintilla.org/scintilla532.zip">Release 5.3.2</a>
|
||||
</h3>
|
||||
<ul>
|
||||
<li>
|
||||
Released 6 December 2022.
|
||||
</li>
|
||||
<li>
|
||||
Add SCI_REPLACETARGETMINIMAL to change text without causing unchanged prefix and suffix
|
||||
to be marked as modified in change history.
|
||||
</li>
|
||||
<li>
|
||||
Draw background colour for EOL annotations with standard and boxed visuals.
|
||||
</li>
|
||||
<li>
|
||||
Add SCI_GETSTYLEDTEXTFULL to support 64-bit document positions on Win32 replacing
|
||||
SCI_GETSTYLEDTEXT which is not safe for huge documents.
|
||||
<a href="https://sourceforge.net/p/scintilla/feature-requests/1455/">Feature #1455</a>.
|
||||
</li>
|
||||
<li>
|
||||
Send SCN_AUTOCCOMPLETED for SCI_AUTOCSHOW
|
||||
triggering insertion because of SCI_AUTOCSETCHOOSESINGLE mode.
|
||||
<a href="https://sourceforge.net/p/scintilla/feature-requests/1459/">Feature #1459</a>.
|
||||
</li>
|
||||
<li>
|
||||
Change 'paragraph up' commands SCI_PARAUP and SCI_PARAUPEXTEND to
|
||||
go to the start position of the paragraph containing the caret.
|
||||
Only if the caret is already at the start of the paragraph will it go to the start
|
||||
of the previous paragraph.
|
||||
<a href="https://sourceforge.net/p/scintilla/bugs/2363/">Bug #2363</a>.
|
||||
</li>
|
||||
<li>
|
||||
Change release compilation optimization option to favour speed over space.
|
||||
-O2 for MSVC and -O3 for gcc and clang.
|
||||
</li>
|
||||
<li>
|
||||
On Win32, avoid blurry display with DirectWrite in GDI scaling mode.
|
||||
<a href="https://sourceforge.net/p/scintilla/bugs/2344/">Bug #2344</a>.
|
||||
</li>
|
||||
<li>
|
||||
On Win32, use the top-level window to find the monitor for DirectWrite rendering parameters.
|
||||
Temporarily switch DPI awareness to find correct monitor in GDI scaling mode.
|
||||
<a href="https://sourceforge.net/p/scintilla/bugs/2344/">Bug #2344</a>.
|
||||
</li>
|
||||
<li>
|
||||
On Qt, implement SCI_SETRECTANGULARSELECTIONMODIFIER for all platforms.
|
||||
</li>
|
||||
<li>
|
||||
On Qt, allow string form XPM images for SCI_REGISTERIMAGE.
|
||||
</li>
|
||||
</ul>
|
||||
<h3>
|
||||
<a href="https://www.scintilla.org/scintilla531.zip">Release 5.3.1</a>
|
||||
</h3>
|
||||
|
@ -1933,7 +1985,7 @@
|
|||
</li>
|
||||
<li>
|
||||
SciTE supports changing caret style via caret.style property.
|
||||
<a href="https://sourceforge.net/p/scintilla/feature-requests/1264/">Feature #1624</a>.
|
||||
<a href="https://sourceforge.net/p/scintilla/feature-requests/1264/">Feature #1264</a>.
|
||||
</li>
|
||||
<li>
|
||||
Lexer added for .NET's Common Intermediate Language CIL.
|
||||
|
@ -2432,15 +2484,15 @@
|
|||
</li>
|
||||
<li>
|
||||
Minor undefined behaviour fixed.
|
||||
<a href="https://sourceforge.net/p/scintilla/bugs/1978">Bug #1978</a>.
|
||||
<a href="https://sourceforge.net/p/scintilla/bugs/1978/">Bug #1978</a>.
|
||||
</li>
|
||||
<li>
|
||||
On Cocoa, improve scrolling on macOS 10.12.
|
||||
<a href="https://sourceforge.net/p/scintilla/bugs/1885">Bug #1885</a>.
|
||||
<a href="https://sourceforge.net/p/scintilla/bugs/1885/">Bug #1885</a>.
|
||||
</li>
|
||||
<li>
|
||||
On Cocoa, fix line selection by clicking in the margin when scrolled.
|
||||
<a href="https://sourceforge.net/p/scintilla/bugs/1971">Bug #1971</a>.
|
||||
<a href="https://sourceforge.net/p/scintilla/bugs/1971/">Bug #1971</a>.
|
||||
</li>
|
||||
</ul>
|
||||
<h3>
|
||||
|
@ -2525,7 +2577,7 @@
|
|||
</li>
|
||||
<li>
|
||||
On GTK+ fix drawing problems including incorrect scrollbar redrawing and flickering of text.
|
||||
<a href="https://sourceforge.net/p/scintilla/bugs/1876">Bug #1876</a>.
|
||||
<a href="https://sourceforge.net/p/scintilla/bugs/1876/">Bug #1876</a>.
|
||||
</li>
|
||||
<li>
|
||||
On Linux, both for GTK+ and Qt, the default modifier key for rectangular selection is now Alt.
|
||||
|
@ -2536,7 +2588,7 @@
|
|||
<li>
|
||||
On Cocoa, fix doCommandBySelector but avoid double effect of 'delete'
|
||||
key.
|
||||
<a href="https://sourceforge.net/p/scintilla/bugs/1958">Bug #1958</a>.
|
||||
<a href="https://sourceforge.net/p/scintilla/bugs/1958/">Bug #1958</a>.
|
||||
</li>
|
||||
<li>
|
||||
On Qt, the updateUi signal includes the 'updated' flags.
|
||||
|
|
|
@ -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="20221012" />
|
||||
<meta name="Date.Modified" content="20221206" />
|
||||
<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.3.1<br />
|
||||
Site last modified October 12 2022</font>
|
||||
<font color="#FFCC99" size="3"> Release version 5.3.2<br />
|
||||
Site last modified December 6 2022</font>
|
||||
</td>
|
||||
<td width="20%">
|
||||
|
||||
|
@ -72,6 +72,7 @@
|
|||
</tr>
|
||||
</table>
|
||||
<ul id="versionlist">
|
||||
<li>Version 5.3.2 adds SCI_REPLACETARGETMINIMAL to modify text without marking unchanged start and end text in change history.</li>
|
||||
<li>Version 5.3.1 can represent invisible text with a character to simplify editing and provide summarized views.</li>
|
||||
<li>Version 5.3.0 adds change history.</li>
|
||||
<li>Version 5.2.4 fixes failures on GTK with multi-threaded layout.</li>
|
||||
|
|
|
@ -84,7 +84,7 @@ DEFINES += -DNO_CXX11_REGEX
|
|||
endif
|
||||
|
||||
DEFINES += -D$(if $(DEBUG),DEBUG,NDEBUG)
|
||||
BASE_FLAGS += $(if $(DEBUG),-g,-Os)
|
||||
BASE_FLAGS += $(if $(DEBUG),-g,-O3)
|
||||
|
||||
CXX_BASE_FLAGS =--std=c++17 $(BASE_FLAGS)
|
||||
CXX_ALL_FLAGS =$(DEFINES) $(INCLUDES) $(CXX_BASE_FLAGS) $(CONFIG_FLAGS)
|
||||
|
|
|
@ -63,6 +63,7 @@ typedef sptr_t (*SciFnDirectStatus)(sptr_t ptr, unsigned int iMessage, uptr_t wP
|
|||
#define SCI_SELECTALL 2013
|
||||
#define SCI_SETSAVEPOINT 2014
|
||||
#define SCI_GETSTYLEDTEXT 2015
|
||||
#define SCI_GETSTYLEDTEXTFULL 2778
|
||||
#define SCI_CANREDO 2016
|
||||
#define SCI_MARKERLINEFROMHANDLE 2017
|
||||
#define SCI_MARKERDELETEHANDLE 2018
|
||||
|
@ -557,6 +558,7 @@ typedef sptr_t (*SciFnDirectStatus)(sptr_t ptr, unsigned int iMessage, uptr_t wP
|
|||
#define SCI_TARGETWHOLEDOCUMENT 2690
|
||||
#define SCI_REPLACETARGET 2194
|
||||
#define SCI_REPLACETARGETRE 2195
|
||||
#define SCI_REPLACETARGETMINIMAL 2779
|
||||
#define SCI_SEARCHINTARGET 2197
|
||||
#define SCI_SETSEARCHFLAGS 2198
|
||||
#define SCI_GETSEARCHFLAGS 2199
|
||||
|
@ -1240,6 +1242,7 @@ typedef sptr_t (*SciFnDirectStatus)(sptr_t ptr, unsigned int iMessage, uptr_t wP
|
|||
#define SC_AC_TAB 3
|
||||
#define SC_AC_NEWLINE 4
|
||||
#define SC_AC_COMMAND 5
|
||||
#define SC_AC_SINGLE_CHOICE 6
|
||||
#define SC_CHARACTERSOURCE_DIRECT_INPUT 0
|
||||
#define SC_CHARACTERSOURCE_TENTATIVE_INPUT 1
|
||||
#define SC_CHARACTERSOURCE_IME_RESULT 2
|
||||
|
|
|
@ -154,6 +154,10 @@ fun void SetSavePoint=2014(,)
|
|||
# Returns the number of bytes in the buffer not including terminating NULs.
|
||||
fun position GetStyledText=2015(, textrange tr)
|
||||
|
||||
# Retrieve a buffer of cells that can be past 2GB.
|
||||
# Returns the number of bytes in the buffer not including terminating NULs.
|
||||
fun position GetStyledTextFull=2778(, textrangefull tr)
|
||||
|
||||
# Are there any redoable actions in the undo history?
|
||||
fun bool CanRedo=2016(,)
|
||||
|
||||
|
@ -1446,6 +1450,10 @@ fun position ReplaceTarget=2194(position length, string text)
|
|||
# caused by processing the \d patterns.
|
||||
fun position ReplaceTargetRE=2195(position length, string text)
|
||||
|
||||
# Replace the target text with the argument text but ignore prefix and suffix that
|
||||
# are the same as current.
|
||||
fun position ReplaceTargetMinimal=2779(position length, string text)
|
||||
|
||||
# Search for a counted string in the target and set the target to the found
|
||||
# range. Text is counted so it can contain NULs.
|
||||
# Returns start of found range or -1 for failure in which case target is not moved.
|
||||
|
@ -3346,6 +3354,7 @@ val SC_AC_DOUBLECLICK=2
|
|||
val SC_AC_TAB=3
|
||||
val SC_AC_NEWLINE=4
|
||||
val SC_AC_COMMAND=5
|
||||
val SC_AC_SINGLE_CHOICE=6
|
||||
|
||||
ali SC_AC_FILLUP=FILL_UP
|
||||
ali SC_AC_DOUBLECLICK=DOUBLE_CLICK
|
||||
|
|
|
@ -71,6 +71,7 @@ public:
|
|||
std::string StringOfRange(Span span);
|
||||
Position ReplaceTarget(std::string_view text);
|
||||
Position ReplaceTargetRE(std::string_view text);
|
||||
Position ReplaceTargetMinimal(std::string_view text);
|
||||
Position SearchInTarget(std::string_view text);
|
||||
Span SpanSearchInTarget(std::string_view text);
|
||||
|
||||
|
@ -95,6 +96,7 @@ public:
|
|||
void SelectAll();
|
||||
void SetSavePoint();
|
||||
Position GetStyledText(void *tr);
|
||||
Position GetStyledTextFull(void *tr);
|
||||
bool CanRedo();
|
||||
Line MarkerLineFromHandle(int markerHandle);
|
||||
void MarkerDeleteHandle(int markerHandle);
|
||||
|
@ -392,6 +394,7 @@ public:
|
|||
void TargetWholeDocument();
|
||||
Position ReplaceTarget(Position length, const char *text);
|
||||
Position ReplaceTargetRE(Position length, const char *text);
|
||||
Position ReplaceTargetMinimal(Position length, const char *text);
|
||||
Position SearchInTarget(Position length, const char *text);
|
||||
void SetSearchFlags(Scintilla::FindOption searchFlags);
|
||||
Scintilla::FindOption SearchFlags();
|
||||
|
|
|
@ -34,6 +34,7 @@ enum class Message {
|
|||
SelectAll = 2013,
|
||||
SetSavePoint = 2014,
|
||||
GetStyledText = 2015,
|
||||
GetStyledTextFull = 2778,
|
||||
CanRedo = 2016,
|
||||
MarkerLineFromHandle = 2017,
|
||||
MarkerDeleteHandle = 2018,
|
||||
|
@ -322,6 +323,7 @@ enum class Message {
|
|||
TargetWholeDocument = 2690,
|
||||
ReplaceTarget = 2194,
|
||||
ReplaceTargetRE = 2195,
|
||||
ReplaceTargetMinimal = 2779,
|
||||
SearchInTarget = 2197,
|
||||
SetSearchFlags = 2198,
|
||||
GetSearchFlags = 2199,
|
||||
|
|
|
@ -625,6 +625,7 @@ enum class CompletionMethods {
|
|||
Tab = 3,
|
||||
Newline = 4,
|
||||
Command = 5,
|
||||
SingleChoice = 6,
|
||||
};
|
||||
|
||||
enum class CharacterSource {
|
||||
|
|
|
@ -13,7 +13,7 @@ TEMPLATE = lib
|
|||
CONFIG += lib_bundle
|
||||
CONFIG += c++1z
|
||||
|
||||
VERSION = 5.3.1
|
||||
VERSION = 5.3.2
|
||||
|
||||
SOURCES += \
|
||||
ScintillaEdit.cpp \
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
|
||||
#include "PlatQt.h"
|
||||
#include "Scintilla.h"
|
||||
#include "XPM.h"
|
||||
#include "UniConversion.h"
|
||||
#include "DBCS.h"
|
||||
|
||||
|
@ -1146,7 +1147,9 @@ void ListBoxImpl::RegisterQPixmapImage(int type, const QPixmap& pm)
|
|||
|
||||
void ListBoxImpl::RegisterImage(int type, const char *xpmData)
|
||||
{
|
||||
RegisterQPixmapImage(type, QPixmap(reinterpret_cast<const char * const *>(xpmData)));
|
||||
XPM xpmImage(xpmData);
|
||||
RGBAImage rgbaImage(xpmImage);
|
||||
RegisterRGBAImage(type, rgbaImage.GetWidth(), rgbaImage.GetHeight(), rgbaImage.Pixels());
|
||||
}
|
||||
|
||||
void ListBoxImpl::RegisterRGBAImage(int type, int width, int height, const unsigned char *pixelsImage)
|
||||
|
|
|
@ -286,7 +286,6 @@ void ScintillaEditBase::keyPressEvent(QKeyEvent *event)
|
|||
emit keyPressed(event);
|
||||
}
|
||||
|
||||
#ifdef Q_WS_X11
|
||||
static int modifierTranslated(int sciModifier)
|
||||
{
|
||||
switch (sciModifier) {
|
||||
|
@ -302,7 +301,6 @@ static int modifierTranslated(int sciModifier)
|
|||
return 0;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
void ScintillaEditBase::mousePressEvent(QMouseEvent *event)
|
||||
{
|
||||
|
@ -323,13 +321,7 @@ void ScintillaEditBase::mousePressEvent(QMouseEvent *event)
|
|||
if (event->button() == Qt::LeftButton) {
|
||||
bool shift = QApplication::keyboardModifiers() & Qt::ShiftModifier;
|
||||
bool ctrl = QApplication::keyboardModifiers() & Qt::ControlModifier;
|
||||
#ifdef Q_WS_X11
|
||||
// On X allow choice of rectangular modifier since most window
|
||||
// managers grab alt + click for moving windows.
|
||||
bool alt = QApplication::keyboardModifiers() & modifierTranslated(sqt->rectangularSelectionModifier);
|
||||
#else
|
||||
bool alt = QApplication::keyboardModifiers() & Qt::AltModifier;
|
||||
#endif
|
||||
|
||||
sqt->ButtonDownWithModifiers(pos, time.elapsed(), ModifierFlags(shift, ctrl, alt));
|
||||
}
|
||||
|
@ -365,13 +357,7 @@ void ScintillaEditBase::mouseMoveEvent(QMouseEvent *event)
|
|||
|
||||
bool shift = QApplication::keyboardModifiers() & Qt::ShiftModifier;
|
||||
bool ctrl = QApplication::keyboardModifiers() & Qt::ControlModifier;
|
||||
#ifdef Q_WS_X11
|
||||
// On X allow choice of rectangular modifier since most window
|
||||
// managers grab alt + click for moving windows.
|
||||
bool alt = QApplication::keyboardModifiers() & modifierTranslated(sqt->rectangularSelectionModifier);
|
||||
#else
|
||||
bool alt = QApplication::keyboardModifiers() & Qt::AltModifier;
|
||||
#endif
|
||||
|
||||
const KeyMod modifiers = ModifierFlags(shift, ctrl, alt);
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@ TEMPLATE = lib
|
|||
CONFIG += lib_bundle
|
||||
CONFIG += c++1z
|
||||
|
||||
VERSION = 5.3.1
|
||||
VERSION = 5.3.2
|
||||
|
||||
SOURCES += \
|
||||
PlatQt.cpp \
|
||||
|
|
|
@ -755,6 +755,13 @@ sptr_t ScintillaQt::WndProc(Message iMessage, uptr_t wParam, sptr_t lParam)
|
|||
case Message::GetDirectPointer:
|
||||
return reinterpret_cast<sptr_t>(this);
|
||||
|
||||
case Message::SetRectangularSelectionModifier:
|
||||
rectangularSelectionModifier = static_cast<int>(wParam);
|
||||
break;
|
||||
|
||||
case Message::GetRectangularSelectionModifier:
|
||||
return rectangularSelectionModifier;
|
||||
|
||||
default:
|
||||
return ScintillaBase::WndProc(iMessage, wParam, lParam);
|
||||
}
|
||||
|
|
|
@ -161,7 +161,7 @@ def checkDocumentation():
|
|||
#~ if api not in headers:
|
||||
#~ print("No header for ", api)
|
||||
|
||||
# Examine definitions
|
||||
# Examine definitions
|
||||
#<b id="SCI_SETLAYOUTCACHE">SCI_SETLAYOUTCACHE(int cacheMode)</b>
|
||||
defPattern = re.compile(r'<b id="([A-Z_0-9]+)">([A-Z][A-Za-z0-9_() *#\"=<>/&;,\n-]+?)</b>')
|
||||
for api, sig in re.findall(defPattern, docs):
|
||||
|
@ -201,7 +201,7 @@ def checkDocumentation():
|
|||
with open(outName, "wt") as docFile:
|
||||
docFile.write(docs)
|
||||
|
||||
# Examine constant definitions
|
||||
# Examine constant definitions
|
||||
#<code>SC_CARETSTICKY_WHITESPACE</code> (2)
|
||||
constPattern = re.compile(r'<code>(\w+)</code> *\((\w+)\)')
|
||||
for name, val in re.findall(constPattern, docs):
|
||||
|
@ -212,6 +212,13 @@ def checkDocumentation():
|
|||
except KeyError:
|
||||
print("***", val, "<-", name)
|
||||
|
||||
# Examine 'seealso' definitions
|
||||
#<a class="seealso" href="#SCI_CREATEDOCUMENT">SCI_CREATEDOCUMENT</a>
|
||||
seealsoPattern = re.compile(r'"seealso" href="#(\w+)">(\w+)[<(]')
|
||||
for ref, text in re.findall(seealsoPattern, docs):
|
||||
if ref != text:
|
||||
print(f"seealso {text} -> {ref}")
|
||||
|
||||
for name in sccToValue.keys():
|
||||
if name not in ["SCI_OPTIONAL_START", "SCI_LEXER_START"] and name not in docs:
|
||||
print(f"Unknown {name}")
|
||||
|
|
|
@ -31,6 +31,8 @@ def printHFile(f):
|
|||
out.append("#endif")
|
||||
return out
|
||||
|
||||
showUnused = False
|
||||
|
||||
def RegenerateAll(root, showMaxID):
|
||||
f = Face.Face()
|
||||
f.ReadFromFile(root / "include/Scintilla.iface")
|
||||
|
@ -39,18 +41,19 @@ def RegenerateAll(root, showMaxID):
|
|||
valueSet = set(int(x) for x in f.values if int(x) < 3000)
|
||||
maximumID = max(valueSet)
|
||||
print("Maximum ID is %d" % maximumID)
|
||||
#~ valuesUnused = sorted(x for x in range(2001,maximumID) if x not in valueSet)
|
||||
#~ print("\nUnused values")
|
||||
#~ valueToName = {}
|
||||
#~ for name, feature in f.features.items():
|
||||
#~ try:
|
||||
#~ value = int(feature["Value"])
|
||||
#~ valueToName[value] = name
|
||||
#~ except ValueError:
|
||||
#~ pass
|
||||
#~ for v in valuesUnused:
|
||||
#~ prev = valueToName.get(v-1, "")
|
||||
#~ print(v, prev)
|
||||
if showUnused:
|
||||
valuesUnused = sorted(x for x in range(2001,maximumID) if x not in valueSet)
|
||||
print("\nUnused values")
|
||||
valueToName = {}
|
||||
for name, feature in f.features.items():
|
||||
try:
|
||||
value = int(feature["Value"])
|
||||
valueToName[value] = name
|
||||
except ValueError:
|
||||
pass
|
||||
for v in valuesUnused:
|
||||
prev = valueToName.get(v-1, "")
|
||||
print(v, prev)
|
||||
|
||||
if __name__ == "__main__":
|
||||
RegenerateAll(pathlib.Path(__file__).resolve().parent.parent, True)
|
||||
|
|
|
@ -76,6 +76,7 @@
|
|||
#include <commctrl.h>
|
||||
#include <richedit.h>
|
||||
#include <windowsx.h>
|
||||
#include <shellscalingapi.h>
|
||||
#include <zmouse.h>
|
||||
#include <ole2.h>
|
||||
#include <d2d1.h>
|
||||
|
|
|
@ -31,7 +31,7 @@ namespace {
|
|||
// Another pattern (pitch==2) is where each lower case letter is preceded by
|
||||
// the upper case form. These are also grouped into ranges.
|
||||
|
||||
int symmetricCaseConversionRanges[] = {
|
||||
constexpr int symmetricCaseConversionRanges[] = {
|
||||
//lower, upper, range length, range pitch
|
||||
//++Autogenerated -- start of section automatically generated
|
||||
//**\(\*\n\)
|
||||
|
@ -67,7 +67,7 @@ int symmetricCaseConversionRanges[] = {
|
|||
8032,8040,8,1,
|
||||
8560,8544,16,1,
|
||||
9424,9398,26,1,
|
||||
11312,11264,47,1,
|
||||
11312,11264,48,1,
|
||||
11393,11392,50,2,
|
||||
11520,4256,38,1,
|
||||
42561,42560,23,2,
|
||||
|
@ -76,10 +76,13 @@ int symmetricCaseConversionRanges[] = {
|
|||
42803,42802,31,2,
|
||||
42879,42878,5,2,
|
||||
42903,42902,10,2,
|
||||
42933,42932,6,2,
|
||||
42933,42932,8,2,
|
||||
65345,65313,26,1,
|
||||
66600,66560,40,1,
|
||||
66776,66736,36,1,
|
||||
66967,66928,11,1,
|
||||
66979,66940,15,1,
|
||||
66995,66956,7,1,
|
||||
68800,68736,51,1,
|
||||
71872,71840,32,1,
|
||||
93792,93760,32,1,
|
||||
|
@ -91,7 +94,7 @@ int symmetricCaseConversionRanges[] = {
|
|||
// Code points that are symmetric but don't fit into a range of similar characters
|
||||
// are listed here.
|
||||
|
||||
int symmetricCaseConversions[] = {
|
||||
constexpr int symmetricCaseConversions[] = {
|
||||
//lower, upper
|
||||
//++Autogenerated -- start of section automatically generated
|
||||
//**1 \(\*\n\)
|
||||
|
@ -241,11 +244,15 @@ int symmetricCaseConversions[] = {
|
|||
42897,42896,
|
||||
42899,42898,
|
||||
42900,42948,
|
||||
42947,42946,
|
||||
42952,42951,
|
||||
42954,42953,
|
||||
42961,42960,
|
||||
42967,42966,
|
||||
42969,42968,
|
||||
42998,42997,
|
||||
43859,42931,
|
||||
67003,66964,
|
||||
67004,66965,
|
||||
|
||||
//--Autogenerated -- end of section automatically generated
|
||||
};
|
||||
|
@ -255,7 +262,7 @@ int symmetricCaseConversions[] = {
|
|||
// folding is different to lowering, or (as appropriate) upper(lower(x)) != x or
|
||||
// lower(upper(x)) != x.
|
||||
|
||||
const char *complexCaseConversions =
|
||||
constexpr std::string_view complexCaseConversions =
|
||||
// Original | Folded | Upper | Lower |
|
||||
//++Autogenerated -- start of section automatically generated
|
||||
//**2 \(\*\n\)
|
||||
|
@ -570,22 +577,20 @@ const char *complexCaseConversions =
|
|||
//--Autogenerated -- end of section automatically generated
|
||||
;
|
||||
|
||||
// Maximum length of a case conversion result is 6 bytes in UTF-8
|
||||
constexpr size_t maxConversionLength = 6;
|
||||
|
||||
class CaseConverter : public ICaseConverter {
|
||||
// Maximum length of a case conversion result is 6 bytes in UTF-8
|
||||
enum { maxConversionLength=6 };
|
||||
struct ConversionString {
|
||||
char conversion[maxConversionLength+1];
|
||||
ConversionString() noexcept : conversion{} {
|
||||
}
|
||||
char conversion[maxConversionLength+1]{};
|
||||
};
|
||||
// Conversions are initially store in a vector of structs but then decomposed into
|
||||
// parallel arrays as that is about 10% faster to search.
|
||||
struct CharacterConversion {
|
||||
int character;
|
||||
int character = 0;
|
||||
ConversionString conversion;
|
||||
CharacterConversion() noexcept : character(0) {
|
||||
// Empty case: NUL -> "".
|
||||
}
|
||||
// Empty case: NUL -> "".
|
||||
CharacterConversion() noexcept = default;
|
||||
CharacterConversion(int character_, std::string_view conversion_) noexcept : character(character_) {
|
||||
assert(conversion_.length() <= maxConversionLength);
|
||||
try {
|
||||
|
@ -600,6 +605,7 @@ class CaseConverter : public ICaseConverter {
|
|||
return character < other.character;
|
||||
}
|
||||
};
|
||||
CaseConversion conversion;
|
||||
typedef std::vector<CharacterConversion> CharacterToConversion;
|
||||
CharacterToConversion characterToConversion;
|
||||
// The parallel arrays
|
||||
|
@ -607,7 +613,8 @@ class CaseConverter : public ICaseConverter {
|
|||
std::vector<ConversionString> conversions;
|
||||
|
||||
public:
|
||||
CaseConverter() = default;
|
||||
explicit CaseConverter(CaseConversion conversion_) : conversion(conversion_) {
|
||||
};
|
||||
// Deleted so CaseConverter objects can not be copied.
|
||||
CaseConverter(const CaseConverter &) = delete;
|
||||
CaseConverter(CaseConverter &&) = delete;
|
||||
|
@ -617,8 +624,8 @@ public:
|
|||
bool Initialised() const noexcept {
|
||||
return !characters.empty();
|
||||
}
|
||||
void Add(int character, const char *conversion) {
|
||||
characterToConversion.emplace_back(character, conversion);
|
||||
void Add(int character, std::string_view conversion_) {
|
||||
characterToConversion.emplace_back(character, conversion_);
|
||||
}
|
||||
const char *Find(int character) {
|
||||
const std::vector<int>::iterator it = std::lower_bound(characters.begin(), characters.end(), character);
|
||||
|
@ -683,32 +690,37 @@ public:
|
|||
// Empty the original calculated data completely
|
||||
CharacterToConversion().swap(characterToConversion);
|
||||
}
|
||||
void AddSymmetric(int lower, int upper);
|
||||
void SetupConversions();
|
||||
};
|
||||
|
||||
CaseConverter caseConvFold;
|
||||
CaseConverter caseConvUp;
|
||||
CaseConverter caseConvLow;
|
||||
CaseConverter caseConvFold(CaseConversion::fold);
|
||||
CaseConverter caseConvUp(CaseConversion::upper);
|
||||
CaseConverter caseConvLow(CaseConversion::lower);
|
||||
|
||||
void AddSymmetric(CaseConversion conversion, int lower,int upper) {
|
||||
char lowerUTF8[UTF8MaxBytes+1];
|
||||
UTF8FromUTF32Character(lower, lowerUTF8);
|
||||
char upperUTF8[UTF8MaxBytes+1];
|
||||
UTF8FromUTF32Character(upper, upperUTF8);
|
||||
|
||||
switch (conversion) {
|
||||
case CaseConversion::fold:
|
||||
caseConvFold.Add(upper, lowerUTF8);
|
||||
break;
|
||||
case CaseConversion::upper:
|
||||
caseConvUp.Add(lower, upperUTF8);
|
||||
break;
|
||||
case CaseConversion::lower:
|
||||
caseConvLow.Add(upper, lowerUTF8);
|
||||
break;
|
||||
}
|
||||
void CaseConverter::AddSymmetric(int lower, int upper) {
|
||||
const int character = (conversion == CaseConversion::upper) ? lower : upper;
|
||||
const int source = (conversion == CaseConversion::upper) ? upper : lower;
|
||||
char converted[maxConversionLength+1]{};
|
||||
UTF8FromUTF32Character(source, converted);
|
||||
Add(character, converted);
|
||||
}
|
||||
|
||||
void SetupConversions(CaseConversion conversion) {
|
||||
// Return the next '|' separated field and remove from view.
|
||||
std::string_view NextField(std::string_view &view) {
|
||||
const size_t separatorPosition = view.find_first_of('|');
|
||||
const std::string_view field = view.substr(0, separatorPosition);
|
||||
if (separatorPosition == std::string_view::npos) {
|
||||
// Reached the end so empty the view
|
||||
view.remove_prefix(view.length());
|
||||
} else {
|
||||
// Remove the '|' from the view as well as the field
|
||||
view.remove_prefix(separatorPosition + 1);
|
||||
}
|
||||
return field;
|
||||
}
|
||||
|
||||
void CaseConverter::SetupConversions() {
|
||||
// First initialize for the symmetric ranges
|
||||
for (size_t i=0; i<std::size(symmetricCaseConversionRanges);) {
|
||||
const int lower = symmetricCaseConversionRanges[i++];
|
||||
|
@ -716,91 +728,63 @@ void SetupConversions(CaseConversion conversion) {
|
|||
const int length = symmetricCaseConversionRanges[i++];
|
||||
const int pitch = symmetricCaseConversionRanges[i++];
|
||||
for (int j=0; j<length*pitch; j+=pitch) {
|
||||
AddSymmetric(conversion, lower+j, upper+j);
|
||||
AddSymmetric(lower+j, upper+j);
|
||||
}
|
||||
}
|
||||
// Add the symmetric singletons
|
||||
for (size_t i=0; i<std::size(symmetricCaseConversions);) {
|
||||
const int lower = symmetricCaseConversions[i++];
|
||||
const int upper = symmetricCaseConversions[i++];
|
||||
AddSymmetric(conversion, lower, upper);
|
||||
AddSymmetric(lower, upper);
|
||||
}
|
||||
// Add the complex cases
|
||||
const char *sComplex = complexCaseConversions;
|
||||
while (*sComplex) {
|
||||
// Longest ligature is 3 character so 5 for safety
|
||||
constexpr size_t lenUTF8 = 5*UTF8MaxBytes+1;
|
||||
unsigned char originUTF8[lenUTF8]{};
|
||||
char foldedUTF8[lenUTF8]{};
|
||||
char lowerUTF8[lenUTF8]{};
|
||||
char upperUTF8[lenUTF8]{};
|
||||
size_t i = 0;
|
||||
while (*sComplex && *sComplex != '|') {
|
||||
originUTF8[i++] = *sComplex;
|
||||
sComplex++;
|
||||
}
|
||||
sComplex++;
|
||||
originUTF8[i] = 0;
|
||||
i = 0;
|
||||
while (*sComplex && *sComplex != '|') {
|
||||
foldedUTF8[i++] = *sComplex;
|
||||
sComplex++;
|
||||
}
|
||||
sComplex++;
|
||||
foldedUTF8[i] = 0;
|
||||
i = 0;
|
||||
while (*sComplex && *sComplex != '|') {
|
||||
upperUTF8[i++] = *sComplex;
|
||||
sComplex++;
|
||||
}
|
||||
sComplex++;
|
||||
upperUTF8[i] = 0;
|
||||
i = 0;
|
||||
while (*sComplex && *sComplex != '|') {
|
||||
lowerUTF8[i++] = *sComplex;
|
||||
sComplex++;
|
||||
}
|
||||
sComplex++;
|
||||
lowerUTF8[i] = 0;
|
||||
std::string_view sComplex = complexCaseConversions;
|
||||
while (!sComplex.empty()) {
|
||||
const std::string_view originUTF8 = NextField(sComplex);
|
||||
const std::string_view foldedUTF8 = NextField(sComplex);
|
||||
const std::string_view upperUTF8 = NextField(sComplex);
|
||||
const std::string_view lowerUTF8 = NextField(sComplex);
|
||||
|
||||
const int character = UnicodeFromUTF8(originUTF8);
|
||||
|
||||
if (conversion == CaseConversion::fold && foldedUTF8[0]) {
|
||||
caseConvFold.Add(character, foldedUTF8);
|
||||
std::string_view converted;
|
||||
switch (conversion) {
|
||||
case CaseConversion::fold:
|
||||
converted = foldedUTF8;
|
||||
break;
|
||||
case CaseConversion::upper:
|
||||
converted = upperUTF8;
|
||||
break;
|
||||
case CaseConversion::lower:
|
||||
default:
|
||||
converted = lowerUTF8;
|
||||
break;
|
||||
}
|
||||
|
||||
if (conversion == CaseConversion::upper && upperUTF8[0]) {
|
||||
caseConvUp.Add(character, upperUTF8);
|
||||
}
|
||||
|
||||
if (conversion == CaseConversion::lower && lowerUTF8[0]) {
|
||||
caseConvLow.Add(character, lowerUTF8);
|
||||
if (!converted.empty()) {
|
||||
const int character = UnicodeFromUTF8(reinterpret_cast<const unsigned char *>(originUTF8.data()));
|
||||
Add(character, converted);
|
||||
}
|
||||
}
|
||||
|
||||
switch (conversion) {
|
||||
case CaseConversion::fold:
|
||||
caseConvFold.FinishedAdding();
|
||||
break;
|
||||
case CaseConversion::upper:
|
||||
caseConvUp.FinishedAdding();
|
||||
break;
|
||||
case CaseConversion::lower:
|
||||
caseConvLow.FinishedAdding();
|
||||
break;
|
||||
}
|
||||
FinishedAdding();
|
||||
}
|
||||
|
||||
CaseConverter *ConverterForConversion(CaseConversion conversion) noexcept {
|
||||
CaseConverter *ConverterForConversion(CaseConversion conversion) {
|
||||
CaseConverter *pCaseConv = &caseConvFold;
|
||||
switch (conversion) {
|
||||
case CaseConversion::fold:
|
||||
return &caseConvFold;
|
||||
pCaseConv = &caseConvFold;
|
||||
break;
|
||||
case CaseConversion::upper:
|
||||
return &caseConvUp;
|
||||
pCaseConv = &caseConvUp;
|
||||
break;
|
||||
case CaseConversion::lower:
|
||||
return &caseConvLow;
|
||||
default:
|
||||
pCaseConv = &caseConvLow;
|
||||
break;
|
||||
}
|
||||
return nullptr;
|
||||
if (!pCaseConv->Initialised()) {
|
||||
pCaseConv->SetupConversions();
|
||||
}
|
||||
return pCaseConv;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -808,23 +792,16 @@ CaseConverter *ConverterForConversion(CaseConversion conversion) noexcept {
|
|||
namespace Scintilla::Internal {
|
||||
|
||||
ICaseConverter *ConverterFor(CaseConversion conversion) {
|
||||
CaseConverter *pCaseConv = ConverterForConversion(conversion);
|
||||
if (!pCaseConv->Initialised())
|
||||
SetupConversions(conversion);
|
||||
return pCaseConv;
|
||||
return ConverterForConversion(conversion);
|
||||
}
|
||||
|
||||
const char *CaseConvert(int character, CaseConversion conversion) {
|
||||
CaseConverter *pCaseConv = ConverterForConversion(conversion);
|
||||
if (!pCaseConv->Initialised())
|
||||
SetupConversions(conversion);
|
||||
return pCaseConv->Find(character);
|
||||
}
|
||||
|
||||
size_t CaseConvertString(char *converted, size_t sizeConverted, const char *mixed, size_t lenMixed, CaseConversion conversion) {
|
||||
CaseConverter *pCaseConv = ConverterForConversion(conversion);
|
||||
if (!pCaseConv->Initialised())
|
||||
SetupConversions(conversion);
|
||||
return pCaseConv->CaseConvertString(converted, sizeConverted, mixed, lenMixed);
|
||||
}
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@ namespace {
|
|||
|
||||
const int catRanges[] = {
|
||||
//++Autogenerated -- start of section automatically generated
|
||||
// Created with Python 3.9.4, Unicode 13.0.0
|
||||
// Created with Python 3.11.0, Unicode 14.0.0
|
||||
25,
|
||||
1046,
|
||||
1073,
|
||||
|
@ -685,8 +685,7 @@ const int catRanges[] = {
|
|||
49669,
|
||||
50033,
|
||||
50074,
|
||||
50109,
|
||||
50129,
|
||||
50097,
|
||||
50180,
|
||||
51203,
|
||||
51236,
|
||||
|
@ -751,11 +750,16 @@ const int catRanges[] = {
|
|||
68605,
|
||||
68612,
|
||||
68989,
|
||||
69124,
|
||||
69908,
|
||||
69924,
|
||||
70141,
|
||||
70170,
|
||||
70237,
|
||||
70405,
|
||||
70660,
|
||||
71357,
|
||||
71364,
|
||||
71965,
|
||||
72293,
|
||||
71971,
|
||||
72005,
|
||||
72794,
|
||||
72805,
|
||||
73830,
|
||||
|
@ -988,6 +992,7 @@ const int catRanges[] = {
|
|||
99645,
|
||||
99652,
|
||||
100189,
|
||||
100229,
|
||||
100260,
|
||||
100293,
|
||||
100390,
|
||||
|
@ -1000,6 +1005,8 @@ const int catRanges[] = {
|
|||
101117,
|
||||
101124,
|
||||
101245,
|
||||
101284,
|
||||
101341,
|
||||
101380,
|
||||
101445,
|
||||
101533,
|
||||
|
@ -1036,7 +1043,7 @@ const int catRanges[] = {
|
|||
104925,
|
||||
105126,
|
||||
105213,
|
||||
105412,
|
||||
105380,
|
||||
105469,
|
||||
105476,
|
||||
105541,
|
||||
|
@ -1289,12 +1296,12 @@ const int catRanges[] = {
|
|||
187940,
|
||||
188221,
|
||||
188420,
|
||||
188861,
|
||||
188868,
|
||||
188997,
|
||||
189117,
|
||||
189444,
|
||||
189094,
|
||||
189149,
|
||||
189412,
|
||||
190021,
|
||||
190086,
|
||||
190129,
|
||||
190205,
|
||||
190468,
|
||||
|
@ -1330,7 +1337,7 @@ const int catRanges[] = {
|
|||
196849,
|
||||
196965,
|
||||
197082,
|
||||
197117,
|
||||
197093,
|
||||
197128,
|
||||
197469,
|
||||
197636,
|
||||
|
@ -1405,7 +1412,7 @@ const int catRanges[] = {
|
|||
218629,
|
||||
219079,
|
||||
219109,
|
||||
219197,
|
||||
219645,
|
||||
221189,
|
||||
221318,
|
||||
221348,
|
||||
|
@ -1418,13 +1425,14 @@ const int catRanges[] = {
|
|||
223301,
|
||||
223334,
|
||||
223396,
|
||||
223645,
|
||||
223677,
|
||||
223752,
|
||||
224081,
|
||||
224309,
|
||||
224613,
|
||||
224917,
|
||||
225213,
|
||||
225201,
|
||||
225277,
|
||||
225285,
|
||||
225350,
|
||||
225380,
|
||||
|
@ -1489,8 +1497,6 @@ const int catRanges[] = {
|
|||
241441,
|
||||
242531,
|
||||
243717,
|
||||
245597,
|
||||
245605,
|
||||
245760,
|
||||
245793,
|
||||
245824,
|
||||
|
@ -1852,7 +1858,7 @@ const int catRanges[] = {
|
|||
266755,
|
||||
267197,
|
||||
267283,
|
||||
268317,
|
||||
268349,
|
||||
268805,
|
||||
269223,
|
||||
269349,
|
||||
|
@ -2032,9 +2038,7 @@ const int catRanges[] = {
|
|||
357085,
|
||||
357109,
|
||||
360448,
|
||||
361981,
|
||||
361985,
|
||||
363517,
|
||||
363520,
|
||||
363553,
|
||||
363584,
|
||||
|
@ -2235,7 +2239,16 @@ const int catRanges[] = {
|
|||
378993,
|
||||
379413,
|
||||
379473,
|
||||
379517,
|
||||
379565,
|
||||
379598,
|
||||
379629,
|
||||
379662,
|
||||
379693,
|
||||
379726,
|
||||
379757,
|
||||
379790,
|
||||
379820,
|
||||
379869,
|
||||
380949,
|
||||
381789,
|
||||
381813,
|
||||
|
@ -2323,8 +2336,6 @@ const int catRanges[] = {
|
|||
425988,
|
||||
636949,
|
||||
638980,
|
||||
1310653,
|
||||
1310724,
|
||||
1311395,
|
||||
1311428,
|
||||
1348029,
|
||||
|
@ -2568,7 +2579,8 @@ const int catRanges[] = {
|
|||
1374113,
|
||||
1374144,
|
||||
1374177,
|
||||
1374237,
|
||||
1374208,
|
||||
1374241,
|
||||
1374272,
|
||||
1374305,
|
||||
1374336,
|
||||
|
@ -2576,6 +2588,18 @@ const int catRanges[] = {
|
|||
1374496,
|
||||
1374529,
|
||||
1374589,
|
||||
1374720,
|
||||
1374753,
|
||||
1374813,
|
||||
1374817,
|
||||
1374877,
|
||||
1374881,
|
||||
1374912,
|
||||
1374945,
|
||||
1374976,
|
||||
1375009,
|
||||
1375069,
|
||||
1375811,
|
||||
1375904,
|
||||
1375937,
|
||||
1375972,
|
||||
|
@ -2761,19 +2785,20 @@ const int catRanges[] = {
|
|||
2058429,
|
||||
2058436,
|
||||
2061908,
|
||||
2062429,
|
||||
2062461,
|
||||
2062948,
|
||||
2074574,
|
||||
2074605,
|
||||
2074653,
|
||||
2074645,
|
||||
2075140,
|
||||
2077213,
|
||||
2077252,
|
||||
2079005,
|
||||
2079221,
|
||||
2079261,
|
||||
2080260,
|
||||
2080659,
|
||||
2080693,
|
||||
2080733,
|
||||
2080773,
|
||||
2081297,
|
||||
2081517,
|
||||
|
@ -2963,13 +2988,34 @@ const int catRanges[] = {
|
|||
2139652,
|
||||
2141341,
|
||||
2141681,
|
||||
2141725,
|
||||
2141696,
|
||||
2142077,
|
||||
2142080,
|
||||
2142589,
|
||||
2142592,
|
||||
2142845,
|
||||
2142848,
|
||||
2142941,
|
||||
2142945,
|
||||
2143325,
|
||||
2143329,
|
||||
2143837,
|
||||
2143841,
|
||||
2144093,
|
||||
2144097,
|
||||
2144189,
|
||||
2146308,
|
||||
2156285,
|
||||
2156548,
|
||||
2157277,
|
||||
2157572,
|
||||
2157853,
|
||||
2158595,
|
||||
2158813,
|
||||
2158819,
|
||||
2160189,
|
||||
2160195,
|
||||
2160509,
|
||||
2162692,
|
||||
2162909,
|
||||
2162948,
|
||||
|
@ -3089,6 +3135,10 @@ const int catRanges[] = {
|
|||
2222634,
|
||||
2222769,
|
||||
2222941,
|
||||
2223620,
|
||||
2224197,
|
||||
2224337,
|
||||
2224477,
|
||||
2225668,
|
||||
2226346,
|
||||
2226589,
|
||||
|
@ -3103,7 +3153,11 @@ const int catRanges[] = {
|
|||
2230749,
|
||||
2230858,
|
||||
2231496,
|
||||
2231837,
|
||||
2231813,
|
||||
2231844,
|
||||
2231909,
|
||||
2231972,
|
||||
2232029,
|
||||
2232293,
|
||||
2232390,
|
||||
2232420,
|
||||
|
@ -3114,7 +3168,8 @@ const int catRanges[] = {
|
|||
2234225,
|
||||
2234298,
|
||||
2234321,
|
||||
2234461,
|
||||
2234437,
|
||||
2234493,
|
||||
2234810,
|
||||
2234845,
|
||||
2234884,
|
||||
|
@ -3290,7 +3345,8 @@ const int catRanges[] = {
|
|||
2283206,
|
||||
2283237,
|
||||
2283268,
|
||||
2283325,
|
||||
2283313,
|
||||
2283357,
|
||||
2283528,
|
||||
2283869,
|
||||
2285572,
|
||||
|
@ -3305,7 +3361,8 @@ const int catRanges[] = {
|
|||
2287434,
|
||||
2287505,
|
||||
2287605,
|
||||
2287645,
|
||||
2287620,
|
||||
2287869,
|
||||
2293764,
|
||||
2295174,
|
||||
2295269,
|
||||
|
@ -3379,7 +3436,7 @@ const int catRanges[] = {
|
|||
2315172,
|
||||
2315217,
|
||||
2315389,
|
||||
2316292,
|
||||
2315780,
|
||||
2318141,
|
||||
2326532,
|
||||
2326845,
|
||||
|
@ -3463,6 +3520,9 @@ const int catRanges[] = {
|
|||
2395837,
|
||||
2396164,
|
||||
2402461,
|
||||
2486788,
|
||||
2489905,
|
||||
2489981,
|
||||
2490372,
|
||||
2524669,
|
||||
2524698,
|
||||
|
@ -3476,7 +3536,10 @@ const int catRanges[] = {
|
|||
2968584,
|
||||
2968925,
|
||||
2969041,
|
||||
2969117,
|
||||
2969092,
|
||||
2971645,
|
||||
2971656,
|
||||
2971997,
|
||||
2972164,
|
||||
2973149,
|
||||
2973189,
|
||||
|
@ -3525,8 +3588,14 @@ const int catRanges[] = {
|
|||
3250909,
|
||||
3252228,
|
||||
3252541,
|
||||
3538435,
|
||||
3538589,
|
||||
3538595,
|
||||
3538845,
|
||||
3538851,
|
||||
3538941,
|
||||
3538948,
|
||||
3548157,
|
||||
3548285,
|
||||
3549700,
|
||||
3549821,
|
||||
3550340,
|
||||
|
@ -3546,6 +3615,12 @@ const int catRanges[] = {
|
|||
3642353,
|
||||
3642394,
|
||||
3642525,
|
||||
3792901,
|
||||
3794397,
|
||||
3794437,
|
||||
3795197,
|
||||
3795477,
|
||||
3799197,
|
||||
3801109,
|
||||
3808989,
|
||||
3809301,
|
||||
|
@ -3562,7 +3637,7 @@ const int catRanges[] = {
|
|||
3813781,
|
||||
3814725,
|
||||
3814869,
|
||||
3816765,
|
||||
3816829,
|
||||
3817493,
|
||||
3819589,
|
||||
3819701,
|
||||
|
@ -3678,6 +3753,10 @@ const int catRanges[] = {
|
|||
3888157,
|
||||
3888165,
|
||||
3888669,
|
||||
3923969,
|
||||
3924292,
|
||||
3924321,
|
||||
3924989,
|
||||
3932165,
|
||||
3932413,
|
||||
3932421,
|
||||
|
@ -3698,12 +3777,23 @@ const int catRanges[] = {
|
|||
3942852,
|
||||
3942901,
|
||||
3942941,
|
||||
3953156,
|
||||
3954117,
|
||||
3954173,
|
||||
3954692,
|
||||
3956101,
|
||||
3956232,
|
||||
3956573,
|
||||
3956723,
|
||||
3956765,
|
||||
3996676,
|
||||
3996925,
|
||||
3996932,
|
||||
3997085,
|
||||
3997092,
|
||||
3997181,
|
||||
3997188,
|
||||
3997693,
|
||||
3997700,
|
||||
4004029,
|
||||
4004074,
|
||||
|
@ -3825,7 +3915,7 @@ const int catRanges[] = {
|
|||
4095860,
|
||||
4096021,
|
||||
4119325,
|
||||
4119573,
|
||||
4119477,
|
||||
4119997,
|
||||
4120085,
|
||||
4120509,
|
||||
|
@ -3835,6 +3925,8 @@ const int catRanges[] = {
|
|||
4127549,
|
||||
4127765,
|
||||
4128157,
|
||||
4128277,
|
||||
4128317,
|
||||
4128789,
|
||||
4129181,
|
||||
4129301,
|
||||
|
@ -3848,27 +3940,27 @@ const int catRanges[] = {
|
|||
4134421,
|
||||
4134493,
|
||||
4136981,
|
||||
4140861,
|
||||
4140885,
|
||||
4143517,
|
||||
4143541,
|
||||
4147869,
|
||||
4148245,
|
||||
4148701,
|
||||
4148757,
|
||||
4148925,
|
||||
4149013,
|
||||
4149117,
|
||||
4149181,
|
||||
4149269,
|
||||
4149501,
|
||||
4149781,
|
||||
4150589,
|
||||
4150717,
|
||||
4150805,
|
||||
4151037,
|
||||
4151165,
|
||||
4151317,
|
||||
4151421,
|
||||
4151517,
|
||||
4151829,
|
||||
4152061,
|
||||
4152157,
|
||||
4152341,
|
||||
4152605,
|
||||
4152853,
|
||||
4153085,
|
||||
4153365,
|
||||
4158077,
|
||||
4158101,
|
||||
|
@ -3876,9 +3968,9 @@ const int catRanges[] = {
|
|||
4161032,
|
||||
4161373,
|
||||
4194308,
|
||||
5561309,
|
||||
5561373,
|
||||
5562372,
|
||||
5695165,
|
||||
5695293,
|
||||
5695492,
|
||||
5702621,
|
||||
5702660,
|
||||
|
|
|
@ -56,7 +56,7 @@ LexInterface::LexInterface(Document *pdoc_) noexcept : pdoc(pdoc_), performingSt
|
|||
|
||||
LexInterface::~LexInterface() noexcept = default;
|
||||
|
||||
void LexInterface::SetInstance(ILexer5 *instance_) {
|
||||
void LexInterface::SetInstance(ILexer5 *instance_) noexcept {
|
||||
instance.reset(instance_);
|
||||
}
|
||||
|
||||
|
@ -125,6 +125,18 @@ size_t ActionDuration::ActionsInAllowedTime(double secondsAllowed) const noexcep
|
|||
return std::lround(secondsAllowed / Duration());
|
||||
}
|
||||
|
||||
CharacterExtracted::CharacterExtracted(const unsigned char *charBytes, size_t widthCharBytes) noexcept {
|
||||
const int utf8status = UTF8Classify(charBytes, widthCharBytes);
|
||||
if (utf8status & UTF8MaskInvalid) {
|
||||
// Treat as invalid and use up just one byte
|
||||
character = unicodeReplacementChar;
|
||||
widthBytes = 1;
|
||||
} else {
|
||||
character = UnicodeFromUTF8(charBytes);
|
||||
widthBytes = utf8status & UTF8MaskWidth;
|
||||
}
|
||||
}
|
||||
|
||||
Document::Document(DocumentOption options) :
|
||||
cb(!FlagSet(options, DocumentOption::StylesNone), FlagSet(options, DocumentOption::TextLarge)),
|
||||
durationStyleOneByte(0.000001, 0.0000001, 0.00001) {
|
||||
|
@ -917,7 +929,7 @@ bool Document::NextCharacter(Sci::Position &pos, int moveDir) const noexcept {
|
|||
}
|
||||
}
|
||||
|
||||
Document::CharacterExtracted Document::CharacterAfter(Sci::Position position) const noexcept {
|
||||
CharacterExtracted Document::CharacterAfter(Sci::Position position) const noexcept {
|
||||
if (position >= LengthNoExcept()) {
|
||||
return CharacterExtracted(unicodeReplacementChar, 0);
|
||||
}
|
||||
|
@ -931,13 +943,7 @@ Document::CharacterExtracted Document::CharacterAfter(Sci::Position position) co
|
|||
unsigned char charBytes[UTF8MaxBytes] = { leadByte, 0, 0, 0 };
|
||||
for (int b = 1; b<widthCharBytes; b++)
|
||||
charBytes[b] = cb.UCharAt(position + b);
|
||||
const int utf8status = UTF8Classify(charBytes, widthCharBytes);
|
||||
if (utf8status & UTF8MaskInvalid) {
|
||||
// Treat as invalid and use up just one byte
|
||||
return CharacterExtracted(unicodeReplacementChar, 1);
|
||||
} else {
|
||||
return CharacterExtracted(UnicodeFromUTF8(charBytes), utf8status & UTF8MaskWidth);
|
||||
}
|
||||
return CharacterExtracted(charBytes, widthCharBytes);
|
||||
} else {
|
||||
if (IsDBCSLeadByteNoExcept(leadByte)) {
|
||||
const unsigned char trailByte = cb.UCharAt(position + 1);
|
||||
|
@ -949,7 +955,7 @@ Document::CharacterExtracted Document::CharacterAfter(Sci::Position position) co
|
|||
}
|
||||
}
|
||||
|
||||
Document::CharacterExtracted Document::CharacterBefore(Sci::Position position) const noexcept {
|
||||
CharacterExtracted Document::CharacterBefore(Sci::Position position) const noexcept {
|
||||
if (position <= 0) {
|
||||
return CharacterExtracted(unicodeReplacementChar, 0);
|
||||
}
|
||||
|
@ -972,13 +978,7 @@ Document::CharacterExtracted Document::CharacterBefore(Sci::Position position) c
|
|||
unsigned char charBytes[UTF8MaxBytes] = { 0, 0, 0, 0 };
|
||||
for (Sci::Position b = 0; b<widthCharBytes; b++)
|
||||
charBytes[b] = cb.UCharAt(startUTF + b);
|
||||
const int utf8status = UTF8Classify(charBytes, widthCharBytes);
|
||||
if (utf8status & UTF8MaskInvalid) {
|
||||
// Treat as invalid and use up just one byte
|
||||
return CharacterExtracted(unicodeReplacementChar, 1);
|
||||
} else {
|
||||
return CharacterExtracted(UnicodeFromUTF8(charBytes), utf8status & UTF8MaskWidth);
|
||||
}
|
||||
return CharacterExtracted(charBytes, widthCharBytes);
|
||||
}
|
||||
// Else invalid UTF-8 so return position of isolated trail byte
|
||||
}
|
||||
|
@ -1242,6 +1242,17 @@ void Document::CheckReadOnly() {
|
|||
}
|
||||
}
|
||||
|
||||
void Document::TrimReplacement(std::string_view &text, Range &range) const noexcept {
|
||||
while (!text.empty() && !range.Empty() && (text.front() == CharAt(range.start))) {
|
||||
text.remove_prefix(1);
|
||||
range.start++;
|
||||
}
|
||||
while (!text.empty() && !range.Empty() && (text.back() == CharAt(range.end-1))) {
|
||||
text.remove_suffix(1);
|
||||
range.end--;
|
||||
}
|
||||
}
|
||||
|
||||
// Document only modified by gateways DeleteChars, InsertString, Undo, Redo, and SetStyleAt.
|
||||
// SetStyleAt does not change the persistent state of a document
|
||||
|
||||
|
@ -1336,6 +1347,10 @@ Sci::Position Document::InsertString(Sci::Position position, const char *s, Sci:
|
|||
return insertLength;
|
||||
}
|
||||
|
||||
Sci::Position Document::InsertString(Sci::Position position, std::string_view sv) {
|
||||
return InsertString(position, sv.data(), sv.length());
|
||||
}
|
||||
|
||||
void Document::ChangeInsertion(const char *s, Sci::Position length) {
|
||||
insertionSet = true;
|
||||
insertion.assign(s, length);
|
||||
|
@ -1584,7 +1599,7 @@ Sci::Position Document::GetLineIndentPosition(Sci::Line line) const {
|
|||
return pos;
|
||||
}
|
||||
|
||||
Sci::Position Document::GetColumn(Sci::Position pos) {
|
||||
Sci::Position Document::GetColumn(Sci::Position pos) const {
|
||||
Sci::Position column = 0;
|
||||
const Sci::Line line = SciLineFromPosition(pos);
|
||||
if ((line >= 0) && (line < LinesTotal())) {
|
||||
|
@ -1757,7 +1772,10 @@ bool Document::IsWhiteLine(Sci::Line line) const {
|
|||
|
||||
Sci::Position Document::ParaUp(Sci::Position pos) const {
|
||||
Sci::Line line = SciLineFromPosition(pos);
|
||||
line--;
|
||||
const Sci::Position start = LineStart(line);
|
||||
if (pos == start) {
|
||||
line--;
|
||||
}
|
||||
while (line >= 0 && IsWhiteLine(line)) { // skip empty lines
|
||||
line--;
|
||||
}
|
||||
|
@ -2033,7 +2051,7 @@ void Document::SetCaseFolder(std::unique_ptr<CaseFolder> pcf_) noexcept {
|
|||
pcf = std::move(pcf_);
|
||||
}
|
||||
|
||||
Document::CharacterExtracted Document::ExtractCharacter(Sci::Position position) const noexcept {
|
||||
CharacterExtracted Document::ExtractCharacter(Sci::Position position) const noexcept {
|
||||
const unsigned char leadByte = cb.UCharAt(position);
|
||||
if (UTF8IsAscii(leadByte)) {
|
||||
// Common case: ASCII character
|
||||
|
@ -2043,13 +2061,7 @@ Document::CharacterExtracted Document::ExtractCharacter(Sci::Position position)
|
|||
unsigned char charBytes[UTF8MaxBytes] = { leadByte, 0, 0, 0 };
|
||||
for (int b=1; b<widthCharBytes; b++)
|
||||
charBytes[b] = cb.UCharAt(position + b);
|
||||
const int utf8status = UTF8Classify(charBytes, widthCharBytes);
|
||||
if (utf8status & UTF8MaskInvalid) {
|
||||
// Treat as invalid and use up just one byte
|
||||
return CharacterExtracted(unicodeReplacementChar, 1);
|
||||
} else {
|
||||
return CharacterExtracted(UnicodeFromUTF8(charBytes), utf8status & UTF8MaskWidth);
|
||||
}
|
||||
return CharacterExtracted(charBytes, widthCharBytes);
|
||||
}
|
||||
|
||||
namespace {
|
||||
|
@ -2173,32 +2185,32 @@ Sci::Position Document::FindText(Sci::Position minPos, Sci::Position maxPos, con
|
|||
const size_t lenSearch =
|
||||
pcf->Fold(&searchThing[0], searchThing.size(), search, lengthFind);
|
||||
while (forward ? (pos < endPos) : (pos >= endPos)) {
|
||||
int widthFirstCharacter = 0;
|
||||
int widthFirstCharacter = 1;
|
||||
Sci::Position posIndexDocument = pos;
|
||||
size_t indexSearch = 0;
|
||||
bool characterMatches = true;
|
||||
for (;;) {
|
||||
while (indexSearch < lenSearch) {
|
||||
const unsigned char leadByte = cbView.CharAt(posIndexDocument);
|
||||
char bytes[UTF8MaxBytes + 1];
|
||||
int widthChar = 1;
|
||||
if (!UTF8IsAscii(leadByte)) {
|
||||
const int widthCharBytes = UTF8BytesOfLead[leadByte];
|
||||
bytes[0] = leadByte;
|
||||
for (int b=1; b<widthCharBytes; b++) {
|
||||
bytes[b] = cbView.CharAt(posIndexDocument+b);
|
||||
}
|
||||
widthChar = UTF8Classify(reinterpret_cast<const unsigned char *>(bytes), widthCharBytes) & UTF8MaskWidth;
|
||||
}
|
||||
if (!widthFirstCharacter) {
|
||||
widthFirstCharacter = widthChar;
|
||||
}
|
||||
if ((posIndexDocument + widthChar) > limitPos) {
|
||||
break;
|
||||
}
|
||||
size_t lenFlat = 1;
|
||||
if (widthChar == 1) {
|
||||
if (UTF8IsAscii(leadByte)) {
|
||||
if ((posIndexDocument + 1) > limitPos) {
|
||||
break;
|
||||
}
|
||||
characterMatches = searchThing[indexSearch] == MakeLowerCase(leadByte);
|
||||
} else {
|
||||
char bytes[UTF8MaxBytes]{ static_cast<char>(leadByte) };
|
||||
const int widthCharBytes = UTF8BytesOfLead[leadByte];
|
||||
for (int b = 1; b < widthCharBytes; b++) {
|
||||
bytes[b] = cbView.CharAt(posIndexDocument + b);
|
||||
}
|
||||
widthChar = UTF8Classify(reinterpret_cast<const unsigned char *>(bytes), widthCharBytes) & UTF8MaskWidth;
|
||||
if (!indexSearch) { // First character
|
||||
widthFirstCharacter = widthChar;
|
||||
}
|
||||
if ((posIndexDocument + widthChar) > limitPos) {
|
||||
break;
|
||||
}
|
||||
char folded[UTF8MaxBytes * maxFoldingExpansion + 1];
|
||||
lenFlat = pcf->Fold(folded, sizeof(folded), bytes, widthChar);
|
||||
// memcmp may examine lenFlat bytes in both arguments so assert it doesn't read past end of searchThing
|
||||
|
@ -2211,9 +2223,6 @@ Sci::Position Document::FindText(Sci::Position minPos, Sci::Position maxPos, con
|
|||
}
|
||||
posIndexDocument += widthChar;
|
||||
indexSearch += lenFlat;
|
||||
if (indexSearch >= lenSearch) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (characterMatches && (indexSearch == lenSearch)) {
|
||||
if (MatchesWordOptions(word, wordStart, pos, posIndexDocument - pos)) {
|
||||
|
@ -2253,9 +2262,10 @@ Sci::Position Document::FindText(Sci::Position minPos, Sci::Position maxPos, con
|
|||
if (widthChar == 1) {
|
||||
characterMatches = searchThing[indexSearch] == MakeLowerCase(leadByte);
|
||||
} else {
|
||||
char bytes[maxBytesCharacter + 1];
|
||||
bytes[0] = leadByte;
|
||||
bytes[1] = cbView.CharAt(pos + indexDocument + 1);
|
||||
const char bytes[maxBytesCharacter + 1] {
|
||||
static_cast<char>(leadByte),
|
||||
cbView.CharAt(pos + indexDocument + 1)
|
||||
};
|
||||
char folded[maxBytesCharacter * maxFoldingExpansion + 1];
|
||||
lenFlat = pcf->Fold(folded, sizeof(folded), bytes, widthChar);
|
||||
// memcmp may examine lenFlat bytes in both arguments so assert it doesn't read past end of searchThing
|
||||
|
@ -3036,7 +3046,7 @@ public:
|
|||
}
|
||||
private:
|
||||
void ReadCharacter() noexcept {
|
||||
const Document::CharacterExtracted charExtracted = doc->ExtractCharacter(position);
|
||||
const CharacterExtracted charExtracted = doc->ExtractCharacter(position);
|
||||
lenBytes = charExtracted.widthBytes;
|
||||
if (charExtracted.character == unicodeReplacementChar) {
|
||||
lenCharacters = 1;
|
||||
|
@ -3065,7 +3075,7 @@ public:
|
|||
doc(doc_), position(position_) {
|
||||
}
|
||||
wchar_t operator*() const noexcept {
|
||||
const Document::CharacterExtracted charExtracted = doc->ExtractCharacter(position);
|
||||
const CharacterExtracted charExtracted = doc->ExtractCharacter(position);
|
||||
return charExtracted.character;
|
||||
}
|
||||
UTF8Iterator &operator++() noexcept {
|
||||
|
|
|
@ -46,6 +46,10 @@ public:
|
|||
return (start != Sci::invalidPosition) && (end != Sci::invalidPosition);
|
||||
}
|
||||
|
||||
[[nodiscard]] bool Empty() const noexcept {
|
||||
return start == end;
|
||||
}
|
||||
|
||||
Sci::Position First() const noexcept {
|
||||
return (start <= end) ? start : end;
|
||||
}
|
||||
|
@ -195,7 +199,7 @@ public:
|
|||
LexInterface &operator=(const LexInterface &) = delete;
|
||||
LexInterface &operator=(LexInterface &&) = delete;
|
||||
virtual ~LexInterface() noexcept;
|
||||
void SetInstance(ILexer5 *instance_);
|
||||
void SetInstance(ILexer5 *instance_) noexcept;
|
||||
void Colourise(Sci::Position start, Sci::Position end);
|
||||
virtual Scintilla::LineEndType LineEndTypesSupported();
|
||||
bool UseContainerLexing() const noexcept;
|
||||
|
@ -226,6 +230,29 @@ public:
|
|||
size_t ActionsInAllowedTime(double secondsAllowed) const noexcept;
|
||||
};
|
||||
|
||||
/**
|
||||
* A whole character (code point) with a value and width in bytes.
|
||||
* For UTF-8, the value is the code point value.
|
||||
* For DBCS, its jamming the lead and trail bytes together.
|
||||
* For 8 bit encodings, is just the byte value.
|
||||
*/
|
||||
struct CharacterExtracted {
|
||||
unsigned int character;
|
||||
unsigned int widthBytes;
|
||||
|
||||
CharacterExtracted(unsigned int character_, unsigned int widthBytes_) noexcept :
|
||||
character(character_), widthBytes(widthBytes_) {
|
||||
}
|
||||
|
||||
// For UTF-8:
|
||||
CharacterExtracted(const unsigned char *charBytes, size_t widthCharBytes) noexcept;
|
||||
|
||||
// For DBCS characters turn 2 bytes into an int
|
||||
static CharacterExtracted DBCS(unsigned char lead, unsigned char trail) noexcept {
|
||||
return CharacterExtracted((lead << 8) | trail, 2);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
*/
|
||||
class Document : PerLine, public Scintilla::IDocument, public Scintilla::ILoader {
|
||||
|
@ -276,18 +303,6 @@ private:
|
|||
|
||||
public:
|
||||
|
||||
struct CharacterExtracted {
|
||||
unsigned int character;
|
||||
unsigned int widthBytes;
|
||||
CharacterExtracted(unsigned int character_, unsigned int widthBytes_) noexcept :
|
||||
character(character_), widthBytes(widthBytes_) {
|
||||
}
|
||||
// For DBCS characters turn 2 bytes into an int
|
||||
static CharacterExtracted DBCS(unsigned char lead, unsigned char trail) noexcept {
|
||||
return CharacterExtracted((lead << 8) | trail, 2);
|
||||
}
|
||||
};
|
||||
|
||||
Scintilla::EndOfLine eolMode;
|
||||
/// Can also be SC_CP_UTF8 to enable UTF-8 mode
|
||||
int dbcsCodePage;
|
||||
|
@ -341,8 +356,8 @@ public:
|
|||
Sci::Position MovePositionOutsideChar(Sci::Position pos, Sci::Position moveDir, bool checkLineEnd=true) const noexcept;
|
||||
Sci::Position NextPosition(Sci::Position pos, int moveDir) const noexcept;
|
||||
bool NextCharacter(Sci::Position &pos, int moveDir) const noexcept; // Returns true if pos changed
|
||||
Document::CharacterExtracted CharacterAfter(Sci::Position position) const noexcept;
|
||||
Document::CharacterExtracted CharacterBefore(Sci::Position position) const noexcept;
|
||||
CharacterExtracted CharacterAfter(Sci::Position position) const noexcept;
|
||||
CharacterExtracted CharacterBefore(Sci::Position position) const noexcept;
|
||||
Sci_Position SCI_METHOD GetRelativePosition(Sci_Position positionStart, Sci_Position characterOffset) const override;
|
||||
Sci::Position GetRelativePositionUTF16(Sci::Position positionStart, Sci::Position characterOffset) const noexcept;
|
||||
int SCI_METHOD GetCharacterAndWidth(Sci_Position position, Sci_Position *pWidth) const override;
|
||||
|
@ -358,8 +373,10 @@ public:
|
|||
// Gateways to modifying document
|
||||
void ModifiedAt(Sci::Position pos) noexcept;
|
||||
void CheckReadOnly();
|
||||
void TrimReplacement(std::string_view &text, Range &range) const noexcept;
|
||||
bool DeleteChars(Sci::Position pos, Sci::Position len);
|
||||
Sci::Position InsertString(Sci::Position position, const char *s, Sci::Position insertLength);
|
||||
Sci::Position InsertString(Sci::Position position, std::string_view sv);
|
||||
void ChangeInsertion(const char *s, Sci::Position length);
|
||||
int SCI_METHOD AddData(const char *data, Sci_Position length) override;
|
||||
void * SCI_METHOD ConvertToDocument() override;
|
||||
|
@ -396,7 +413,7 @@ public:
|
|||
int SCI_METHOD GetLineIndentation(Sci_Position line) override;
|
||||
Sci::Position SetLineIndentation(Sci::Line line, Sci::Position indent);
|
||||
Sci::Position GetLineIndentPosition(Sci::Line line) const;
|
||||
Sci::Position GetColumn(Sci::Position pos);
|
||||
Sci::Position GetColumn(Sci::Position pos) const;
|
||||
Sci::Position CountCharacters(Sci::Position startPos, Sci::Position endPos) const noexcept;
|
||||
Sci::Position CountUTF16(Sci::Position startPos, Sci::Position endPos) const noexcept;
|
||||
Sci::Position FindColumn(Sci::Line line, Sci::Position column);
|
||||
|
@ -416,6 +433,7 @@ public:
|
|||
cb.GetCharRange(buffer, position, lengthRetrieve);
|
||||
}
|
||||
char SCI_METHOD StyleAt(Sci_Position position) const override { return cb.StyleAt(position); }
|
||||
char StyleAtNoExcept(Sci_Position position) const noexcept { return cb.StyleAt(position); }
|
||||
int StyleIndexAt(Sci_Position position) const noexcept { return static_cast<unsigned char>(cb.StyleAt(position)); }
|
||||
void GetStyleRange(unsigned char *buffer, Sci::Position position, Sci::Position lengthRetrieve) const {
|
||||
cb.GetStyleRange(buffer, position, lengthRetrieve);
|
||||
|
|
|
@ -1571,21 +1571,34 @@ void EditView::DrawEOLAnnotationText(Surface *surface, const EditModel &model, c
|
|||
|
||||
// Draw any box or stadium shape
|
||||
if (FlagSet(phase, DrawPhase::indicatorsBack)) {
|
||||
if (vsDraw.eolAnnotationVisible >= EOLAnnotationVisible::Boxed) {
|
||||
PRectangle rcBox = rcSegment;
|
||||
rcBox.left = std::round(rcSegment.left);
|
||||
rcBox.right = std::round(rcSegment.right);
|
||||
if (vsDraw.eolAnnotationVisible == EOLAnnotationVisible::Boxed) {
|
||||
surface->RectangleFrame(rcBox, Stroke(textFore));
|
||||
} else {
|
||||
if (phasesDraw == PhasesDraw::One) {
|
||||
// Draw an outline around the text
|
||||
surface->Stadium(rcBox, FillStroke(ColourRGBA(textBack, 0), textFore, 1.0), ends);
|
||||
} else {
|
||||
// Draw with a fill to fill the edges of the shape.
|
||||
surface->Stadium(rcBox, FillStroke(textBack, textFore, 1.0), ends);
|
||||
}
|
||||
const PRectangle rcBox = PixelAlign(rcSegment, 1);
|
||||
|
||||
switch (vsDraw.eolAnnotationVisible) {
|
||||
case EOLAnnotationVisible::Standard:
|
||||
if (phasesDraw != PhasesDraw::One) {
|
||||
surface->FillRectangle(rcBox, textBack);
|
||||
}
|
||||
break;
|
||||
|
||||
case EOLAnnotationVisible::Boxed:
|
||||
if (phasesDraw == PhasesDraw::One) {
|
||||
// Draw a rectangular outline around the text
|
||||
surface->RectangleFrame(rcBox, textFore);
|
||||
} else {
|
||||
// Draw with a fill to fill the edges of the rectangle.
|
||||
surface->RectangleDraw(rcBox, FillStroke(textBack, textFore));
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
if (phasesDraw == PhasesDraw::One) {
|
||||
// Draw an outline around the text
|
||||
surface->Stadium(rcBox, FillStroke(ColourRGBA(textBack, 0), textFore), ends);
|
||||
} else {
|
||||
// Draw with a fill to fill the edges of the shape.
|
||||
surface->Stadium(rcBox, FillStroke(textBack, textFore), ends);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -5696,15 +5696,27 @@ Sci::Position Editor::GetTag(char *tagValue, int tagNumber) {
|
|||
return length;
|
||||
}
|
||||
|
||||
Sci::Position Editor::ReplaceTarget(bool replacePatterns, const char *text, Sci::Position length) {
|
||||
Sci::Position Editor::ReplaceTarget(ReplaceType replaceType, std::string_view text) {
|
||||
UndoGroup ug(pdoc);
|
||||
if (length == -1)
|
||||
length = strlen(text);
|
||||
if (replacePatterns) {
|
||||
text = pdoc->SubstituteByPosition(text, &length);
|
||||
if (!text) {
|
||||
if (replaceType == ReplaceType::patterns) {
|
||||
Sci::Position length = text.length();
|
||||
const char *p = pdoc->SubstituteByPosition(text.data(), &length);
|
||||
if (!p) {
|
||||
return 0;
|
||||
}
|
||||
text = std::string_view(p, length);
|
||||
}
|
||||
|
||||
if (replaceType == ReplaceType::minimal) {
|
||||
// Check for prefix and suffix and reduce text and target to match.
|
||||
// This is performed with Range which doesn't support virtual space.
|
||||
Range range(targetRange.start.Position(), targetRange.end.Position());
|
||||
pdoc->TrimReplacement(text, range);
|
||||
// Re-apply virtual space to start if start position didn't change.
|
||||
// Don't bother with end as its virtual space is not used
|
||||
const SelectionPosition start(range.start == targetRange.start.Position() ?
|
||||
targetRange.start : SelectionPosition(range.start));
|
||||
targetRange = SelectionSegment(start, SelectionPosition(range.end));
|
||||
}
|
||||
|
||||
// Remove the text inside the range
|
||||
|
@ -5718,9 +5730,9 @@ Sci::Position Editor::ReplaceTarget(bool replacePatterns, const char *text, Sci:
|
|||
targetRange.end = targetRange.start;
|
||||
|
||||
// Insert the new text
|
||||
const Sci::Position lengthInserted = pdoc->InsertString(targetRange.start.Position(), text, length);
|
||||
const Sci::Position lengthInserted = pdoc->InsertString(targetRange.start.Position(), text);
|
||||
targetRange.end.SetPosition(targetRange.start.Position() + lengthInserted);
|
||||
return length;
|
||||
return text.length();
|
||||
}
|
||||
|
||||
bool Editor::IsUnicodeMode() const noexcept {
|
||||
|
@ -5783,6 +5795,27 @@ void Editor::AddStyledText(const char *buffer, Sci::Position appendLength) {
|
|||
SetEmptySelection(sel.MainCaret() + lengthInserted);
|
||||
}
|
||||
|
||||
Sci::Position Editor::GetStyledText(char *buffer, Sci::Position cpMin, Sci::Position cpMax) const noexcept {
|
||||
Sci::Position iPlace = 0;
|
||||
for (Sci::Position iChar = cpMin; iChar < cpMax; iChar++) {
|
||||
buffer[iPlace++] = pdoc->CharAt(iChar);
|
||||
buffer[iPlace++] = pdoc->StyleAtNoExcept(iChar);
|
||||
}
|
||||
buffer[iPlace] = '\0';
|
||||
buffer[iPlace + 1] = '\0';
|
||||
return iPlace;
|
||||
}
|
||||
|
||||
Sci::Position Editor::GetTextRange(char *buffer, Sci::Position cpMin, Sci::Position cpMax) const {
|
||||
const Sci::Position cpEnd = (cpMax == -1) ? pdoc->Length() : cpMax;
|
||||
PLATFORM_ASSERT(cpEnd <= pdoc->Length());
|
||||
const Sci::Position len = cpEnd - cpMin; // No -1 as cpMin and cpMax are referring to inter character positions
|
||||
pdoc->GetCharRange(buffer, cpMin, len);
|
||||
// Spec says copied text is terminated with a NUL
|
||||
buffer[len] = '\0';
|
||||
return len; // Not including NUL
|
||||
}
|
||||
|
||||
bool Editor::ValidMargin(uptr_t wParam) const noexcept {
|
||||
return wParam < vs.ms.size();
|
||||
}
|
||||
|
@ -5839,7 +5872,7 @@ void Editor::StyleSetMessage(Message iMessage, uptr_t wParam, sptr_t lParam) {
|
|||
if (!(classified & UTF8MaskInvalid)) {
|
||||
// valid UTF-8
|
||||
int len = classified & UTF8MaskWidth;
|
||||
while (len--)
|
||||
for (int i=0; i<len && i<4; i++)
|
||||
*rep++ = *utf8++;
|
||||
}
|
||||
*rep = 0;
|
||||
|
@ -6219,11 +6252,15 @@ sptr_t Editor::WndProc(Message iMessage, uptr_t wParam, sptr_t lParam) {
|
|||
|
||||
case Message::ReplaceTarget:
|
||||
PLATFORM_ASSERT(lParam);
|
||||
return ReplaceTarget(false, ConstCharPtrFromSPtr(lParam), PositionFromUPtr(wParam));
|
||||
return ReplaceTarget(ReplaceType::basic, ViewFromParams(lParam, wParam));
|
||||
|
||||
case Message::ReplaceTargetRE:
|
||||
PLATFORM_ASSERT(lParam);
|
||||
return ReplaceTarget(true, ConstCharPtrFromSPtr(lParam), PositionFromUPtr(wParam));
|
||||
return ReplaceTarget(ReplaceType::patterns, ViewFromParams(lParam, wParam));
|
||||
|
||||
case Message::ReplaceTargetMinimal:
|
||||
PLATFORM_ASSERT(lParam);
|
||||
return ReplaceTarget(ReplaceType::minimal, ViewFromParams(lParam, wParam));
|
||||
|
||||
case Message::SearchInTarget:
|
||||
PLATFORM_ASSERT(lParam);
|
||||
|
@ -6311,36 +6348,17 @@ sptr_t Editor::WndProc(Message iMessage, uptr_t wParam, sptr_t lParam) {
|
|||
case Message::FindTextFull:
|
||||
return FindTextFull(wParam, lParam);
|
||||
|
||||
case Message::GetTextRange: {
|
||||
if (lParam == 0)
|
||||
return 0;
|
||||
TextRange *tr = static_cast<TextRange *>(PtrFromSPtr(lParam));
|
||||
Sci::Position cpMax = static_cast<Sci::Position>(tr->chrg.cpMax);
|
||||
if (cpMax == -1)
|
||||
cpMax = pdoc->Length();
|
||||
PLATFORM_ASSERT(cpMax <= pdoc->Length());
|
||||
Sci::Position len = cpMax - tr->chrg.cpMin; // No -1 as cpMin and cpMax are referring to inter character positions
|
||||
pdoc->GetCharRange(tr->lpstrText, tr->chrg.cpMin, len);
|
||||
// Spec says copied text is terminated with a NUL
|
||||
tr->lpstrText[len] = '\0';
|
||||
return len; // Not including NUL
|
||||
case Message::GetTextRange:
|
||||
if (TextRange *tr = static_cast<TextRange *>(PtrFromSPtr(lParam))) {
|
||||
return GetTextRange(tr->lpstrText, tr->chrg.cpMin, tr->chrg.cpMax);
|
||||
}
|
||||
return 0;
|
||||
|
||||
case Message::GetTextRangeFull: {
|
||||
if (lParam == 0)
|
||||
return 0;
|
||||
TextRangeFull *tr = static_cast<TextRangeFull *>(PtrFromSPtr(lParam));
|
||||
Sci::Position cpMax = tr->chrg.cpMax;
|
||||
if (cpMax == -1)
|
||||
cpMax = pdoc->Length();
|
||||
PLATFORM_ASSERT(cpMax <= pdoc->Length());
|
||||
const Sci::Position len = cpMax - tr->chrg.cpMin; // No -1 as cpMin and cpMax are referring to inter character positions
|
||||
PLATFORM_ASSERT(len >= 0);
|
||||
pdoc->GetCharRange(tr->lpstrText, tr->chrg.cpMin, len);
|
||||
// Spec says copied text is terminated with a NUL
|
||||
tr->lpstrText[len] = '\0';
|
||||
return len; // Not including NUL
|
||||
case Message::GetTextRangeFull:
|
||||
if (TextRangeFull *tr = static_cast<TextRangeFull *>(PtrFromSPtr(lParam))) {
|
||||
return GetTextRange(tr->lpstrText, tr->chrg.cpMin, tr->chrg.cpMax);
|
||||
}
|
||||
return 0;
|
||||
|
||||
case Message::HideSelection:
|
||||
vs.selection.visible = wParam == 0;
|
||||
|
@ -6588,19 +6606,17 @@ sptr_t Editor::WndProc(Message iMessage, uptr_t wParam, sptr_t lParam) {
|
|||
pdoc->SetSavePoint();
|
||||
break;
|
||||
|
||||
case Message::GetStyledText: {
|
||||
if (lParam == 0)
|
||||
return 0;
|
||||
TextRange *tr = static_cast<TextRange *>(PtrFromSPtr(lParam));
|
||||
Sci::Position iPlace = 0;
|
||||
for (Sci::Position iChar = tr->chrg.cpMin; iChar < tr->chrg.cpMax; iChar++) {
|
||||
tr->lpstrText[iPlace++] = pdoc->CharAt(iChar);
|
||||
tr->lpstrText[iPlace++] = pdoc->StyleAt(iChar);
|
||||
}
|
||||
tr->lpstrText[iPlace] = '\0';
|
||||
tr->lpstrText[iPlace + 1] = '\0';
|
||||
return iPlace;
|
||||
case Message::GetStyledText:
|
||||
if (TextRange *tr = static_cast<TextRange *>(PtrFromSPtr(lParam))) {
|
||||
return GetStyledText(tr->lpstrText, tr->chrg.cpMin, tr->chrg.cpMax);
|
||||
}
|
||||
return 0;
|
||||
|
||||
case Message::GetStyledTextFull:
|
||||
if (TextRangeFull *tr = static_cast<TextRangeFull *>(PtrFromSPtr(lParam))) {
|
||||
return GetStyledText(tr->lpstrText, tr->chrg.cpMin, tr->chrg.cpMax);
|
||||
}
|
||||
return 0;
|
||||
|
||||
case Message::CanRedo:
|
||||
return (pdoc->CanRedo() && !pdoc->IsReadOnly()) ? 1 : 0;
|
||||
|
|
|
@ -581,7 +581,8 @@ protected: // ScintillaBase subclass needs access to much of Editor
|
|||
void FoldAll(Scintilla::FoldAction action);
|
||||
|
||||
Sci::Position GetTag(char *tagValue, int tagNumber);
|
||||
Sci::Position ReplaceTarget(bool replacePatterns, const char *text, Sci::Position length=-1);
|
||||
enum class ReplaceType {basic, patterns, minimal};
|
||||
Sci::Position ReplaceTarget(ReplaceType replaceType, std::string_view text);
|
||||
|
||||
bool PositionIsHotspot(Sci::Position position) const noexcept;
|
||||
bool PointIsHotspot(Point pt);
|
||||
|
@ -598,6 +599,8 @@ protected: // ScintillaBase subclass needs access to much of Editor
|
|||
|
||||
Sci::Line WrapCount(Sci::Line line);
|
||||
void AddStyledText(const char *buffer, Sci::Position appendLength);
|
||||
Sci::Position GetStyledText(char *buffer, Sci::Position cpMin, Sci::Position cpMax) const noexcept;
|
||||
Sci::Position GetTextRange(char *buffer, Sci::Position cpMin, Sci::Position cpMax) const;
|
||||
|
||||
virtual Scintilla::sptr_t DefWndProc(Scintilla::Message iMessage, Scintilla::uptr_t wParam, Scintilla::sptr_t lParam) = 0;
|
||||
bool ValidMargin(Scintilla::uptr_t wParam) const noexcept;
|
||||
|
@ -623,6 +626,12 @@ protected: // ScintillaBase subclass needs access to much of Editor
|
|||
static unsigned char *UCharPtrFromSPtr(Scintilla::sptr_t lParam) noexcept {
|
||||
return static_cast<unsigned char *>(PtrFromSPtr(lParam));
|
||||
}
|
||||
static std::string_view ViewFromParams(Scintilla::sptr_t lParam, Scintilla::uptr_t wParam) noexcept {
|
||||
if (SPtrFromUPtr(wParam) == -1) {
|
||||
return std::string_view(CharPtrFromSPtr(lParam));
|
||||
}
|
||||
return std::string_view(CharPtrFromSPtr(lParam), wParam);
|
||||
}
|
||||
static void *PtrFromUPtr(Scintilla::uptr_t wParam) noexcept {
|
||||
return reinterpret_cast<void *>(wParam);
|
||||
}
|
||||
|
|
|
@ -211,11 +211,11 @@ void ScintillaBase::ListNotify(ListBoxEvent *plbe) {
|
|||
}
|
||||
}
|
||||
|
||||
void ScintillaBase::AutoCompleteInsert(Sci::Position startPos, Sci::Position removeLen, const char *text, Sci::Position textLen) {
|
||||
void ScintillaBase::AutoCompleteInsert(Sci::Position startPos, Sci::Position removeLen, std::string_view text) {
|
||||
UndoGroup ug(pdoc);
|
||||
if (multiAutoCMode == MultiAutoComplete::Once) {
|
||||
pdoc->DeleteChars(startPos, removeLen);
|
||||
const Sci::Position lengthInserted = pdoc->InsertString(startPos, text, textLen);
|
||||
const Sci::Position lengthInserted = pdoc->InsertString(startPos, text);
|
||||
SetEmptySelection(startPos + lengthInserted);
|
||||
} else {
|
||||
// MultiAutoComplete::Each
|
||||
|
@ -228,7 +228,7 @@ void ScintillaBase::AutoCompleteInsert(Sci::Position startPos, Sci::Position rem
|
|||
positionInsert -= removeLen;
|
||||
pdoc->DeleteChars(positionInsert, removeLen);
|
||||
}
|
||||
const Sci::Position lengthInserted = pdoc->InsertString(positionInsert, text, textLen);
|
||||
const Sci::Position lengthInserted = pdoc->InsertString(positionInsert, text);
|
||||
if (lengthInserted > 0) {
|
||||
sel.Range(r).caret.SetPosition(positionInsert + lengthInserted);
|
||||
sel.Range(r).anchor.SetPosition(positionInsert + lengthInserted);
|
||||
|
@ -245,15 +245,20 @@ void ScintillaBase::AutoCompleteStart(Sci::Position lenEntered, const char *list
|
|||
|
||||
if (ac.chooseSingle && (listType == 0)) {
|
||||
if (list && !strchr(list, ac.GetSeparator())) {
|
||||
const char *typeSep = strchr(list, ac.GetTypesep());
|
||||
const Sci::Position lenInsert = typeSep ?
|
||||
(typeSep-list) : strlen(list);
|
||||
// list contains just one item so choose it
|
||||
const std::string_view item(list);
|
||||
const std::string_view choice = item.substr(0, item.find_first_of(ac.GetTypesep()));
|
||||
if (ac.ignoreCase) {
|
||||
// May need to convert the case before invocation, so remove lenEntered characters
|
||||
AutoCompleteInsert(sel.MainCaret() - lenEntered, lenEntered, list, lenInsert);
|
||||
AutoCompleteInsert(sel.MainCaret() - lenEntered, lenEntered, choice);
|
||||
} else {
|
||||
AutoCompleteInsert(sel.MainCaret(), 0, list + lenEntered, lenInsert - lenEntered);
|
||||
AutoCompleteInsert(sel.MainCaret(), 0, choice.substr(lenEntered));
|
||||
}
|
||||
const Sci::Position firstPos = sel.MainCaret() - lenEntered;
|
||||
// Construct a string with a NUL at end as that is expected by applications
|
||||
const std::string selected(choice);
|
||||
AutoCompleteNotifyCompleted('\0', CompletionMethods::SingleChoice, firstPos, selected.c_str());
|
||||
|
||||
ac.Cancel();
|
||||
return;
|
||||
}
|
||||
|
@ -395,6 +400,20 @@ void ScintillaBase::AutoCompleteCharacterDeleted() {
|
|||
NotifyParent(scn);
|
||||
}
|
||||
|
||||
void ScintillaBase::AutoCompleteNotifyCompleted(char ch, CompletionMethods completionMethod, Sci::Position firstPos, const char *text) {
|
||||
NotificationData scn = {};
|
||||
scn.nmhdr.code = Notification::AutoCCompleted;
|
||||
scn.message = static_cast<Message>(0);
|
||||
scn.ch = ch;
|
||||
scn.listCompletionMethod = completionMethod;
|
||||
scn.wParam = listType;
|
||||
scn.listType = listType;
|
||||
scn.position = firstPos;
|
||||
scn.lParam = firstPos;
|
||||
scn.text = text;
|
||||
NotifyParent(scn);
|
||||
}
|
||||
|
||||
void ScintillaBase::AutoCompleteCompleted(char ch, CompletionMethods completionMethod) {
|
||||
const int item = ac.GetSelection();
|
||||
if (item == -1) {
|
||||
|
@ -430,12 +449,10 @@ void ScintillaBase::AutoCompleteCompleted(char ch, CompletionMethods completionM
|
|||
endPos = pdoc->ExtendWordSelect(endPos, 1, true);
|
||||
if (endPos < firstPos)
|
||||
return;
|
||||
AutoCompleteInsert(firstPos, endPos - firstPos, selected.c_str(), selected.length());
|
||||
AutoCompleteInsert(firstPos, endPos - firstPos, selected);
|
||||
SetLastXChosen();
|
||||
|
||||
scn.nmhdr.code = Notification::AutoCCompleted;
|
||||
NotifyParent(scn);
|
||||
|
||||
AutoCompleteNotifyCompleted(ch, completionMethod, firstPos, selected.c_str());
|
||||
}
|
||||
|
||||
int ScintillaBase::AutoCompleteGetCurrent() const {
|
||||
|
|
|
@ -57,7 +57,7 @@ protected:
|
|||
void CancelModes() override;
|
||||
int KeyCommand(Scintilla::Message iMessage) override;
|
||||
|
||||
void AutoCompleteInsert(Sci::Position startPos, Sci::Position removeLen, const char *text, Sci::Position textLen);
|
||||
void AutoCompleteInsert(Sci::Position startPos, Sci::Position removeLen, std::string_view text);
|
||||
void AutoCompleteStart(Sci::Position lenEntered, const char *list);
|
||||
void AutoCompleteCancel();
|
||||
void AutoCompleteMove(int delta);
|
||||
|
@ -65,6 +65,7 @@ protected:
|
|||
int AutoCompleteGetCurrentText(char *buffer) const;
|
||||
void AutoCompleteCharacterAdded(char ch);
|
||||
void AutoCompleteCharacterDeleted();
|
||||
void AutoCompleteNotifyCompleted(char ch, CompletionMethods completionMethod, Sci::Position firstPos, const char *text);
|
||||
void AutoCompleteCompleted(char ch, Scintilla::CompletionMethods completionMethod);
|
||||
void AutoCompleteMoveToCurrentWord();
|
||||
void AutoCompleteSelection();
|
||||
|
|
|
@ -172,6 +172,16 @@ class ScintillaCallable:
|
|||
styledText = tr.lpstrText[:length]
|
||||
styledText += b"\0" * (length - len(styledText))
|
||||
return styledText
|
||||
def StyledTextRangeFull(self, start, end):
|
||||
tr = TEXTRANGEFULL()
|
||||
tr.cpMin = start
|
||||
tr.cpMax = end
|
||||
length = 2 * (end - start)
|
||||
tr.lpstrText = ctypes.create_string_buffer(length + 2)
|
||||
self.GetStyledTextFull(0, ctypes.byref(tr))
|
||||
styledText = tr.lpstrText[:length]
|
||||
styledText += b"\0" * (length - len(styledText))
|
||||
return styledText
|
||||
def FindBytes(self, start, end, s, flags):
|
||||
ft = FINDTEXT()
|
||||
ft.cpMin = start
|
||||
|
|
|
@ -26,7 +26,7 @@ class TestPerformance(unittest.TestCase):
|
|||
def testAddLine(self):
|
||||
data = (string.ascii_letters + string.digits + "\n").encode('utf-8')
|
||||
start = timer()
|
||||
for i in range(1000):
|
||||
for i in range(2000):
|
||||
self.ed.AddText(len(data), data)
|
||||
self.assertEquals(self.ed.LineCount, i + 2)
|
||||
end = timer()
|
||||
|
@ -38,7 +38,7 @@ class TestPerformance(unittest.TestCase):
|
|||
def testAddLineMiddle(self):
|
||||
data = (string.ascii_letters + string.digits + "\n").encode('utf-8')
|
||||
start = timer()
|
||||
for i in range(1000):
|
||||
for i in range(2000):
|
||||
self.ed.AddText(len(data), data)
|
||||
self.assertEquals(self.ed.LineCount, i + 2)
|
||||
end = timer()
|
||||
|
@ -64,7 +64,7 @@ class TestPerformance(unittest.TestCase):
|
|||
insert = (string.digits + "\n").encode('utf-8')
|
||||
self.ed.AddText(len(data), data)
|
||||
start = timer()
|
||||
for i in range(1000):
|
||||
for i in range(2000):
|
||||
self.ed.InsertText(0, insert)
|
||||
end = timer()
|
||||
duration = end - start
|
||||
|
@ -96,7 +96,7 @@ class TestPerformance(unittest.TestCase):
|
|||
self.ed.AddText(len(manyLines), manyLines)
|
||||
searchString = "φ".encode('utf-8')
|
||||
start = timer()
|
||||
for i in range(10):
|
||||
for i in range(1000):
|
||||
self.ed.TargetStart = 0
|
||||
self.ed.TargetEnd = self.ed.Length-1
|
||||
self.ed.SearchFlags = self.ed.SCFIND_MATCHCASE
|
||||
|
@ -115,7 +115,7 @@ class TestPerformance(unittest.TestCase):
|
|||
self.ed.AddText(len(manyLines), manyLines)
|
||||
searchString = "φ".encode('utf-8')
|
||||
start = timer()
|
||||
for i in range(10):
|
||||
for i in range(20):
|
||||
self.ed.TargetStart = 0
|
||||
self.ed.TargetEnd = self.ed.Length-1
|
||||
self.ed.SearchFlags = 0
|
||||
|
@ -126,5 +126,24 @@ class TestPerformance(unittest.TestCase):
|
|||
print("%6.3f testUTF8Searches" % duration)
|
||||
self.xite.DoEvents()
|
||||
|
||||
def testUTF8AsciiSearches(self):
|
||||
self.ed.SetCodePage(65001)
|
||||
oneLine = "Fold Margin=NagasakiOsakaHiroshimaHanedaKyoto(&F)\n".encode('utf-8')
|
||||
manyLines = oneLine * 100000
|
||||
manyLines = manyLines + "φ\n".encode('utf-8')
|
||||
self.ed.AddText(len(manyLines), manyLines)
|
||||
searchString = "φ".encode('utf-8')
|
||||
start = timer()
|
||||
for i in range(20):
|
||||
self.ed.TargetStart = 0
|
||||
self.ed.TargetEnd = self.ed.Length-1
|
||||
self.ed.SearchFlags = 0
|
||||
pos = self.ed.SearchInTarget(len(searchString), searchString)
|
||||
self.assert_(pos > 0)
|
||||
end = timer()
|
||||
duration = end - start
|
||||
print("%6.3f testUTF8AsciiSearches" % duration)
|
||||
self.xite.DoEvents()
|
||||
|
||||
if __name__ == '__main__':
|
||||
Xite.main("performanceTests")
|
||||
|
|
|
@ -62,6 +62,15 @@ class TestSimple(unittest.TestCase):
|
|||
self.assertEquals(self.ed.GetStyleAt(0), 0)
|
||||
self.assertEquals(self.ed.StyledTextRange(0, 1), b"x\0")
|
||||
|
||||
def testStyledTextRangeFull(self):
|
||||
self.assertEquals(self.ed.EndStyled, 0)
|
||||
self.ed.AddStyledText(4, b"x\002y\377")
|
||||
self.assertEquals(self.ed.StyledTextRangeFull(0, 1), b"x\002")
|
||||
self.assertEquals(self.ed.StyledTextRangeFull(1, 2), b"y\377")
|
||||
self.ed.ClearDocumentStyle()
|
||||
self.assertEquals(self.ed.Length, 2)
|
||||
self.assertEquals(self.ed.StyledTextRangeFull(0, 1), b"x\0")
|
||||
|
||||
def testStyling(self):
|
||||
self.assertEquals(self.ed.EndStyled, 0)
|
||||
self.ed.AddStyledText(4, b"x\002y\003")
|
||||
|
@ -625,6 +634,45 @@ class TestSimple(unittest.TestCase):
|
|||
self.assertEquals(self.ed.TargetStart, 4)
|
||||
self.assertEquals(self.ed.TargetEnd, 5)
|
||||
|
||||
def testReplaceTargetMinimal(self):
|
||||
# 1: No common characters
|
||||
self.ed.SetContents(b"abcd")
|
||||
self.ed.TargetStart = 1
|
||||
self.ed.TargetEnd = 3
|
||||
self.assertEquals(self.ed.TargetStart, 1)
|
||||
self.assertEquals(self.ed.TargetEnd, 3)
|
||||
rep = b"321"
|
||||
self.ed.ReplaceTargetMinimal(len(rep), rep)
|
||||
self.assertEquals(self.ed.Contents(), b"a321d")
|
||||
|
||||
# 2: New characters with common prefix and suffix
|
||||
self.ed.TargetStart = 1
|
||||
self.ed.TargetEnd = 4
|
||||
rep = b"3<>1"
|
||||
self.ed.ReplaceTargetMinimal(len(rep), rep)
|
||||
self.assertEquals(self.ed.Contents(), b"a3<>1d")
|
||||
|
||||
# 3: Remove characters with common prefix and suffix
|
||||
self.ed.TargetStart = 1
|
||||
self.ed.TargetEnd = 5
|
||||
rep = b"31"
|
||||
self.ed.ReplaceTargetMinimal(len(rep), rep)
|
||||
self.assertEquals(self.ed.Contents(), b"a31d")
|
||||
|
||||
# 4: Common prefix
|
||||
self.ed.TargetStart = 1
|
||||
self.ed.TargetEnd = 3
|
||||
rep = b"3bc"
|
||||
self.ed.ReplaceTargetMinimal(len(rep), rep)
|
||||
self.assertEquals(self.ed.Contents(), b"a3bcd")
|
||||
|
||||
# 5: Common suffix
|
||||
self.ed.TargetStart = 2
|
||||
self.ed.TargetEnd = 5
|
||||
rep = b"cd"
|
||||
self.ed.ReplaceTargetMinimal(len(rep), rep)
|
||||
self.assertEquals(self.ed.Contents(), b"a3cd")
|
||||
|
||||
def testTargetWhole(self):
|
||||
self.ed.SetContents(b"abcd")
|
||||
self.ed.TargetStart = 1
|
||||
|
@ -973,6 +1021,46 @@ class TestKeyCommands(unittest.TestCase):
|
|||
self.ed.DocumentEndExtend()
|
||||
self.assertEquals(self.selRange(), (10, 3))
|
||||
|
||||
def testParagraphMove(self):
|
||||
example = b"a\n\nbig\n\n\n\nboat"
|
||||
self.ed.AddText(len(example), example)
|
||||
start1 = 0 # Before 'a'
|
||||
start2 = 3 # Before 'big'
|
||||
start3 = 10 # Before 'boat'
|
||||
|
||||
# Paragraph 2 to 1
|
||||
self.ed.SetSel(start2, start2)
|
||||
self.ed.ParaUp()
|
||||
self.assertEquals(self.selRange(), (start1, start1))
|
||||
self.ed.ParaDown()
|
||||
self.assertEquals(self.selRange(), (start2, start2))
|
||||
self.ed.SetSel(start2, start2)
|
||||
self.ed.ParaUpExtend()
|
||||
self.assertEquals(self.selRange(), (start1, start2))
|
||||
self.ed.ParaDownExtend()
|
||||
self.assertEquals(self.selRange(), (start2, start2))
|
||||
|
||||
# Inside paragraph 2 to start paragraph 2
|
||||
mid2 = start2+1
|
||||
self.ed.SetSel(mid2, mid2)
|
||||
# Next line behaved differently before change for bug #2363
|
||||
self.ed.ParaUp()
|
||||
self.assertEquals(self.selRange(), (start2, start2))
|
||||
self.ed.ParaDown()
|
||||
self.assertEquals(self.selRange(), (start3, start3))
|
||||
self.ed.SetSel(mid2, mid2)
|
||||
self.ed.ParaUpExtend()
|
||||
self.assertEquals(self.selRange(), (start2, mid2))
|
||||
self.ed.ParaDownExtend()
|
||||
self.assertEquals(self.selRange(), (start3, mid2))
|
||||
|
||||
# Paragraph 3 to 2
|
||||
self.ed.SetSel(start3, start3)
|
||||
self.ed.ParaUp()
|
||||
self.assertEquals(self.selRange(), (start2, start2))
|
||||
self.ed.ParaDown()
|
||||
self.assertEquals(self.selRange(), (start3, start3))
|
||||
|
||||
|
||||
class TestMarkers(unittest.TestCase):
|
||||
|
||||
|
|
|
@ -1 +1 @@
|
|||
531
|
||||
532
|
||||
|
|
|
@ -36,6 +36,7 @@
|
|||
#include <commctrl.h>
|
||||
#include <richedit.h>
|
||||
#include <windowsx.h>
|
||||
#include <shellscalingapi.h>
|
||||
|
||||
#if !defined(DISABLE_D2D)
|
||||
#define USE_D2D 1
|
||||
|
@ -157,11 +158,24 @@ GetSystemMetricsForDpiSig fnGetSystemMetricsForDpi = nullptr;
|
|||
using AdjustWindowRectExForDpiSig = BOOL(WINAPI *)(LPRECT lpRect, DWORD dwStyle, BOOL bMenu, DWORD dwExStyle, UINT dpi);
|
||||
AdjustWindowRectExForDpiSig fnAdjustWindowRectExForDpi = nullptr;
|
||||
|
||||
using AreDpiAwarenessContextsEqualSig = BOOL(WINAPI *)(DPI_AWARENESS_CONTEXT, DPI_AWARENESS_CONTEXT);
|
||||
AreDpiAwarenessContextsEqualSig fnAreDpiAwarenessContextsEqual = nullptr;
|
||||
|
||||
using GetWindowDpiAwarenessContextSig = DPI_AWARENESS_CONTEXT(WINAPI *)(HWND);
|
||||
GetWindowDpiAwarenessContextSig fnGetWindowDpiAwarenessContext = nullptr;
|
||||
|
||||
using GetScaleFactorForMonitorSig = HRESULT(WINAPI *)(HMONITOR, DEVICE_SCALE_FACTOR *);
|
||||
GetScaleFactorForMonitorSig fnGetScaleFactorForMonitor = nullptr;
|
||||
|
||||
using SetThreadDpiAwarenessContextSig = DPI_AWARENESS_CONTEXT(WINAPI *)(DPI_AWARENESS_CONTEXT);
|
||||
SetThreadDpiAwarenessContextSig fnSetThreadDpiAwarenessContext = nullptr;
|
||||
|
||||
void LoadDpiForWindow() noexcept {
|
||||
HMODULE user32 = ::GetModuleHandleW(L"user32.dll");
|
||||
fnGetDpiForWindow = DLLFunction<GetDpiForWindowSig>(user32, "GetDpiForWindow");
|
||||
fnGetSystemMetricsForDpi = DLLFunction<GetSystemMetricsForDpiSig>(user32, "GetSystemMetricsForDpi");
|
||||
fnAdjustWindowRectExForDpi = DLLFunction<AdjustWindowRectExForDpiSig>(user32, "AdjustWindowRectExForDpi");
|
||||
fnSetThreadDpiAwarenessContext = DLLFunction<SetThreadDpiAwarenessContextSig>(user32, "SetThreadDpiAwarenessContext");
|
||||
|
||||
using GetDpiForSystemSig = UINT(WINAPI *)(void);
|
||||
GetDpiForSystemSig fnGetDpiForSystem = DLLFunction<GetDpiForSystemSig>(user32, "GetDpiForSystem");
|
||||
|
@ -173,11 +187,13 @@ void LoadDpiForWindow() noexcept {
|
|||
::DeleteDC(hdcMeasure);
|
||||
}
|
||||
|
||||
if (!fnGetDpiForWindow) {
|
||||
hDLLShcore = ::LoadLibraryExW(L"shcore.dll", {}, LOAD_LIBRARY_SEARCH_SYSTEM32);
|
||||
if (hDLLShcore) {
|
||||
fnGetDpiForMonitor = DLLFunction<GetDpiForMonitorSig>(hDLLShcore, "GetDpiForMonitor");
|
||||
}
|
||||
fnGetWindowDpiAwarenessContext = DLLFunction<GetWindowDpiAwarenessContextSig>(user32, "GetWindowDpiAwarenessContext");
|
||||
fnAreDpiAwarenessContextsEqual = DLLFunction<AreDpiAwarenessContextsEqualSig>(user32, "AreDpiAwarenessContextsEqual");
|
||||
|
||||
hDLLShcore = ::LoadLibraryExW(L"shcore.dll", {}, LOAD_LIBRARY_SEARCH_SYSTEM32);
|
||||
if (hDLLShcore) {
|
||||
fnGetScaleFactorForMonitor = DLLFunction<GetScaleFactorForMonitorSig>(hDLLShcore, "GetScaleFactorForMonitor");
|
||||
fnGetDpiForMonitor = DLLFunction<GetDpiForMonitorSig>(hDLLShcore, "GetDpiForMonitor");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -358,6 +374,39 @@ struct FontDirectWrite : public FontWin {
|
|||
|
||||
}
|
||||
|
||||
HMONITOR MonitorFromWindowHandleScaling(HWND hWnd) noexcept {
|
||||
constexpr DWORD monitorFlags = MONITOR_DEFAULTTONEAREST;
|
||||
|
||||
if (!fnSetThreadDpiAwarenessContext) {
|
||||
return ::MonitorFromWindow(hWnd, monitorFlags);
|
||||
}
|
||||
|
||||
// Temporarily switching to PerMonitorV2 to retrieve correct monitor via MonitorFromRect() in case of active GDI scaling.
|
||||
const DPI_AWARENESS_CONTEXT oldContext = fnSetThreadDpiAwarenessContext(DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2);
|
||||
PLATFORM_ASSERT(oldContext != nullptr);
|
||||
|
||||
RECT rect;
|
||||
::GetWindowRect(hWnd, &rect);
|
||||
const HMONITOR monitor = ::MonitorFromRect(&rect, monitorFlags);
|
||||
|
||||
fnSetThreadDpiAwarenessContext(oldContext);
|
||||
return monitor;
|
||||
}
|
||||
|
||||
int GetDeviceScaleFactorWhenGdiScalingActive(HWND hWnd) noexcept {
|
||||
if (fnAreDpiAwarenessContextsEqual) {
|
||||
PLATFORM_ASSERT(fnGetWindowDpiAwarenessContext && fnGetScaleFactorForMonitor);
|
||||
if (fnAreDpiAwarenessContextsEqual(DPI_AWARENESS_CONTEXT_UNAWARE_GDISCALED, fnGetWindowDpiAwarenessContext(hWnd))) {
|
||||
const HWND hRootWnd = ::GetAncestor(hWnd, GA_ROOT); // Scale factor applies to entire (root) window.
|
||||
const HMONITOR hMonitor = MonitorFromWindowHandleScaling(hRootWnd);
|
||||
DEVICE_SCALE_FACTOR deviceScaleFactor;
|
||||
if (S_OK == fnGetScaleFactorForMonitor(hMonitor, &deviceScaleFactor))
|
||||
return (static_cast<int>(deviceScaleFactor) + 99) / 100; // increase to first integral multiple of 1
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
std::shared_ptr<Font> Font::Allocate(const FontParameters &fp) {
|
||||
#if defined(USE_D2D)
|
||||
if (fp.technology != Technology::Default) {
|
||||
|
@ -1287,11 +1336,13 @@ class SurfaceD2D : public Surface, public ISetRenderingParams {
|
|||
static constexpr FontQuality invalidFontQuality = FontQuality::QualityMask;
|
||||
FontQuality fontQuality = invalidFontQuality;
|
||||
int logPixelsY = USER_DEFAULT_SCREEN_DPI;
|
||||
int deviceScaleFactor = 1;
|
||||
std::shared_ptr<RenderingParams> renderingParams;
|
||||
|
||||
void Clear() noexcept;
|
||||
void SetFontQuality(FontQuality extraFontFlag);
|
||||
HRESULT GetBitmap(ID2D1Bitmap **ppBitmap);
|
||||
void SetDeviceScaleFactor(const ID2D1RenderTarget *const pRenderTarget) noexcept;
|
||||
|
||||
public:
|
||||
SurfaceD2D() noexcept;
|
||||
|
@ -1381,6 +1432,7 @@ SurfaceD2D::SurfaceD2D(ID2D1RenderTarget *pRenderTargetCompatible, int width, in
|
|||
&desiredSize, nullptr, &desiredFormat, D2D1_COMPATIBLE_RENDER_TARGET_OPTIONS_NONE, &pBitmapRenderTarget);
|
||||
if (SUCCEEDED(hr)) {
|
||||
pRenderTarget = pBitmapRenderTarget;
|
||||
SetDeviceScaleFactor(pRenderTarget);
|
||||
pRenderTarget->BeginDraw();
|
||||
ownRenderTarget = true;
|
||||
}
|
||||
|
@ -1439,6 +1491,7 @@ void SurfaceD2D::Init(SurfaceID sid, WindowID wid) {
|
|||
Release();
|
||||
SetScale(wid);
|
||||
pRenderTarget = static_cast<ID2D1RenderTarget *>(sid);
|
||||
SetDeviceScaleFactor(pRenderTarget);
|
||||
}
|
||||
|
||||
std::unique_ptr<Surface> SurfaceD2D::AllocatePixMap(int width, int height) {
|
||||
|
@ -1487,9 +1540,15 @@ int SurfaceD2D::LogPixelsY() {
|
|||
return logPixelsY;
|
||||
}
|
||||
|
||||
void SurfaceD2D::SetDeviceScaleFactor(const ID2D1RenderTarget *const pD2D1RenderTarget) noexcept {
|
||||
FLOAT dpiX = 0.f;
|
||||
FLOAT dpiY = 0.f;
|
||||
pD2D1RenderTarget->GetDpi(&dpiX, &dpiY);
|
||||
deviceScaleFactor = static_cast<int>(dpiX / 96.f);
|
||||
}
|
||||
|
||||
int SurfaceD2D::PixelDivisions() {
|
||||
// Win32 uses device pixels.
|
||||
return 1;
|
||||
return deviceScaleFactor;
|
||||
}
|
||||
|
||||
int SurfaceD2D::DeviceHeightFont(int points) {
|
||||
|
@ -1621,7 +1680,7 @@ void SurfaceD2D::FillRectangle(PRectangle rc, Fill fill) {
|
|||
}
|
||||
|
||||
void SurfaceD2D::FillRectangleAligned(PRectangle rc, Fill fill) {
|
||||
FillRectangle(PixelAlign(rc, 1), fill);
|
||||
FillRectangle(PixelAlign(rc, PixelDivisions()), fill);
|
||||
}
|
||||
|
||||
void SurfaceD2D::FillRectangle(PRectangle rc, Surface &surfacePattern) {
|
||||
|
@ -2895,7 +2954,7 @@ class ListBoxX : public ListBox {
|
|||
PRectangle rcPreSize;
|
||||
Point dragOffset;
|
||||
Point location; // Caret location at which the list is opened
|
||||
int wheelDelta; // mouse wheel residue
|
||||
MouseWheelDelta wheelDelta;
|
||||
ListOptions options;
|
||||
DWORD frameStyle = WS_THICKFRAME;
|
||||
|
||||
|
@ -2927,7 +2986,7 @@ public:
|
|||
desiredVisibleRows(9), maxItemCharacters(0), aveCharWidth(8),
|
||||
parent(nullptr), ctrlID(0), dpi(USER_DEFAULT_SCREEN_DPI),
|
||||
delegate(nullptr),
|
||||
widestItem(nullptr), maxCharWidth(1), resizeHit(0), wheelDelta(0) {
|
||||
widestItem(nullptr), maxCharWidth(1), resizeHit(0) {
|
||||
}
|
||||
ListBoxX(const ListBoxX &) = delete;
|
||||
ListBoxX(ListBoxX &&) = delete;
|
||||
|
@ -3689,21 +3748,15 @@ LRESULT ListBoxX::WndProc(HWND hWnd, UINT iMessage, WPARAM wParam, LPARAM lParam
|
|||
}
|
||||
return ::DefWindowProc(hWnd, iMessage, wParam, lParam);
|
||||
case WM_MOUSEWHEEL:
|
||||
wheelDelta -= GET_WHEEL_DELTA_WPARAM(wParam);
|
||||
if (std::abs(wheelDelta) >= WHEEL_DELTA) {
|
||||
if (wheelDelta.Accumulate(wParam)) {
|
||||
const int nRows = GetVisibleRows();
|
||||
int linesToScroll = std::clamp(nRows - 1, 1, 3);
|
||||
linesToScroll *= (wheelDelta / WHEEL_DELTA);
|
||||
linesToScroll *= wheelDelta.Actions();
|
||||
int top = ListBox_GetTopIndex(lb) + linesToScroll;
|
||||
if (top < 0) {
|
||||
top = 0;
|
||||
}
|
||||
ListBox_SetTopIndex(lb, top);
|
||||
// update wheel delta residue
|
||||
if (wheelDelta >= 0)
|
||||
wheelDelta = wheelDelta % WHEEL_DELTA;
|
||||
else
|
||||
wheelDelta = - (-wheelDelta % WHEEL_DELTA);
|
||||
}
|
||||
break;
|
||||
|
||||
|
|
|
@ -43,12 +43,29 @@ inline HWND HwndFromWindow(const Window &w) noexcept {
|
|||
void *PointerFromWindow(HWND hWnd) noexcept;
|
||||
void SetWindowPointer(HWND hWnd, void *ptr) noexcept;
|
||||
|
||||
HMONITOR MonitorFromWindowHandleScaling(HWND hWnd) noexcept;
|
||||
|
||||
UINT DpiForWindow(WindowID wid) noexcept;
|
||||
int GetDeviceScaleFactorWhenGdiScalingActive(HWND hWnd) noexcept;
|
||||
|
||||
int SystemMetricsForDpi(int nIndex, UINT dpi) noexcept;
|
||||
|
||||
HCURSOR LoadReverseArrowCursor(UINT dpi) noexcept;
|
||||
|
||||
class MouseWheelDelta {
|
||||
int wheelDelta = 0;
|
||||
public:
|
||||
bool Accumulate(WPARAM wParam) noexcept {
|
||||
wheelDelta -= GET_WHEEL_DELTA_WPARAM(wParam);
|
||||
return std::abs(wheelDelta) >= WHEEL_DELTA;
|
||||
}
|
||||
int Actions() noexcept {
|
||||
const int actions = wheelDelta / WHEEL_DELTA;
|
||||
wheelDelta = wheelDelta % WHEEL_DELTA;
|
||||
return actions;
|
||||
}
|
||||
};
|
||||
|
||||
#if defined(USE_D2D)
|
||||
extern bool LoadD2D();
|
||||
extern ID2D1Factory *pD2DFactory;
|
||||
|
|
|
@ -4,8 +4,8 @@
|
|||
|
||||
#include <windows.h>
|
||||
|
||||
#define VERSION_SCINTILLA "5.3.1"
|
||||
#define VERSION_WORDS 5, 3, 1, 0
|
||||
#define VERSION_SCINTILLA "5.3.2"
|
||||
#define VERSION_WORDS 5, 3, 2, 0
|
||||
|
||||
VS_VERSION_INFO VERSIONINFO
|
||||
FILEVERSION VERSION_WORDS
|
||||
|
|
|
@ -309,20 +309,6 @@ public:
|
|||
}
|
||||
};
|
||||
|
||||
class MouseWheelDelta {
|
||||
int wheelDelta = 0;
|
||||
public:
|
||||
bool Accumulate(WPARAM wParam) noexcept {
|
||||
wheelDelta -= GET_WHEEL_DELTA_WPARAM(wParam);
|
||||
return std::abs(wheelDelta) >= WHEEL_DELTA;
|
||||
}
|
||||
int Actions() noexcept {
|
||||
const int actions = wheelDelta / WHEEL_DELTA;
|
||||
wheelDelta = wheelDelta % WHEEL_DELTA;
|
||||
return actions;
|
||||
}
|
||||
};
|
||||
|
||||
struct HorizontalScrollRange {
|
||||
int pageWidth;
|
||||
int documentWidth;
|
||||
|
@ -371,6 +357,8 @@ class ScintillaWin :
|
|||
static ATOM scintillaClassAtom;
|
||||
static ATOM callClassAtom;
|
||||
|
||||
int deviceScaleFactor = 1;
|
||||
|
||||
#if defined(USE_D2D)
|
||||
ID2D1RenderTarget *pRenderTarget;
|
||||
bool renderTargetValid;
|
||||
|
@ -650,7 +638,8 @@ bool ScintillaWin::UpdateRenderingParams(bool force) noexcept {
|
|||
return false;
|
||||
}
|
||||
}
|
||||
HMONITOR monitor = ::MonitorFromWindow(MainHWND(), MONITOR_DEFAULTTONEAREST);
|
||||
const HWND hRootWnd = ::GetAncestor(MainHWND(), GA_ROOT);
|
||||
const HMONITOR monitor = Internal::MonitorFromWindowHandleScaling(hRootWnd);
|
||||
if (!force && monitor == hCurrentMonitor && renderingParams->defaultRenderingParams) {
|
||||
return false;
|
||||
}
|
||||
|
@ -672,11 +661,23 @@ bool ScintillaWin::UpdateRenderingParams(bool force) noexcept {
|
|||
}
|
||||
|
||||
hCurrentMonitor = monitor;
|
||||
deviceScaleFactor = Internal::GetDeviceScaleFactorWhenGdiScalingActive(hRootWnd);
|
||||
renderingParams->defaultRenderingParams.reset(monitorRenderingParams);
|
||||
renderingParams->customRenderingParams.reset(customClearTypeRenderingParams);
|
||||
return true;
|
||||
}
|
||||
|
||||
namespace {
|
||||
|
||||
D2D1_SIZE_U GetSizeUFromRect(const RECT &rc, const int scaleFactor) noexcept {
|
||||
const long width = rc.right - rc.left;
|
||||
const long height = rc.bottom - rc.top;
|
||||
const UINT32 scaledWidth = width * scaleFactor;
|
||||
const UINT32 scaledHeight = height * scaleFactor;
|
||||
return D2D1::SizeU(scaledWidth, scaledHeight);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void ScintillaWin::EnsureRenderTarget(HDC hdc) {
|
||||
if (!renderTargetValid) {
|
||||
|
@ -688,19 +689,15 @@ void ScintillaWin::EnsureRenderTarget(HDC hdc) {
|
|||
RECT rc;
|
||||
::GetClientRect(hw, &rc);
|
||||
|
||||
const D2D1_SIZE_U size = D2D1::SizeU(rc.right - rc.left, rc.bottom - rc.top);
|
||||
|
||||
// Create a Direct2D render target.
|
||||
D2D1_RENDER_TARGET_PROPERTIES drtp {};
|
||||
drtp.type = D2D1_RENDER_TARGET_TYPE_DEFAULT;
|
||||
drtp.pixelFormat.format = DXGI_FORMAT_UNKNOWN;
|
||||
drtp.pixelFormat.alphaMode = D2D1_ALPHA_MODE_UNKNOWN;
|
||||
drtp.dpiX = 96.0;
|
||||
drtp.dpiY = 96.0;
|
||||
drtp.usage = D2D1_RENDER_TARGET_USAGE_NONE;
|
||||
drtp.minLevel = D2D1_FEATURE_LEVEL_DEFAULT;
|
||||
|
||||
if (technology == Technology::DirectWriteDC) {
|
||||
drtp.dpiX = 96.f;
|
||||
drtp.dpiY = 96.f;
|
||||
// Explicit pixel format needed.
|
||||
drtp.pixelFormat = D2D1::PixelFormat(DXGI_FORMAT_B8G8R8A8_UNORM,
|
||||
D2D1_ALPHA_MODE_IGNORE);
|
||||
|
@ -715,9 +712,14 @@ void ScintillaWin::EnsureRenderTarget(HDC hdc) {
|
|||
}
|
||||
|
||||
} else {
|
||||
drtp.dpiX = 96.f * deviceScaleFactor;
|
||||
drtp.dpiY = 96.f * deviceScaleFactor;
|
||||
drtp.pixelFormat = D2D1::PixelFormat(DXGI_FORMAT_UNKNOWN,
|
||||
D2D1_ALPHA_MODE_UNKNOWN);
|
||||
|
||||
D2D1_HWND_RENDER_TARGET_PROPERTIES dhrtp {};
|
||||
dhrtp.hwnd = hw;
|
||||
dhrtp.pixelSize = size;
|
||||
dhrtp.pixelSize = ::GetSizeUFromRect(rc, deviceScaleFactor);
|
||||
dhrtp.presentOptions = (technology == Technology::DirectWriteRetain) ?
|
||||
D2D1_PRESENT_OPTIONS_RETAIN_CONTENTS : D2D1_PRESENT_OPTIONS_NONE;
|
||||
|
||||
|
@ -3668,10 +3670,12 @@ LRESULT PASCAL ScintillaWin::CTWndProc(
|
|||
surfaceWindow->Init(ps.hdc, hWnd);
|
||||
} else {
|
||||
#if defined(USE_D2D)
|
||||
const int scaleFactor = sciThis->deviceScaleFactor;
|
||||
|
||||
// Create a Direct2D render target.
|
||||
D2D1_HWND_RENDER_TARGET_PROPERTIES dhrtp {};
|
||||
dhrtp.hwnd = hWnd;
|
||||
dhrtp.pixelSize = D2D1::SizeU(rc.right - rc.left, rc.bottom - rc.top);
|
||||
dhrtp.pixelSize = ::GetSizeUFromRect(rc, scaleFactor);
|
||||
dhrtp.presentOptions = (sciThis->technology == Technology::DirectWriteRetain) ?
|
||||
D2D1_PRESENT_OPTIONS_RETAIN_CONTENTS : D2D1_PRESENT_OPTIONS_NONE;
|
||||
|
||||
|
@ -3679,8 +3683,8 @@ LRESULT PASCAL ScintillaWin::CTWndProc(
|
|||
drtp.type = D2D1_RENDER_TARGET_TYPE_DEFAULT;
|
||||
drtp.pixelFormat.format = DXGI_FORMAT_UNKNOWN;
|
||||
drtp.pixelFormat.alphaMode = D2D1_ALPHA_MODE_UNKNOWN;
|
||||
drtp.dpiX = 96.0;
|
||||
drtp.dpiY = 96.0;
|
||||
drtp.dpiX = 96.f * scaleFactor;
|
||||
drtp.dpiY = 96.f * scaleFactor;
|
||||
drtp.usage = D2D1_RENDER_TARGET_USAGE_NONE;
|
||||
drtp.minLevel = D2D1_FEATURE_LEVEL_DEFAULT;
|
||||
|
||||
|
|
|
@ -57,7 +57,7 @@ DEFINES += -DNO_CXX11_REGEX
|
|||
endif
|
||||
|
||||
DEFINES += -D$(if $(DEBUG),DEBUG,NDEBUG)
|
||||
BASE_FLAGS += $(if $(DEBUG),-g,-Os)
|
||||
BASE_FLAGS += $(if $(DEBUG),-g,-O3)
|
||||
|
||||
ifndef DEBUG
|
||||
STRIPFLAG=$(STRIPOPTION)
|
||||
|
|
|
@ -38,7 +38,7 @@ SUBSYSTEM=-SUBSYSTEM:WINDOWS,10.00
|
|||
CRTFLAGS=-D_CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES=1 -D_CRT_SECURE_NO_DEPRECATE=1 -D_SCL_SECURE_NO_WARNINGS=1 $(ADD_DEFINE)
|
||||
CXXFLAGS=-Zi -TP -MP -W4 -EHsc -std:c++17 $(CRTFLAGS)
|
||||
CXXDEBUG=-Od -MTd -DDEBUG
|
||||
CXXNDEBUG=-O1 -MT -DNDEBUG -GL
|
||||
CXXNDEBUG=-O2 -MT -DNDEBUG -GL
|
||||
NAME=-Fo
|
||||
LDFLAGS=-OPT:REF -LTCG -IGNORE:4197 -DEBUG $(SUBSYSTEM) $(CETCOMPAT)
|
||||
LDDEBUG=
|
||||
|
|
Loading…
Reference in New Issue