Update Scintilla to v5.3.8 & Lexilla to v5.2.8

Scintilla Release 5.3.8 https://www.scintilla.org/scintilla538.zip

    Released 5 November 2023.
    Fix excessive memory use when deleting contiguous ranges backwards. Notepad++ Issue #13442.
    Fix incorrect substitution when searching for a regular expression backwards. Bug #2405.
    Make SCI_MOVESELECTEDLINESUP and SCI_MOVESELECTEDLINESDOWN work for rectangular selections. Bug #2078.
    For Cocoa, minimum supported macOS release increased to 10.13.
    For Cocoa, fix invisible text on macOS 14 Sonoma. Bug #2402.
    For Cocoa, do nothing for suspendDrawing on macOS 10.14+ as the underlying calls have been deprecated.

and lexilla

Release 5.2.8 https://www.scintilla.org/lexilla528.zip

    Released 5 November 2023.
    Python: Update f-string handling to match PEP 701 and Python 3.12. Controlled with property lexer.python.strings.f.pep.701. Issue #150, Pull request #209.
    R: Fix escape sequence highlighting with change of for loop to while loop. Issue #206, Pull request #207.
    Minimum supported macOS release increased to 10.13.

Related to Notepad++ issue #13442, #14188 & #14288
Tested with: https://github.com/notepad-plus-plus/notepad-plus-plus/issues/14188#issuecomment-1740088956
Result: https://github.com/notepad-plus-plus/notepad-plus-plus/issues/14188#issuecomment-1799039503

Fix #13442, fix #14188, fix #14288, close #14320
This commit is contained in:
Christian Grasser 2023-11-05 18:24:41 +01:00 committed by Don Ho
parent 5b61cc1680
commit 69998ab7de
76 changed files with 3107 additions and 2568 deletions

View File

@ -1,6 +1,6 @@
// File to suppress cppcheck warnings for files that will not be fixed.
// Does not suppress warnings where an additional occurrence of the warning may be of interest.
// Configured for cppcheck 2.11
// Configured for cppcheck 2.12
// Coding style is to use assignments in constructor when there are many
// members to initialize or the initialization is complex or has comments.
@ -35,8 +35,8 @@ checkLevelNormal:lexilla/lexers/LexHTML.cxx
checkLevelNormal:lexilla/lexers/LexPerl.cxx
checkLevelNormal:lexilla/lexers/LexRuby.cxx
// Cppcheck wrongly assumes string_view::remove_prefix can not empty the view
knownConditionTrueFalse:lexilla/test/TestLexers.cxx
// Physically but not logically const.
constVariablePointer:lexilla/examples/CheckLexilla/CheckLexilla.c
// Suppress most lexer warnings since the lexers are maintained by others
redundantCondition:lexilla/lexers/LexA68k.cxx
@ -62,13 +62,14 @@ constParameterPointer:lexilla/lexers/LexCoffeeScript.cxx
knownConditionTrueFalse:lexilla/lexers/LexCoffeeScript.cxx
constParameterReference:lexilla/lexers/LexCPP.cxx
variableScope:lexilla/lexers/LexCSS.cxx
knownConditionTrueFalse:lexilla/lexers/LexDataflex.cxx
variableScope:lexilla/lexers/LexDataflex.cxx
knownConditionTrueFalse:lexilla/lexers/LexECL.cxx
variableScope:lexilla/lexers/LexECL.cxx
constParameter:lexilla/lexers/LexEDIFACT.cxx
constParameterPointer:lexilla/lexers/LexEDIFACT.cxx
knownConditionTrueFalse:lexilla/lexers/LexEiffel.cxx
variableScope:lexilla/lexers/LexErlang.cxx
knownConditionTrueFalse:lexilla/lexers/LexErrorList.cxx
knownConditionTrueFalse:lexilla/lexers/LexEScript.cxx
constParameter:lexilla/lexers/LexFortran.cxx
constParameterReference:lexilla/lexers/LexFortran.cxx
@ -82,14 +83,17 @@ knownConditionTrueFalse:lexilla/lexers/LexHex.cxx
constParameterReference:lexilla/lexers/LexHTML.cxx
constVariable:lexilla/lexers/LexHollywood.cxx
variableScope:lexilla/lexers/LexInno.cxx
constParameterPointer:lexilla/lexers/LexJulia.cxx
constParameterReference:lexilla/lexers/LexJulia.cxx
knownConditionTrueFalse:lexilla/lexers/LexJulia.cxx
unreadVariable:lexilla/lexers/LexJulia.cxx
variableScope:lexilla/lexers/LexJulia.cxx
variableScope:lexilla/lexers/LexLaTeX.cxx
constParameterReference:lexilla/lexers/LexLaTeX.cxx
constParameterPointer:lexilla/lexers/LexMagik.cxx
constParameterReference:lexilla/lexers/LexMagik.cxx
constParameterReference:lexilla/lexers/LexMarkdown.cxx
constParameterPointer:lexilla/lexers/LexMatlab.cxx
constParameterReference:lexilla/lexers/LexMatlab.cxx
unreadVariable:lexilla/lexers/LexMatlab.cxx
variableScope:lexilla/lexers/LexMatlab.cxx
@ -128,9 +132,7 @@ constParameterReference:lexilla/lexers/LexSTTXT.cxx
knownConditionTrueFalse:lexilla/lexers/LexTACL.cxx
clarifyCalculation:lexilla/lexers/LexTADS3.cxx
constParameterReference:lexilla/lexers/LexTADS3.cxx
unreadVariable:lexilla/lexers/LexTCL.cxx
invalidscanf:lexilla/lexers/LexTCMD.cxx
constParameterPointer:lexilla/lexers/LexTCMD.cxx
constParameterReference:lexilla/lexers/LexTeX.cxx
variableScope:lexilla/lexers/LexTeX.cxx
knownConditionTrueFalse:lexilla/lexers/LexTxt2tags.cxx
@ -166,7 +168,6 @@ constParameterCallback:lexilla/lexers/LexVB.cxx
constVariableReference:lexilla/lexers/LexCSS.cxx
constVariableReference:lexilla/lexers/LexCrontab.cxx
constVariableReference:lexilla/lexers/LexGui4Cli.cxx
constVariableReference:lexilla/lexers/LexKix.cxx
constVariableReference:lexilla/lexers/LexMetapost.cxx
constVariableReference:lexilla/lexers/LexOpal.cxx
@ -179,5 +180,8 @@ constVariableReference:lexilla/lexers/LexOpal.cxx
*:lexilla/test/unit/UnitTester.cxx
*:lexilla/test/unit/unitTest.cxx
// Tests often test things that are always true
knownConditionTrueFalse:lexilla/test/unit/testCharacterSet.cxx
// cppcheck fails REQUIRE from Catch
comparisonOfFuncReturningBoolError:lexilla/test/unit/*.cxx

View File

@ -9,7 +9,7 @@
<meta name="keywords" content="Scintilla, SciTE, Editing Component, Text Editor" />
<meta name="Description"
content="www.scintilla.org is the home of the Scintilla editing component and SciTE text editor application." />
<meta name="Date.Modified" content="20230922" />
<meta name="Date.Modified" content="20231105" />
<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.7<br />
Site last modified September 22 2023</font>
<font color="#FFCC99" size="3">Release version 5.2.8<br />
Site last modified November 5 2023</font>
</td>
<td width="20%">
&nbsp;
@ -77,11 +77,11 @@
</tr>
</table>
<ul id="versionlist">
<li>Version 5.2.8 improves Python and R.</li>
<li>Version 5.2.7 improves Bash, F#, and HTML.</li>
<li>Version 5.2.6 improves Bash, Errorlist, HTML, Matlab, and Visual Prolog.</li>
<li>Version 5.2.5 improves Bash, Batch, F#, and VB.</li>
<li>Version 5.2.4 improves C++ and GDScript.</li>
<li>Version 5.2.3 improves Makefile, Ruby, and YAML.</li>
</ul>
<ul id="menu">
<li id="remote1"><a href="https://www.scintilla.org/SciTEImage.html">Screenshot</a></li>

View File

@ -26,9 +26,9 @@
<table bgcolor="#CCCCCC" width="100%" cellspacing="0" cellpadding="8" border="0">
<tr>
<td>
<font size="4"> <a href="https://www.scintilla.org/lexilla527.zip">
<font size="4"> <a href="https://www.scintilla.org/lexilla528.zip">
Windows</a>&nbsp;&nbsp;
<a href="https://www.scintilla.org/lexilla527.tgz">
<a href="https://www.scintilla.org/lexilla528.tgz">
GTK/Linux</a>&nbsp;&nbsp;
</font>
</td>
@ -42,7 +42,7 @@
containing very few restrictions.
</p>
<h3>
Release 5.2.7
Release 5.2.8
</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/lexilla527.zip">zip format</a> (1.2M) commonly used on Windows</li>
<li><a href="https://www.scintilla.org/lexilla527.tgz">tgz format</a> (0.9M) commonly used on Linux and compatible operating systems</li>
<li><a href="https://www.scintilla.org/lexilla528.zip">zip format</a> (1.3M) commonly used on Windows</li>
<li><a href="https://www.scintilla.org/lexilla528.tgz">tgz format</a> (0.9M) commonly used on Linux and compatible operating systems</li>
</ul>
Instructions for building on both Windows and Linux are included in the readme file.
<h4>

View File

@ -586,6 +586,28 @@
</tr>
</table>
<h2>Releases</h2>
<h3>
<a href="https://www.scintilla.org/lexilla528.zip">Release 5.2.8</a>
</h3>
<ul>
<li>
Released 5 November 2023.
</li>
<li>
Python: Update f-string handling to match PEP 701 and Python 3.12.
Controlled with property lexer.python.strings.f.pep.701.
<a href="https://github.com/ScintillaOrg/lexilla/issues/150">Issue #150</a>,
<a href="https://github.com/ScintillaOrg/lexilla/pull/209">Pull request #209</a>.
</li>
<li>
R: Fix escape sequence highlighting with change of for loop to while loop.
<a href="https://github.com/ScintillaOrg/lexilla/issues/206">Issue #206</a>,
<a href="https://github.com/ScintillaOrg/lexilla/pull/207">Pull request #207</a>.
</li>
<li>
Minimum supported macOS release increased to 10.13.
</li>
</ul>
<h3>
<a href="https://www.scintilla.org/lexilla527.zip">Release 5.2.7</a>
</h3>

View File

@ -152,118 +152,6 @@
#define SCLEX_OBJC 151
#define SCLEX_USER 152
#define SCLEX_AUTOMATIC 1000
//For All lexer
#define SCE_UNIVERSAL_FOUND_STYLE 31
#define SCE_UNIVERSAL_FOUND_STYLE_SMART 29
#define SCE_UNIVERSAL_FOUND_STYLE_INC 28
#define SCE_UNIVERSAL_TAGMATCH 27
#define SCE_UNIVERSAL_TAGATTR 26
#define SCE_UNIVERSAL_FOUND_STYLE_EXT1 25
#define SCE_UNIVERSAL_FOUND_STYLE_EXT2 24
#define SCE_UNIVERSAL_FOUND_STYLE_EXT3 23
#define SCE_UNIVERSAL_FOUND_STYLE_EXT4 22
#define SCE_UNIVERSAL_FOUND_STYLE_EXT5 21
#define SCE_UDL_VERSION_MAJOR 2
#define SCE_UDL_VERSION_MINOR 1
#define SCE_UDL_VERSION_BUILD 0
#define SCE_UDL_VERSION_REVISION 12
#define SCE_USER_KWLIST_COMMENTS 0
#define SCE_USER_KWLIST_NUMBER_PREFIX1 1
#define SCE_USER_KWLIST_NUMBER_PREFIX2 2
#define SCE_USER_KWLIST_NUMBER_EXTRAS1 3
#define SCE_USER_KWLIST_NUMBER_EXTRAS2 4
#define SCE_USER_KWLIST_NUMBER_SUFFIX1 5
#define SCE_USER_KWLIST_NUMBER_SUFFIX2 6
#define SCE_USER_KWLIST_NUMBER_RANGE 7
#define SCE_USER_KWLIST_OPERATORS1 8
#define SCE_USER_KWLIST_OPERATORS2 9
#define SCE_USER_KWLIST_FOLDERS_IN_CODE1_OPEN 10
#define SCE_USER_KWLIST_FOLDERS_IN_CODE1_MIDDLE 11
#define SCE_USER_KWLIST_FOLDERS_IN_CODE1_CLOSE 12
#define SCE_USER_KWLIST_FOLDERS_IN_CODE2_OPEN 13
#define SCE_USER_KWLIST_FOLDERS_IN_CODE2_MIDDLE 14
#define SCE_USER_KWLIST_FOLDERS_IN_CODE2_CLOSE 15
#define SCE_USER_KWLIST_FOLDERS_IN_COMMENT_OPEN 16
#define SCE_USER_KWLIST_FOLDERS_IN_COMMENT_MIDDLE 17
#define SCE_USER_KWLIST_FOLDERS_IN_COMMENT_CLOSE 18
#define SCE_USER_KWLIST_KEYWORDS1 19
#define SCE_USER_KWLIST_KEYWORDS2 20
#define SCE_USER_KWLIST_KEYWORDS3 21
#define SCE_USER_KWLIST_KEYWORDS4 22
#define SCE_USER_KWLIST_KEYWORDS5 23
#define SCE_USER_KWLIST_KEYWORDS6 24
#define SCE_USER_KWLIST_KEYWORDS7 25
#define SCE_USER_KWLIST_KEYWORDS8 26
#define SCE_USER_KWLIST_DELIMITERS 27
#define SCE_USER_KWLIST_TOTAL 28 // must always be <= KEYWORDSET_MAX
#define SCE_USER_TOTAL_DELIMITERS 8
#define SCE_USER_TOTAL_KEYWORD_GROUPS 8
#define SCE_USER_TOTAL_FOLDERS 6
#define SCE_USER_STYLE_DEFAULT 0
#define SCE_USER_STYLE_COMMENT 1
#define SCE_USER_STYLE_COMMENTLINE 2
#define SCE_USER_STYLE_NUMBER 3
#define SCE_USER_STYLE_KEYWORD1 4
#define SCE_USER_STYLE_KEYWORD2 5
#define SCE_USER_STYLE_KEYWORD3 6
#define SCE_USER_STYLE_KEYWORD4 7
#define SCE_USER_STYLE_KEYWORD5 8
#define SCE_USER_STYLE_KEYWORD6 9
#define SCE_USER_STYLE_KEYWORD7 10
#define SCE_USER_STYLE_KEYWORD8 11
#define SCE_USER_STYLE_OPERATOR 12
#define SCE_USER_STYLE_FOLDER_IN_CODE1 13
#define SCE_USER_STYLE_FOLDER_IN_CODE2 14
#define SCE_USER_STYLE_FOLDER_IN_COMMENT 15
#define SCE_USER_STYLE_DELIMITER1 16
#define SCE_USER_STYLE_DELIMITER2 17
#define SCE_USER_STYLE_DELIMITER3 18
#define SCE_USER_STYLE_DELIMITER4 19
#define SCE_USER_STYLE_DELIMITER5 20
#define SCE_USER_STYLE_DELIMITER6 21
#define SCE_USER_STYLE_DELIMITER7 22
#define SCE_USER_STYLE_DELIMITER8 23
#define SCE_USER_STYLE_IDENTIFIER 24
#define SCE_USER_STYLE_TOTAL_STYLES SCE_USER_STYLE_IDENTIFIER
#define SCE_USER_STYLE_MAPPER_TOTAL 17
#define SCE_USER_MASK_NESTING_NONE 0
#define SCE_USER_MASK_NESTING_DELIMITER1 0x1
#define SCE_USER_MASK_NESTING_DELIMITER2 0x2
#define SCE_USER_MASK_NESTING_DELIMITER3 0x4
#define SCE_USER_MASK_NESTING_DELIMITER4 0x8
#define SCE_USER_MASK_NESTING_DELIMITER5 0x10
#define SCE_USER_MASK_NESTING_DELIMITER6 0x20
#define SCE_USER_MASK_NESTING_DELIMITER7 0x40
#define SCE_USER_MASK_NESTING_DELIMITER8 0x80
#define SCE_USER_MASK_NESTING_COMMENT 0x100
#define SCE_USER_MASK_NESTING_COMMENT_LINE 0x200
#define SCE_USER_MASK_NESTING_KEYWORD1 0x400
#define SCE_USER_MASK_NESTING_KEYWORD2 0x800
#define SCE_USER_MASK_NESTING_KEYWORD3 0x1000
#define SCE_USER_MASK_NESTING_KEYWORD4 0x2000
#define SCE_USER_MASK_NESTING_KEYWORD5 0x4000
#define SCE_USER_MASK_NESTING_KEYWORD6 0x8000
#define SCE_USER_MASK_NESTING_KEYWORD7 0x10000
#define SCE_USER_MASK_NESTING_KEYWORD8 0x20000
#define SCE_USER_MASK_NESTING_FOLDERS_IN_CODE2_OPEN 0x40000
#define SCE_USER_MASK_NESTING_FOLDERS_IN_CODE2_MIDDLE 0x80000
#define SCE_USER_MASK_NESTING_FOLDERS_IN_CODE2_CLOSE 0x100000
#define SCE_USER_MASK_NESTING_FOLDERS_IN_COMMENT_OPEN 0x200000
#define SCE_USER_MASK_NESTING_FOLDERS_IN_COMMENT_MIDDLE 0x400000
#define SCE_USER_MASK_NESTING_FOLDERS_IN_COMMENT_CLOSE 0x800000
#define SCE_USER_MASK_NESTING_OPERATORS1 0x1000000
#define SCE_USER_MASK_NESTING_OPERATORS2 0x2000000
#define SCE_USER_MASK_NESTING_NUMBERS 0x4000000
#define SCE_P_DEFAULT 0
#define SCE_P_COMMENTLINE 1
#define SCE_P_NUMBER 2
@ -336,17 +224,6 @@
#define SCE_D_WORD5 20
#define SCE_D_WORD6 21
#define SCE_D_WORD7 22
#define SCE_SEARCHRESULT_DEFAULT 0
#define SCE_SEARCHRESULT_SEARCH_HEADER 1
#define SCE_SEARCHRESULT_FILE_HEADER 2
#define SCE_SEARCHRESULT_LINE_NUMBER 3
#define SCE_SEARCHRESULT_WORD2SEARCH 4
//#define SCE_SEARCHRESULT_HIGHLIGHT_LINE 5 // (no use anymore)
#define SCE_SEARCHRESULT_CURRENT_LINE 6
#define SCE_OBJC_DIRECTIVE 20
#define SCE_OBJC_QUALIFIER 21
#define SCE_TCL_DEFAULT 0
#define SCE_TCL_COMMENT 1
#define SCE_TCL_COMMENTLINE 2
@ -2186,4 +2063,127 @@
#define SCE_GD_NODEPATH 16
/* --Autogenerated -- end of section automatically generated from Scintilla.iface */
//For All lexer
#define SCE_UNIVERSAL_FOUND_STYLE 31
#define SCE_UNIVERSAL_FOUND_STYLE_SMART 29
#define SCE_UNIVERSAL_FOUND_STYLE_INC 28
#define SCE_UNIVERSAL_TAGMATCH 27
#define SCE_UNIVERSAL_TAGATTR 26
#define SCE_UNIVERSAL_FOUND_STYLE_EXT1 25
#define SCE_UNIVERSAL_FOUND_STYLE_EXT2 24
#define SCE_UNIVERSAL_FOUND_STYLE_EXT3 23
#define SCE_UNIVERSAL_FOUND_STYLE_EXT4 22
#define SCE_UNIVERSAL_FOUND_STYLE_EXT5 21
#define SCE_UDL_VERSION_MAJOR 2
#define SCE_UDL_VERSION_MINOR 1
#define SCE_UDL_VERSION_BUILD 0
#define SCE_UDL_VERSION_REVISION 12
#define SCE_USER_KWLIST_COMMENTS 0
#define SCE_USER_KWLIST_NUMBER_PREFIX1 1
#define SCE_USER_KWLIST_NUMBER_PREFIX2 2
#define SCE_USER_KWLIST_NUMBER_EXTRAS1 3
#define SCE_USER_KWLIST_NUMBER_EXTRAS2 4
#define SCE_USER_KWLIST_NUMBER_SUFFIX1 5
#define SCE_USER_KWLIST_NUMBER_SUFFIX2 6
#define SCE_USER_KWLIST_NUMBER_RANGE 7
#define SCE_USER_KWLIST_OPERATORS1 8
#define SCE_USER_KWLIST_OPERATORS2 9
#define SCE_USER_KWLIST_FOLDERS_IN_CODE1_OPEN 10
#define SCE_USER_KWLIST_FOLDERS_IN_CODE1_MIDDLE 11
#define SCE_USER_KWLIST_FOLDERS_IN_CODE1_CLOSE 12
#define SCE_USER_KWLIST_FOLDERS_IN_CODE2_OPEN 13
#define SCE_USER_KWLIST_FOLDERS_IN_CODE2_MIDDLE 14
#define SCE_USER_KWLIST_FOLDERS_IN_CODE2_CLOSE 15
#define SCE_USER_KWLIST_FOLDERS_IN_COMMENT_OPEN 16
#define SCE_USER_KWLIST_FOLDERS_IN_COMMENT_MIDDLE 17
#define SCE_USER_KWLIST_FOLDERS_IN_COMMENT_CLOSE 18
#define SCE_USER_KWLIST_KEYWORDS1 19
#define SCE_USER_KWLIST_KEYWORDS2 20
#define SCE_USER_KWLIST_KEYWORDS3 21
#define SCE_USER_KWLIST_KEYWORDS4 22
#define SCE_USER_KWLIST_KEYWORDS5 23
#define SCE_USER_KWLIST_KEYWORDS6 24
#define SCE_USER_KWLIST_KEYWORDS7 25
#define SCE_USER_KWLIST_KEYWORDS8 26
#define SCE_USER_KWLIST_DELIMITERS 27
#define SCE_USER_KWLIST_TOTAL 28 // must always be <= KEYWORDSET_MAX
#define SCE_USER_TOTAL_DELIMITERS 8
#define SCE_USER_TOTAL_KEYWORD_GROUPS 8
#define SCE_USER_TOTAL_FOLDERS 6
#define SCE_USER_STYLE_DEFAULT 0
#define SCE_USER_STYLE_COMMENT 1
#define SCE_USER_STYLE_COMMENTLINE 2
#define SCE_USER_STYLE_NUMBER 3
#define SCE_USER_STYLE_KEYWORD1 4
#define SCE_USER_STYLE_KEYWORD2 5
#define SCE_USER_STYLE_KEYWORD3 6
#define SCE_USER_STYLE_KEYWORD4 7
#define SCE_USER_STYLE_KEYWORD5 8
#define SCE_USER_STYLE_KEYWORD6 9
#define SCE_USER_STYLE_KEYWORD7 10
#define SCE_USER_STYLE_KEYWORD8 11
#define SCE_USER_STYLE_OPERATOR 12
#define SCE_USER_STYLE_FOLDER_IN_CODE1 13
#define SCE_USER_STYLE_FOLDER_IN_CODE2 14
#define SCE_USER_STYLE_FOLDER_IN_COMMENT 15
#define SCE_USER_STYLE_DELIMITER1 16
#define SCE_USER_STYLE_DELIMITER2 17
#define SCE_USER_STYLE_DELIMITER3 18
#define SCE_USER_STYLE_DELIMITER4 19
#define SCE_USER_STYLE_DELIMITER5 20
#define SCE_USER_STYLE_DELIMITER6 21
#define SCE_USER_STYLE_DELIMITER7 22
#define SCE_USER_STYLE_DELIMITER8 23
#define SCE_USER_STYLE_IDENTIFIER 24
#define SCE_USER_STYLE_TOTAL_STYLES SCE_USER_STYLE_IDENTIFIER
#define SCE_USER_STYLE_MAPPER_TOTAL 17
#define SCE_USER_MASK_NESTING_NONE 0
#define SCE_USER_MASK_NESTING_DELIMITER1 0x1
#define SCE_USER_MASK_NESTING_DELIMITER2 0x2
#define SCE_USER_MASK_NESTING_DELIMITER3 0x4
#define SCE_USER_MASK_NESTING_DELIMITER4 0x8
#define SCE_USER_MASK_NESTING_DELIMITER5 0x10
#define SCE_USER_MASK_NESTING_DELIMITER6 0x20
#define SCE_USER_MASK_NESTING_DELIMITER7 0x40
#define SCE_USER_MASK_NESTING_DELIMITER8 0x80
#define SCE_USER_MASK_NESTING_COMMENT 0x100
#define SCE_USER_MASK_NESTING_COMMENT_LINE 0x200
#define SCE_USER_MASK_NESTING_KEYWORD1 0x400
#define SCE_USER_MASK_NESTING_KEYWORD2 0x800
#define SCE_USER_MASK_NESTING_KEYWORD3 0x1000
#define SCE_USER_MASK_NESTING_KEYWORD4 0x2000
#define SCE_USER_MASK_NESTING_KEYWORD5 0x4000
#define SCE_USER_MASK_NESTING_KEYWORD6 0x8000
#define SCE_USER_MASK_NESTING_KEYWORD7 0x10000
#define SCE_USER_MASK_NESTING_KEYWORD8 0x20000
#define SCE_USER_MASK_NESTING_FOLDERS_IN_CODE2_OPEN 0x40000
#define SCE_USER_MASK_NESTING_FOLDERS_IN_CODE2_MIDDLE 0x80000
#define SCE_USER_MASK_NESTING_FOLDERS_IN_CODE2_CLOSE 0x100000
#define SCE_USER_MASK_NESTING_FOLDERS_IN_COMMENT_OPEN 0x200000
#define SCE_USER_MASK_NESTING_FOLDERS_IN_COMMENT_MIDDLE 0x400000
#define SCE_USER_MASK_NESTING_FOLDERS_IN_COMMENT_CLOSE 0x800000
#define SCE_USER_MASK_NESTING_OPERATORS1 0x1000000
#define SCE_USER_MASK_NESTING_OPERATORS2 0x2000000
#define SCE_USER_MASK_NESTING_NUMBERS 0x4000000
#define SCE_SEARCHRESULT_DEFAULT 0
#define SCE_SEARCHRESULT_SEARCH_HEADER 1
#define SCE_SEARCHRESULT_FILE_HEADER 2
#define SCE_SEARCHRESULT_LINE_NUMBER 3
#define SCE_SEARCHRESULT_WORD2SEARCH 4
//#define SCE_SEARCHRESULT_HIGHLIGHT_LINE 5 // (no use anymore)
#define SCE_SEARCHRESULT_CURRENT_LINE 6
#define SCE_OBJC_DIRECTIVE 20
#define SCE_OBJC_QUALIFIER 21
#endif

View File

@ -470,7 +470,7 @@ const LexicalClass lexicalClasses[] = {
10, "SCE_SH_PARAM", "identifier", "Parameter",
11, "SCE_SH_BACKTICKS", "literal string", "Backtick quoted command",
12, "SCE_SH_HERE_DELIM", "operator", "Heredoc delimiter",
13, "SCE_SH_HERE_Q", "literal string", "Heredoc quoted string",
13, "SCE_SH_HERE_Q", "here-doc literal string", "Heredoc quoted string",
};
}
@ -488,7 +488,7 @@ class LexerBash final : public DefaultLexer {
SubStyles subStyles;
public:
LexerBash() :
DefaultLexer("bash", SCLEX_BASH, lexicalClasses, ELEMENTS(lexicalClasses)),
DefaultLexer("bash", SCLEX_BASH, lexicalClasses, std::size(lexicalClasses)),
setParamStart(CharacterSet::setAlphaNum, "_" BASH_SPECIAL_PARAMETER),
subStyles(styleSubable, 0x80, 0x40, 0) {
cmdDelimiter.Set("| || |& & && ; ;; ( ) { }");

View File

@ -1664,8 +1664,9 @@ void LexerCPP::EvaluateTokens(Tokens &tokens, const SymbolTable &preprocessorDef
// The insertion is done before the removal because there were failures with the opposite approach
tokens.insert(bracketPair.itBracket, inBracket.begin(), inBracket.end());
bracketPair = FindBracketPair(tokens);
tokens.erase(bracketPair.itBracket, bracketPair.itEndBracket + 1);
// insert invalidated bracketPair. Use a new variable to avoid warning from Coverity.
const BracketPair pairToErase = FindBracketPair(tokens);
tokens.erase(pairToErase.itBracket, pairToErase.itEndBracket + 1);
bracketPair = FindBracketPair(tokens);
}

View File

@ -34,6 +34,8 @@
using namespace Scintilla;
using namespace Lexilla;
namespace {
// Info for HERE document handling from perldata.pod (reformatted):
// ----------------------------------------------------------------
// A line-oriented form of quoting is based on the shell ``here-doc'' syntax.
@ -91,7 +93,7 @@ using namespace Lexilla;
// we also assume SCE_PL_STRING_VAR is the interpolated style with the smallest value
#define INTERPOLATE_SHIFT (SCE_PL_STRING_VAR - SCE_PL_STRING)
static bool isPerlKeyword(Sci_PositionU start, Sci_PositionU end, WordList &keywords, LexAccessor &styler) {
bool isPerlKeyword(Sci_PositionU start, Sci_PositionU end, WordList &keywords, LexAccessor &styler) {
// old-style keyword matcher; needed because GetCurrent() needs
// current segment to be committed, but we may abandon early...
char s[100];
@ -102,7 +104,7 @@ static bool isPerlKeyword(Sci_PositionU start, Sci_PositionU end, WordList &keyw
return keywords.InList(s);
}
static int disambiguateBareword(LexAccessor &styler, Sci_PositionU bk, Sci_PositionU fw,
int disambiguateBareword(LexAccessor &styler, Sci_PositionU bk, Sci_PositionU fw,
int backFlag, Sci_PositionU backPos, Sci_PositionU endPos) {
// identifiers are recognized by Perl as barewords under some
// conditions, the following attempts to do the disambiguation
@ -152,7 +154,7 @@ static int disambiguateBareword(LexAccessor &styler, Sci_PositionU bk, Sci_Posit
return result;
}
static void skipWhitespaceComment(LexAccessor &styler, Sci_PositionU &p) {
void skipWhitespaceComment(LexAccessor &styler, Sci_PositionU &p) {
// when backtracking, we need to skip whitespace and comments
while (p > 0) {
const int style = styler.StyleAt(p);
@ -162,7 +164,7 @@ static void skipWhitespaceComment(LexAccessor &styler, Sci_PositionU &p) {
}
}
static int findPrevLexeme(LexAccessor &styler, Sci_PositionU &bk, int &style) {
int findPrevLexeme(LexAccessor &styler, Sci_PositionU &bk, int &style) {
// scan backward past whitespace and comments to find a lexeme
skipWhitespaceComment(styler, bk);
if (bk == 0)
@ -178,7 +180,7 @@ static int findPrevLexeme(LexAccessor &styler, Sci_PositionU &bk, int &style) {
return sz;
}
static int styleBeforeBracePair(LexAccessor &styler, Sci_PositionU bk) {
int styleBeforeBracePair(LexAccessor &styler, Sci_PositionU bk) {
// backtrack to find open '{' corresponding to a '}', balanced
// return significant style to be tested for '/' disambiguation
int braceCount = 1;
@ -205,7 +207,7 @@ static int styleBeforeBracePair(LexAccessor &styler, Sci_PositionU bk) {
return SCE_PL_DEFAULT;
}
static int styleCheckIdentifier(LexAccessor &styler, Sci_PositionU bk) {
int styleCheckIdentifier(LexAccessor &styler, Sci_PositionU bk) {
// backtrack to classify sub-styles of identifier under test
// return sub-style to be tested for '/' disambiguation
if (styler.SafeGetCharAt(bk) == '>') // inputsymbol, like <foo>
@ -230,7 +232,7 @@ static int styleCheckIdentifier(LexAccessor &styler, Sci_PositionU bk) {
return 0;
}
static int podLineScan(LexAccessor &styler, Sci_PositionU &pos, Sci_PositionU endPos) {
int podLineScan(LexAccessor &styler, Sci_PositionU &pos, Sci_PositionU endPos) {
// forward scan the current line to classify line for POD style
int state = -1;
while (pos < endPos) {
@ -254,7 +256,7 @@ static int podLineScan(LexAccessor &styler, Sci_PositionU &pos, Sci_PositionU en
return state;
}
static bool styleCheckSubPrototype(LexAccessor &styler, Sci_PositionU bk) {
bool styleCheckSubPrototype(LexAccessor &styler, Sci_PositionU bk) {
// backtrack to identify if we're starting a subroutine prototype
// we also need to ignore whitespace/comments, format is like:
// sub abc::pqr :const :prototype(...)
@ -311,7 +313,7 @@ static bool styleCheckSubPrototype(LexAccessor &styler, Sci_PositionU bk) {
return (state == SUB_HAS_SUB);
}
static int actualNumStyle(int numberStyle) {
int actualNumStyle(int numberStyle) {
if (numberStyle == PERLNUM_VECTOR || numberStyle == PERLNUM_V_VECTOR) {
return SCE_PL_STRING;
} else if (numberStyle == PERLNUM_BAD) {
@ -320,7 +322,7 @@ static int actualNumStyle(int numberStyle) {
return SCE_PL_NUMBER;
}
static int opposite(int ch) {
int opposite(int ch) {
if (ch == '(') return ')';
if (ch == '[') return ']';
if (ch == '{') return '}';
@ -328,7 +330,7 @@ static int opposite(int ch) {
return ch;
}
static bool IsCommentLine(Sci_Position line, LexAccessor &styler) {
bool IsCommentLine(Sci_Position line, LexAccessor &styler) {
Sci_Position pos = styler.LineStart(line);
Sci_Position eol_pos = styler.LineStart(line + 1) - 1;
for (Sci_Position i = pos; i < eol_pos; i++) {
@ -342,7 +344,7 @@ static bool IsCommentLine(Sci_Position line, LexAccessor &styler) {
return false;
}
static bool IsPackageLine(Sci_Position line, LexAccessor &styler) {
bool IsPackageLine(Sci_Position line, LexAccessor &styler) {
Sci_Position pos = styler.LineStart(line);
int style = styler.StyleAt(pos);
if (style == SCE_PL_WORD && styler.Match(pos, "package")) {
@ -351,7 +353,7 @@ static bool IsPackageLine(Sci_Position line, LexAccessor &styler) {
return false;
}
static int PodHeadingLevel(Sci_Position pos, LexAccessor &styler) {
int PodHeadingLevel(Sci_Position pos, LexAccessor &styler) {
int lvl = static_cast<unsigned char>(styler.SafeGetCharAt(pos + 5));
if (lvl >= '1' && lvl <= '4') {
return lvl - '0';
@ -387,7 +389,7 @@ struct OptionsPerl {
}
};
static const char *const perlWordListDesc[] = {
const char *const perlWordListDesc[] = {
"Keywords",
0
};
@ -416,6 +418,55 @@ struct OptionSetPerl : public OptionSet<OptionsPerl> {
}
};
const LexicalClass lexicalClasses[] = {
// Lexer perl SCLEX_PERL SCE_PL_:
0, "SCE_PL_DEFAULT", "default", "white space",
1, "SCE_PL_ERROR", "error", "error",
2, "SCE_PL_COMMENTLINE", "comment line", "comment",
3, "SCE_PL_POD", "data", "pod: = at beginning of line",
4, "SCE_PL_NUMBER", "literal numeric", "number",
5, "SCE_PL_WORD", "keyword", "keyword",
6, "SCE_PL_STRING", "literal string interpolated", "double quoted string",
7, "SCE_PL_CHARACTER", "literal string", "single quoted string",
8, "SCE_PL_PUNCTUATION", "operator", "symbols / punctuation. currently not used",
9, "SCE_PL_PREPROCESSOR", "preprocessor unused", "preprocessor. currently not used",
10, "SCE_PL_OPERATOR", "operator", "operators",
11, "SCE_PL_IDENTIFIER", "identifier", "identifiers (functions, etc.)",
12, "SCE_PL_SCALAR", "identifier", "scalars: $var",
13, "SCE_PL_ARRAY", "identifier", "array: @var",
14, "SCE_PL_HASH", "identifier", "hash: %var",
15, "SCE_PL_SYMBOLTABLE", "identifier", "symbol table: *var",
16, "SCE_PL_VARIABLE_INDEXER", "identifier unused", "sce_pl_variable_indexer allocated but unused",
17, "SCE_PL_REGEX", "literal regex", "regex: /re/ or m{re}",
18, "SCE_PL_REGSUBST", "literal regex", "substitution: s/re/ore/",
19, "SCE_PL_LONGQUOTE", "literal string", "long quote (qq, qr, qw, qx) -- obsolete: replaced by qq, qx, qr, qw",
20, "SCE_PL_BACKTICKS", "literal string interpolated", "back ticks",
21, "SCE_PL_DATASECTION", "data", "data section: __data__ or __end__ at beginning of line",
22, "SCE_PL_HERE_DELIM", "here-doc literal string", "here-doc (delimiter)",
23, "SCE_PL_HERE_Q", "here-doc literal string", "here-doc (single quoted, q)",
24, "SCE_PL_HERE_QQ", "here-doc literal string interpolated", "here-doc (double quoted, qq)",
25, "SCE_PL_HERE_QX", "here-doc literal interpolated", "here-doc (back ticks, qx)",
26, "SCE_PL_STRING_Q", "literal string", "single quoted string, generic",
27, "SCE_PL_STRING_QQ", "literal string interpolated", "qq = double quoted string",
28, "SCE_PL_STRING_QX", "literal string interpolated", "qx = back ticks",
29, "SCE_PL_STRING_QR", "literal regex", "qr = regex",
30, "SCE_PL_STRING_QW", "literal string interpolated", "qw = array",
31, "SCE_PL_POD_VERB", "data", "pod: verbatim paragraphs",
40, "SCE_PL_SUB_PROTOTYPE", "identifier", "subroutine prototype",
41, "SCE_PL_FORMAT_IDENT", "identifier", "format identifier",
42, "SCE_PL_FORMAT", "literal string", "format body",
43, "SCE_PL_STRING_VAR", "identifier interpolated", "double quoted string (interpolated variable)",
44, "SCE_PL_XLAT", "literal string", "translation: tr{}{} y{}{}",
54, "SCE_PL_REGEX_VAR", "identifier interpolated", "regex: /re/ or m{re} (interpolated variable)",
55, "SCE_PL_REGSUBST_VAR", "identifier interpolated", "substitution: s/re/ore/ (interpolated variable)",
57, "SCE_PL_BACKTICKS_VAR", "identifier interpolated", "back ticks (interpolated variable)",
61, "SCE_PL_HERE_QQ_VAR", "identifier interpolated", "here-doc (double quoted, qq) (interpolated variable)",
62, "SCE_PL_HERE_QX_VAR", "identifier interpolated", "here-doc (back ticks, qx) (interpolated variable)",
64, "SCE_PL_STRING_QQ_VAR", "identifier interpolated", "qq = double quoted string (interpolated variable)",
65, "SCE_PL_STRING_QX_VAR", "identifier interpolated", "qx = back ticks (interpolated variable)",
66, "SCE_PL_STRING_QR_VAR", "identifier interpolated", "qr = regex (interpolated variable)",
};
class LexerPerl : public DefaultLexer {
CharacterSet setWordStart;
CharacterSet setWord;
@ -426,7 +477,7 @@ class LexerPerl : public DefaultLexer {
OptionSetPerl osPerl;
public:
LexerPerl() :
DefaultLexer("perl", SCLEX_PERL),
DefaultLexer("perl", SCLEX_PERL, lexicalClasses, std::size(lexicalClasses)),
setWordStart(CharacterSet::setAlpha, "_", 0x80, true),
setWord(CharacterSet::setAlphaNum, "_", 0x80, true),
setSpecialVar(CharacterSet::setNone, "\"$;<>&`'+,./\\%:=~!?@[]"),
@ -1848,4 +1899,6 @@ void SCI_METHOD LexerPerl::Fold(Sci_PositionU startPos, Sci_Position length, int
styler.SetLevel(lineCurrent, levelPrev | flagsNext);
}
}
LexerModule lmPerl(SCLEX_PERL, LexerPerl::LexerFactoryPerl, "perl", perlWordListDesc);

View File

@ -78,16 +78,24 @@ constexpr bool IsPyStringTypeChar(int ch, literalsAllowed allowed) noexcept {
((allowed & litF) && (ch == 'f' || ch == 'F'));
}
constexpr bool IsQuote(int ch) {
return AnyOf(ch, '"', '\'');
}
constexpr bool IsRawPrefix(int ch) {
return AnyOf(ch, 'r', 'R');
}
bool IsPyStringStart(int ch, int chNext, int chNext2, literalsAllowed allowed) noexcept {
if (ch == '\'' || ch == '"')
if (IsQuote(ch))
return true;
if (IsPyStringTypeChar(ch, allowed)) {
if (chNext == '"' || chNext == '\'')
if (IsQuote(chNext))
return true;
if ((chNext == 'r' || chNext == 'R') && (chNext2 == '"' || chNext2 == '\''))
if (IsRawPrefix(chNext) && IsQuote(chNext2))
return true;
}
if ((ch == 'r' || ch == 'R') && (chNext == '"' || chNext == '\''))
if (IsRawPrefix(ch) && IsQuote(chNext))
return true;
return false;
@ -150,12 +158,12 @@ int GetPyStringState(Accessor &styler, Sci_Position i, Sci_PositionU *nextIndex,
const int firstIsF = (ch == 'f' || ch == 'F');
// Advance beyond r, u, or ur prefix (or r, b, or br in Python 2.7+ and r, f, or fr in Python 3.6+), but bail if there are any unexpected chars
if (ch == 'r' || ch == 'R') {
if (IsRawPrefix(ch)) {
i++;
ch = styler.SafeGetCharAt(i);
chNext = styler.SafeGetCharAt(i + 1);
} else if (IsPyStringTypeChar(ch, allowed)) {
if (chNext == 'r' || chNext == 'R')
if (IsRawPrefix(chNext))
i += 2;
else
i += 1;
@ -163,7 +171,7 @@ int GetPyStringState(Accessor &styler, Sci_Position i, Sci_PositionU *nextIndex,
chNext = styler.SafeGetCharAt(i + 1);
}
if (ch != '"' && ch != '\'') {
if (!IsQuote(ch)) {
*nextIndex = i + 1;
return SCE_P_DEFAULT;
}
@ -185,7 +193,7 @@ int GetPyStringState(Accessor &styler, Sci_Position i, Sci_PositionU *nextIndex,
}
}
inline bool IsAWordChar(int ch, bool unicodeIdentifiers) {
bool IsAWordChar(int ch, bool unicodeIdentifiers) {
if (IsASCII(ch))
return (IsAlphaNumeric(ch) || ch == '.' || ch == '_');
@ -196,7 +204,7 @@ inline bool IsAWordChar(int ch, bool unicodeIdentifiers) {
return IsXidContinue(ch);
}
inline bool IsAWordStart(int ch, bool unicodeIdentifiers) {
bool IsAWordStart(int ch, bool unicodeIdentifiers) {
if (IsASCII(ch))
return (IsUpperOrLowerCase(ch) || ch == '_');
@ -212,7 +220,7 @@ bool IsFirstNonWhitespace(Sci_Position pos, Accessor &styler) {
const Sci_Position start_pos = styler.LineStart(line);
for (Sci_Position i = start_pos; i < pos; i++) {
const char ch = styler[i];
if (!(ch == ' ' || ch == '\t'))
if (!IsASpaceOrTab(ch))
return false;
}
return true;
@ -221,7 +229,7 @@ bool IsFirstNonWhitespace(Sci_Position pos, Accessor &styler) {
unsigned char GetNextNonWhitespaceChar(Accessor &styler, Sci_PositionU pos, Sci_PositionU maxPos, Sci_PositionU *charPosPtr = nullptr) {
while (pos < maxPos) {
const unsigned char ch = styler.SafeGetCharAt(pos, '\0');
if (!(ch == ' ' || ch == '\t' || ch == '\n' || ch == '\r')) {
if (!AnyOf(ch, ' ', '\t', '\n', '\r')) {
if (charPosPtr != nullptr) {
*charPosPtr = pos;
}
@ -281,8 +289,9 @@ struct OptionsPython {
bool unicodeIdentifiers = true;
int identifierAttributes = 0;
int decoratorAttributes = 0;
bool pep701StringsF = true;
literalsAllowed AllowedLiterals() const noexcept {
[[nodiscard]] literalsAllowed AllowedLiterals() const noexcept {
literalsAllowed allowedLiterals = stringsU ? litU : litNone;
if (stringsB)
allowedLiterals = static_cast<literalsAllowed>(allowedLiterals | litB);
@ -321,6 +330,9 @@ struct OptionSetPython : public OptionSet<OptionsPython> {
DefineProperty("lexer.python.strings.f", &OptionsPython::stringsF,
"Set to 0 to not recognise Python 3.6 f-string literals f\"var={var}\".");
DefineProperty("lexer.python.strings.f.pep.701", &OptionsPython::pep701StringsF,
"Set to 0 to use pre-PEP 701 / Python 3.12 f-string lexing.");
DefineProperty("lexer.python.strings.over.newline", &OptionsPython::stringsOverNewline,
"Set to 1 to allow strings to span newline characters.");
@ -390,8 +402,7 @@ public:
DefaultLexer("python", SCLEX_PYTHON, lexicalClasses, ELEMENTS(lexicalClasses)),
subStyles(styleSubable, 0x80, 0x40, 0) {
}
~LexerPython() override {
}
~LexerPython() override = default;
void SCI_METHOD Release() override {
delete this;
}
@ -492,23 +503,29 @@ Sci_Position SCI_METHOD LexerPython::WordListSet(int n, const char *wl) {
}
void LexerPython::ProcessLineEnd(StyleContext &sc, std::vector<SingleFStringExpState> &fstringStateStack, SingleFStringExpState *&currentFStringExp, bool &inContinuedString) {
long deepestSingleStateIndex = -1;
unsigned long i;
// Before pep 701 single quote f-string's could not continue to a 2nd+ line
// Post pep 701, they can continue both with a trailing \ and if a { field is
// not ended with a }
if (!options.pep701StringsF) {
long deepestSingleStateIndex = -1;
unsigned long i;
// Find the deepest single quote state because that string will end; no \ continuation in f-string
for (i = 0; i < fstringStateStack.size(); i++) {
if (IsPySingleQuoteStringState(fstringStateStack[i].state)) {
deepestSingleStateIndex = i;
break;
// Find the deepest single quote state because that string will end; no \ continuation in f-string
for (i = 0; i < fstringStateStack.size(); i++) {
if (IsPySingleQuoteStringState(fstringStateStack[i].state)) {
deepestSingleStateIndex = i;
break;
}
}
if (deepestSingleStateIndex != -1) {
sc.SetState(fstringStateStack[deepestSingleStateIndex].state);
while (fstringStateStack.size() > static_cast<unsigned long>(deepestSingleStateIndex)) {
PopFromStateStack(fstringStateStack, currentFStringExp);
}
}
}
if (deepestSingleStateIndex != -1) {
sc.SetState(fstringStateStack[deepestSingleStateIndex].state);
while (fstringStateStack.size() > static_cast<unsigned long>(deepestSingleStateIndex)) {
PopFromStateStack(fstringStateStack, currentFStringExp);
}
}
if (!fstringStateStack.empty()) {
std::pair<Sci_Position, std::vector<SingleFStringExpState> > val;
val.first = sc.currentLine;
@ -567,7 +584,6 @@ void SCI_METHOD LexerPython::Lex(Sci_PositionU startPos, Sci_Position length, in
const literalsAllowed allowedLiterals = options.AllowedLiterals();
initStyle = initStyle & 31;
if (initStyle == SCE_P_STRINGEOL) {
initStyle = SCE_P_DEFAULT;
}
@ -705,7 +721,7 @@ void SCI_METHOD LexerPython::Lex(Sci_PositionU startPos, Sci_Position length, in
if (attrCh == '#')
isComment = true;
// Detect if this attribute belongs to a decorator
if (!(ch == ' ' || ch == '\t'))
if (!IsASpaceOrTab(ch))
break;
}
if (((isDecoratorAttribute) && (!isComment)) && (((options.decoratorAttributes == 1) && (style == SCE_P_IDENTIFIER)) || (options.decoratorAttributes == 2))){
@ -795,10 +811,12 @@ void SCI_METHOD LexerPython::Lex(Sci_PositionU startPos, Sci_Position length, in
needEOLCheck = true;
}
// If in an f-string expression, check for the ending quote(s)
// and end f-string to handle syntactically incorrect cases like
// f'{' and f"""{"""
if (!fstringStateStack.empty() && (sc.ch == '\'' || sc.ch == '"')) {
// If in an f-string expression and pre pep 701 lexing is used,
// check for the ending quote(s) and end f-string to handle
// syntactically incorrect cases like f'{' and f"""{""". Post
// pep 701, a quote may appear in a { } field so cases like
// f"n = {":".join(seq)}" is valid
if (!options.pep701StringsF && !fstringStateStack.empty() && IsQuote(sc.ch)) {
long matching_stack_i = -1;
for (unsigned long stack_i = 0; stack_i < fstringStateStack.size() && matching_stack_i == -1; stack_i++) {
const int stack_state = fstringStateStack[stack_i].state;
@ -918,7 +936,7 @@ static bool IsCommentLine(Sci_Position line, Accessor &styler) {
}
static bool IsQuoteLine(Sci_Position line, const Accessor &styler) {
const int style = styler.StyleAt(styler.LineStart(line)) & 31;
const int style = styler.StyleAt(styler.LineStart(line));
return IsPyTripleQuoteStringState(style);
}
@ -952,9 +970,9 @@ void SCI_METHOD LexerPython::Fold(Sci_PositionU startPos, Sci_Position length, i
// Set up initial loop state
startPos = styler.LineStart(lineCurrent);
int prev_state = SCE_P_DEFAULT & 31;
int prev_state = SCE_P_DEFAULT;
if (lineCurrent >= 1)
prev_state = styler.StyleAt(startPos - 1) & 31;
prev_state = styler.StyleAt(startPos - 1);
int prevQuote = options.foldQuotes && IsPyTripleQuoteStringState(prev_state);
// Process all characters to end of requested range or end of any triple quote
@ -971,7 +989,7 @@ void SCI_METHOD LexerPython::Fold(Sci_PositionU startPos, Sci_Position length, i
// Information about next line is only available if not at end of document
indentNext = styler.IndentAmount(lineNext, &spaceFlags, nullptr);
const Sci_Position lookAtPos = (styler.LineStart(lineNext) == styler.Length()) ? styler.Length() - 1 : styler.LineStart(lineNext);
const int style = styler.StyleAt(lookAtPos) & 31;
const int style = styler.StyleAt(lookAtPos);
quote = options.foldQuotes && IsPyTripleQuoteStringState(style);
}
const bool quote_start = (quote && !prevQuote);

View File

@ -124,7 +124,7 @@ void ColouriseRDoc(Sci_PositionU startPos, Sci_Position length, int initStyle, W
dashCount = lineState >> 8;
}
for (; sc.More(); sc.Forward()) {
while (sc.More()) {
// Determine if the current state should terminate.
switch (sc.state) {
case SCE_R_OPERATOR:
@ -272,6 +272,7 @@ void ColouriseRDoc(Sci_PositionU startPos, Sci_Position length, int initStyle, W
const int lineState = matchingDelimiter | (dashCount << 8);
styler.SetLineState(sc.currentLine, lineState);
}
sc.Forward();
}
sc.Complete();
}

View File

@ -47,7 +47,7 @@ struct PPDefinition {
std::string value;
bool isUndef;
std::string arguments;
PPDefinition(Sci_Position line_, const std::string &key_, const std::string &value_, bool isUndef_ = false, std::string arguments_="") :
PPDefinition(Sci_Position line_, const std::string &key_, const std::string &value_, bool isUndef_ = false, const std::string &arguments_ = "") :
line(line_), key(key_), value(value_), isUndef(isUndef_), arguments(arguments_) {
}
};

View File

@ -20,7 +20,7 @@ namespace {
const int catRanges[] = {
//++Autogenerated -- start of section automatically generated
// Created with Python 3.11.0, Unicode 14.0.0
// Created with Python 3.12.0, Unicode 15.0.0
25,
1046,
1073,
@ -1049,7 +1049,8 @@ const int catRanges[] = {
105672,
106013,
106020,
106109,
106086,
106141,
106501,
106566,
106628,
@ -1141,7 +1142,7 @@ const int catRanges[] = {
121027,
121085,
121093,
121309,
121341,
121352,
121693,
121732,
@ -3124,6 +3125,7 @@ const int catRanges[] = {
2217437,
2217476,
2217565,
2219941,
2220036,
2220970,
2221284,
@ -3222,7 +3224,9 @@ const int catRanges[] = {
2246341,
2246417,
2246597,
2246653,
2246628,
2246693,
2246749,
2248708,
2248957,
2248964,
@ -3436,6 +3440,8 @@ const int catRanges[] = {
2315389,
2315780,
2318141,
2318353,
2318685,
2326532,
2326845,
2326852,
@ -3502,6 +3508,22 @@ const int catRanges[] = {
2350758,
2350833,
2350909,
2351109,
2351172,
2351206,
2351236,
2351677,
2351684,
2352774,
2352837,
2353021,
2353094,
2353157,
2353190,
2353221,
2353265,
2353672,
2354013,
2356740,
2356797,
2357258,
@ -3522,9 +3544,11 @@ const int catRanges[] = {
2489905,
2489981,
2490372,
2524669,
2524698,
2524989,
2525189,
2525220,
2525413,
2525917,
2654212,
2672893,
2949124,
@ -3594,8 +3618,12 @@ const int catRanges[] = {
3538941,
3538948,
3548285,
3548740,
3548797,
3549700,
3549821,
3549860,
3549917,
3550340,
3550493,
3550724,
@ -3640,6 +3668,8 @@ const int catRanges[] = {
3819589,
3819701,
3819741,
3823626,
3824285,
3824650,
3825309,
3825685,
@ -3755,6 +3785,8 @@ const int catRanges[] = {
3924292,
3924321,
3924989,
3925153,
3925373,
3932165,
3932413,
3932421,
@ -3765,6 +3797,10 @@ const int catRanges[] = {
3933373,
3933381,
3933565,
3933699,
3935709,
3936741,
3936797,
3940356,
3941821,
3941893,
@ -3784,6 +3820,11 @@ const int catRanges[] = {
3956573,
3956723,
3956765,
3971588,
3972451,
3972485,
3972616,
3972957,
3996676,
3996925,
3996932,
@ -3913,14 +3954,14 @@ const int catRanges[] = {
4095860,
4096021,
4119325,
4119477,
4119445,
4119997,
4120085,
4120509,
4120597,
4124317,
4124693,
4127549,
4124413,
4124533,
4127581,
4127765,
4128157,
4128277,
@ -3942,23 +3983,19 @@ const int catRanges[] = {
4148245,
4148701,
4148757,
4148925,
4149013,
4149181,
4149269,
4149501,
4149565,
4149781,
4150717,
4150805,
4151165,
4151317,
4151261,
4151285,
4151517,
4151829,
4152157,
4151765,
4152221,
4152341,
4152605,
4152637,
4152853,
4153085,
4153149,
4153365,
4158077,
4158101,
@ -3968,7 +4005,7 @@ const int catRanges[] = {
4194308,
5561373,
5562372,
5695293,
5695325,
5695492,
5702621,
5702660,
@ -3979,6 +4016,8 @@ const int catRanges[] = {
6243293,
6291460,
6449533,
6449668,
6583837,
29360186,
29360221,
29361178,

View File

@ -17,7 +17,8 @@ class SparseState {
struct State {
Sci_Position position;
T value;
constexpr State(Sci_Position position_, T value_) noexcept : position(position_), value(value_) {
constexpr State(Sci_Position position_, T value_) noexcept :
position(position_), value(std::move(value_)) {
}
inline bool operator<(const State &other) const noexcept {
return position < other.position;

View File

@ -1,9 +1,10 @@
#!/usr/bin/env python3
# ScintillaData.py - implemented 2013 by Neil Hodgson neilh@scintilla.org
# LexillaData.py - implemented 2013 by Neil Hodgson neilh@scintilla.org
# Released to the public domain.
# Requires FileGenerator from Scintilla so scintilla must be a peer directory of lexilla.
# Common code used by Scintilla and SciTE for source file regeneration.
# The ScintillaData object exposes information about Scintilla as properties:
# Common code used by Lexilla and SciTE for source file regeneration.
# The LexillaData object exposes information about Lexilla as properties:
# Version properties
# version
# versionDotted
@ -18,17 +19,23 @@
#
# Information about lexers and properties defined in lexers
# lexFiles
# sorted list of lexer files
# sorted list of lexer file stems like LexAbaqus
# lexerModules
# sorted list of module names
# sorted list of module names like lmAbaqus
# lexerProperties
# sorted list of lexer properties
# sorted list of lexer properties like lexer.bash.command.substitution
# propertyDocuments
# dictionary of property documentation { name: document string }
# like lexer.bash.special.parameter: Set shell (default is Bash) special parameters.
# sclexFromName
# dictionary of SCLEX_* IDs { name: SCLEX_ID }
# dictionary of SCLEX_* IDs { name: SCLEX_ID } like ave: SCLEX_AVE
# fileFromSclex
# dictionary of file names { SCLEX_ID: file name }
# dictionary of file names { SCLEX_ID: file name } like SCLEX_AU3: LexAU3.cxx
# lexersXcode
# dictionary of project file UUIDs { file name: [build UUID, file UUID] }
# like LexTCL: [28BA733B24E34D9700272C2D,28BA72C924E34D9100272C2D]
# credits
# list of names of contributors like Atsuo Ishimoto
# This file can be run to see the data it provides.
# Requires Python 3.6 or later
@ -73,6 +80,8 @@ def FindModules(lexFile):
def FindLexersInXcode(xCodeProject):
lines = FileGenerator.ReadFileAsList(xCodeProject)
# PBXBuildFile section is a list of all buildable files in the project so extract the file basename and
# its build and file IDs
uidsOfBuild = {}
markersPBXBuildFile = ["Begin PBXBuildFile section", "", "End PBXBuildFile section"]
for buildLine in lines[FileGenerator.FindSectionInList(lines, markersPBXBuildFile)]:
@ -84,6 +93,7 @@ def FindLexersInXcode(xCodeProject):
uid2 = pieces[12]
uidsOfBuild[filename] = [uid1, uid2]
# PBXGroup section contains the folders (Lexilla, Lexers, LexLib, ...) so is used to find the lexers
lexers = {}
markersLexers = ["/* Lexers */ =", "children", ");"]
for lexerLine in lines[FileGenerator.FindSectionInList(lines, markersLexers)]:

View File

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

View File

@ -3,10 +3,11 @@
archiveVersion = 1;
classes = {
};
objectVersion = 50;
objectVersion = 54;
objects = {
/* Begin PBXBuildFile section */
00D544CC992062D2E3CD4BF6 /* LexGDScript.cxx in Sources */ = {isa = PBXBuildFile; fileRef = A383409E9A994F461550FEC1 /* LexGDScript.cxx */; };
283639BC268FD4EA009D58A1 /* LexAccessor.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 283639BB268FD4EA009D58A1 /* LexAccessor.cxx */; };
28BA72AB24E34D5B00272C2D /* LexerBase.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 28BA728F24E34D5A00272C2D /* LexerBase.cxx */; };
28BA72AC24E34D5B00272C2D /* LexAccessor.h in Headers */ = {isa = PBXBuildFile; fileRef = 28BA729024E34D5A00272C2D /* LexAccessor.h */; };
@ -152,10 +153,9 @@
28BA73AA24E34D9700272C2D /* LexRust.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 28BA733824E34D9700272C2D /* LexRust.cxx */; };
28BA73AD24E34DBC00272C2D /* Lexilla.h in Headers */ = {isa = PBXBuildFile; fileRef = 28BA73AB24E34DBC00272C2D /* Lexilla.h */; };
28BA73AE24E34DBC00272C2D /* Lexilla.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 28BA73AC24E34DBC00272C2D /* Lexilla.cxx */; };
510D44AFB91EE873E86ABDD4 /* LexAsciidoc.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 3AF14420BFC43876F16C5995 /* LexAsciidoc.cxx */; };
70BF497C8D265026B77C97DA /* LexJulia.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 315E4E969868C52C125686B2 /* LexJulia.cxx */; };
B32D4A2A9CEC222A5140E99F /* LexFSharp.cxx in Sources */ = {isa = PBXBuildFile; fileRef = F8E54626B22BD9493090F40B /* LexFSharp.cxx */; };
510D44AFB91EE873E86ABDD4 /* LexAsciidoc.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 3AF14420BFC43876F16C5995 /* LexAsciidoc.cxx */; };
00D544CC992062D2E3CD4BF6 /* LexGDScript.cxx in Sources */ = {isa = PBXBuildFile; fileRef = A383409E9A994F461550FEC1 /* LexGDScript.cxx */; };
/* End PBXBuildFile section */
/* Begin PBXFileReference section */
@ -307,9 +307,9 @@
28BA73AC24E34DBC00272C2D /* Lexilla.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Lexilla.cxx; path = ../Lexilla.cxx; sourceTree = "<group>"; };
28BA73B024E3510900272C2D /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
315E4E969868C52C125686B2 /* LexJulia.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexJulia.cxx; path = ../../lexers/LexJulia.cxx; sourceTree = SOURCE_ROOT; };
F8E54626B22BD9493090F40B /* LexFSharp.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexFSharp.cxx; path = ../../lexers/LexFSharp.cxx; sourceTree = SOURCE_ROOT; };
3AF14420BFC43876F16C5995 /* LexAsciidoc.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexAsciidoc.cxx; path = ../../lexers/LexAsciidoc.cxx; sourceTree = SOURCE_ROOT; };
A383409E9A994F461550FEC1 /* LexGDScript.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexGDScript.cxx; path = ../../lexers/LexGDScript.cxx; sourceTree = SOURCE_ROOT; };
F8E54626B22BD9493090F40B /* LexFSharp.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexFSharp.cxx; path = ../../lexers/LexFSharp.cxx; sourceTree = SOURCE_ROOT; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
@ -566,7 +566,8 @@
2802629D246DF655000DF3B8 /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 1200;
BuildIndependentTargetsInParallel = YES;
LastUpgradeCheck = 1500;
ORGANIZATIONNAME = "Neil Hodgson";
TargetAttributes = {
280262A4246DF655000DF3B8 = {
@ -772,6 +773,7 @@
DEBUG_INFORMATION_FORMAT = dwarf;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
ENABLE_USER_SCRIPT_SANDBOXING = YES;
GCC_C_LANGUAGE_STANDARD = gnu11;
GCC_DYNAMIC_NO_PIC = NO;
GCC_NO_COMMON_BLOCKS = YES;
@ -786,7 +788,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
MACOSX_DEPLOYMENT_TARGET = 10.9;
MACOSX_DEPLOYMENT_TARGET = 10.13;
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
MTL_FAST_MATH = YES;
ONLY_ACTIVE_ARCH = YES;
@ -832,6 +834,7 @@
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
ENABLE_NS_ASSERTIONS = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_USER_SCRIPT_SANDBOXING = YES;
GCC_C_LANGUAGE_STANDARD = gnu11;
GCC_NO_COMMON_BLOCKS = YES;
GCC_PREPROCESSOR_DEFINITIONS = NDEBUG;
@ -841,7 +844,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
MACOSX_DEPLOYMENT_TARGET = 10.9;
MACOSX_DEPLOYMENT_TARGET = 10.13;
MTL_ENABLE_DEBUG_INFO = NO;
MTL_FAST_MATH = YES;
SDKROOT = macosx;
@ -853,7 +856,7 @@
buildSettings = {
CLANG_CXX_LANGUAGE_STANDARD = "gnu++17";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 5.2.7;
CURRENT_PROJECT_VERSION = 5.2.8;
DEAD_CODE_STRIPPING = YES;
DEVELOPMENT_TEAM = 4F446KW87E;
DYLIB_COMPATIBILITY_VERSION = 1;
@ -869,6 +872,7 @@
);
INFOPLIST_FILE = "$(SRCROOT)/Lexilla/Info.plist";
INSTALL_PATH = "@rpath";
MACOSX_DEPLOYMENT_TARGET = 10.13;
PRODUCT_BUNDLE_IDENTIFIER = org.scintilla.Lexilla;
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
@ -880,7 +884,7 @@
buildSettings = {
CLANG_CXX_LANGUAGE_STANDARD = "gnu++17";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 5.2.7;
CURRENT_PROJECT_VERSION = 5.2.8;
DEAD_CODE_STRIPPING = YES;
DEVELOPMENT_TEAM = 4F446KW87E;
DYLIB_COMPATIBILITY_VERSION = 1;
@ -896,6 +900,7 @@
);
INFOPLIST_FILE = "$(SRCROOT)/Lexilla/Info.plist";
INSTALL_PATH = "@rpath";
MACOSX_DEPLOYMENT_TARGET = 10.13;
PRODUCT_BUNDLE_IDENTIFIER = org.scintilla.Lexilla;
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;

View File

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

View File

@ -0,0 +1,16 @@
# Simple nesting
f" { "" } "
# Multi-line field with comment
f" {
"" # comment
} "
# Single quoted continued with \
f" \
"
# 4 nested f-strings
f'Outer {f"nested {1} {f"nested {2} {f"nested {3} {f"nested {4}"}"}"}"}'

View File

@ -0,0 +1,17 @@
0 400 0 # Simple nesting
0 400 0 f" { "" } "
1 400 0
0 400 0 # Multi-line field with comment
0 400 0 f" {
1 400 0
0 400 0 "" # comment
1 400 0
0 400 0 } "
1 400 0
0 400 0 # Single quoted continued with \
0 400 0 f" \
0 400 0 "
1 400 0
0 400 0 # 4 nested f-strings
0 400 0 f'Outer {f"nested {1} {f"nested {2} {f"nested {3} {f"nested {4}"}"}"}"}'
1 400 0

View File

@ -0,0 +1,16 @@
{1}# Simple nesting{0}
{16}f" {{0} {3}""{0} {16}} "{0}
{1}# Multi-line field with comment{0}
{16}f" {{0}
{3}""{0} {1}# comment{0}
{16}} "{0}
{1}# Single quoted continued with \{0}
{16}f" \
"{0}
{1}# 4 nested f-strings{0}
{17}f'Outer {{16}f"nested {{2}1{16}} {f"nested {{2}2{16}} {f"nested {{2}3{16}} {f"nested {{2}4{16}}"}"}"}"{17}}'{0}

View File

@ -33,6 +33,9 @@ acme
"\n0\r1\t2\b3\a4\f5\\6\'7\"8\`9"
"\1230\x121\u12342\U000123453\u{1234}4\U{00012345}5\
6\ 7"
# issue #206
"\n"
"\r\n"
# Backticks
d$`1st column`

View File

@ -33,6 +33,9 @@
0 400 400 "\n0\r1\t2\b3\a4\f5\\6\'7\"8\`9"
0 400 400 "\1230\x121\u12342\U000123453\u{1234}4\U{00012345}5\
0 400 400 6\ 7"
0 400 400 # issue #206
0 400 400 "\n"
0 400 400 "\r\n"
1 400 400
0 400 400 # Backticks
0 400 400 d$`1st column`

View File

@ -33,6 +33,9 @@
{6}"{15}\n{6}0{15}\r{6}1{15}\t{6}2{15}\b{6}3{15}\a{6}4{15}\f{6}5{15}\\{6}6{15}\'{6}7{15}\"{6}8{15}\`{6}9"{0}
{6}"{15}\123{6}0{15}\x12{6}1{15}\u1234{6}2{15}\U00012345{6}3{15}\u{1234}{6}4{15}\U{00012345}{6}5{15}\{6}
6{15}\ {6}7"{0}
{1}# issue #206{0}
{6}"{15}\n{6}"{0}
{6}"{15}\r\n{6}"{0}
{1}# Backticks{0}
{9}d{8}${12}`1st column`{0}

View File

@ -1 +1 @@
527
528

View File

@ -95,6 +95,7 @@
mCurrentCaretX = 0;
mCurrentCaretY = 0;
[self createItems];
self.clipsToBounds = TRUE;
}
return self;
}

View File

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

View File

@ -3,7 +3,7 @@
archiveVersion = 1;
classes = {
};
objectVersion = 50;
objectVersion = 54;
objects = {
/* Begin PBXBuildFile section */
@ -449,7 +449,8 @@
287F3C38246F8DC70040E76F /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 1200;
BuildIndependentTargetsInParallel = YES;
LastUpgradeCheck = 1500;
ORGANIZATIONNAME = "Neil Hodgson";
TargetAttributes = {
287F3C40246F8DC70040E76F = {
@ -573,11 +574,12 @@
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = NO;
CURRENT_PROJECT_VERSION = 5.3.7;
CURRENT_PROJECT_VERSION = 5.3.8;
DEAD_CODE_STRIPPING = YES;
DEBUG_INFORMATION_FORMAT = dwarf;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
ENABLE_USER_SCRIPT_SANDBOXING = YES;
GCC_C_LANGUAGE_STANDARD = gnu11;
GCC_DYNAMIC_NO_PIC = NO;
GCC_NO_COMMON_BLOCKS = YES;
@ -592,7 +594,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
MACOSX_DEPLOYMENT_TARGET = 10.9;
MACOSX_DEPLOYMENT_TARGET = 10.13;
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
MTL_FAST_MATH = YES;
ONLY_ACTIVE_ARCH = YES;
@ -636,11 +638,12 @@
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = NO;
CURRENT_PROJECT_VERSION = 5.3.7;
CURRENT_PROJECT_VERSION = 5.3.8;
DEAD_CODE_STRIPPING = YES;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
ENABLE_NS_ASSERTIONS = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_USER_SCRIPT_SANDBOXING = YES;
GCC_C_LANGUAGE_STANDARD = gnu11;
GCC_NO_COMMON_BLOCKS = YES;
GCC_PREPROCESSOR_DEFINITIONS = NDEBUG;
@ -650,7 +653,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
MACOSX_DEPLOYMENT_TARGET = 10.9;
MACOSX_DEPLOYMENT_TARGET = 10.13;
MTL_ENABLE_DEBUG_INFO = NO;
MTL_FAST_MATH = YES;
SDKROOT = macosx;
@ -667,7 +670,7 @@
CODE_SIGN_IDENTITY = "-";
CODE_SIGN_STYLE = Manual;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 5.3.7;
CURRENT_PROJECT_VERSION = 5.3.8;
DEAD_CODE_STRIPPING = YES;
DEFINES_MODULE = YES;
DEVELOPMENT_TEAM = "";
@ -686,7 +689,7 @@
"@executable_path/../Frameworks",
"@loader_path/Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 10.9;
MACOSX_DEPLOYMENT_TARGET = 10.13;
PRODUCT_BUNDLE_IDENTIFIER = org.scintilla.Scintilla;
PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
PROVISIONING_PROFILE_SPECIFIER = "";
@ -702,7 +705,7 @@
CODE_SIGN_IDENTITY = "-";
CODE_SIGN_STYLE = Manual;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 5.3.7;
CURRENT_PROJECT_VERSION = 5.3.8;
DEAD_CODE_STRIPPING = YES;
DEFINES_MODULE = YES;
DEVELOPMENT_TEAM = "";
@ -721,7 +724,7 @@
"@executable_path/../Frameworks",
"@loader_path/Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 10.9;
MACOSX_DEPLOYMENT_TARGET = 10.13;
PRODUCT_BUNDLE_IDENTIFIER = org.scintilla.Scintilla;
PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
PROVISIONING_PROFILE_SPECIFIER = "";

View File

@ -116,6 +116,8 @@ const char user_keywords[] = // Definition of own keywords, not used by MySQL.
}
}
[mEditor suspendDrawing: TRUE];
// Keywords to highlight. Indices are:
// 0 - Major keywords (reserved keywords)
// 1 - Normal keywords (everything not reserved but integral part of the language)
@ -219,6 +221,8 @@ const char user_keywords[] = // Definition of own keywords, not used by MySQL.
// Uncomment if you wanna see auto wrapping in action.
//[mEditor setGeneralProperty: SCI_SETWRAPMODE parameter: SC_WRAP_WORD value: 0];
[mEditor suspendDrawing: FALSE];
InfoBar* infoBar = [[[InfoBar alloc] initWithFrame: NSMakeRect(0, 0, 400, 0)] autorelease];
[infoBar setDisplay: IBShowAll];
[mEditor setInfoBar: infoBar top: NO];

View File

@ -3,7 +3,7 @@
archiveVersion = 1;
classes = {
};
objectVersion = 46;
objectVersion = 54;
objects = {
/* Begin PBXBuildFile section */
@ -204,7 +204,8 @@
29B97313FDCFA39411CA2CEA /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 1250;
BuildIndependentTargetsInParallel = YES;
LastUpgradeCheck = 1500;
};
buildConfigurationList = C01FCF4E08A954540054247B /* Build configuration list for PBXProject "ScintillaTest" */;
compatibilityVersion = "Xcode 3.2";
@ -304,6 +305,7 @@
CODE_SIGN_IDENTITY = "-";
COMBINE_HIDPI_IMAGES = YES;
COPY_PHASE_STRIP = NO;
DEAD_CODE_STRIPPING = YES;
FRAMEWORK_SEARCH_PATHS = "$(inherited)";
GCC_DYNAMIC_NO_PIC = NO;
GCC_MODEL_TUNING = G5;
@ -314,9 +316,12 @@
HEADER_SEARCH_PATHS = "";
INFOPLIST_FILE = Info.plist;
INSTALL_PATH = "$(HOME)/Applications";
LD_RUNPATH_SEARCH_PATHS = "$(LD_RUNPATH_SEARCH_PATHS_$(IS_MACCATALYST)) @executable_path/../Frameworks";
LD_RUNPATH_SEARCH_PATHS = (
"$(LD_RUNPATH_SEARCH_PATHS_$(IS_MACCATALYST))",
"@executable_path/../Frameworks",
);
LIBRARY_SEARCH_PATHS = "$(inherited)";
MACOSX_DEPLOYMENT_TARGET = 10.9;
MACOSX_DEPLOYMENT_TARGET = 10.13;
OTHER_LDFLAGS = "";
PRODUCT_BUNDLE_IDENTIFIER = "com.sun.${PRODUCT_NAME:identifier}";
PRODUCT_NAME = ScintillaTest;
@ -333,6 +338,7 @@
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = NO;
CODE_SIGN_IDENTITY = "-";
COMBINE_HIDPI_IMAGES = YES;
DEAD_CODE_STRIPPING = YES;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
FRAMEWORK_SEARCH_PATHS = "$(inherited)";
GCC_MODEL_TUNING = G5;
@ -342,9 +348,12 @@
HEADER_SEARCH_PATHS = "";
INFOPLIST_FILE = Info.plist;
INSTALL_PATH = "$(HOME)/Applications";
LD_RUNPATH_SEARCH_PATHS = "$(LD_RUNPATH_SEARCH_PATHS_$(IS_MACCATALYST)) @executable_path/../Frameworks";
LD_RUNPATH_SEARCH_PATHS = (
"$(LD_RUNPATH_SEARCH_PATHS_$(IS_MACCATALYST))",
"@executable_path/../Frameworks",
);
LIBRARY_SEARCH_PATHS = "$(inherited)";
MACOSX_DEPLOYMENT_TARGET = 10.9;
MACOSX_DEPLOYMENT_TARGET = 10.13;
OTHER_LDFLAGS = "";
PRODUCT_BUNDLE_IDENTIFIER = "com.sun.${PRODUCT_NAME:identifier}";
PRODUCT_NAME = ScintillaTest;
@ -375,8 +384,10 @@
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
DEAD_CODE_STRIPPING = YES;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
ENABLE_USER_SCRIPT_SANDBOXING = YES;
GCC_C_LANGUAGE_STANDARD = c99;
GCC_NO_COMMON_BLOCKS = YES;
GCC_OPTIMIZATION_LEVEL = 0;
@ -387,7 +398,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
MACOSX_DEPLOYMENT_TARGET = 10.9;
MACOSX_DEPLOYMENT_TARGET = 10.13;
ONLY_ACTIVE_ARCH = YES;
OTHER_LDFLAGS = "";
SDKROOT = macosx;
@ -417,7 +428,9 @@
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
DEAD_CODE_STRIPPING = YES;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_USER_SCRIPT_SANDBOXING = YES;
GCC_C_LANGUAGE_STANDARD = c99;
GCC_NO_COMMON_BLOCKS = YES;
GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
@ -427,7 +440,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
MACOSX_DEPLOYMENT_TARGET = 10.9;
MACOSX_DEPLOYMENT_TARGET = 10.13;
OTHER_LDFLAGS = "";
SDKROOT = macosx;
SYSTEM_HEADER_SEARCH_PATHS = "../../../lexilla/**";

View File

@ -202,6 +202,9 @@ static NSCursor *cursorFromEnum(Window::Cursor cursor) {
}
- (void) drawRect: (NSRect) rect {
if (!NSContainsRect(self.bounds, rect)) {
rect = self.bounds;
}
[super drawRect:rect];
}
@ -1349,10 +1352,17 @@ static NSCursor *cursorFromEnum(Window::Cursor cursor) {
* (like clearing all marks and setting new ones etc.).
*/
- (void) suspendDrawing: (BOOL) suspend {
if (suspend)
[self.window disableFlushWindow];
else
[self.window enableFlushWindow];
if (@available(macOS 10.14, *)) {
// Don't try where deprecated
} else {
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
if (suspend)
[self.window disableFlushWindow];
else
[self.window enableFlushWindow];
#pragma GCC diagnostic pop
}
}
//--------------------------------------------------------------------------------------------------

View File

@ -24,11 +24,15 @@ checkLevelNormal:scintilla/src/Editor.cxx
// Redundant code: Found unused cast of expression 'leadByte'
constStatement:scintilla/src/Document.cxx
// ILexer5* is not pointing at logically const
constParameterPointer:scintilla/src/Document.cxx
// Some non-explicit constructors are used for conversions or are private to lexers
noExplicitConstructor
// MarginView access to all bits is safe and is better defined in later versions of C++
shiftTooManyBitsSigned:scintilla/src/MarginView.cxx
integerOverflow:scintilla/src/MarginView.cxx
// DLL entry points are unused inside Scintilla
unusedFunction:scintilla/win32/ScintillaDLL.cxx
@ -50,9 +54,6 @@ knownConditionTrueFalse:scintilla/src/EditView.cxx
arithOperationsOnVoidPointer:scintilla/src/PerLine.cxx
arithOperationsOnVoidPointer:scintilla/src/PositionCache.cxx
// Cppcheck wrongly assumes string_view::remove_prefix can not empty the view
knownConditionTrueFalse:scintilla/src/CallTip.cxx
// G_DEFINE_TYPE is too complex to pass to cppcheck
unknownMacro:scintilla/gtk/PlatGTK.cxx

File diff suppressed because it is too large Load Diff

View File

@ -26,9 +26,9 @@
<table bgcolor="#CCCCCC" width="100%" cellspacing="0" cellpadding="8" border="0">
<tr>
<td>
<font size="4"> <a href="https://www.scintilla.org/scintilla537.zip">
<font size="4"> <a href="https://www.scintilla.org/scintilla538.zip">
Windows</a>&nbsp;&nbsp;
<a href="https://www.scintilla.org/scintilla537.tgz">
<a href="https://www.scintilla.org/scintilla538.tgz">
GTK/Linux</a>&nbsp;&nbsp;
</font>
</td>
@ -42,7 +42,7 @@
containing very few restrictions.
</p>
<h3>
Release 5.3.7
Release 5.3.8
</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/scintilla537.zip">zip format</a> (1.7M) commonly used on Windows</li>
<li><a href="https://www.scintilla.org/scintilla537.tgz">tgz format</a> (1.6M) commonly used on Linux and compatible operating systems</li>
<li><a href="https://www.scintilla.org/scintilla538.zip">zip format</a> (1.7M) commonly used on Windows</li>
<li><a href="https://www.scintilla.org/scintilla538.tgz">tgz format</a> (1.6M) commonly used on Linux and compatible operating systems</li>
</ul>
Instructions for building on both Windows and Linux are included in the readme file.
<h4>

View File

@ -583,6 +583,36 @@
</tr>
</table>
<h2>Releases</h2>
<h3>
<a href="https://www.scintilla.org/scintilla538.zip">Release 5.3.8</a>
</h3>
<ul>
<li>
Released 5 November 2023.
</li>
<li>
Fix excessive memory use when deleting contiguous ranges backwards.
<a href="https://github.com/notepad-plus-plus/notepad-plus-plus/issues/13442">Notepad++ Issue #13442</a>.
</li>
<li>
Fix incorrect substitution when searching for a regular expression backwards.
<a href="https://sourceforge.net/p/scintilla/bugs/2405/">Bug #2405</a>.
</li>
<li>
Make SCI_MOVESELECTEDLINESUP and SCI_MOVESELECTEDLINESDOWN work for rectangular selections.
<a href="https://sourceforge.net/p/scintilla/bugs/2078/">Bug #2078</a>.
</li>
<li>
For Cocoa, minimum supported macOS release increased to 10.13.
</li>
<li>
For Cocoa, fix invisible text on macOS 14 Sonoma.
<a href="https://sourceforge.net/p/scintilla/bugs/2402/">Bug #2402</a>.
</li>
<li>
For Cocoa, do nothing for suspendDrawing on macOS 10.14+ as the underlying calls have been deprecated.
</li>
</ul>
<h3>
<a href="https://www.scintilla.org/scintilla537.zip">Release 5.3.7</a>
</h3>

View File

@ -9,7 +9,7 @@
<meta name="keywords" content="Scintilla, SciTE, Editing Component, Text Editor" />
<meta name="Description"
content="www.scintilla.org is the home of the Scintilla editing component and SciTE text editor application." />
<meta name="Date.Modified" content="20230922" />
<meta name="Date.Modified" content="20231105" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<style type="text/css">
.logo {
@ -60,8 +60,8 @@
GTK, and macOS</font>
</td>
<td width="40%" align="right">
<font color="#FFCC99" size="3"> Release version 5.3.7<br />
Site last modified September 22 2023</font>
<font color="#FFCC99" size="3"> Release version 5.3.8<br />
Site last modified November 5 2023</font>
</td>
<td width="20%">
&nbsp;
@ -76,11 +76,11 @@
</tr>
</table>
<ul id="versionlist">
<li>Version 5.3.8 fixes excesssive memory use when deleting contiguous ranges backwards and is compatible with new macOS 14.</li>
<li>Version 5.3.7 fixes platform-specific issues on GTK, Qt, and Win32.</li>
<li>Version 5.3.6 improves cursor behaviour on Win32 and IME support on Win32 and Qt.</li>
<li>Version 5.3.5 improves IME support on Win32 and Qt.</li>
<li>Version 5.3.4 adds multithreaded wrapping.</li>
<li>Version 5.3.3 fixes minor bugs in APIs and platform layers.</li>
</ul>
<ul id="menu">
<li id="remote1"><a href="https://www.scintilla.org/SciTEImage.html">Screenshot</a></li>

View File

@ -2149,7 +2149,7 @@ ColourRGBA Platform::Chrome() {
}
ColourRGBA Platform::ChromeHighlight() {
return ColourRGBA(0xff, 0xff, 0xff);
return white;
}
const char *Platform::DefaultFont() {

View File

@ -704,10 +704,11 @@ void ScintillaGTK::Init() {
timers[tr].reason = static_cast<TickReason>(tr);
timers[tr].scintilla = this;
}
vs.indicators[SC_INDICATOR_UNKNOWN] = Indicator(IndicatorStyle::Hidden, ColourRGBA(0, 0, 0xff));
vs.indicators[SC_INDICATOR_INPUT] = Indicator(IndicatorStyle::Dots, ColourRGBA(0, 0, 0xff));
vs.indicators[SC_INDICATOR_CONVERTED] = Indicator(IndicatorStyle::CompositionThick, ColourRGBA(0, 0, 0xff));
vs.indicators[SC_INDICATOR_TARGET] = Indicator(IndicatorStyle::StraightBox, ColourRGBA(0, 0, 0xff));
vs.indicators[SC_INDICATOR_UNKNOWN] = Indicator(IndicatorStyle::Hidden, colourIME);
vs.indicators[SC_INDICATOR_INPUT] = Indicator(IndicatorStyle::Dots, colourIME);
vs.indicators[SC_INDICATOR_CONVERTED] = Indicator(IndicatorStyle::CompositionThick, colourIME);
vs.indicators[SC_INDICATOR_TARGET] = Indicator(IndicatorStyle::StraightBox, colourIME);
fontOptionsPrevious = FontOptions(PWidget(wText));
}

View File

@ -13,7 +13,7 @@ TEMPLATE = lib
CONFIG += lib_bundle
CONFIG += c++1z
VERSION = 5.3.7
VERSION = 5.3.8
SOURCES += \
ScintillaEdit.cpp \

View File

@ -56,8 +56,6 @@ ScintillaEditBase::ScintillaEditBase(QWidget *parent)
setAttribute(Qt::WA_KeyCompression);
setAttribute(Qt::WA_InputMethodEnabled);
// All IME indicators drawn in same colour, blue, with different patterns
const ColourRGBA colourIME(0, 0, UCHAR_MAX);
sqt->vs.indicators[IndicatorUnknown] = Indicator(IndicatorStyle::Hidden, colourIME);
sqt->vs.indicators[IndicatorInput] = Indicator(IndicatorStyle::Dots, colourIME);
sqt->vs.indicators[IndicatorConverted] = Indicator(IndicatorStyle::CompositionThick, colourIME);

View File

@ -12,7 +12,7 @@ TEMPLATE = lib
CONFIG += lib_bundle
CONFIG += c++1z
VERSION = 5.3.7
VERSION = 5.3.8
SOURCES += \
PlatQt.cpp \

View File

@ -137,7 +137,7 @@ def checkDocumentation():
#<a class="message" href="#SCI_SETLAYOUTCACHE">SCI_SETLAYOUTCACHE(int cacheMode)</a><br />
dirPattern = re.compile(r'<a class="message" href="#([A-Z0-9_]+)">([A-Z][A-Za-z0-9_() *&;,\n]+)</a>')
for api, sig in re.findall(dirPattern, docs):
sigApi = re.split('\W+', sig)[0]
sigApi = re.split(r'\W+', sig)[0]
sigFlat = flattenSpaces(sig)
sigFlat = sigFlat.replace('colouralpha ', 'xxxx ') # Temporary to avoid next line
sigFlat = sigFlat.replace('alpha ', 'int ')
@ -176,7 +176,7 @@ def checkDocumentation():
sigFlat = sigFlat.replace(' NUL-terminated', '')
sigFlat = sigFlat.rstrip()
#~ sigFlat = sigFlat.replace(' NUL-terminated', '')
sigApi = re.split('\W+', sigFlat)[0]
sigApi = re.split(r'\W+', sigFlat)[0]
#~ print(sigFlat, ";;", sig, ";;", api)
if '(' in sigFlat or api.startswith("SCI_"):
try:

View File

@ -15,6 +15,9 @@
# mdyModified
# dmyModified
# myModified
#
# List of contributors
# credits
# This file can be run to see the data it provides.
# Requires Python 3.6 or later

View File

@ -37,6 +37,22 @@ size_t Chunk::Length() const noexcept {
return end - start;
}
namespace {
#ifdef __APPLE__
// Archaic macOS colours for the default: black on light yellow
constexpr ColourRGBA colourTextAndArrow(black);
constexpr ColourRGBA colourBackground(0xff, 0xff, 0xc6);
#else
// Grey on white
constexpr ColourRGBA colourTextAndArrow(0x80, 0x80, 0x80);
constexpr ColourRGBA colourBackground(white);
#endif
constexpr ColourRGBA silver(0xc0, 0xc0, 0xc0);
}
CallTip::CallTip() noexcept {
wCallTip = {};
inCallTipMode = false;
@ -54,17 +70,12 @@ CallTip::CallTip() noexcept {
borderHeight = 2; // Extra line for border and an empty line at top and bottom.
verticalOffset = 1;
#ifdef __APPLE__
// proper apple colours for the default
colourBG = ColourRGBA(0xff, 0xff, 0xc6);
colourUnSel = ColourRGBA(0, 0, 0);
#else
colourBG = ColourRGBA(0xff, 0xff, 0xff);
colourUnSel = ColourRGBA(0x80, 0x80, 0x80);
#endif
colourBG = colourBackground;
colourUnSel = colourTextAndArrow;
colourSel = ColourRGBA(0, 0, 0x80);
colourShade = ColourRGBA(0, 0, 0);
colourLight = ColourRGBA(0xc0, 0xc0, 0xc0);
colourShade = black;
colourLight = silver;
codePage = 0;
clickPlace = 0;
}
@ -272,7 +283,7 @@ void CallTip::MouseClick(Point pt) noexcept {
}
PRectangle CallTip::CallTipStart(Sci::Position pos, Point pt, int textHeight, const char *defn,
int codePage_, Surface *surfaceMeasure, std::shared_ptr<Font> font_) {
int codePage_, Surface *surfaceMeasure, const std::shared_ptr<Font> &font_) {
clickPlace = 0;
val = defn;
codePage = codePage_;

View File

@ -71,7 +71,7 @@ public:
/// Setup the calltip and return a rectangle of the area required.
PRectangle CallTipStart(Sci::Position pos, Point pt, int textHeight, const char *defn,
int codePage_, Surface *surfaceMeasure, std::shared_ptr<Font> font_);
int codePage_, Surface *surfaceMeasure, const std::shared_ptr<Font> &font_);
void CallTipCancel() noexcept;

View File

@ -848,6 +848,33 @@ Sci::Position CellBuffer::LineStart(Sci::Line line) const noexcept {
return plv->LineStart(line);
}
Sci::Position CellBuffer::LineEnd(Sci::Line line) const noexcept {
if (line >= Lines() - 1) {
return LineStart(line + 1);
} else {
Sci::Position position = LineStart(line + 1);
if (LineEndType::Unicode == GetLineEndTypes()) {
const unsigned char bytes[] = {
UCharAt(position - 3),
UCharAt(position - 2),
UCharAt(position - 1),
};
if (UTF8IsSeparator(bytes)) {
return position - UTF8SeparatorLength;
}
if (UTF8IsNEL(bytes + 1)) {
return position - UTF8NELLength;
}
}
position--; // Back over CR or LF
// When line terminator is CR+LF, may need to go back one more
if ((position > LineStart(line)) && (CharAt(position - 1) == '\r')) {
position--;
}
return position;
}
}
Sci::Line CellBuffer::LineFromPosition(Sci::Position pos) const noexcept {
return plv->LineFromPosition(pos);
}

View File

@ -186,6 +186,7 @@ public:
Sci::Line Lines() const noexcept;
void AllocateLines(Sci::Line lines);
Sci::Position LineStart(Sci::Line line) const noexcept;
Sci::Position LineEnd(Sci::Line line) const noexcept;
Sci::Position IndexLineStart(Sci::Line line, Scintilla::LineCharacterIndexType lineCharacterIndex) const noexcept;
Sci::Line LineFromPosition(Sci::Position pos) const noexcept;
Sci::Line LineFromPositionIndex(Sci::Position pos, Scintilla::LineCharacterIndexType lineCharacterIndex) const noexcept;

View File

@ -30,44 +30,82 @@ namespace Scintilla::Internal {
void ChangeStack::Clear() noexcept {
steps.clear();
insertions.clear();
changes.clear();
}
void ChangeStack::AddStep() {
steps.push_back(0);
}
void ChangeStack::PushDeletion(Sci::Position positionDeletion, int edition) {
steps.back()++;
insertions.push_back({ positionDeletion, 0, edition, InsertionSpan::Direction::deletion });
namespace {
constexpr bool InsertionSpanSameDeletion(const ChangeSpan &is, Sci::Position positionDeletion, int edition) {
// Equal except for count
return
is.direction == ChangeSpan::Direction::deletion &&
is.start == positionDeletion &&
is.length == 0 &&
is.edition == edition;
};
}
void ChangeStack::PushDeletion(Sci::Position positionDeletion, const EditionCount &ec) {
steps.back() += ec.count;
if (changes.empty() || !InsertionSpanSameDeletion(changes.back(), positionDeletion, ec.edition)) {
changes.push_back({ positionDeletion, 0, ec.edition, ec.count, ChangeSpan::Direction::deletion });
} else {
changes.back().count += ec.count;
}
}
void ChangeStack::PushInsertion(Sci::Position positionInsertion, Sci::Position length, int edition) {
steps.back()++;
insertions.push_back({ positionInsertion, length, edition, InsertionSpan::Direction::insertion });
changes.push_back({ positionInsertion, length, edition, 1, ChangeSpan::Direction::insertion });
}
size_t ChangeStack::PopStep() noexcept {
const size_t spans = steps.back();
int ChangeStack::PopStep() noexcept {
const int spans = steps.back();
steps.pop_back();
return spans;
}
InsertionSpan ChangeStack::PopSpan() noexcept {
const InsertionSpan span = insertions.back();
insertions.pop_back();
ChangeSpan ChangeStack::PopSpan(int maxSteps) noexcept {
ChangeSpan span = changes.back();
const int remove = std::min(maxSteps, span.count);
if (span.count == remove) {
changes.pop_back();
} else {
changes.back().count -= remove;
span.count = remove;
}
return span;
}
void ChangeStack::SetSavePoint() noexcept {
// Switch changeUnsaved to changeSaved
for (InsertionSpan &x : insertions) {
for (ChangeSpan &x : changes) {
if (x.edition == changeModified) {
x.edition = changeSaved;
}
}
}
void ChangeStack::Check() const noexcept {
#ifdef _DEBUG
// Ensure count in steps same as insertions;
int sizeSteps = 0;
for (const int c : steps) {
sizeSteps += c;
}
int sizeInsertions = 0;
for (const ChangeSpan &is: changes) {
sizeInsertions += is.count;
}
assert(sizeSteps == sizeInsertions);
#endif
}
void ChangeLog::Clear(Sci::Position length) {
changeStack.Clear();
insertEdition.DeleteAll();
@ -105,8 +143,8 @@ void ChangeLog::CollapseRange(Sci::Position position, Sci::Position deleteLength
while (positionDeletion <= positionMax) {
const EditionSetOwned &editions = deleteEdition.ValueAt(positionDeletion);
if (editions) {
for (const int ed : *editions) {
PushDeletionAt(position, ed);
for (const EditionCount &ec : *editions) {
PushDeletionAt(position, ec);
}
EditionSetOwned empty;
deleteEdition.SetValueAt(positionDeletion, std::move(empty));
@ -115,19 +153,50 @@ void ChangeLog::CollapseRange(Sci::Position position, Sci::Position deleteLength
}
}
void ChangeLog::PushDeletionAt(Sci::Position position, int edition) {
namespace {
// EditionSets have repeat counts on items so push and pop may just
// manipulate the count field or may push/pop items.
void EditionSetPush(EditionSet &set, EditionCount ec) {
if (set.empty() || (set.back().edition != ec.edition)) {
set.push_back(ec);
} else {
set.back().count += ec.count;
}
}
void EditionSetPop(EditionSet &set) noexcept {
if (set.back().count == 1) {
set.pop_back();
} else {
set.back().count--;
}
}
int EditionSetCount(const EditionSet &set) noexcept {
int count = 0;
for (const EditionCount &ec : set) {
count += ec.count;
}
return count;
}
}
void ChangeLog::PushDeletionAt(Sci::Position position, EditionCount ec) {
if (!deleteEdition.ValueAt(position)) {
deleteEdition.SetValueAt(position, std::make_unique<EditionSet>());
}
deleteEdition.ValueAt(position)->push_back(edition);
EditionSetPush(*deleteEdition.ValueAt(position), ec);
}
void ChangeLog::InsertFrontDeletionAt(Sci::Position position, int edition) {
void ChangeLog::InsertFrontDeletionAt(Sci::Position position, EditionCount ec) {
if (!deleteEdition.ValueAt(position)) {
deleteEdition.SetValueAt(position, std::make_unique<EditionSet>());
}
const EditionSetOwned &editions = deleteEdition.ValueAt(position);
editions->insert(editions->begin(), edition);
editions->insert(editions->begin(), ec);
}
void ChangeLog::SaveRange(Sci::Position position, Sci::Position length) {
@ -149,8 +218,8 @@ void ChangeLog::SaveRange(Sci::Position position, Sci::Position length) {
while (positionDeletion <= positionMax) {
const EditionSetOwned &editions = deleteEdition.ValueAt(positionDeletion);
if (editions) {
for (const int ed : *editions) {
changeStack.PushDeletion(positionDeletion, ed);
for (const EditionCount &ec : *editions) {
changeStack.PushDeletion(positionDeletion, ec);
}
}
positionDeletion = deleteEdition.PositionNext(positionDeletion);
@ -164,17 +233,25 @@ void ChangeLog::PopDeletion(Sci::Position position, Sci::Position deleteLength)
deleteEdition.SetValueAt(position, std::move(eso));
const EditionSetOwned &editions = deleteEdition.ValueAt(position);
assert(editions);
editions->pop_back();
const size_t inserts = changeStack.PopStep();
for (size_t i = 0; i < inserts; i++) {
const InsertionSpan span = changeStack.PopSpan();
if (span.direction == InsertionSpan::Direction::insertion) {
EditionSetPop(*editions);
const int inserts = changeStack.PopStep();
for (int i = 0; i < inserts;) {
const ChangeSpan span = changeStack.PopSpan(inserts);
if (span.direction == ChangeSpan::Direction::insertion) {
assert(span.count == 1); // Insertions are never compressed
insertEdition.FillRange(span.start, span.edition, span.length);
i++;
} else {
assert(editions);
assert(editions->back() == span.edition);
editions->pop_back();
InsertFrontDeletionAt(span.start, span.edition);
assert(editions->back().edition == span.edition);
for (int j = 0; j < span.count; j++) {
EditionSetPop(*editions);
}
// Iterating backwards (pop) through changeStack, reverse order of insertion
// and original deletion list.
// Therefore need to insert at front to recreate original order.
InsertFrontDeletionAt(span.start, { span.edition, span.count });
i += span.count;
}
}
@ -213,9 +290,9 @@ void ChangeLog::SetSavePoint() {
for (Sci::Position positionDeletion = 0; positionDeletion <= length;) {
const EditionSetOwned &editions = deleteEdition.ValueAt(positionDeletion);
if (editions) {
for (int &ed : *editions) {
if (ed == changeModified) {
ed = changeSaved;
for (EditionCount &ec : *editions) {
if (ec.edition == changeModified) {
ec.edition = changeSaved;
}
}
}
@ -233,7 +310,7 @@ size_t ChangeLog::DeletionCount(Sci::Position start, Sci::Position length) const
while (start <= end) {
const EditionSetOwned &editions = deleteEdition.ValueAt(start);
if (editions) {
count += editions->size();
count += EditionSetCount(*editions);
}
start = deleteEdition.PositionNext(start);
}
@ -242,6 +319,7 @@ size_t ChangeLog::DeletionCount(Sci::Position start, Sci::Position length) const
void ChangeLog::Check() const noexcept {
assert(insertEdition.Length() == deleteEdition.Length());
changeStack.Check();
}
ChangeHistory::ChangeHistory(Sci::Position length) {
@ -270,7 +348,7 @@ void ChangeHistory::DeleteRange(Sci::Position position, Sci::Position deleteLeng
if (changeLogReversions) {
changeLogReversions->DeleteRangeSavingHistory(position, deleteLength);
if (reverting) {
changeLogReversions->PushDeletionAt(position, 1);
changeLogReversions->PushDeletionAt(position, { changeRevertedOriginal, 1 });
}
}
Check();
@ -278,7 +356,7 @@ void ChangeHistory::DeleteRange(Sci::Position position, Sci::Position deleteLeng
void ChangeHistory::DeleteRangeSavingHistory(Sci::Position position, Sci::Position deleteLength, bool beforeSave, bool isDetached) {
changeLog.DeleteRangeSavingHistory(position, deleteLength);
changeLog.PushDeletionAt(position, beforeSave ? changeSaved : changeModified);
changeLog.PushDeletionAt(position, { beforeSave ? changeSaved : changeModified, 1 });
if (changeLogReversions) {
if (isDetached) {
changeLogReversions->SaveHistoryForDelete(position, deleteLength);
@ -332,7 +410,7 @@ void ChangeHistory::EditionCreateHistory(Sci::Position start, Sci::Position leng
if (length) {
changeLog.insertEdition.FillRange(start, historicEpoch, length);
} else {
changeLog.PushDeletionAt(start, historicEpoch);
changeLog.PushDeletionAt(start, { historicEpoch, 1 });
}
}
}
@ -349,9 +427,9 @@ int ChangeHistory::EditionAt(Sci::Position pos) const noexcept {
if (changeLogReversions) {
const int editionReversion = changeLogReversions->insertEdition.ValueAt(pos);
if (editionReversion) {
if (edition < 0)
return 1;
return edition ? 4 : 1;
if (edition < 0) // Historical revision
return changeRevertedOriginal;
return edition ? changeRevertedToChange : changeRevertedOriginal;
}
}
return edition;
@ -372,8 +450,8 @@ unsigned int ChangeHistory::EditionDeletesAt(Sci::Position pos) const noexcept {
unsigned int editionSet = 0;
const EditionSetOwned &editionSetDeletions = changeLog.deleteEdition.ValueAt(pos);
if (editionSetDeletions) {
for (const unsigned int ed : *editionSetDeletions) {
editionSet = editionSet | (1u << (ed-1));
for (const EditionCount &ec : *editionSetDeletions) {
editionSet = editionSet | (1u << (ec.edition-1));
}
}
if (changeLogReversions) {

View File

@ -22,27 +22,39 @@ constexpr unsigned int bitSaved = 2;
constexpr unsigned int bitModified = 4;
constexpr unsigned int bitRevertedToModified = 8;
struct InsertionSpan {
struct ChangeSpan {
Sci::Position start;
Sci::Position length;
int edition;
int count;
enum class Direction { insertion, deletion } direction;
};
using EditionSet = std::vector<int>;
struct EditionCount {
int edition;
int count;
// Used in tests.
constexpr bool operator==(const EditionCount &other) const noexcept {
return (edition == other.edition) && (count == other.count);
}
};
// EditionSet is ordered from oldest to newest, its not really a set
using EditionSet = std::vector<EditionCount>;
using EditionSetOwned = std::unique_ptr<EditionSet>;
class ChangeStack {
std::vector<size_t> steps;
std::vector<InsertionSpan> insertions;
std::vector<int> steps;
std::vector<ChangeSpan> changes;
public:
void Clear() noexcept;
void AddStep();
void PushDeletion(Sci::Position positionDeletion, int edition);
void PushDeletion(Sci::Position positionDeletion, const EditionCount &ec);
void PushInsertion(Sci::Position positionInsertion, Sci::Position length, int edition);
[[nodiscard]] size_t PopStep() noexcept;
[[nodiscard]] InsertionSpan PopSpan() noexcept;
[[nodiscard]] int PopStep() noexcept;
[[nodiscard]] ChangeSpan PopSpan(int maxSteps) noexcept;
void SetSavePoint() noexcept;
void Check() const noexcept;
};
struct ChangeLog {
@ -55,8 +67,8 @@ struct ChangeLog {
void DeleteRange(Sci::Position position, Sci::Position deleteLength);
void Insert(Sci::Position start, Sci::Position length, int edition);
void CollapseRange(Sci::Position position, Sci::Position deleteLength);
void PushDeletionAt(Sci::Position position, int edition);
void InsertFrontDeletionAt(Sci::Position position, int edition);
void PushDeletionAt(Sci::Position position, EditionCount ec);
void InsertFrontDeletionAt(Sci::Position position, EditionCount ec);
void SaveRange(Sci::Position position, Sci::Position length);
void PopDeletion(Sci::Position position, Sci::Position deleteLength);
void SaveHistoryForDelete(Sci::Position position, Sci::Position deleteLength);

View File

@ -22,7 +22,7 @@ namespace {
const int catRanges[] = {
//++Autogenerated -- start of section automatically generated
// Created with Python 3.11.0, Unicode 14.0.0
// Created with Python 3.12.0, Unicode 15.0.0
25,
1046,
1073,
@ -1051,7 +1051,8 @@ const int catRanges[] = {
105672,
106013,
106020,
106109,
106086,
106141,
106501,
106566,
106628,
@ -1143,7 +1144,7 @@ const int catRanges[] = {
121027,
121085,
121093,
121309,
121341,
121352,
121693,
121732,
@ -3126,6 +3127,7 @@ const int catRanges[] = {
2217437,
2217476,
2217565,
2219941,
2220036,
2220970,
2221284,
@ -3224,7 +3226,9 @@ const int catRanges[] = {
2246341,
2246417,
2246597,
2246653,
2246628,
2246693,
2246749,
2248708,
2248957,
2248964,
@ -3438,6 +3442,8 @@ const int catRanges[] = {
2315389,
2315780,
2318141,
2318353,
2318685,
2326532,
2326845,
2326852,
@ -3504,6 +3510,22 @@ const int catRanges[] = {
2350758,
2350833,
2350909,
2351109,
2351172,
2351206,
2351236,
2351677,
2351684,
2352774,
2352837,
2353021,
2353094,
2353157,
2353190,
2353221,
2353265,
2353672,
2354013,
2356740,
2356797,
2357258,
@ -3524,9 +3546,11 @@ const int catRanges[] = {
2489905,
2489981,
2490372,
2524669,
2524698,
2524989,
2525189,
2525220,
2525413,
2525917,
2654212,
2672893,
2949124,
@ -3596,8 +3620,12 @@ const int catRanges[] = {
3538941,
3538948,
3548285,
3548740,
3548797,
3549700,
3549821,
3549860,
3549917,
3550340,
3550493,
3550724,
@ -3642,6 +3670,8 @@ const int catRanges[] = {
3819589,
3819701,
3819741,
3823626,
3824285,
3824650,
3825309,
3825685,
@ -3757,6 +3787,8 @@ const int catRanges[] = {
3924292,
3924321,
3924989,
3925153,
3925373,
3932165,
3932413,
3932421,
@ -3767,6 +3799,10 @@ const int catRanges[] = {
3933373,
3933381,
3933565,
3933699,
3935709,
3936741,
3936797,
3940356,
3941821,
3941893,
@ -3786,6 +3822,11 @@ const int catRanges[] = {
3956573,
3956723,
3956765,
3971588,
3972451,
3972485,
3972616,
3972957,
3996676,
3996925,
3996932,
@ -3915,14 +3956,14 @@ const int catRanges[] = {
4095860,
4096021,
4119325,
4119477,
4119445,
4119997,
4120085,
4120509,
4120597,
4124317,
4124693,
4127549,
4124413,
4124533,
4127581,
4127765,
4128157,
4128277,
@ -3944,23 +3985,19 @@ const int catRanges[] = {
4148245,
4148701,
4148757,
4148925,
4149013,
4149181,
4149269,
4149501,
4149565,
4149781,
4150717,
4150805,
4151165,
4151317,
4151261,
4151285,
4151517,
4151829,
4152157,
4151765,
4152221,
4152341,
4152605,
4152637,
4152853,
4153085,
4153149,
4153365,
4158077,
4158101,
@ -3970,7 +4007,7 @@ const int catRanges[] = {
4194308,
5561373,
5562372,
5695293,
5695325,
5695492,
5702621,
5702660,
@ -3981,6 +4018,8 @@ const int catRanges[] = {
6243293,
6291460,
6449533,
6449668,
6583837,
29360186,
29360221,
29361178,

View File

@ -16,6 +16,7 @@
#include <string>
#include <string_view>
#include <vector>
#include <array>
#include <forward_list>
#include <optional>
#include <algorithm>
@ -452,35 +453,12 @@ Range Document::LineRange(Sci::Line line) const noexcept {
return {cb.LineStart(line), cb.LineStart(line + 1)};
}
bool Document::IsLineStartPosition(Sci::Position position) const {
return LineStart(LineFromPosition(position)) == position;
bool Document::IsLineStartPosition(Sci::Position position) const noexcept {
return LineStartPosition(position) == position;
}
Sci_Position SCI_METHOD Document::LineEnd(Sci_Position line) const {
if (line >= LinesTotal() - 1) {
return LineStart(line + 1);
} else {
Sci::Position position = LineStart(line + 1);
if (LineEndType::Unicode == cb.GetLineEndTypes()) {
const unsigned char bytes[] = {
cb.UCharAt(position-3),
cb.UCharAt(position-2),
cb.UCharAt(position-1),
};
if (UTF8IsSeparator(bytes)) {
return position - UTF8SeparatorLength;
}
if (UTF8IsNEL(bytes+1)) {
return position - UTF8NELLength;
}
}
position--; // Back over CR or LF
// When line terminator is CR+LF, may need to go back one more
if ((position > LineStart(line)) && (cb.CharAt(position - 1) == '\r')) {
position--;
}
return position;
}
return cb.LineEnd(line);
}
void SCI_METHOD Document::SetErrorStatus(int status) {
@ -499,16 +477,20 @@ Sci::Line Document::SciLineFromPosition(Sci::Position pos) const noexcept {
return cb.LineFromPosition(pos);
}
Sci::Position Document::LineEndPosition(Sci::Position position) const {
return LineEnd(LineFromPosition(position));
Sci::Position Document::LineStartPosition(Sci::Position position) const noexcept {
return cb.LineStart(cb.LineFromPosition(position));
}
bool Document::IsLineEndPosition(Sci::Position position) const {
return LineEnd(LineFromPosition(position)) == position;
Sci::Position Document::LineEndPosition(Sci::Position position) const noexcept {
return cb.LineEnd(cb.LineFromPosition(position));
}
bool Document::IsPositionInLineEnd(Sci::Position position) const {
return position >= LineEnd(LineFromPosition(position));
bool Document::IsLineEndPosition(Sci::Position position) const noexcept {
return LineEndPosition(position) == position;
}
bool Document::IsPositionInLineEnd(Sci::Position position) const noexcept {
return position >= LineEndPosition(position);
}
Sci::Position Document::VCHomePosition(Sci::Position position) const {
@ -789,7 +771,7 @@ Sci::Position Document::MovePositionOutsideChar(Sci::Position pos, Sci::Position
} else {
// Anchor DBCS calculations at start of line because start of line can
// not be a DBCS trail byte.
const Sci::Position posStartLine = cb.LineStart(cb.LineFromPosition(pos));
const Sci::Position posStartLine = LineStartPosition(pos);
if (pos == posStartLine)
return pos;
@ -872,7 +854,7 @@ Sci::Position Document::NextPosition(Sci::Position pos, int moveDir) const noexc
} else {
// Anchor DBCS calculations at start of line because start of line can
// not be a DBCS trail byte.
const Sci::Position posStartLine = cb.LineStart(cb.LineFromPosition(pos));
const Sci::Position posStartLine = LineStartPosition(pos);
// See http://msdn.microsoft.com/en-us/library/cc194792%28v=MSDN.10%29.aspx
// http://msdn.microsoft.com/en-us/library/cc194790.aspx
if ((pos - 1) <= posStartLine) {
@ -3101,7 +3083,7 @@ public:
#endif
std::regex_constants::match_flag_type MatchFlags(const Document *doc, Sci::Position startPos, Sci::Position endPos) {
std::regex_constants::match_flag_type MatchFlags(const Document *doc, Sci::Position startPos, Sci::Position endPos) noexcept {
std::regex_constants::match_flag_type flagsMatch = std::regex_constants::match_default;
if (!doc->IsLineStartPosition(startPos))
flagsMatch |= std::regex_constants::match_not_bol;
@ -3161,11 +3143,6 @@ bool MatchOnLines(const Document *doc, const Regex &regexp, const RESearchRange
for (size_t co = 0; co < match.size() && co < RESearch::MAXTAG; co++) {
search.bopat[co] = match[co].first.Pos();
search.eopat[co] = match[co].second.PosRoundUp();
const Sci::Position lenMatch = search.eopat[co] - search.bopat[co];
search.pat[co].resize(lenMatch);
for (Sci::Position iPos = 0; iPos < lenMatch; iPos++) {
search.pat[co][iPos] = doc->CharAt(iPos + search.bopat[co]);
}
}
}
return matched;
@ -3293,7 +3270,11 @@ Sci::Position BuiltinRegex::FindText(Document *doc, Sci::Position minPos, Sci::P
if ((resr.increment == -1) && !searchforLineStart) {
// Check for the last match on this line.
int repetitions = 1000; // Break out of infinite loop
RESearch::MatchPositions bopat{};
RESearch::MatchPositions eopat{};
while (success && (search.eopat[0] <= endOfLine) && (repetitions--)) {
bopat = search.bopat;
eopat = search.eopat;
success = search.Execute(di, pos+1, endOfLine);
if (success) {
if (search.eopat[0] <= minPos) {
@ -3304,6 +3285,10 @@ Sci::Position BuiltinRegex::FindText(Document *doc, Sci::Position minPos, Sci::P
}
}
}
if (!success) {
search.bopat = bopat;
search.eopat = eopat;
}
}
break;
}
@ -3314,19 +3299,20 @@ Sci::Position BuiltinRegex::FindText(Document *doc, Sci::Position minPos, Sci::P
const char *BuiltinRegex::SubstituteByPosition(Document *doc, const char *text, Sci::Position *length) {
substituted.clear();
const DocumentIndexer di(doc, doc->Length());
search.GrabMatches(di);
for (Sci::Position j = 0; j < *length; j++) {
if (text[j] == '\\') {
if (text[j + 1] >= '0' && text[j + 1] <= '9') {
const unsigned int patNum = text[j + 1] - '0';
const Sci::Position len = search.eopat[patNum] - search.bopat[patNum];
if (!search.pat[patNum].empty()) // Will be null if try for a match that did not occur
substituted.append(search.pat[patNum].c_str(), len);
j++;
const char chNext = text[++j];
if (chNext >= '0' && chNext <= '9') {
const unsigned int patNum = chNext - '0';
const Sci::Position startPos = search.bopat[patNum];
const Sci::Position len = search.eopat[patNum] - startPos;
if (len > 0) { // Will be null if try for a match that did not occur
const size_t size = substituted.length();
substituted.resize(size + len);
doc->GetCharRange(substituted.data() + size, startPos, len);
}
} else {
j++;
switch (text[j]) {
switch (chNext) {
case 'a':
substituted.push_back('\a');
break;

View File

@ -455,11 +455,12 @@ public:
int MarkerHandleFromLine(Sci::Line line, int which) const noexcept;
Sci_Position SCI_METHOD LineStart(Sci_Position line) const override;
[[nodiscard]] Range LineRange(Sci::Line line) const noexcept;
bool IsLineStartPosition(Sci::Position position) const;
bool IsLineStartPosition(Sci::Position position) const noexcept;
Sci_Position SCI_METHOD LineEnd(Sci_Position line) const override;
Sci::Position LineEndPosition(Sci::Position position) const;
bool IsLineEndPosition(Sci::Position position) const;
bool IsPositionInLineEnd(Sci::Position position) const;
Sci::Position LineStartPosition(Sci::Position position) const noexcept;
Sci::Position LineEndPosition(Sci::Position position) const noexcept;
bool IsLineEndPosition(Sci::Position position) const noexcept;
bool IsPositionInLineEnd(Sci::Position position) const noexcept;
Sci::Position VCHomePosition(Sci::Position position) const;
Sci::Position IndexLineStart(Sci::Line line, Scintilla::LineCharacterIndexType lineCharacterIndex) const noexcept;
Sci::Line LineFromPositionIndex(Sci::Position pos, Scintilla::LineCharacterIndexType lineCharacterIndex) const noexcept;

View File

@ -831,13 +831,13 @@ Sci::Position EditView::StartEndDisplayLine(Surface *surface, const EditModel &m
namespace {
constexpr ColourRGBA bugColour = ColourRGBA(0xff, 0, 0xfe, 0xf0);
constexpr ColourRGBA colourBug(0xff, 0, 0xfe, 0xf0);
// Selection background colours are always defined, the value_or is to show if bug
ColourRGBA SelectionBackground(const EditModel &model, const ViewStyle &vsDraw, InSelection inSelection) {
if (inSelection == InSelection::inNone)
return bugColour; // Not selected is a bug
return colourBug; // Not selected is a bug
Element element = Element::SelectionBack;
if (inSelection == InSelection::inAdditional)
@ -846,7 +846,7 @@ ColourRGBA SelectionBackground(const EditModel &model, const ViewStyle &vsDraw,
element = Element::SelectionSecondaryBack;
if (!model.hasFocus && vsDraw.ElementColour(Element::SelectionInactiveBack))
element = Element::SelectionInactiveBack;
return vsDraw.ElementColour(element).value_or(bugColour);
return vsDraw.ElementColour(element).value_or(colourBug);
}
ColourOptional SelectionForeground(const EditModel &model, const ViewStyle &vsDraw, InSelection inSelection) {
@ -1411,9 +1411,9 @@ void EditView::DrawAnnotation(Surface *surface, const EditModel &model, const Vi
}
}
} else {
// No annotation to draw so show bug with bugColour
// No annotation to draw so show bug with colourBug
if (FlagSet(phase, DrawPhase::back)) {
surface->FillRectangle(rcSegment, bugColour.Opaque());
surface->FillRectangle(rcSegment, colourBug.Opaque());
}
}
}
@ -2093,7 +2093,7 @@ ColourRGBA InvertedLight(ColourRGBA orig) noexcept {
const unsigned int l = (r + g + b) / 3; // There is a better calculation for this that matches human eye
const unsigned int il = 0xff - l;
if (l == 0)
return ColourRGBA(0xff, 0xff, 0xff);
return white;
r = r * il / l;
g = g * il / l;
b = b * il / l;
@ -2714,15 +2714,15 @@ Sci::Position EditView::FormatRange(bool draw, CharacterRangeFull chrg, Rectangl
it->fore = InvertedLight(it->fore);
it->back = InvertedLight(it->back);
} else if (colourMode == PrintOption::BlackOnWhite) {
it->fore = ColourRGBA(0, 0, 0);
it->back = ColourRGBA(0xff, 0xff, 0xff);
it->fore = black;
it->back = white;
} else if (colourMode == PrintOption::ColourOnWhite || colourMode == PrintOption::ColourOnWhiteDefaultBG) {
it->back = ColourRGBA(0xff, 0xff, 0xff);
it->back = white;
}
}
// White background for the line numbers if PrintOption::ScreenColours isn't used
if (colourMode != PrintOption::ScreenColours) {
vsPrint.styles[StyleLineNumber].back = ColourRGBA(0xff, 0xff, 0xff);
vsPrint.styles[StyleLineNumber].back = white;
}
// Printing uses different margins, so reset screen margins

View File

@ -623,15 +623,11 @@ void Editor::InvalidateWholeSelection() {
at the beginning and end of the region lines. */
SelectionRange Editor::LineSelectionRange(SelectionPosition currentPos_, SelectionPosition anchor_) const {
if (currentPos_ > anchor_) {
anchor_ = SelectionPosition(
pdoc->LineStart(pdoc->LineFromPosition(anchor_.Position())));
currentPos_ = SelectionPosition(
pdoc->LineEnd(pdoc->LineFromPosition(currentPos_.Position())));
anchor_ = SelectionPosition(pdoc->LineStartPosition(anchor_.Position()));
currentPos_ = SelectionPosition(pdoc->LineEndPosition(currentPos_.Position()));
} else {
currentPos_ = SelectionPosition(
pdoc->LineStart(pdoc->LineFromPosition(currentPos_.Position())));
anchor_ = SelectionPosition(
pdoc->LineEnd(pdoc->LineFromPosition(anchor_.Position())));
currentPos_ = SelectionPosition(pdoc->LineStartPosition(currentPos_.Position()));
anchor_ = SelectionPosition(pdoc->LineEndPosition(anchor_.Position()));
}
return SelectionRange(currentPos_, anchor_);
}
@ -984,7 +980,10 @@ void Editor::VerticalCentreCaret() {
void Editor::MoveSelectedLines(int lineDelta) {
if (sel.IsRectangular()) {
return;
// Convert to stream selection
const SelectionRange rangeRectangular = sel.Rectangular();
sel.Clear();
sel.SetSelection(rangeRectangular);
}
// if selection doesn't start at the beginning of the line, set the new start
@ -2194,8 +2193,7 @@ void Editor::InsertPasteShape(const char *text, Sci::Position len, PasteShape sh
PasteRectangular(sel.Start(), text, len);
} else {
if (shape == PasteShape::line) {
const Sci::Position insertPos =
pdoc->LineStart(pdoc->LineFromPosition(sel.MainCaret()));
const Sci::Position insertPos = pdoc->LineStartPosition(sel.MainCaret());
Sci::Position lengthInserted = pdoc->InsertString(insertPos, text, len);
// add the newline if necessary
if ((len > 0) && (text[len - 1] != '\n' && text[len - 1] != '\r')) {
@ -3447,6 +3445,14 @@ constexpr bool IsRectExtend(Message iMessage, bool isRectMoveExtends) noexcept {
}
Sci::Position Editor::HomeWrapPosition(Sci::Position position) {
const Sci::Position viewLineStart = StartEndDisplayLine(position, true);
const Sci::Position homePos = MovePositionSoVisible(viewLineStart, -1).Position();
if (position <= homePos)
return pdoc->LineStartPosition(position);
return homePos;
}
Sci::Position Editor::VCHomeDisplayPosition(Sci::Position position) {
const Sci::Position homePos = pdoc->VCHomePosition(position);
const Sci::Position viewLineStart = StartEndDisplayLine(position, true);
@ -3475,6 +3481,125 @@ Sci::Position Editor::LineEndWrapPosition(Sci::Position position) {
return endPos;
}
SelectionPosition Editor::PositionMove(Message iMessage, SelectionPosition spCaret) {
switch (iMessage) {
case Message::CharLeft:
case Message::CharLeftExtend:
if (spCaret.VirtualSpace()) {
spCaret.AddVirtualSpace(-1);
} else if (!FlagSet(virtualSpaceOptions, VirtualSpace::NoWrapLineStart) || pdoc->GetColumn(spCaret.Position()) > 0) {
spCaret.Add(-1);
}
return spCaret;
case Message::CharRight:
case Message::CharRightExtend:
if (FlagSet(virtualSpaceOptions, VirtualSpace::UserAccessible) && pdoc->IsLineEndPosition(spCaret.Position())) {
spCaret.AddVirtualSpace(1);
} else {
spCaret.Add(1);
}
return spCaret;
case Message::WordLeft:
case Message::WordLeftExtend:
return SelectionPosition(pdoc->NextWordStart(spCaret.Position(), -1));
case Message::WordRight:
case Message::WordRightExtend:
return SelectionPosition(pdoc->NextWordStart(spCaret.Position(), 1));
case Message::WordLeftEnd:
case Message::WordLeftEndExtend:
return SelectionPosition(pdoc->NextWordEnd(spCaret.Position(), -1));
case Message::WordRightEnd:
case Message::WordRightEndExtend:
return SelectionPosition(pdoc->NextWordEnd(spCaret.Position(), 1));
case Message::WordPartLeft:
case Message::WordPartLeftExtend:
return SelectionPosition(pdoc->WordPartLeft(spCaret.Position()));
case Message::WordPartRight:
case Message::WordPartRightExtend:
return SelectionPosition(pdoc->WordPartRight(spCaret.Position()));
case Message::Home:
case Message::HomeExtend:
return SelectionPosition(pdoc->LineStartPosition(spCaret.Position()));
case Message::HomeDisplay:
case Message::HomeDisplayExtend:
return SelectionPosition(StartEndDisplayLine(spCaret.Position(), true));
case Message::HomeWrap:
case Message::HomeWrapExtend:
return SelectionPosition(HomeWrapPosition(spCaret.Position()));
case Message::VCHome:
case Message::VCHomeExtend:
// VCHome alternates between beginning of line and beginning of text so may move back or forwards
return SelectionPosition(pdoc->VCHomePosition(spCaret.Position()));
case Message::VCHomeDisplay:
case Message::VCHomeDisplayExtend:
return SelectionPosition(VCHomeDisplayPosition(spCaret.Position()));
case Message::VCHomeWrap:
case Message::VCHomeWrapExtend:
return SelectionPosition(VCHomeWrapPosition(spCaret.Position()));
case Message::LineEnd:
case Message::LineEndExtend:
return SelectionPosition(pdoc->LineEndPosition(spCaret.Position()));
case Message::LineEndDisplay:
case Message::LineEndDisplayExtend:
return SelectionPosition(StartEndDisplayLine(spCaret.Position(), false));
case Message::LineEndWrap:
case Message::LineEndWrapExtend:
return SelectionPosition(LineEndWrapPosition(spCaret.Position()));
default:
break;
}
// Above switch should be exhaustive so this will never be reached.
PLATFORM_ASSERT(false);
return spCaret;
}
SelectionRange Editor::SelectionMove(Scintilla::Message iMessage, size_t r) {
const SelectionPosition spCaretStart = sel.Range(r).caret;
const SelectionPosition spCaretMoved = PositionMove(iMessage, spCaretStart);
const int directionMove = (spCaretMoved < spCaretStart) ? -1 : 1;
const SelectionPosition spCaret = MovePositionSoVisible(spCaretMoved, directionMove);
// Handle move versus extend, and special behaviour for non-empty left/right
switch (iMessage) {
case Message::CharLeft:
case Message::CharRight:
if (sel.Range(r).Empty()) {
return SelectionRange(spCaret);
}
if (iMessage == Message::CharLeft) {
return SelectionRange(sel.Range(r).Start());
}
return SelectionRange(sel.Range(r).End());
case Message::WordLeft:
case Message::WordRight:
case Message::WordLeftEnd:
case Message::WordRightEnd:
case Message::WordPartLeft:
case Message::WordPartRight:
case Message::Home:
case Message::HomeDisplay:
case Message::HomeWrap:
case Message::VCHome:
case Message::VCHomeDisplay:
case Message::VCHomeWrap:
case Message::LineEnd:
case Message::LineEndDisplay:
case Message::LineEndWrap:
return SelectionRange(spCaret);
default:
break;
}
// All remaining cases are *Extend
const SelectionRange rangeNew = SelectionRange(spCaret, sel.Range(r).anchor);
sel.TrimOtherSelections(r, rangeNew);
return rangeNew;
}
int Editor::HorizontalMove(Message iMessage) {
if (sel.selType == Selection::SelTypes::lines) {
return 0; // horizontal moves with line selection have no effect
@ -3517,8 +3642,7 @@ int Editor::HorizontalMove(Message iMessage) {
break;
case Message::HomeRectExtend:
case Message::HomeExtend: // only when sel.IsRectangular() && sel.MoveExtends()
spCaret = SelectionPosition(
pdoc->LineStart(pdoc->LineFromPosition(spCaret.Position())));
spCaret = SelectionPosition(pdoc->LineStartPosition(spCaret.Position()));
break;
case Message::VCHomeRectExtend:
case Message::VCHomeExtend: // only when sel.IsRectangular() && sel.MoveExtends()
@ -3541,8 +3665,7 @@ int Editor::HorizontalMove(Message iMessage) {
SelectionPosition selAtLimit = (NaturalDirection(iMessage) > 0) ? sel.Limits().end : sel.Limits().start;
switch (iMessage) {
case Message::Home:
selAtLimit = SelectionPosition(
pdoc->LineStart(pdoc->LineFromPosition(selAtLimit.Position())));
selAtLimit = SelectionPosition(pdoc->LineStartPosition(selAtLimit.Position()));
break;
case Message::VCHome:
selAtLimit = SelectionPosition(pdoc->VCHomePosition(selAtLimit.Position()));
@ -3561,154 +3684,7 @@ int Editor::HorizontalMove(Message iMessage) {
sel.DropAdditionalRanges();
}
for (size_t r = 0; r < sel.Count(); r++) {
const SelectionPosition spCaretNow = sel.Range(r).caret;
SelectionPosition spCaret = spCaretNow;
switch (iMessage) {
case Message::CharLeft:
case Message::CharLeftExtend:
if (spCaret.VirtualSpace()) {
spCaret.SetVirtualSpace(spCaret.VirtualSpace() - 1);
} else if (!FlagSet(virtualSpaceOptions, VirtualSpace::NoWrapLineStart) || pdoc->GetColumn(spCaret.Position()) > 0) {
spCaret = SelectionPosition(spCaret.Position() - 1);
}
break;
case Message::CharRight:
case Message::CharRightExtend:
if (FlagSet(virtualSpaceOptions, VirtualSpace::UserAccessible) && pdoc->IsLineEndPosition(spCaret.Position())) {
spCaret.SetVirtualSpace(spCaret.VirtualSpace() + 1);
} else {
spCaret = SelectionPosition(spCaret.Position() + 1);
}
break;
case Message::WordLeft:
case Message::WordLeftExtend:
spCaret = SelectionPosition(pdoc->NextWordStart(spCaret.Position(), -1));
break;
case Message::WordRight:
case Message::WordRightExtend:
spCaret = SelectionPosition(pdoc->NextWordStart(spCaret.Position(), 1));
break;
case Message::WordLeftEnd:
case Message::WordLeftEndExtend:
spCaret = SelectionPosition(pdoc->NextWordEnd(spCaret.Position(), -1));
break;
case Message::WordRightEnd:
case Message::WordRightEndExtend:
spCaret = SelectionPosition(pdoc->NextWordEnd(spCaret.Position(), 1));
break;
case Message::WordPartLeft:
case Message::WordPartLeftExtend:
spCaret = SelectionPosition(pdoc->WordPartLeft(spCaret.Position()));
break;
case Message::WordPartRight:
case Message::WordPartRightExtend:
spCaret = SelectionPosition(pdoc->WordPartRight(spCaret.Position()));
break;
case Message::Home:
case Message::HomeExtend:
spCaret = SelectionPosition(
pdoc->LineStart(pdoc->LineFromPosition(spCaret.Position())));
break;
case Message::HomeDisplay:
case Message::HomeDisplayExtend:
spCaret = SelectionPosition(StartEndDisplayLine(spCaret.Position(), true));
break;
case Message::HomeWrap:
case Message::HomeWrapExtend:
spCaret = MovePositionSoVisible(StartEndDisplayLine(spCaret.Position(), true), -1);
if (spCaretNow <= spCaret)
spCaret = SelectionPosition(
pdoc->LineStart(pdoc->LineFromPosition(spCaret.Position())));
break;
case Message::VCHome:
case Message::VCHomeExtend:
// VCHome alternates between beginning of line and beginning of text so may move back or forwards
spCaret = SelectionPosition(pdoc->VCHomePosition(spCaret.Position()));
break;
case Message::VCHomeDisplay:
case Message::VCHomeDisplayExtend:
spCaret = SelectionPosition(VCHomeDisplayPosition(spCaret.Position()));
break;
case Message::VCHomeWrap:
case Message::VCHomeWrapExtend:
spCaret = SelectionPosition(VCHomeWrapPosition(spCaret.Position()));
break;
case Message::LineEnd:
case Message::LineEndExtend:
spCaret = SelectionPosition(pdoc->LineEndPosition(spCaret.Position()));
break;
case Message::LineEndDisplay:
case Message::LineEndDisplayExtend:
spCaret = SelectionPosition(StartEndDisplayLine(spCaret.Position(), false));
break;
case Message::LineEndWrap:
case Message::LineEndWrapExtend:
spCaret = SelectionPosition(LineEndWrapPosition(spCaret.Position()));
break;
default:
PLATFORM_ASSERT(false);
}
const int directionMove = (spCaret < spCaretNow) ? -1 : 1;
spCaret = MovePositionSoVisible(spCaret, directionMove);
// Handle move versus extend, and special behaviour for non-empty left/right
switch (iMessage) {
case Message::CharLeft:
case Message::CharRight:
if (sel.Range(r).Empty()) {
sel.Range(r) = SelectionRange(spCaret);
} else {
sel.Range(r) = SelectionRange(
(iMessage == Message::CharLeft) ? sel.Range(r).Start() : sel.Range(r).End());
}
break;
case Message::WordLeft:
case Message::WordRight:
case Message::WordLeftEnd:
case Message::WordRightEnd:
case Message::WordPartLeft:
case Message::WordPartRight:
case Message::Home:
case Message::HomeDisplay:
case Message::HomeWrap:
case Message::VCHome:
case Message::VCHomeDisplay:
case Message::VCHomeWrap:
case Message::LineEnd:
case Message::LineEndDisplay:
case Message::LineEndWrap:
sel.Range(r) = SelectionRange(spCaret);
break;
case Message::CharLeftExtend:
case Message::CharRightExtend:
case Message::WordLeftExtend:
case Message::WordRightExtend:
case Message::WordLeftEndExtend:
case Message::WordRightEndExtend:
case Message::WordPartLeftExtend:
case Message::WordPartRightExtend:
case Message::HomeExtend:
case Message::HomeDisplayExtend:
case Message::HomeWrapExtend:
case Message::VCHomeExtend:
case Message::VCHomeDisplayExtend:
case Message::VCHomeWrapExtend:
case Message::LineEndExtend:
case Message::LineEndDisplayExtend:
case Message::LineEndWrapExtend: {
SelectionRange rangeNew = SelectionRange(spCaret, sel.Range(r).anchor);
sel.TrimOtherSelections(r, SelectionRange(rangeNew));
sel.Range(r) = rangeNew;
}
break;
default:
PLATFORM_ASSERT(false);
}
sel.Range(r) = SelectionMove(iMessage, r);
}
}
@ -3768,7 +3744,7 @@ int Editor::DelWordOrLine(Message iMessage) {
break;
case Message::DelLineLeft:
rangeDelete = Range(
pdoc->LineStart(pdoc->LineFromPosition(sel.Range(r).caret.Position())),
pdoc->LineStartPosition(sel.Range(r).caret.Position()),
sel.Range(r).caret.Position());
break;
case Message::DelLineRight:
@ -4610,7 +4586,7 @@ void Editor::WordSelection(Sci::Position pos) {
// Extend forward to the word containing the character to the left of pos.
// Skip ExtendWordSelect if the line is empty or if pos is the first position on the line.
// This ensures that a series of empty lines isn't counted as a single "word".
if (pos > pdoc->LineStart(pdoc->LineFromPosition(pos)))
if (pos > pdoc->LineStartPosition(pos))
pos = pdoc->ExtendWordSelect(pdoc->MovePositionOutsideChar(pos - 1, -1), 1);
TrimAndSetSelection(pos, wordSelectAnchorStartPos);
} else {
@ -4724,7 +4700,7 @@ void Editor::ButtonDownWithModifiers(Point pt, unsigned int curTime, KeyMod modi
} else {
// Selecting backwards, or anchor beyond last character on line. In these cases,
// we select the word containing the character to the *left* of the anchor.
if (charPos > pdoc->LineStart(pdoc->LineFromPosition(charPos))) {
if (charPos > pdoc->LineStartPosition(charPos)) {
startWord = pdoc->ExtendWordSelect(charPos, -1);
endWord = pdoc->ExtendWordSelect(startWord, 1);
} else {

View File

@ -491,9 +491,12 @@ protected: // ScintillaBase subclass needs access to much of Editor
void ParaUpOrDown(int direction, Selection::SelTypes selt);
Range RangeDisplayLine(Sci::Line lineVisible);
Sci::Position StartEndDisplayLine(Sci::Position pos, bool start);
Sci::Position HomeWrapPosition(Sci::Position position);
Sci::Position VCHomeDisplayPosition(Sci::Position position);
Sci::Position VCHomeWrapPosition(Sci::Position position);
Sci::Position LineEndWrapPosition(Sci::Position position);
SelectionPosition PositionMove(Scintilla::Message iMessage, SelectionPosition spCaretNow);
SelectionRange SelectionMove(Scintilla::Message iMessage, size_t r);
int HorizontalMove(Scintilla::Message iMessage);
int DelWordOrLine(Scintilla::Message iMessage);
virtual int KeyCommand(Scintilla::Message iMessage);

View File

@ -170,15 +170,19 @@ PRectangle PixelAlignOutside(const PRectangle &rc, int pixelDivisions) noexcept;
/**
* Holds an RGBA colour with 8 bits for each component.
*/
constexpr const float componentMaximum = 255.0f;
constexpr float componentMaximum = 255.0F;
constexpr unsigned int maximumByte = 0xffU;
class ColourRGBA {
static constexpr float ComponentAsFloat(unsigned int component) {
return component / componentMaximum;
}
static constexpr int rgbMask = 0xffffff;
int co;
public:
constexpr explicit ColourRGBA(int co_ = 0) noexcept : co(co_) {
}
constexpr ColourRGBA(unsigned int red, unsigned int green, unsigned int blue, unsigned int alpha=0xff) noexcept :
constexpr ColourRGBA(unsigned int red, unsigned int green, unsigned int blue, unsigned int alpha= maximumByte) noexcept :
ColourRGBA(red | (green << 8) | (blue << 16) | (alpha << 24)) {
}
@ -187,11 +191,11 @@ public:
}
static constexpr ColourRGBA FromRGB(int co_) noexcept {
return ColourRGBA(co_ | (0xffu << 24));
return ColourRGBA(co_ | (maximumByte << 24));
}
static constexpr ColourRGBA FromIpRGB(intptr_t co_) noexcept {
return ColourRGBA((co_ & rgbMask) | (0xffu << 24));
return ColourRGBA((co_ & rgbMask) | (maximumByte << 24));
}
constexpr ColourRGBA WithoutAlpha() const noexcept {
@ -199,7 +203,7 @@ public:
}
constexpr ColourRGBA Opaque() const noexcept {
return ColourRGBA(co | (0xffu << 24));
return ColourRGBA(co | (maximumByte << 24));
}
constexpr int AsInteger() const noexcept {
@ -212,32 +216,32 @@ public:
// Red, green and blue values as bytes 0..255
constexpr unsigned char GetRed() const noexcept {
return co & 0xffU;
return co & maximumByte;
}
constexpr unsigned char GetGreen() const noexcept {
return (co >> 8) & 0xffU;
return (co >> 8) & maximumByte;
}
constexpr unsigned char GetBlue() const noexcept {
return (co >> 16) & 0xffU;
return (co >> 16) & maximumByte;
}
constexpr unsigned char GetAlpha() const noexcept {
// Use a temporary here to prevent a 'Wconversion' warning from GCC
const int shifted = co >> 24;
return shifted & 0xffU;
return shifted & maximumByte;
}
// Red, green, blue, and alpha values as float 0..1.0
constexpr float GetRedComponent() const noexcept {
return GetRed() / componentMaximum;
return ComponentAsFloat(GetRed());
}
constexpr float GetGreenComponent() const noexcept {
return GetGreen() / componentMaximum;
return ComponentAsFloat(GetGreen());
}
constexpr float GetBlueComponent() const noexcept {
return GetBlue() / componentMaximum;
return ComponentAsFloat(GetBlue());
}
constexpr float GetAlphaComponent() const noexcept {
return GetAlpha() / componentMaximum;
return ComponentAsFloat(GetAlpha());
}
constexpr bool operator==(const ColourRGBA &other) const noexcept {
@ -245,13 +249,16 @@ public:
}
constexpr bool IsOpaque() const noexcept {
return GetAlpha() == 0xff;
return GetAlpha() == maximumByte;
}
ColourRGBA MixedWith(ColourRGBA other) const noexcept;
ColourRGBA MixedWith(ColourRGBA other, double proportion) const noexcept;
};
constexpr ColourRGBA white(maximumByte, maximumByte, maximumByte);
constexpr ColourRGBA black(0x0, 0x0, 0x0);
/**
* Holds an RGBA colour and stroke width to stroke a shape.
*/

View File

@ -15,7 +15,7 @@ struct StyleAndColour {
ColourRGBA fore;
StyleAndColour() noexcept : style(Scintilla::IndicatorStyle::Plain), fore(0, 0, 0) {
}
StyleAndColour(Scintilla::IndicatorStyle style_, ColourRGBA fore_ = ColourRGBA(0, 0, 0)) noexcept : style(style_), fore(fore_) {
StyleAndColour(Scintilla::IndicatorStyle style_, ColourRGBA fore_ = black) noexcept : style(style_), fore(fore_) {
}
bool operator==(const StyleAndColour &other) const noexcept {
return (style == other.style) && (fore == other.fore);
@ -36,7 +36,7 @@ public:
XYPOSITION strokeWidth = 1.0f;
Indicator() noexcept : under(false), fillAlpha(30), outlineAlpha(50), attributes(Scintilla::IndicFlag::None) {
}
Indicator(Scintilla::IndicatorStyle style_, ColourRGBA fore_= ColourRGBA(0,0,0), bool under_=false, int fillAlpha_=30, int outlineAlpha_=50) noexcept :
Indicator(Scintilla::IndicatorStyle style_, ColourRGBA fore_= black, bool under_=false, int fillAlpha_=30, int outlineAlpha_=50) noexcept :
sacNormal(style_, fore_), sacHover(style_, fore_), under(under_), fillAlpha(fillAlpha_), outlineAlpha(outlineAlpha_), attributes(Scintilla::IndicFlag::None) {
}
void Draw(Surface *surface, const PRectangle &rc, const PRectangle &rcLine, const PRectangle &rcCharacter, State drawState, int value) const;

View File

@ -22,8 +22,8 @@ public:
enum class FoldPart { undefined, head, body, tail, headWithTail };
Scintilla::MarkerSymbol markType = Scintilla::MarkerSymbol::Circle;
ColourRGBA fore = ColourRGBA(0, 0, 0);
ColourRGBA back = ColourRGBA(0xff, 0xff, 0xff);
ColourRGBA fore = black;
ColourRGBA back = white;
ColourRGBA backSelected = ColourRGBA(0xff, 0x00, 0x00);
Scintilla::Layer layer = Scintilla::Layer::Base;
Scintilla::Alpha alpha = Scintilla::Alpha::NoAlpha;

View File

@ -138,7 +138,7 @@ void MarginView::RefreshPixMaps(Surface *surfaceWindow, const ViewStyle &vsDraw)
ColourRGBA colourFMFill = vsDraw.selbar;
ColourRGBA colourFMStripes = vsDraw.selbarlight;
if (!(vsDraw.selbarlight == ColourRGBA(0xff, 0xff, 0xff))) {
if (!(vsDraw.selbarlight == white)) {
// User has chosen an unusual chrome colour scheme so just use the highlight edge colour.
// (Typically, the highlight colour is white.)
colourFMFill = vsDraw.selbarlight;

View File

@ -205,6 +205,7 @@
#include <stdexcept>
#include <string>
#include <array>
#include <algorithm>
#include <iterator>
@ -260,23 +261,9 @@ RESearch::RESearch(CharClassify *charClassTable) {
Clear();
}
void RESearch::Clear() noexcept {
for (int i = 0; i < MAXTAG; i++) {
pat[i].clear();
bopat[i] = NOTFOUND;
eopat[i] = NOTFOUND;
}
}
void RESearch::GrabMatches(const CharacterIndexer &ci) {
for (unsigned int i = 0; i < MAXTAG; i++) {
if ((bopat[i] != NOTFOUND) && (eopat[i] != NOTFOUND)) {
const Sci::Position len = eopat[i] - bopat[i];
pat[i].resize(len);
for (Sci::Position j = 0; j < len; j++)
pat[i][j] = ci.CharAt(bopat[i] + j);
}
}
void RESearch::Clear() {
bopat.fill(NOTFOUND);
eopat.fill(NOTFOUND);
}
void RESearch::ChSet(unsigned char c) noexcept {

View File

@ -21,17 +21,16 @@ class RESearch {
public:
explicit RESearch(CharClassify *charClassTable);
// No dynamic allocation so default copy constructor and assignment operator are OK.
void Clear() noexcept;
void GrabMatches(const CharacterIndexer &ci);
void Clear();
const char *Compile(const char *pattern, Sci::Position length, bool caseSensitive, bool posix) noexcept;
int Execute(const CharacterIndexer &ci, Sci::Position lp, Sci::Position endp);
static constexpr int MAXTAG = 10;
static constexpr int NOTFOUND = -1;
Sci::Position bopat[MAXTAG];
Sci::Position eopat[MAXTAG];
std::string pat[MAXTAG];
using MatchPositions = std::array<Sci::Position, MAXTAG>;
MatchPositions bopat;
MatchPositions eopat;
private:

View File

@ -10,6 +10,10 @@
namespace Scintilla::Internal {
// For most platforms (not Cocoa) all IME indicators are drawn in same colour,
// blue, with different patterns.
constexpr ColourRGBA colourIME(0x0, 0x0, 0xffU);
class LexState;
/**
*/

View File

@ -49,6 +49,9 @@ public:
void Add(Sci::Position increment) noexcept {
position = position + increment;
}
void AddVirtualSpace(Sci::Position increment) noexcept {
SetVirtualSpace(virtualSpace + increment);
}
bool IsValid() const noexcept {
return position >= 0;
}

View File

@ -65,8 +65,8 @@ int DefaultFontSize() noexcept {
Style::Style(const char *fontName_) noexcept :
FontSpecification(fontName_, DefaultFontSize() * FontSizeMultiplier),
fore(0,0,0),
back(0xff, 0xff, 0xff),
fore(black),
back(white),
eolFilled(false),
underline(false),
caseForce(CaseForce::mixed),

View File

@ -186,10 +186,10 @@ ViewStyle::ViewStyle(size_t stylesSize_) :
controlCharWidth = 0;
selbar = Platform::Chrome();
selbarlight = Platform::ChromeHighlight();
styles[StyleLineNumber].fore = ColourRGBA(0, 0, 0);
styles[StyleLineNumber].fore = black;
styles[StyleLineNumber].back = Platform::Chrome();
elementBaseColours[Element::Caret] = ColourRGBA(0, 0, 0);
elementBaseColours[Element::Caret] = black;
elementBaseColours[Element::CaretAdditional] = ColourRGBA(0x7f, 0x7f, 0x7f);
elementAllowsTranslucent.insert({
Element::Caret,
@ -459,7 +459,7 @@ void ViewStyle::ClearStyles() {
styles[StyleLineNumber].back = Platform::Chrome();
// Set call tip fore/back to match the values previously set for call tips
styles[StyleCallTip].back = ColourRGBA(0xff, 0xff, 0xff);
styles[StyleCallTip].back = white;
styles[StyleCallTip].fore = ColourRGBA(0x80, 0x80, 0x80);
}
@ -622,8 +622,7 @@ ColourRGBA ViewStyle::ElementColourForced(Element element) const {
// This method avoids warnings for unwrapping potentially empty optionals from
// Visual C++ Code Analysis
const ColourOptional colour = ElementColour(element);
constexpr ColourRGBA opaqueBlack(0, 0, 0, 0xff);
return colour.value_or(opaqueBlack);
return colour.value_or(black);
}
bool ViewStyle::ElementAllowsTranslucent(Element element) const {

View File

@ -117,7 +117,7 @@ void XPM::Init(const char *const *linesForm) {
if (!linesForm)
return;
std::fill(colourCodeTable, std::end(colourCodeTable), ColourRGBA(0, 0, 0));
std::fill(colourCodeTable, std::end(colourCodeTable), black);
const char *line0 = linesForm[0];
width = atoi(line0);
line0 = NextField(line0);

File diff suppressed because it is too large Load Diff

View File

@ -72,6 +72,58 @@ TEST_CASE("CellBuffer") {
REQUIRE(!cb.CanRedo());
}
SECTION("LineEnds") {
// Check that various line ends produce correct result from LineEnd.
cb.SetLineEndTypes(LineEndType::Unicode);
bool startSequence = false;
{
// Unix \n
const char sText2[] = "Two\nLines";
const Sci::Position sLength2 = static_cast<Sci::Position>(strlen(sText2));
cb.InsertString(0, sText2, strlen(sText2), startSequence);
REQUIRE(3 == cb.LineEnd(0));
REQUIRE(sLength2 == cb.LineEnd(1));
cb.DeleteChars(0, sLength2, startSequence);
}
{
// Windows \r\n
const char sText2[] = "Two\r\nLines";
const Sci::Position sLength2 = static_cast<Sci::Position>(strlen(sText2));
cb.InsertString(0, sText2, sLength2, startSequence);
REQUIRE(3 == cb.LineEnd(0));
REQUIRE(sLength2 == cb.LineEnd(1));
cb.DeleteChars(0, sLength2, startSequence);
}
{
// Old macOS \r
const char sText2[] = "Two\rLines";
const Sci::Position sLength2 = static_cast<Sci::Position>(strlen(sText2));
cb.InsertString(0, sText2, strlen(sText2), startSequence);
REQUIRE(3 == cb.LineEnd(0));
REQUIRE(sLength2 == cb.LineEnd(1));
cb.DeleteChars(0, sLength2, startSequence);
}
{
// Unicode NEL is U+0085 \xc2\x85
const char sText2[] = "Two\xc2\x85Lines";
const Sci::Position sLength2 = static_cast<Sci::Position>(strlen(sText2));
cb.InsertString(0, sText2, sLength2, startSequence);
REQUIRE(3 == cb.LineEnd(0));
REQUIRE(sLength2 == cb.LineEnd(1));
cb.DeleteChars(0, sLength2, startSequence);
}
{
// Unicode LS line separator is U+2028 \xe2\x80\xa8
const char sText2[] = "Two\xe2\x80\xa8Lines";
const Sci::Position sLength2 = static_cast<Sci::Position>(strlen(sText2));
cb.InsertString(0, sText2, sLength2, startSequence);
REQUIRE(3 == cb.LineEnd(0));
REQUIRE(sLength2 == cb.LineEnd(1));
cb.DeleteChars(0, sLength2, startSequence);
}
cb.SetLineEndTypes(LineEndType::Default);
}
SECTION("UndoOff") {
REQUIRE(cb.IsCollectingUndo());
cb.SetUndoCollection(false);
@ -586,14 +638,14 @@ TEST_CASE("ChangeHistory") {
REQUIRE(il.DeletionCount(0, 2) == 0);
il.DeleteRangeSavingHistory(1, 1, true, false);
REQUIRE(il.DeletionCount(0,2) == 1);
const EditionSet at1 = {2};
const EditionSet at1 = { {2, 1} };
REQUIRE(il.DeletionsAt(1) == at1);
il.DeleteRangeSavingHistory(1, 1, false, false);
REQUIRE(il.DeletionCount(0,1) == 2);
const EditionSet at2 = { 2, 3 };
const EditionSet at2 = { {2, 1}, {3, 1} };
REQUIRE(il.DeletionsAt(1) == at2);
il.DeleteRangeSavingHistory(0, 1, false, false);
const EditionSet at3 = { 2, 3, 3 };
const EditionSet at3 = { {2, 1}, {3, 2} };
REQUIRE(il.DeletionsAt(0) == at3);
REQUIRE(il.DeletionCount(0,0) == 3);
@ -633,6 +685,55 @@ TEST_CASE("ChangeHistory") {
}
REQUIRE(il.DeletionCount(0, 10) == 0);
REQUIRE(il.Length() == 10);
}
SECTION("Delete Contiguous Backward") {
// Deletes that touch
constexpr size_t length = 20;
constexpr size_t rounds = 8;
il.Insert(0, length, false, true);
REQUIRE(il.Length() == length);
il.SetSavePoint();
for (size_t i = 0; i < rounds; i++) {
il.DeleteRangeSavingHistory(9-i, 1, false, false);
}
constexpr size_t lengthAfterDeletions = length - rounds;
REQUIRE(il.Length() == lengthAfterDeletions);
REQUIRE(il.DeletionCount(0, lengthAfterDeletions) == rounds);
for (size_t j = 0; j < rounds; j++) {
il.UndoDeleteStep(2+j, 1, false);
}
// Restored to original
REQUIRE(il.DeletionCount(0, length) == 0);
REQUIRE(il.Length() == length);
}
SECTION("Delete Contiguous Forward") {
// Deletes that touch
constexpr size_t length = 20;
constexpr size_t rounds = 8;
il.Insert(0, length, false, true);
REQUIRE(il.Length() == length);
il.SetSavePoint();
for (size_t i = 0; i < rounds; i++) {
il.DeleteRangeSavingHistory(2,1, false, false);
}
constexpr size_t lengthAfterDeletions = length - rounds;
REQUIRE(il.Length() == lengthAfterDeletions);
REQUIRE(il.DeletionCount(0, lengthAfterDeletions) == rounds);
for (size_t j = 0; j < rounds; j++) {
il.UndoDeleteStep(2, 1, false);
}
// Restored to original
REQUIRE(il.Length() == length);
REQUIRE(il.DeletionCount(0, length) == 0);
}
}

View File

@ -38,6 +38,18 @@
using namespace Scintilla;
using namespace Scintilla::Internal;
#if !defined(_WIN32) && !defined(NO_CXX11_REGEX)
// set global locale to pass std::regex related tests
// see https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63776
struct GlobalLocaleInitializer {
GlobalLocaleInitializer() {
try {
std::locale::global(std::locale("en_US.UTF-8"));
} catch (...) {}
}
} globalLocaleInitializer;
#endif
// Test Document.
struct Folding {
@ -143,6 +155,7 @@ TEST_CASE("Document") {
REQUIRE(1 == doc.document.LinesTotal());
REQUIRE(0 == doc.document.LineStart(0));
REQUIRE(0 == doc.document.LineFromPosition(0));
REQUIRE(0 == doc.document.LineStartPosition(0));
REQUIRE(sLength == doc.document.LineStart(1));
REQUIRE(0 == doc.document.LineFromPosition(static_cast<int>(sLength)));
REQUIRE(doc.document.CanUndo());
@ -453,6 +466,52 @@ TEST_CASE("Document") {
REQUIRE(doc.NextPosition(15, -1) == 14);
}
SECTION("RegexSearchAndSubstitution") {
DocPlus doc("\n\r\r\n 1a\xCE\x93z \n\r\r\n 2b\xCE\x93y \n\r\r\n", CpUtf8);// 1a gamma z 2b gamma y
const std::string finding = R"(\d+(\w+))";
Sci::Position lengthFinding = finding.length();
Sci::Position location = doc.FindNeedle(finding, FindOption::RegExp | FindOption::Posix, &lengthFinding);
REQUIRE(location == 5);
REQUIRE(lengthFinding == 5);
const std::string_view substituteText = R"(\t\1\n)";
Sci::Position lengthsubstitute = substituteText.length();
std::string substituted = doc.document.SubstituteByPosition(substituteText.data(), &lengthsubstitute);
REQUIRE(lengthsubstitute == 6);
REQUIRE(substituted == "\ta\xCE\x93z\n");
lengthFinding = finding.length();
location = doc.FindNeedleReverse(finding, FindOption::RegExp | FindOption::Posix, &lengthFinding);
REQUIRE(location == 16);
REQUIRE(lengthFinding == 5);
lengthsubstitute = substituteText.length();
substituted = doc.document.SubstituteByPosition(substituteText.data(), &lengthsubstitute);
REQUIRE(lengthsubstitute == 6);
REQUIRE(substituted == "\tb\xCE\x93y\n");
#ifndef NO_CXX11_REGEX
lengthFinding = finding.length();
location = doc.FindNeedle(finding, FindOption::RegExp | FindOption::Cxx11RegEx, &lengthFinding);
REQUIRE(location == 5);
REQUIRE(lengthFinding == 5);
lengthsubstitute = substituteText.length();
substituted = doc.document.SubstituteByPosition(substituteText.data(), &lengthsubstitute);
REQUIRE(lengthsubstitute == 6);
REQUIRE(substituted == "\ta\xCE\x93z\n");
lengthFinding = finding.length();
location = doc.FindNeedleReverse(finding, FindOption::RegExp | FindOption::Cxx11RegEx, &lengthFinding);
REQUIRE(location == 16);
REQUIRE(lengthFinding == 5);
lengthsubstitute = substituteText.length();
substituted = doc.document.SubstituteByPosition(substituteText.data(), &lengthsubstitute);
REQUIRE(lengthsubstitute == 6);
REQUIRE(substituted == "\tb\xCE\x93y\n");
#endif
}
}
TEST_CASE("Words") {

View File

@ -22,9 +22,6 @@
using namespace Scintilla::Internal;
constexpr int lengthTestArray = 8;
static const int testArray[lengthTestArray] = {3, 4, 5, 6, 7, 8, 9, 10};
// Test Partitioning.
TEST_CASE("CompileCopying Partitioning") {

View File

@ -5,8 +5,10 @@
#include <cstddef>
#include <cstring>
#include <stdexcept>
#include <string>
#include <string_view>
#include <vector>
#include <array>
#include <optional>
#include <algorithm>
#include <memory>
@ -39,6 +41,9 @@ public:
char CharAt(Sci::Position index) const override {
return s.at(index);
}
std::string GetCharRange(Sci::Position position, Sci::Position lengthRetrieve) const {
return s.substr(position, lengthRetrieve);
}
};
// Test RESearch.
@ -46,18 +51,18 @@ public:
TEST_CASE("RESearch") {
CharClassify cc;
const char sTextSpace[] = "Scintilla ";
const char pattern[] = "[a-z]+";
constexpr std::string_view sTextSpace = "Scintilla ";
constexpr std::string_view pattern = "[a-z]+";
SECTION("Compile") {
std::unique_ptr<RESearch> re = std::make_unique<RESearch>(&cc);
const char *msg = re->Compile(pattern, strlen(pattern), true, false);
const char *msg = re->Compile(pattern.data(), pattern.length(), true, false);
REQUIRE(nullptr == msg);
}
SECTION("Execute") {
std::unique_ptr<RESearch> re = std::make_unique<RESearch>(&cc);
re->Compile(pattern, strlen(pattern), true, false);
re->Compile(pattern.data(), pattern.length(), true, false);
StringCI sci(sTextSpace);
const int x = re->Execute(sci, 0, sci.Length());
REQUIRE(x == 1);
@ -67,11 +72,11 @@ TEST_CASE("RESearch") {
SECTION("Grab") {
std::unique_ptr<RESearch> re = std::make_unique<RESearch>(&cc);
re->Compile(pattern, strlen(pattern), true, false);
re->Compile(pattern.data(), pattern.length(), true, false);
StringCI sci(sTextSpace);
re->Execute(sci, 0, sci.Length());
re->GrabMatches(sci);
REQUIRE(re->pat[0] == "cintilla");
std::string pat = sci.GetCharRange(re->bopat[0], re->eopat[0] - re->bopat[0]);
REQUIRE(pat == "cintilla");
}
}

View File

@ -1 +1 @@
537
538

View File

@ -2671,7 +2671,7 @@ void SurfaceD2D::FlushDrawing() {
}
void SurfaceD2D::SetRenderingParams(std::shared_ptr<RenderingParams> renderingParams_) {
renderingParams = renderingParams_;
renderingParams = std::move(renderingParams_);
}
#endif

View File

@ -4,8 +4,8 @@
#include <windows.h>
#define VERSION_SCINTILLA "5.3.7"
#define VERSION_WORDS 5, 3, 7, 0
#define VERSION_SCINTILLA "5.3.8"
#define VERSION_WORDS 5, 3, 8, 0
VS_VERSION_INFO VERSIONINFO
FILEVERSION VERSION_WORDS

View File

@ -648,10 +648,10 @@ ScintillaWin::ScintillaWin(HWND hwnd) {
HMODULE user32 = ::GetModuleHandleW(L"user32.dll");
SetCoalescableTimerFn = DLLFunction<SetCoalescableTimerSig>(user32, "SetCoalescableTimer");
vs.indicators[IndicatorUnknown] = Indicator(IndicatorStyle::Hidden, ColourRGBA(0, 0, 0xff));
vs.indicators[IndicatorInput] = Indicator(IndicatorStyle::Dots, ColourRGBA(0, 0, 0xff));
vs.indicators[IndicatorConverted] = Indicator(IndicatorStyle::CompositionThick, ColourRGBA(0, 0, 0xff));
vs.indicators[IndicatorTarget] = Indicator(IndicatorStyle::StraightBox, ColourRGBA(0, 0, 0xff));
vs.indicators[IndicatorUnknown] = Indicator(IndicatorStyle::Hidden, colourIME);
vs.indicators[IndicatorInput] = Indicator(IndicatorStyle::Dots, colourIME);
vs.indicators[IndicatorConverted] = Indicator(IndicatorStyle::CompositionThick, colourIME);
vs.indicators[IndicatorTarget] = Indicator(IndicatorStyle::StraightBox, colourIME);
}
ScintillaWin::~ScintillaWin() {