Update lexilla to 5.1.7 & Scintilla to 5.2.3

Use new interfaces SCI_FORMATRANGEFULL, SCI_GETTEXTRANGEFULL, SCI_FINDTEXTFULL from scintilla 5.2.3

Close #11734
This commit is contained in:
Christian Grasser 2022-05-25 22:16:39 +02:00 committed by Don Ho
parent 3a2ef5cff9
commit ed4bb1a93e
129 changed files with 2779 additions and 204 deletions

View File

@ -404,9 +404,9 @@ size_t Printer::doPrint(bool justDoIt)
}
}
frPrint.chrg.cpMin = static_cast<Sci_PositionCR>(lengthPrinted);
frPrint.chrg.cpMax = static_cast<Sci_PositionCR>(lengthDoc);
lengthPrinted = _pSEView->execute(SCI_FORMATRANGE, printPage, reinterpret_cast<LPARAM>(&frPrint));
frPrint.chrg.cpMin = static_cast<Sci_Position>(lengthPrinted);
frPrint.chrg.cpMax = static_cast<Sci_Position>(lengthDoc);
lengthPrinted = _pSEView->execute(SCI_FORMATRANGEFULL, printPage, reinterpret_cast<LPARAM>(&frPrint));
if (printPage)
{
@ -481,7 +481,7 @@ size_t Printer::doPrint(bool justDoIt)
if (!nppGUI._printSettings._printLineNumber)
_pSEView->showMargin(ScintillaEditView::_SC_MARGE_LINENUMBER, isShown);
_pSEView->execute(SCI_FORMATRANGE, FALSE, 0);
_pSEView->execute(SCI_FORMATRANGEFULL, FALSE, 0);
::EndDoc(_pdlg.hDC);
::DeleteDC(_pdlg.hDC);

View File

@ -25,7 +25,7 @@ struct NPP_RangeToFormat {
HDC hdcTarget = nullptr;
RECT rc = {};
RECT rcPage = {};
Sci_CharacterRange chrg = {};
Sci_CharacterRangeFull chrg = {};
};
class Printer

View File

@ -2253,11 +2253,11 @@ void ScintillaEditView::foldAll(bool mode)
void ScintillaEditView::getText(char *dest, size_t start, size_t end) const
{
Sci_TextRange tr;
tr.chrg.cpMin = static_cast<Sci_PositionCR>(start);
tr.chrg.cpMax = static_cast<Sci_PositionCR>(end);
Sci_TextRangeFull tr{};
tr.chrg.cpMin = static_cast<Sci_Position>(start);
tr.chrg.cpMax = static_cast<Sci_Position>(end);
tr.lpstrText = dest;
execute(SCI_GETTEXTRANGE, 0, reinterpret_cast<LPARAM>(&tr));
execute(SCI_GETTEXTRANGEFULL, 0, reinterpret_cast<LPARAM>(&tr));
}
generic_string ScintillaEditView::getGenericTextAsString(size_t start, size_t end) const

View File

@ -564,11 +564,11 @@ XmlMatchedTagsHighlighter::FindResult XmlMatchedTagsHighlighter::findText(const
{
FindResult returnValue;
Sci_TextToFind search;
Sci_TextToFindFull search{};
search.lpstrText = const_cast<char *>(text); // Grrrrrr
search.chrg.cpMin = static_cast<Sci_PositionCR>(start);
search.chrg.cpMax = static_cast<Sci_PositionCR>(end);
intptr_t result = _pEditView->execute(SCI_FINDTEXT, flags, reinterpret_cast<LPARAM>(&search));
search.chrg.cpMin = static_cast<Sci_Position>(start);
search.chrg.cpMax = static_cast<Sci_Position>(end);
intptr_t result = _pEditView->execute(SCI_FINDTEXTFULL, flags, reinterpret_cast<LPARAM>(&search));
if (-1 == result)
{
returnValue.success = false;

View File

@ -1,4 +1,4 @@
version: 8.2.{build}
version: 8.4.{build}
image: Visual Studio 2019
#skip_commits:

View File

@ -26,11 +26,13 @@
**.asp text
**.php text
**.vb text
**.cmake text
**.d text
**.erl text
**.gd text
**.iss text
**.jl text
**.json text
**.lua text
**.matlab text
**.ml text
@ -45,6 +47,7 @@
**.mms text
**.tex text
**.fs text
**.vhd text
**.x12 text
**.yaml text
**.md text

View File

@ -9,7 +9,7 @@
<meta name="keywords" content="Scintilla, SciTE, Editing Component, Text Editor" />
<meta name="Description"
content="www.scintilla.org is the home of the Scintilla editing component and SciTE text editor application." />
<meta name="Date.Modified" content="20220331" />
<meta name="Date.Modified" content="20220522" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<style type="text/css">
.logo {
@ -61,8 +61,8 @@
<font color="#FFCC99" size="4"> A library of language lexers for use with Scintilla</font>
</td>
<td width="40%" align="right">
<font color="#FFCC99" size="3">Release version 5.1.6<br />
Site last modified March 31 2022</font>
<font color="#FFCC99" size="3">Release version 5.1.7<br />
Site last modified May 22 2022</font>
</td>
<td width="20%">
&nbsp;
@ -77,6 +77,7 @@
</tr>
</table>
<ul id="versionlist">
<li>Version 5.1.7 improves CMake, HTML, Matlab, Raku, Ruby, and VHDL.</li>
<li>Version 5.1.6 improves Markdown and Ruby.</li>
<li>Version 5.1.5 improves Bash, Batch, F#, HTML, Inno Setup, and Python.</li>
<li>Version 5.1.4 adds lexers for AsciiDoc and GDScript.</li>

View File

@ -111,7 +111,7 @@
<p>The Lexilla protocol is a superset of the earlier external lexer protocol that defined the first 3 functions
(<span class="name">GetLexerCount</span>, <span class="name">GetLexerName</span>, <span class="name">GetLexerFactory</span>)
so Lexilla be loaded by applications that support that protocol.
so Lexilla can be loaded by applications that support that protocol.
<span class="name">GetLexerFactory</span> will rarely be used now as it is easier to call <span class="name">CreateLexer</span>.
</p>

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/lexilla516.zip">
<font size="4"> <a href="https://www.scintilla.org/lexilla517.zip">
Windows</a>&nbsp;&nbsp;
<a href="https://www.scintilla.org/lexilla516.tgz">
<a href="https://www.scintilla.org/lexilla517.tgz">
GTK/Linux</a>&nbsp;&nbsp;
</font>
</td>
@ -42,7 +42,7 @@
containing very few restrictions.
</p>
<h3>
Release 5.1.6
Release 5.1.7
</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/lexilla516.zip">zip format</a> (1.1M) commonly used on Windows</li>
<li><a href="https://www.scintilla.org/lexilla516.tgz">tgz format</a> (0.9M) commonly used on Linux and compatible operating systems</li>
<li><a href="https://www.scintilla.org/lexilla517.zip">zip format</a> (1.1M) commonly used on Windows</li>
<li><a href="https://www.scintilla.org/lexilla517.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

@ -578,9 +578,65 @@
</tr><tr>
<td>Red_M</td>
<td>cdbdev</td>
<td>Andrey Smolyakov</td>
<td>Knut Leimbert</td>
</tr>
</table>
<h2>Releases</h2>
<h3>
<a href="https://www.scintilla.org/lexilla517.zip">Release 5.1.7</a>
</h3>
<ul>
<li>
Released 22 May 2022.
</li>
<li>
Add LexAccessor::StyleIndexAt to retrieve style values as unsigned to handle styles > 127 better.
<a href="https://github.com/ScintillaOrg/lexilla/issues/61">Issue #61</a>.
</li>
<li>
Associate more than one file extension with a setting for testing.
<a href="https://github.com/ScintillaOrg/lexilla/issues/81">Issue #81</a>.
</li>
<li>
CMake: Fix folding of "ElseIf".
<a href="https://github.com/ScintillaOrg/lexilla/issues/77">Issue #77</a>,
<a href="https://github.com/ScintillaOrg/lexilla/pull/78">Pull request #78</a>,
<a href="https://sourceforge.net/p/scintilla/bugs/2213/">Bug #2213</a>.
</li>
<li>
HTML: Fix folding of JavaScript doc comments.
<a href="https://sourceforge.net/p/scintilla/bugs/2219/">Bug #2219</a>.
</li>
<li>
Matlab: add "classdef" and "spmd" to folding keywords.
<a href="https://github.com/ScintillaOrg/lexilla/pull/70">Pull request #70</a>.
</li>
<li>
Matlab: handle "arguments" contextual keyword.
<a href="https://github.com/ScintillaOrg/lexilla/pull/70">Pull request #70</a>.
</li>
<li>
Matlab: improve support of class definition syntax.
<a href="https://github.com/ScintillaOrg/lexilla/pull/75">Pull request #75</a>.
</li>
<li>
Raku: fix escape detection.
<a href="https://github.com/ScintillaOrg/lexilla/pull/76">Pull request #76</a>.
</li>
<li>
Ruby: fix character sequence "?\\#" to not include '#' in SCE_RB_NUMBER as only second '\' is quoted.
<a href="https://github.com/ScintillaOrg/lexilla/issues/69">Issue #69</a>.
</li>
<li>
Ruby: improve styling of ternary expressions as commonly used.
<a href="https://github.com/ScintillaOrg/lexilla/issues/69">Issue #69</a>.
</li>
<li>
VHDL: support folding for VHDL 08 else-generate and case-generate.
<a href="https://github.com/ScintillaOrg/lexilla/pull/80">Pull request #80</a>.
</li>
</ul>
<h3>
<a href="https://www.scintilla.org/lexilla516.zip">Release 5.1.6</a>
</h3>

View File

@ -1,6 +1,8 @@
// Scintilla source code edit control
// @file LexASY.cxx
//Author: instanton (email: soft_share<at>126<dot>com)
// This lexer is for the Asymptote vector graphics language
// https://en.wikipedia.org/wiki/Asymptote_(vector_graphics_language)
// The License.txt file describes the conditions under which this software may be distributed.
#include <stdlib.h>

View File

@ -88,7 +88,7 @@ static int calculateFoldCmake(Sci_PositionU start, Sci_PositionU end, int foldle
if ( CompareCaseInsensitive(s, "IF") == 0 || CompareCaseInsensitive(s, "WHILE") == 0
|| CompareCaseInsensitive(s, "MACRO") == 0 || CompareCaseInsensitive(s, "FOREACH") == 0
|| CompareCaseInsensitive(s, "FUNCTION") == 0 || CompareCaseInsensitive(s, "ELSEIF") == 0)
|| CompareCaseInsensitive(s, "FUNCTION") == 0)
newFoldlevel++;
else if ( CompareCaseInsensitive(s, "ENDIF") == 0 || CompareCaseInsensitive(s, "ENDWHILE") == 0
|| CompareCaseInsensitive(s, "ENDMACRO") == 0 || CompareCaseInsensitive(s, "ENDFOREACH") == 0

View File

@ -1233,7 +1233,7 @@ void SCI_METHOD LexerHTML::Lex(Sci_PositionU startPos, Sci_Position length, int
} else if ((ch == '{') || (ch == '}') || (foldComment && (ch == '/') && (chNext == '*'))) {
levelCurrent += (((ch == '{') || (ch == '/')) ? 1 : -1);
}
} else if (((state == SCE_HPHP_COMMENT) || (state == SCE_HJ_COMMENT)) && foldComment && (ch == '*') && (chNext == '/')) {
} else if (((state == SCE_HPHP_COMMENT) || (state == SCE_HJ_COMMENT || state == SCE_HJ_COMMENTDOC)) && foldComment && (ch == '*') && (chNext == '/')) {
levelCurrent--;
}
break;

View File

@ -292,7 +292,7 @@ void SCI_METHOD LexerJSON::Lex(Sci_PositionU startPos,
}
break;
case SCE_JSON_LINECOMMENT:
if (context.atLineEnd) {
if (context.MatchLineEnd()) {
context.SetState(SCE_JSON_DEFAULT);
}
break;
@ -311,7 +311,7 @@ void SCI_METHOD LexerJSON::Lex(Sci_PositionU startPos,
}
if (context.ch == '"') {
context.SetState(stringStyleBefore);
context.ForwardSetState(SCE_C_DEFAULT);
context.ForwardSetState(SCE_JSON_DEFAULT);
} else if (context.ch == '\\') {
if (!escapeSeq.newSequence(context.chNext)) {
context.SetState(SCE_JSON_ERROR);
@ -383,7 +383,7 @@ void SCI_METHOD LexerJSON::Lex(Sci_PositionU startPos,
context.SetState(SCE_JSON_DEFAULT);
break;
case SCE_JSON_ERROR:
if (context.atLineEnd) {
if (context.MatchLineEnd()) {
context.SetState(SCE_JSON_DEFAULT);
}
break;

View File

@ -22,6 +22,9 @@
**
** Changes by John Donoghue 2017/01/18
** - update matlab block comment detection
**
** Changes by Andrey Smolyakov 2022/04/15
** - add support for "arguments" block and class definition syntax
**/
// Copyright 1998-2001 by Neil Hodgson <neilh@scintilla.org>
// The License.txt file describes the conditions under which this software may be distributed.
@ -71,6 +74,12 @@ static int CheckKeywordFoldPoint(char *str) {
strcmp ("try", str) == 0 ||
strcmp ("do", str) == 0 ||
strcmp ("parfor", str) == 0 ||
strcmp ("classdef", str) == 0 ||
strcmp ("spmd", str) == 0 ||
strcmp ("arguments", str) == 0 ||
strcmp ("methods", str) == 0 ||
strcmp ("properties", str) == 0 ||
strcmp ("events", str) == 0 ||
strcmp ("function", str) == 0)
return 1;
if (strncmp("end", str, 3) == 0 ||
@ -89,6 +98,29 @@ static bool IsSpaceToEOL(Sci_Position startPos, Accessor &styler) {
return true;
}
#define MATLAB_STATE_FOLD_LVL_OFFSET 8
#define MATLAB_STATE_FOLD_LVL_MASK (0xFF00)
#define MATLAB_STATE_FLAGS_OFFSET 16
#define MATLAB_STATE_COMM_DEPTH_OFFSET 0
#define MATLAB_STATE_COMM_DEPTH_MASK (0xFF)
#define MATLAB_STATE_EXPECTING_ARG_BLOCK (1 << MATLAB_STATE_FLAGS_OFFSET)
#define MATLAB_STATE_IN_CLASS_SCOPE (1 <<(MATLAB_STATE_FLAGS_OFFSET+1))
static int ComposeLineState(int commentDepth,
int foldingLevel,
int expectingArgumentsBlock,
int inClassScope) {
return ((commentDepth << MATLAB_STATE_COMM_DEPTH_OFFSET)
& MATLAB_STATE_COMM_DEPTH_MASK) |
((foldingLevel << MATLAB_STATE_FOLD_LVL_OFFSET)
& MATLAB_STATE_FOLD_LVL_MASK) |
(expectingArgumentsBlock
& MATLAB_STATE_EXPECTING_ARG_BLOCK) |
(inClassScope
& MATLAB_STATE_IN_CLASS_SCOPE);
}
static void ColouriseMatlabOctaveDoc(
Sci_PositionU startPos, Sci_Position length, int initStyle,
WordList *keywordlists[], Accessor &styler,
@ -111,28 +143,68 @@ static void ColouriseMatlabOctaveDoc(
// approximate column position of the current character in a line
int column = 0;
// use the line state of each line to store the block comment depth
// This line contains a function declaration
bool funcDeclarationLine = false;
// We've just seen "function" keyword, so now we may expect the "arguments"
// keyword opening the corresponding code block
int expectingArgumentsBlock = 0;
// Current line's folding level
int foldingLevel = 0;
// Current line in in class scope
int inClassScope = 0;
// use the line state of each line to store the block comment depth
Sci_Position curLine = styler.GetLine(startPos);
int commentDepth = curLine > 0 ? styler.GetLineState(curLine-1) : 0;
int commentDepth = 0;
// Restore the previous line's state, if there was such a line
if (curLine > 0) {
int prevState = styler.GetLineState(curLine-1);
commentDepth = (prevState & MATLAB_STATE_COMM_DEPTH_MASK)
>> MATLAB_STATE_COMM_DEPTH_OFFSET;
foldingLevel = (prevState & MATLAB_STATE_FOLD_LVL_MASK)
>> MATLAB_STATE_FOLD_LVL_OFFSET;
expectingArgumentsBlock = prevState & MATLAB_STATE_EXPECTING_ARG_BLOCK;
inClassScope = prevState & MATLAB_STATE_IN_CLASS_SCOPE;
}
StyleContext sc(startPos, length, initStyle, styler);
for (; sc.More(); sc.Forward(), column++) {
if(sc.atLineStart) {
if(sc.atLineStart) {
// set the line state to the current commentDepth
curLine = styler.GetLine(sc.currentPos);
styler.SetLineState(curLine, commentDepth);
styler.SetLineState(curLine, ComposeLineState(
commentDepth, foldingLevel, expectingArgumentsBlock, inClassScope));
// reset the column to 0, nonSpace to -1 (not set)
column = 0;
nonSpaceColumn = -1;
// Reset the flag
funcDeclarationLine = false;
}
// Only comments allowed between the function declaration and the
// arguments code block
if (expectingArgumentsBlock && !funcDeclarationLine) {
if ((sc.state != SCE_MATLAB_KEYWORD) &&
(sc.state != SCE_MATLAB_COMMENT) &&
(sc.state != SCE_MATLAB_DEFAULT)) {
expectingArgumentsBlock = 0;
styler.SetLineState(curLine, ComposeLineState(
commentDepth, foldingLevel, expectingArgumentsBlock, inClassScope));
}
}
// We've just left the class scope
if ((foldingLevel ==0) && inClassScope) {
inClassScope = 0;
}
// save the column position of first non space character in a line
if((nonSpaceColumn == -1) && (! IsASpace(sc.ch)))
{
if((nonSpaceColumn == -1) && (! IsASpace(sc.ch))) {
nonSpaceColumn = column;
}
@ -145,10 +217,10 @@ static void ColouriseMatlabOctaveDoc(
} else if (sc.ch == '\'') {
sc.ForwardSetState(SCE_MATLAB_DEFAULT);
transpose = true;
} else if(sc.ch == '.' && sc.chNext == '.') {
// we werent an operator, but a '...'
sc.ChangeState(SCE_MATLAB_COMMENT);
transpose = false;
} else if(sc.ch == '.' && sc.chNext == '.') {
// we werent an operator, but a '...'
sc.ChangeState(SCE_MATLAB_COMMENT);
transpose = false;
} else {
sc.SetState(SCE_MATLAB_DEFAULT);
}
@ -159,19 +231,58 @@ static void ColouriseMatlabOctaveDoc(
if (!isalnum(sc.ch) && sc.ch != '_') {
char s[100];
sc.GetCurrent(s, sizeof(s));
bool notKeyword = false;
transpose = false;
if (keywords.InList(s)) {
if (strcmp ("end", s) == 0 && allow_end_op) {
sc.ChangeState(SCE_MATLAB_NUMBER);
notKeyword = true;
} else if (strcmp("function", s) == 0) {
// Need this flag to handle "arguments" block correctly
funcDeclarationLine = true;
expectingArgumentsBlock = ismatlab ? MATLAB_STATE_EXPECTING_ARG_BLOCK : 0;
} else if (strcmp("classdef", s) == 0) {
// Need this flag to process "events", "methods" and "properties" blocks
inClassScope = MATLAB_STATE_IN_CLASS_SCOPE;
}
sc.SetState(SCE_MATLAB_DEFAULT);
transpose = false;
expectingArgumentsBlock = funcDeclarationLine ? expectingArgumentsBlock : 0;
} else {
sc.ChangeState(SCE_MATLAB_IDENTIFIER);
sc.SetState(SCE_MATLAB_DEFAULT);
transpose = true;
// "arguments" is a keyword here, despite not being in the keywords list
if (expectingArgumentsBlock && (strcmp("arguments", s) == 0)) {
// No need to expect another arguments block
expectingArgumentsBlock = 0;
} else {
// Found an identifier or a keyword after the function declaration
// No need to wait for the arguments block anymore
expectingArgumentsBlock = funcDeclarationLine ? expectingArgumentsBlock : 0;
// "properties", "methods" and "events" are not keywords if they're declared
// inside some function in methods block
// To avoid tracking possible nested functions scopes, lexer considers everything
// beyond level 2 of folding to be in a scope of some function declared in the
// methods block. It is ok for the valid syntax: classes can only be declared in
// a separate file, function - only in methods block. However, in case of the invalid
// syntax lexer may erroneously ignore a keyword.
if (!((inClassScope) && (foldingLevel <= 2) && (
strcmp("properties", s) == 0 ||
strcmp("methods", s) == 0 ||
strcmp("events", s) == 0 ))) {
sc.ChangeState(SCE_MATLAB_IDENTIFIER);
transpose = true;
notKeyword = true;
}
}
}
sc.SetState(SCE_MATLAB_DEFAULT);
if (!notKeyword) {
foldingLevel += CheckKeywordFoldPoint(s);
}
}
styler.SetLineState(curLine, ComposeLineState(
commentDepth, foldingLevel, expectingArgumentsBlock, inClassScope));
} else if (sc.state == SCE_MATLAB_NUMBER) {
if (!isdigit(sc.ch) && sc.ch != '.'
&& !(sc.ch == 'e' || sc.ch == 'E')
@ -182,10 +293,10 @@ static void ColouriseMatlabOctaveDoc(
} else if (sc.state == SCE_MATLAB_STRING) {
if (sc.ch == '\'') {
if (sc.chNext == '\'') {
sc.Forward();
sc.Forward();
} else {
sc.ForwardSetState(SCE_MATLAB_DEFAULT);
}
}
}
} else if (sc.state == SCE_MATLAB_DOUBLEQUOTESTRING) {
if (sc.ch == '\\' && !ismatlab) {
@ -203,27 +314,27 @@ static void ColouriseMatlabOctaveDoc(
} else if (sc.state == SCE_MATLAB_COMMENT) {
// end or start of a nested a block comment?
if( IsCommentChar(sc.ch) && sc.chNext == '}' && nonSpaceColumn == column && IsSpaceToEOL(sc.currentPos+2, styler)) {
if(commentDepth > 0) commentDepth --;
if(commentDepth > 0) commentDepth --;
curLine = styler.GetLine(sc.currentPos);
styler.SetLineState(curLine, commentDepth);
styler.SetLineState(curLine, ComposeLineState(
commentDepth, foldingLevel, expectingArgumentsBlock, inClassScope));
sc.Forward();
if (commentDepth == 0) {
sc.ForwardSetState(SCE_D_DEFAULT);
sc.ForwardSetState(SCE_MATLAB_DEFAULT);
transpose = false;
}
}
else if( IsCommentChar(sc.ch) && sc.chNext == '{' && nonSpaceColumn == column && IsSpaceToEOL(sc.currentPos+2, styler))
{
commentDepth ++;
} else if( IsCommentChar(sc.ch) && sc.chNext == '{' && nonSpaceColumn == column && IsSpaceToEOL(sc.currentPos+2, styler)) {
commentDepth ++;
curLine = styler.GetLine(sc.currentPos);
styler.SetLineState(curLine, commentDepth);
styler.SetLineState(curLine, ComposeLineState(
commentDepth, foldingLevel, expectingArgumentsBlock, inClassScope));
sc.Forward();
transpose = false;
} else if(commentDepth == 0) {
} else if(commentDepth == 0) {
// single line comment
if (sc.atLineEnd || sc.ch == '\r' || sc.ch == '\n') {
sc.SetState(SCE_MATLAB_DEFAULT);
@ -242,7 +353,8 @@ static void ColouriseMatlabOctaveDoc(
}
}
curLine = styler.GetLine(sc.currentPos);
styler.SetLineState(curLine, commentDepth);
styler.SetLineState(curLine, ComposeLineState(
commentDepth, foldingLevel, expectingArgumentsBlock, inClassScope));
sc.SetState(SCE_MATLAB_COMMENT);
} else if (sc.ch == '!' && sc.chNext != '=' ) {
if(ismatlab) {
@ -342,7 +454,7 @@ static void FoldMatlabOctaveDoc(Sci_PositionU startPos, Sci_Position length, int
wordlen = 0;
levelNext += CheckKeywordFoldPoint(word);
}
}
}
if (!IsASpace(ch))
visibleChars++;

View File

@ -521,6 +521,7 @@ Sci_Position LengthToDelimiter(StyleContext &sc, const DelimPair &dp,
Sci_Position length, bool noTrailing = false) {
short cnt_open = 0; // count open bracket
short cnt_close = 0; // count close bracket
bool is_escape = false; // has been escaped using '\'?
Sci_Position len = 0; // count characters
int chOpener = dp.opener; // look for nested opener / closer
if (dp.opener == dp.closer[0])
@ -533,10 +534,14 @@ Sci_Position LengthToDelimiter(StyleContext &sc, const DelimPair &dp,
if (cnt_open == 0 && cnt_close == dp.count) {
return len; // end condition has been met
} else if (is_escape) {
is_escape = false;
} else if (ch == '\\') {
is_escape = true;
} else {
if (chPrev != '\\' && ch == chOpener) { // ignore escape sequence
if (ch == chOpener) {
cnt_open++; // open nested bracket
} else if (chPrev != '\\' && dp.isCloser(ch)) { // ignore escape sequence
} else if (dp.isCloser(ch)) {
if ( cnt_open > 0 ) {
cnt_open--; // close nested bracket
} else if (dp.count > 1 && cnt_close < (dp.count - 1)) {

View File

@ -64,6 +64,15 @@ static bool inline iswhitespace(char ch) {
return ch == ' ' || ch == '\t';
}
static inline bool isQestionMarkChar(char chNext, char chNext2) {
// followed by a single character or escape sequence that corresponds to a single codepoint
if (isSafeAlnum(chNext)) {
return !isSafeWordcharOrHigh(chNext2);
}
// multibyte character, escape sequence, punctuation
return !IsASpace(chNext);
}
#define MAX_KEYWORD_LENGTH 200
#define STYLE_MASK 63
@ -1018,7 +1027,7 @@ static void ColouriseRbDoc(Sci_PositionU startPos, Sci_Position length, int init
styler.ColourTo(i, SCE_RB_SYMBOL);
state = SCE_RB_DEFAULT;
}
} else if (!preferRE) {
} else if (!preferRE && !IsASpace(chNext)) {
// Don't color symbol strings (yet)
// Just color the ":" and color rest as string
styler.ColourTo(i, SCE_RB_SYMBOL);
@ -1067,8 +1076,22 @@ static void ColouriseRbDoc(Sci_PositionU startPos, Sci_Position length, int init
} else if (ch == '?') {
afterDef = false;
styler.ColourTo(i - 1, state);
if (iswhitespace(chNext) || chNext == '\n' || chNext == '\r') {
if (isHighBitChar(chNext)) {
preferRE = false;
Sci_Position width = 1;
styler.MultiByteAccess()->GetCharacterAndWidth(i + 1, &width);
chNext = styler.SafeGetCharAt(i + 1 + width);
if (isSafeWordcharOrHigh(chNext)) {
styler.ColourTo(i, SCE_RB_OPERATOR);
i += width;
state = SCE_RB_WORD;
} else {
i += width;
styler.ColourTo(i, SCE_RB_NUMBER);
}
} else if (!isQestionMarkChar(chNext, chNext2)) {
styler.ColourTo(i, SCE_RB_OPERATOR);
preferRE = chNext <= ' ';
} else {
// It's the start of a character code escape sequence
// Color it as a number.
@ -1195,7 +1218,7 @@ static void ColouriseRbDoc(Sci_PositionU startPos, Sci_Position length, int init
}
} else if (state == SCE_RB_NUMBER) {
if (!is_real_number) {
if (ch != '\\') {
if (ch != '\\' || chPrev == '\\') {
styler.ColourTo(i, state);
state = SCE_RB_DEFAULT;
preferRE = false;

View File

@ -235,7 +235,7 @@ static void FoldNoBoxVHDLDoc(
// Decided it would be smarter to have the lexer have all keywords included. Therefore I
// don't check if the style for the keywords that I use to adjust the levels.
char words[] =
"architecture begin block case component else elsif end entity generate loop package process record then "
"architecture begin block case component else elsif end entity for generate loop package process record then "
"procedure protected function when units";
WordList keywords;
keywords.Set(words);
@ -396,7 +396,6 @@ static void FoldNoBoxVHDLDoc(
if (
strcmp(s, "architecture") == 0 ||
strcmp(s, "case") == 0 ||
strcmp(s, "generate") == 0 ||
strcmp(s, "block") == 0 ||
strcmp(s, "loop") == 0 ||
strcmp(s, "package") ==0 ||
@ -413,6 +412,16 @@ static void FoldNoBoxVHDLDoc(
}
levelNext++;
}
} else if (strcmp(s, "generate") == 0){
if (strcmp(prevWord, "end") != 0 &&
strcmp(prevWord, "else") != 0 && // vhdl08 else generate
strcmp(prevWord, "case") != 0) // vhdl08 case generate
{
if (levelMinCurrentElse > levelNext) {
levelMinCurrentElse = levelNext;
}
levelNext++;
}
} else if (
strcmp(s, "component") == 0 ||
strcmp(s, "entity") == 0 ||
@ -479,7 +488,7 @@ static void FoldNoBoxVHDLDoc(
} else if (strcmp(s, "end") == 0) {
levelNext--;
} else if(strcmp(s, "elsif") == 0) { // elsif is followed by then so folding occurs correctly
} else if(strcmp(s, "elsif") == 0) { // elsif is followed by then or generate so folding occurs correctly
levelNext--;
} else if (strcmp(s, "else") == 0) {
if(strcmp(prevWord, "when") != 0) // ignore a <= x when y else z;
@ -489,7 +498,8 @@ static void FoldNoBoxVHDLDoc(
} else if(
((strcmp(s, "begin") == 0) && (strcmp(prevWord, "architecture") == 0)) ||
((strcmp(s, "begin") == 0) && (strcmp(prevWord, "function") == 0)) ||
((strcmp(s, "begin") == 0) && (strcmp(prevWord, "procedure") == 0)))
((strcmp(s, "begin") == 0) && (strcmp(prevWord, "procedure") == 0)) ||
((strcmp(s, "begin") == 0) && (strcmp(prevWord, "generate") == 0)))
{
levelMinCurrentBegin = levelNext - 1;
}

View File

@ -120,6 +120,9 @@ public:
char StyleAt(Sci_Position position) const {
return pAccess->StyleAt(position);
}
int StyleIndexAt(Sci_Position position) const {
return static_cast<unsigned char>(pAccess->StyleAt(position));
}
// Return style value from buffer when in buffer, else retrieve from document.
// This is faster and can avoid calls to Flush() as that may be expensive.
int BufferStyleAt(Sci_Position position) const {

View File

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

View File

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

View File

@ -4,8 +4,8 @@
#include <windows.h>
#define VERSION_LEXILLA "5.1.6"
#define VERSION_WORDS 5, 1, 6, 0
#define VERSION_LEXILLA "5.1.7"
#define VERSION_WORDS 5, 1, 7, 0
VS_VERSION_INFO VERSIONINFO
FILEVERSION VERSION_WORDS

View File

@ -87,11 +87,11 @@ backtrack to a previous safe line - often something like a line that starts with
in the default style.
The SciTE.properties file is similar to properties files used for SciTE but are simpler.
The lexer to be run is defined with a lexer.{filepattern} statement like:
The lexer to be run is defined with a lexer.{filepatterns} statement like:
lexer.*.d=d
Keywords may be defined with keywords settings like:
keywords.*.cxx=int char
keywords.*.cxx;*.c=int char
keywords2.*.cxx=open
Other settings are treated as lexer or folder properties and forwarded to the lexer/folder:

View File

@ -250,7 +250,7 @@ bool PathMatch(std::string pattern, std::string relPath) {
constexpr std::string_view suffixStyled = ".styled";
constexpr std::string_view suffixFolded = ".folded";
constexpr std::string_view lexerPrefix = "lexer.*";
constexpr std::string_view prefixIf = "if ";
constexpr std::string_view prefixMatch = "match ";
constexpr std::string_view prefixEqual = "= ";
@ -383,6 +383,27 @@ class PropertyMap {
return withVars;
}
std::vector<std::string> GetFilePatterns(const std::string &key) const {
std::vector<std::string> exts;
// Malformed patterns are skipped if we require the whole prefix here;
// a fuzzy search lets us collect and report them
const size_t patternStart = key.find('*');
if (patternStart == std::string::npos)
return exts;
const std::string patterns = key.substr(patternStart);
for (const std::string &pat : StringSplit(patterns, ';')) {
// Only accept patterns in the form *.xyz
if (pat.starts_with("*.") && pat.length() > 2) {
exts.push_back(pat.substr(1));
} else {
std::cout << "\n"
<< "Ignoring bad file pattern '" << pat << "' in list " << patterns << "\n";
}
}
return exts;
}
bool ProcessLine(std::string_view text, bool ifIsTrue) {
// If clause ends with first non-indented line
if (!ifIsTrue && (text.empty() || IsSpaceOrTab(text.at(0)))) {
@ -461,6 +482,15 @@ public:
const std::string keySuffix = key.substr(keyPrefix.length());
if (fileName.ends_with(keySuffix)) {
return val;
} else if (key.find(';') != std::string::npos) {
// It may be the case that a suite of test files with various extensions are
// meant to share a common configuration, so try to find a matching
// extension in a delimited list, e.g., lexer.*.html;*.php;*.asp=hypertext
for (const std::string &ext : GetFilePatterns(key)) {
if (fileName.ends_with(ext)) {
return val;
}
}
}
}
}
@ -702,7 +732,7 @@ void SetProperties(Scintilla::ILexer5 *plex, const PropertyMap &propertyMap, std
for (int kw = 0; kw < 10; kw++) {
std::string kwChoice("keywords");
if (kw > 0) {
kwChoice.push_back('1' + kw);
kwChoice.push_back(static_cast<char>('1' + kw));
}
kwChoice.append(".*");
std::optional<std::string> keywordN = propertyMap.GetPropertyForFile(kwChoice, fileName);
@ -723,7 +753,6 @@ void SetProperties(Scintilla::ILexer5 *plex, const PropertyMap &propertyMap, std
}
}
const char *lexerPrefix = "lexer.*";
bool TestFile(const std::filesystem::path &path, const PropertyMap &propertyMap) {
// Find and create correct lexer

View File

@ -91,7 +91,7 @@
<ClCompile>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<WarningLevel>Level4</WarningLevel>
<Optimization>Disabled</Optimization>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
@ -108,7 +108,7 @@
<ClCompile>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<WarningLevel>Level4</WarningLevel>
<Optimization>Disabled</Optimization>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
@ -125,7 +125,7 @@
<ClCompile>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<WarningLevel>Level4</WarningLevel>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
@ -146,7 +146,7 @@
<ClCompile>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<WarningLevel>Level4</WarningLevel>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>

View File

@ -0,0 +1,25 @@
if(MSVC80)
# 1
elseif(MSVC90)
# 2
elseif(APPLE)
# 3
else()
# 4
endif()
if(MSVC80)
# 1
elseif(MSVC90)
# 2
endif()
if(MSVC80)
# 1
else()
# 2
endif()
if(MSVC80)
# 1
endif()

View File

@ -0,0 +1,26 @@
2 400 401 + if(MSVC80)
0 401 401 | # 1
0 401 401 | elseif(MSVC90)
0 401 401 | # 2
0 401 401 | elseif(APPLE)
0 401 401 | # 3
0 401 401 | else()
0 401 401 | # 4
0 401 400 | endif()
0 400 400
2 400 401 + if(MSVC80)
0 401 401 | # 1
0 401 401 | elseif(MSVC90)
0 401 401 | # 2
0 401 400 | endif()
0 400 400
2 400 401 + if(MSVC80)
0 401 401 | # 1
0 401 401 | else()
0 401 401 | # 2
0 401 400 | endif()
0 400 400
2 400 401 + if(MSVC80)
0 401 401 | # 1
0 401 400 | endif()
0 400 400

View File

@ -0,0 +1,25 @@
{11}if{0}({6}MSVC80{0})
{1}# 1{0}
{11}elseif{0}({6}MSVC90{0})
{1}# 2{0}
{11}elseif{0}({6}APPLE{0})
{1}# 3{0}
{11}else{0}()
{1}# 4{0}
{11}endif{0}()
{11}if{0}({6}MSVC80{0})
{1}# 1{0}
{11}elseif{0}({6}MSVC90{0})
{1}# 2{0}
{11}endif{0}()
{11}if{0}({6}MSVC80{0})
{1}# 1{0}
{11}else{0}()
{1}# 2{0}
{11}endif{0}()
{11}if{0}({6}MSVC80{0})
{1}# 1{0}
{11}endif{0}()

View File

@ -0,0 +1,25 @@
if(MSVC80)
# 1
elseif(MSVC90)
# 2
elseif(APPLE)
# 3
else()
# 4
endif()
if(MSVC80)
# 1
elseif(MSVC90)
# 2
endif()
if(MSVC80)
# 1
else()
# 2
endif()
if(MSVC80)
# 1
endif()

View File

@ -0,0 +1,26 @@
2 400 401 + if(MSVC80)
0 401 400 | # 1
2 400 401 + elseif(MSVC90)
0 401 400 | # 2
2 400 401 + elseif(APPLE)
0 401 400 | # 3
2 400 401 + else()
0 401 401 | # 4
0 401 400 | endif()
0 400 400
2 400 401 + if(MSVC80)
0 401 400 | # 1
2 400 401 + elseif(MSVC90)
0 401 401 | # 2
0 401 400 | endif()
0 400 400
2 400 401 + if(MSVC80)
0 401 400 | # 1
2 400 401 + else()
0 401 401 | # 2
0 401 400 | endif()
0 400 400
2 400 401 + if(MSVC80)
0 401 401 | # 1
0 401 400 | endif()
0 400 400

View File

@ -0,0 +1,25 @@
{11}if{0}({6}MSVC80{0})
{1}# 1{0}
{11}elseif{0}({6}MSVC90{0})
{1}# 2{0}
{11}elseif{0}({6}APPLE{0})
{1}# 3{0}
{11}else{0}()
{1}# 4{0}
{11}endif{0}()
{11}if{0}({6}MSVC80{0})
{1}# 1{0}
{11}elseif{0}({6}MSVC90{0})
{1}# 2{0}
{11}endif{0}()
{11}if{0}({6}MSVC80{0})
{1}# 1{0}
{11}else{0}()
{1}# 2{0}
{11}endif{0}()
{11}if{0}({6}MSVC80{0})
{1}# 1{0}
{11}endif{0}()

View File

@ -0,0 +1,7 @@
lexer.*.cmake=cmake
keywords2.*.cmake=MSVC80 MSVC90 APPLE
fold=1
fold.at.else=0
match Bug77_1.cmake
fold.at.else=1

View File

@ -0,0 +1,6 @@
<script>
/**
*/
</script>

View File

@ -0,0 +1,7 @@
2 400 0 + <script>
1 401 0 |
2 401 0 + /**
0 402 0 | */
1 401 0 |
0 401 0 | </script>
0 400 0

View File

@ -0,0 +1,6 @@
{1}<script>{40}
{44}/**
*/{41}
{1}</script>{0}

View File

@ -0,0 +1,43 @@
// Enumerate all styles: 0 to 13
// default=0
// number=1
1
// string=2
"2"
// stringeol=3
"3
// propertyname=4
"4":
// escapesequence=5
"\n"
// linecomment=6
// 6 Line Comment
// blockcomment=7
/* 7 Block Comment */
// operator=8
{}
// uri=9
"http://9.org"
// compactiri=10
"x:y"
// keyword=11
true
// ldkeyword=12
"@id"
// error=13
# 13 error

View File

@ -0,0 +1,44 @@
0 400 400 // Enumerate all styles: 0 to 13
1 400 400
0 400 400 // default=0
1 400 400
1 400 400
0 400 400 // number=1
0 400 400 1
1 400 400
0 400 400 // string=2
0 400 400 "2"
1 400 400
0 400 400 // stringeol=3
0 400 400 "3
1 400 400
0 400 400 // propertyname=4
0 400 400 "4":
1 400 400
0 400 400 // escapesequence=5
0 400 400 "\n"
1 400 400
0 400 400 // linecomment=6
0 400 400 // 6 Line Comment
1 400 400
0 400 400 // blockcomment=7
0 400 400 /* 7 Block Comment */
1 400 400
0 400 400 // operator=8
0 400 400 {}
1 400 400
0 400 400 // uri=9
0 400 400 "http://9.org"
1 400 400
0 400 400 // compactiri=10
0 400 400 "x:y"
1 400 400
0 400 400 // keyword=11
0 400 400 true
1 400 400
0 400 400 // ldkeyword=12
0 400 400 "@id"
1 400 400
0 400 400 // error=13
0 400 400 # 13 error
0 400 0

View File

@ -0,0 +1,43 @@
{6}// Enumerate all styles: 0 to 13{0}
{6}// default=0{0}
{6}// number=1{0}
{1}1{0}
{6}// string=2{0}
{2}"2"{0}
{6}// stringeol=3{0}
{3}"3
{0}
{6}// propertyname=4{0}
{4}"4"{8}:{0}
{6}// escapesequence=5{0}
{2}"{5}\n{2}"{0}
{6}// linecomment=6{0}
{6}// 6 Line Comment{0}
{6}// blockcomment=7{0}
{7}/* 7 Block Comment */{0}
{6}// operator=8{0}
{8}{}{0}
{6}// uri=9{0}
{2}"{9}http://9.org{2}"{0}
{6}// compactiri=10{0}
{10}"x:y"{0}
{6}// keyword=11{0}
{11}true{0}
{6}// ldkeyword=12{0}
{2}"{12}@id{2}"{0}
{6}// error=13{0}
{13}# 13 error{0}

View File

@ -0,0 +1,14 @@
lexer.*.json=json
# JSON keywords
keywords.*.json=false true null
# JSON-LD keywords
keywords2.*.json=@id @context @type @value @language @container \
@list @set @reverse @index @base @vocab @graph
lexer.json.escape.sequence=1
lexer.json.allow.comments=1
fold=1
fold.compact=1

View File

@ -0,0 +1,20 @@
H1
==
H2
--
# H1
## H2
H1
==
H2
--
# H1
## H2
### H3
#### H4
##### H5
###### H6

View File

@ -0,0 +1,21 @@
0 400 0 H1
0 400 0 ==
0 400 0
0 400 0 H2
0 400 0 --
0 400 0
0 400 0 # H1
0 400 0
0 400 0 ## H2
0 400 0
0 400 0 H1
0 400 0 ==
0 400 0 H2
0 400 0 --
0 400 0 # H1
0 400 0 ## H2
0 400 0 ### H3
0 400 0 #### H4
0 400 0 ##### H5
0 400 0 ###### H6
0 400 0

View File

@ -0,0 +1,20 @@
{0}H1{1}
{6}=={1}
{0}H2{1}
{7}--{1}
{6}#{0} H1{1}
{7}##{0} H2{1}
{0}H1{1}
{6}=={1}
{0}H2{1}
{7}--{1}
{6}#{0} H1{1}
{7}##{0} H2{1}
{8}###{0} H3{1}
{9}####{0} H4{1}
{10}#####{0} H5{1}
{11}######{0} H6{1}

View File

@ -0,0 +1,20 @@
H1
==
H2
--
# H1
## H2
H1
==
H2
--
# H1
## H2
### H3
#### H4
##### H5
###### H6

View File

@ -0,0 +1,21 @@
0 400 0 H1
0 400 0 ==
0 400 0
0 400 0 H2
0 400 0 --
0 400 0
0 400 0 # H1
0 400 0
0 400 0 ## H2
0 400 0
0 400 0 H1
0 400 0 ==
0 400 0 H2
0 400 0 --
0 400 0 # H1
0 400 0 ## H2
0 400 0 ### H3
0 400 0 #### H4
0 400 0 ##### H5
0 400 0 ###### H6
0 400 0

View File

@ -0,0 +1,20 @@
{0}H1{1}
{6}==
{1}
{0}H2{1}
{7}--
{1}
{6}# H1
{1}
{7}## H2
{1}
{0}H1{1}
{6}==
{0}H2{1}
{7}--
{6}# H1
{7}## H2
{8}### H3
{9}#### H4
{10}##### H5
{11}###### H6

View File

@ -0,0 +1,89 @@
%% Correctly defined arguments block
function y = foo (x)
% Some comment here
% And, maybe, here
arguments
x (1,2) {mustBeReal(x)}
end
y = x*2;
arguments = 1;
y = y + arguments;
end
%% No arguments block, "arguments" is used
% as a variable name (identifier)
% Prevent arguments from folding with an identifier
function y = foo (x)
% Some comment here
x = x + 1;
arguments = 10;
y = x + arguments;
end
% Prevent arguments from folding with a number
function y = foo (x)
4
arguments = 10;
y = x + arguments;
end
% With a double quote string
function y = foo (x)
"test"
arguments = 10;
y = x + arguments;
end
% With a string
function y = foo (x)
'test'
arguments = 10;
y = x + arguments;
end
% With a keyword
function y = foo (x)
if x == 0;
return 0;
end
arguments = 10;
y = x + arguments;
end
% With an operator (illegal syntax)
function y = foo (x)
*
arguments = 10;
y = x + arguments;
end
% Arguments block is illegal in nested functions,
% but lexer should process it anyway
function y = foo (x)
arguments
x (1,2) {mustBeReal(x)}
end
function y = foo (x)
arguments
x (1,2) {mustBeReal(x)}
end
arguments = 5;
y = arguments + x;
end
% Use as a variable, just in case
arguments = 10;
end
% Erroneous use of arguments block
function y = foo(x)
% Some comment
x = x + 1;
arguments
x
end
y = x;
end

View File

@ -0,0 +1,89 @@
0 400 400 %% Correctly defined arguments block
2 400 401 + function y = foo (x)
0 401 401 | % Some comment here
0 401 401 | % And, maybe, here
1 401 401 |
2 401 402 + arguments
0 402 402 | x (1,2) {mustBeReal(x)}
0 402 401 | end
1 401 401 |
0 401 401 | y = x*2;
0 401 401 | arguments = 1;
0 401 401 | y = y + arguments;
0 401 400 | end
1 400 400
0 400 400 %% No arguments block, "arguments" is used
0 400 400 % as a variable name (identifier)
0 400 400 % Prevent arguments from folding with an identifier
2 400 401 + function y = foo (x)
0 401 401 | % Some comment here
0 401 401 | x = x + 1;
0 401 401 | arguments = 10;
0 401 401 | y = x + arguments;
0 401 400 | end
1 400 400
0 400 400 % Prevent arguments from folding with a number
2 400 401 + function y = foo (x)
0 401 401 | 4
0 401 401 | arguments = 10;
0 401 401 | y = x + arguments;
0 401 400 | end
1 400 400
0 400 400 % With a double quote string
2 400 401 + function y = foo (x)
0 401 401 | "test"
0 401 401 | arguments = 10;
0 401 401 | y = x + arguments;
0 401 400 | end
1 400 400
0 400 400 % With a string
2 400 401 + function y = foo (x)
0 401 401 | 'test'
0 401 401 | arguments = 10;
0 401 401 | y = x + arguments;
0 401 400 | end
1 400 400
0 400 400 % With a keyword
2 400 401 + function y = foo (x)
2 401 402 + if x == 0;
0 402 402 | return 0;
0 402 401 | end
0 401 401 | arguments = 10;
0 401 401 | y = x + arguments;
0 401 400 | end
1 400 400
0 400 400 % With an operator (illegal syntax)
2 400 401 + function y = foo (x)
0 401 401 | *
0 401 401 | arguments = 10;
0 401 401 | y = x + arguments;
0 401 400 | end
1 400 400
0 400 400 % Arguments block is illegal in nested functions,
0 400 400 % but lexer should process it anyway
2 400 401 + function y = foo (x)
2 401 402 + arguments
0 402 402 | x (1,2) {mustBeReal(x)}
0 402 401 | end
1 401 401 |
2 401 402 + function y = foo (x)
2 402 403 + arguments
0 403 403 | x (1,2) {mustBeReal(x)}
0 403 402 | end
0 402 402 | arguments = 5;
0 402 402 | y = arguments + x;
0 402 401 | end
1 401 401 |
0 401 401 | % Use as a variable, just in case
0 401 401 | arguments = 10;
0 401 400 | end
1 400 400
0 400 400 % Erroneous use of arguments block
2 400 401 + function y = foo(x)
0 401 401 | % Some comment
0 401 401 | x = x + 1;
0 401 401 | arguments
0 401 401 | x
0 401 400 | end
0 400 400 y = x;
0 400 3ff end

View File

@ -0,0 +1,89 @@
{1}%% Correctly defined arguments block{0}
{4}function{0} {7}y{0} {6}={0} {7}foo{0} {6}({7}x{6}){0}
{1}% Some comment here{0}
{1}% And, maybe, here{0}
{4}arguments{0}
{7}x{0} {6}({3}1{6},{3}2{6}){0} {6}{{7}mustBeReal{6}({7}x{6})}{0}
{4}end{0}
{7}y{0} {6}={0} {7}x{6}*{3}2{6};{0}
{7}arguments{0} {6}={0} {3}1{6};{0}
{7}y{0} {6}={0} {7}y{0} {6}+{0} {7}arguments{6};{0}
{4}end{0}
{1}%% No arguments block, "arguments" is used {0}
{1}% as a variable name (identifier){0}
{1}% Prevent arguments from folding with an identifier{0}
{4}function{0} {7}y{0} {6}={0} {7}foo{0} {6}({7}x{6}){0}
{1}% Some comment here{0}
{7}x{0} {6}={0} {7}x{0} {6}+{0} {3}1{6};{0}
{7}arguments{0} {6}={0} {3}10{6};{0}
{7}y{0} {6}={0} {7}x{0} {6}+{0} {7}arguments{6};{0}
{4}end{0}
{1}% Prevent arguments from folding with a number{0}
{4}function{0} {7}y{0} {6}={0} {7}foo{0} {6}({7}x{6}){0}
{3}4{0}
{7}arguments{0} {6}={0} {3}10{6};{0}
{7}y{0} {6}={0} {7}x{0} {6}+{0} {7}arguments{6};{0}
{4}end{0}
{1}% With a double quote string{0}
{4}function{0} {7}y{0} {6}={0} {7}foo{0} {6}({7}x{6}){0}
{8}"test"{0}
{7}arguments{0} {6}={0} {3}10{6};{0}
{7}y{0} {6}={0} {7}x{0} {6}+{0} {7}arguments{6};{0}
{4}end{0}
{1}% With a string{0}
{4}function{0} {7}y{0} {6}={0} {7}foo{0} {6}({7}x{6}){0}
{5}'test'{0}
{7}arguments{0} {6}={0} {3}10{6};{0}
{7}y{0} {6}={0} {7}x{0} {6}+{0} {7}arguments{6};{0}
{4}end{0}
{1}% With a keyword{0}
{4}function{0} {7}y{0} {6}={0} {7}foo{0} {6}({7}x{6}){0}
{4}if{0} {7}x{0} {6}=={0} {3}0{6};{0}
{4}return{0} {3}0{6};{0}
{4}end{0}
{7}arguments{0} {6}={0} {3}10{6};{0}
{7}y{0} {6}={0} {7}x{0} {6}+{0} {7}arguments{6};{0}
{4}end{0}
{1}% With an operator (illegal syntax){0}
{4}function{0} {7}y{0} {6}={0} {7}foo{0} {6}({7}x{6}){0}
{6}*{0}
{7}arguments{0} {6}={0} {3}10{6};{0}
{7}y{0} {6}={0} {7}x{0} {6}+{0} {7}arguments{6};{0}
{4}end{0}
{1}% Arguments block is illegal in nested functions,{0}
{1}% but lexer should process it anyway{0}
{4}function{0} {7}y{0} {6}={0} {7}foo{0} {6}({7}x{6}){0}
{4}arguments{0}
{7}x{0} {6}({3}1{6},{3}2{6}){0} {6}{{7}mustBeReal{6}({7}x{6})}{0}
{4}end{0}
{4}function{0} {7}y{0} {6}={0} {7}foo{0} {6}({7}x{6}){0}
{4}arguments{0}
{7}x{0} {6}({3}1{6},{3}2{6}){0} {6}{{7}mustBeReal{6}({7}x{6})}{0}
{4}end{0}
{7}arguments{0} {6}={0} {3}5{6};{0}
{7}y{0} {6}={0} {7}arguments{0} {6}+{0} {7}x{6};{0}
{4}end{0}
{1}% Use as a variable, just in case{0}
{7}arguments{0} {6}={0} {3}10{6};{0}
{4}end{0}
{1}% Erroneous use of arguments block{0}
{4}function{0} {7}y{0} {6}={0} {7}foo{6}({7}x{6}){0}
{1}% Some comment{0}
{7}x{0} {6}={0} {7}x{0} {6}+{0} {3}1{6};{0}
{7}arguments{0}
{7}x{0}
{4}end{0}
{7}y{0} {6}={0} {7}x{6};{0}
{4}end

View File

@ -0,0 +1,74 @@
classdef Foo < handle
% A couple of properties blocks
properties (SetAccess = private)
Var1
Var2
end
properties
Var3
Var4
end
methods (Static)
function y = f1(x)
% events, properties and methods are the valid idenifiers
% in the function scope
events = 1;
properties = 2;
y = x + events * properties;
end
% Any of these words are also valid functions' names inside
% methods block
function y = events(x)
arguments
x {mustBeNegative}
end
y = f2(x)*100;
function b = f2(a)
b = a + 5;
end
end
end
% Example events block
events
Event1
Event2
end
end
% Now, let's break some stuff
classdef Bar
properties
% Though MATLAB won't execute such a code, events, properties
% and methods are keywords here, because we're still in the class scope
events
end
methods
end
end
% Not allowed in MATLAB, but, technically, we're still in the class scope
if condition1
if condition2
% Though we're in the class scope, lexel will recognize no
% keywords here: to avoid the neccessaty to track nested scopes,
% it just considers everything beyond level 2 of folding to be
% a function scope
methods
events
properties
end
end
end

View File

@ -0,0 +1,75 @@
2 400 401 + classdef Foo < handle
1 401 401 |
0 401 401 | % A couple of properties blocks
2 401 402 + properties (SetAccess = private)
0 402 402 | Var1
0 402 402 | Var2
0 402 401 | end
1 401 401 |
2 401 402 + properties
0 402 402 | Var3
0 402 402 | Var4
0 402 401 | end
1 401 401 |
2 401 402 + methods (Static)
2 402 403 + function y = f1(x)
0 403 403 | % events, properties and methods are the valid idenifiers
0 403 403 | % in the function scope
0 403 403 | events = 1;
0 403 403 | properties = 2;
0 403 403 | y = x + events * properties;
0 403 402 | end
1 402 402 |
0 402 402 | % Any of these words are also valid functions' names inside
0 402 402 | % methods block
2 402 403 + function y = events(x)
1 403 403 |
2 403 404 + arguments
0 404 404 | x {mustBeNegative}
0 404 403 | end
1 403 403 |
0 403 403 | y = f2(x)*100;
2 403 404 + function b = f2(a)
0 404 404 | b = a + 5;
0 404 403 | end
0 403 402 | end
0 402 401 | end
1 401 401 |
0 401 401 | % Example events block
2 401 402 + events
0 402 402 | Event1
0 402 402 | Event2
0 402 401 | end
0 401 400 | end
1 400 400
1 400 400
0 400 400 % Now, let's break some stuff
2 400 401 + classdef Bar
1 401 401 |
2 401 402 + properties
0 402 402 | % Though MATLAB won't execute such a code, events, properties
0 402 402 | % and methods are keywords here, because we're still in the class scope
2 402 403 + events
0 403 402 | end
1 402 402 |
2 402 403 + methods
0 403 402 | end
0 402 401 | end
1 401 401 |
0 401 401 | % Not allowed in MATLAB, but, technically, we're still in the class scope
2 401 402 + if condition1
2 402 403 + if condition2
0 403 403 | % Though we're in the class scope, lexel will recognize no
0 403 403 | % keywords here: to avoid the neccessaty to track nested scopes,
0 403 403 | % it just considers everything beyond level 2 of folding to be
0 403 403 | % a function scope
0 403 403 | methods
0 403 403 | events
0 403 403 | properties
0 403 402 | end
0 402 401 | end
1 401 401 |
1 401 401 |
0 401 400 | end
1 400 400
1 400 400

View File

@ -0,0 +1,74 @@
{4}classdef{0} {7}Foo{0} {6}<{0} {7}handle{0}
{1}% A couple of properties blocks{0}
{4}properties{0} {6}({7}SetAccess{0} {6}={0} {7}private{6}){0}
{7}Var1{0}
{7}Var2{0}
{4}end{0}
{4}properties{0}
{7}Var3{0}
{7}Var4{0}
{4}end{0}
{4}methods{0} {6}({7}Static{6}){0}
{4}function{0} {7}y{0} {6}={0} {7}f1{6}({7}x{6}){0}
{1}% events, properties and methods are the valid idenifiers{0}
{1}% in the function scope{0}
{7}events{0} {6}={0} {3}1{6};{0}
{7}properties{0} {6}={0} {3}2{6};{0}
{7}y{0} {6}={0} {7}x{0} {6}+{0} {7}events{0} {6}*{0} {7}properties{6};{0}
{4}end{0}
{1}% Any of these words are also valid functions' names inside{0}
{1}% methods block{0}
{4}function{0} {7}y{0} {6}={0} {7}events{6}({7}x{6}){0}
{4}arguments{0}
{7}x{0} {6}{{7}mustBeNegative{6}}{0}
{4}end{0}
{7}y{0} {6}={0} {7}f2{6}({7}x{6})*{3}100{6};{0}
{4}function{0} {7}b{0} {6}={0} {7}f2{6}({7}a{6}){0}
{7}b{0} {6}={0} {7}a{0} {6}+{0} {3}5{6};{0}
{4}end{0}
{4}end{0}
{4}end{0}
{1}% Example events block{0}
{4}events{0}
{7}Event1{0}
{7}Event2{0}
{4}end{0}
{4}end{0}
{1}% Now, let's break some stuff{0}
{4}classdef{0} {7}Bar{0}
{4}properties{0}
{1}% Though MATLAB won't execute such a code, events, properties{0}
{1}% and methods are keywords here, because we're still in the class scope{0}
{4}events{0}
{4}end{0}
{4}methods{0}
{4}end{0}
{4}end{0}
{1}% Not allowed in MATLAB, but, technically, we're still in the class scope{0}
{4}if{0} {7}condition1{0}
{4}if{0} {7}condition2{0}
{1}% Though we're in the class scope, lexel will recognize no{0}
{1}% keywords here: to avoid the neccessaty to track nested scopes,{0}
{1}% it just considers everything beyond level 2 of folding to be{0}
{1}% a function scope{0}
{7}methods{0}
{7}events{0}
{7}properties{0}
{4}end{0}
{4}end{0}
{4}end{0}

View File

@ -0,0 +1,48 @@
% All the exaples here should yeild folding
classdef
% Some code
end
for
% Some code
end
function
% Some code
end
if
% Some code
elseif
% Some code
else
% Some code
end
parfor
% Some code
end
spmd
% Some code
end
switch
case
% Some code
case
% Some code
otherwise
% Some code
end
try
% Some code
catch
% Some code
end
while
% Some code
end

View File

@ -0,0 +1,49 @@
0 400 400 % All the exaples here should yeild folding
1 400 400
2 400 401 + classdef
0 401 401 | % Some code
0 401 400 | end
1 400 400
2 400 401 + for
0 401 401 | % Some code
0 401 400 | end
1 400 400
2 400 401 + function
0 401 401 | % Some code
0 401 400 | end
1 400 400
2 400 401 + if
0 401 401 | % Some code
0 401 401 | elseif
0 401 401 | % Some code
0 401 401 | else
0 401 401 | % Some code
0 401 400 | end
1 400 400
2 400 401 + parfor
0 401 401 | % Some code
0 401 400 | end
1 400 400
2 400 401 + spmd
0 401 401 | % Some code
0 401 400 | end
1 400 400
2 400 401 + switch
0 401 401 | case
0 401 401 | % Some code
0 401 401 | case
0 401 401 | % Some code
0 401 401 | otherwise
0 401 401 | % Some code
0 401 400 | end
1 400 400
2 400 401 + try
0 401 401 | % Some code
0 401 401 | catch
0 401 401 | % Some code
0 401 400 | end
1 400 400
2 400 401 + while
0 401 401 | % Some code
0 401 400 | end
1 400 400

View File

@ -0,0 +1,48 @@
{1}% All the exaples here should yeild folding{0}
{4}classdef{0}
{1}% Some code{0}
{4}end{0}
{4}for{0}
{1}% Some code{0}
{4}end{0}
{4}function{0}
{1}% Some code{0}
{4}end{0}
{4}if{0}
{1}% Some code{0}
{4}elseif{0}
{1}% Some code{0}
{4}else{0}
{1}% Some code{0}
{4}end{0}
{4}parfor{0}
{1}% Some code{0}
{4}end{0}
{4}spmd{0}
{1}% Some code{0}
{4}end{0}
{4}switch{0}
{4}case{0}
{1}% Some code{0}
{4}case{0}
{1}% Some code{0}
{4}otherwise{0}
{1}% Some code{0}
{4}end{0}
{4}try{0}
{1}% Some code{0}
{4}catch{0}
{1}% Some code{0}
{4}end{0}
{4}while{0}
{1}% Some code{0}
{4}end{0}

View File

@ -1,5 +1,5 @@
lexer.*.matlab=matlab
keywords.*.matlab=end for global if
keywords.*.matlab=end for global if break case catch classdef continue else elseif function otherwise parfor persistent return spmd switch try while
lexer.*.octave=octave
keywords.*.octave=end for global if

View File

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

View File

@ -0,0 +1,19 @@
# Default=0
a
# Comment=1
# Heading=2
[heading]
# Assignment=3
=
# Default Value=4
@
# Key=5
key=

View File

@ -0,0 +1,20 @@
0 400 0 # Default=0
0 400 0 a
1 400 0
0 400 0 # Comment=1
1 400 0
1 400 0
0 400 0 # Heading=2
2 400 0 + [heading]
1 401 0 |
1 401 0 |
0 401 0 | # Assignment=3
0 401 0 | =
1 401 0 |
0 401 0 | # Default Value=4
0 401 0 | @
1 401 0 |
0 401 0 | # Key=5
0 401 0 | key=
1 401 0 |
0 401 0 |

View File

@ -0,0 +1,19 @@
{1}# Default=0
{0}a
{1}# Comment=1
{0}
{1}# Heading=2
{2}[heading]
{0}
{1}# Assignment=3
{3}={0}
{1}# Default Value=4
{4}@{0}
{1}# Key=5
{5}key{3}={0}

View File

@ -3,6 +3,7 @@ use v6;
# Normal single line comment
my Int $i = 0;
my Rat $r = 3.142;
my Str $backslash = "\\";
my Str $s = "Hello, world! \$i == $i and \$r == $r";
say $s;

View File

@ -3,6 +3,7 @@
0 400 400 # Normal single line comment
0 400 400 my Int $i = 0;
0 400 400 my Rat $r = 3.142;
0 400 400 my Str $backslash = "\\";
0 400 400 my Str $s = "Hello, world! \$i == $i and \$r == $r";
0 400 400 say $s;
1 400 400

View File

@ -3,6 +3,7 @@
{2}# Normal single line comment{0}
{20}my{0} {22}Int{0} {23}$i{0} {18}={0} {16}0{18};{0}
{20}my{0} {22}Rat{0} {23}$r{0} {18}={0} {16}3.142{18};{0}
{20}my{0} {22}Str{0} {23}$backslash{0} {18}={0} {8}"\\"{18};{0}
{20}my{0} {22}Str{0} {23}$s{0} {18}={0} {8}"Hello, world! \$i == {12}$i{8} and \$r == {12}$r{8}"{18};{0}
{20}say{0} {23}$s{18};{0}

View File

@ -0,0 +1,100 @@
# Enumerate all styles where possible: 0..31,40..41
# 22,23,30,31,40,41 are never set and 1 switches rest of file to error state
#0 whitespace
#
#
#1:error, can be set with a heredoc delimiter >256 characters but that can't be recovered from
#<<ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789
#2:comment line
#3:POD
=begin
3:POD
=end
#4:number
4
#5:word
super
#6:string
"6:double quotes"
#7:single quoted string
'7:single quotes'
#8:class name
class ClassName end
#9:def name
def Function end
#10:operator
&
#11:identifier
identifier
#12:regex
/[12a-z]/
#13:global
$global13
#14:symbol
:symbol14
#15:module name
module Module15 end
#16:instance var
@instance16
#17:class var
@@class17
#18:back ticks
`18`
#19:data section at end of file
#20:here delimiter
<<DELIMITER20
DELIMITER20
#21:here doc
<<D
21:here doc
D
#22:here qq never set
#23:here qw never set
#24:q quoted string
%q!24:quotes's!
#25:Q quoted string
%Q!25:quotes"s!
#26:executed string
%x(echo 26)
#27:regex
%r(27[a-z]/[A-Z]+)
#28:string array
%w(28 cgi.rb complex.rb date.rb)
#29:demoted keyword do
while 1 do end
# 30,31,40,41 never set
#19:data section
__END__

View File

@ -0,0 +1,101 @@
0 400 0 # Enumerate all styles where possible: 0..31,40..41
0 400 0 # 22,23,30,31,40,41 are never set and 1 switches rest of file to error state
1 400 0
0 400 0 #0 whitespace
0 400 0 #
0 400 0 #
1 400 0
0 400 0 #1:error, can be set with a heredoc delimiter >256 characters but that can't be recovered from
0 400 0 #<<ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789
1 400 0
0 400 0 #2:comment line
1 400 0
0 400 0 #3:POD
0 400 0 =begin
0 400 0 3:POD
0 400 0 =end
1 400 0
0 400 0 #4:number
0 400 0 4
1 400 0
0 400 0 #5:word
0 400 0 super
1 400 0
0 400 0 #6:string
0 400 0 "6:double quotes"
1 400 0
0 400 0 #7:single quoted string
0 400 0 '7:single quotes'
1 400 0
0 400 0 #8:class name
0 400 0 class ClassName end
1 400 0
0 400 0 #9:def name
0 400 0 def Function end
1 400 0
0 400 0 #10:operator
0 400 0 &
1 400 0
0 400 0 #11:identifier
0 400 0 identifier
1 400 0
0 400 0 #12:regex
0 400 0 /[12a-z]/
1 400 0
0 400 0 #13:global
0 400 0 $global13
1 400 0
0 400 0 #14:symbol
0 400 0 :symbol14
1 400 0
0 400 0 #15:module name
0 400 0 module Module15 end
1 400 0
0 400 0 #16:instance var
0 400 0 @instance16
1 400 0
0 400 0 #17:class var
0 400 0 @@class17
1 400 0
0 400 0 #18:back ticks
0 400 0 `18`
1 400 0
0 400 0 #19:data section at end of file
1 400 0
0 400 0 #20:here delimiter
2 400 0 + <<DELIMITER20
0 401 0 | DELIMITER20
1 400 0
0 400 0 #21:here doc
2 400 0 + <<D
0 401 0 | 21:here doc
0 401 0 | D
1 400 0
0 400 0 #22:here qq never set
1 400 0
0 400 0 #23:here qw never set
1 400 0
0 400 0 #24:q quoted string
0 400 0 %q!24:quotes's!
1 400 0
0 400 0 #25:Q quoted string
0 400 0 %Q!25:quotes"s!
1 400 0
0 400 0 #26:executed string
0 400 0 %x(echo 26)
1 400 0
0 400 0 #27:regex
0 400 0 %r(27[a-z]/[A-Z]+)
1 400 0
0 400 0 #28:string array
0 400 0 %w(28 cgi.rb complex.rb date.rb)
1 400 0
0 400 0 #29:demoted keyword do
0 400 0 while 1 do end
1 400 0
0 400 0 # 30,31,40,41 never set
1 400 0
0 400 0 #19:data section
0 400 0 __END__
1 400 0
0 400 0

View File

@ -0,0 +1,100 @@
{2}# Enumerate all styles where possible: 0..31,40..41{0}
{2}# 22,23,30,31,40,41 are never set and 1 switches rest of file to error state{0}
{2}#0 whitespace{0}
{2}#{0}
{2}#{0}
{2}#1:error, can be set with a heredoc delimiter >256 characters but that can't be recovered from{0}
{2}#<<ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789{0}
{2}#2:comment line{0}
{2}#3:POD{0}
{3}=begin
3:POD
=end{0}
{2}#4:number{0}
{4}4{0}
{2}#5:word{0}
{5}super{0}
{2}#6:string{0}
{6}"6:double quotes"{0}
{2}#7:single quoted string{0}
{7}'7:single quotes'{0}
{2}#8:class name{0}
{5}class{0} {8}ClassName{0} {5}end{0}
{2}#9:def name{0}
{5}def{0} {9}Function{0} {5}end{0}
{2}#10:operator{0}
{10}&{0}
{2}#11:identifier{0}
{11}identifier{0}
{2}#12:regex{0}
{12}/[12a-z]/{0}
{2}#13:global{0}
{13}$global13{0}
{2}#14:symbol{0}
{14}:symbol14{0}
{2}#15:module name{0}
{5}module{0} {15}Module15{0} {5}end{0}
{2}#16:instance var{0}
{16}@instance16{0}
{2}#17:class var{0}
{17}@@class17{0}
{2}#18:back ticks{0}
{18}`18`{0}
{2}#19:data section at end of file{0}
{2}#20:here delimiter{0}
{10}<<{20}DELIMITER20{21}
{20}DELIMITER20{0}
{2}#21:here doc{0}
{10}<<{20}D{21}
21:here doc
{20}D{0}
{2}#22:here qq never set{0}
{2}#23:here qw never set{0}
{2}#24:q quoted string{0}
{24}%q!24:quotes's!{0}
{2}#25:Q quoted string{0}
{25}%Q!25:quotes"s!{0}
{2}#26:executed string{0}
{26}%x(echo 26){0}
{2}#27:regex{0}
{27}%r(27[a-z]/[A-Z]+){0}
{2}#28:string array{0}
{28}%w(28 cgi.rb complex.rb date.rb){0}
{2}#29:demoted keyword do{0}
{5}while{0} {4}1{0} {29}do{0} {5}end{0}
{2}# 30,31,40,41 never set{0}
{2}#19:data section{0}
{19}__END__

View File

@ -0,0 +1,71 @@
def dbg_args(a, b=1, c:, d: 6, &block) = puts("Args passed: #{[a, b, c, d, block.call]}")
dbg_args(0, c: 5) { 7 }
class A
def attr = @attr
def attr=(value)
@attr = value
end
def attr? = !!@attr
def attr! = @attr = true
# unary operator
def -@ = 1
def +@ = 1
def ! = 1
def !@ = 1
# binary operator
def +(value) = 1 + value
def -(value) = 1 - value
def *(value) = 1 * value
def **(value) = 1 ** value
def /(value) = 1 / value
def %(value) = 1 % value
def &(value) = 1 & value
def ^(value) = 1 ^ value
def >>(value) = 1 >> value
def <<(value) = 1 << value
def ==(other) = true
def !=(other) = true
def ===(other) = true
def =~(other) = true
def <=>(other) = true
def <(other) = true
def <=(other) = true
def >(other) = true
def >=(other) = true
# element reference and assignment
def [](a, b) = puts(a + b)
def []=(a, b, c)
puts a + b + c
end
# array decomposition
def dec(((a, b), c)) = puts(a + b + c)
# class method
def self.say(*s) = puts(s)
# test short method name
def a = 1
def ab = 1
end
# class method
def String.hello
"Hello, world!"
end
# singleton method
greeting = "Hello"
def greeting.broaden
self + ", world!"
end
# one line definition
def a(b, c) b; c end
# parentheses omitted
def ab c
puts c
end
# Test folding of multi-line SCE_RB_STRING_QW
puts %W(
a
b
c
)

View File

@ -0,0 +1,72 @@
0 400 0 def dbg_args(a, b=1, c:, d: 6, &block) = puts("Args passed: #{[a, b, c, d, block.call]}")
0 400 0 dbg_args(0, c: 5) { 7 }
1 400 0
2 400 0 + class A
0 401 0 | def attr = @attr
2 401 0 + def attr=(value)
0 402 0 | @attr = value
0 402 0 | end
0 401 0 | def attr? = !!@attr
0 401 0 | def attr! = @attr = true
0 401 0 | # unary operator
0 401 0 | def -@ = 1
0 401 0 | def +@ = 1
0 401 0 | def ! = 1
0 401 0 | def !@ = 1
0 401 0 | # binary operator
0 401 0 | def +(value) = 1 + value
0 401 0 | def -(value) = 1 - value
0 401 0 | def *(value) = 1 * value
0 401 0 | def **(value) = 1 ** value
0 401 0 | def /(value) = 1 / value
0 401 0 | def %(value) = 1 % value
0 401 0 | def &(value) = 1 & value
0 401 0 | def ^(value) = 1 ^ value
0 401 0 | def >>(value) = 1 >> value
0 401 0 | def <<(value) = 1 << value
0 401 0 | def ==(other) = true
0 401 0 | def !=(other) = true
0 401 0 | def ===(other) = true
0 401 0 | def =~(other) = true
0 401 0 | def <=>(other) = true
0 401 0 | def <(other) = true
0 401 0 | def <=(other) = true
0 401 0 | def >(other) = true
0 401 0 | def >=(other) = true
0 401 0 | # element reference and assignment
0 401 0 | def [](a, b) = puts(a + b)
2 401 0 + def []=(a, b, c)
0 402 0 | puts a + b + c
0 402 0 | end
0 401 0 | # array decomposition
0 401 0 | def dec(((a, b), c)) = puts(a + b + c)
0 401 0 | # class method
0 401 0 | def self.say(*s) = puts(s)
0 401 0 | # test short method name
0 401 0 | def a = 1
0 401 0 | def ab = 1
0 401 0 | end
1 400 0
0 400 0 # class method
2 400 0 + def String.hello
0 401 0 | "Hello, world!"
0 401 0 | end
0 400 0 # singleton method
0 400 0 greeting = "Hello"
2 400 0 + def greeting.broaden
0 401 0 | self + ", world!"
0 401 0 | end
0 400 0 # one line definition
0 400 0 def a(b, c) b; c end
0 400 0 # parentheses omitted
2 400 0 + def ab c
0 401 0 | puts c
0 401 0 | end
1 400 0
0 400 0 # Test folding of multi-line SCE_RB_STRING_QW
2 400 0 + puts %W(
0 401 0 | a
0 401 0 | b
0 401 0 | c
0 401 0 | )
0 400 0

View File

@ -0,0 +1,71 @@
{5}def{0} {9}dbg_args{10}({11}a{10},{0} {11}b{10}={4}1{10},{0} {11}c{14}:{10},{0} {14}d:{0} {4}6{10},{0} {10}&{11}block{10}){0} {10}={0} {11}puts{10}({6}"Args passed: {10}#{[{11}a{10},{0} {11}b{10},{0} {11}c{10},{0} {11}d{10},{0} {11}block{10}.{11}call{10}]}{6}"{10}){0}
{11}dbg_args{10}({4}0{10},{0} {14}c:{0} {4}5{10}){0} {10}{{0} {4}7{0} {10}}{0}
{5}class{0} {8}A{0}
{5}def{0} {9}attr{0} {10}={0} {16}@attr{0}
{5}def{0} {9}attr={10}({11}value{10}){0}
{16}@attr{0} {10}={0} {11}value{0}
{5}end{0}
{5}def{0} {9}attr?{0} {10}={0} {10}!!{16}@attr{0}
{5}def{0} {9}attr!{0} {10}={0} {16}@attr{0} {10}={0} {5}true{0}
{2}# unary operator{0}
{5}def{0} {10}-@{0} {10}={0} {4}1{0}
{5}def{0} {10}+@{0} {10}={0} {4}1{0}
{5}def{0} {10}!{0} {10}={0} {4}1{0}
{5}def{0} {10}!@{0} {10}={0} {4}1{0}
{2}# binary operator{0}
{5}def{0} {10}+({11}value{10}){0} {10}={0} {4}1{0} {10}+{0} {11}value{0}
{5}def{0} {10}-({11}value{10}){0} {10}={0} {4}1{0} {10}-{0} {11}value{0}
{5}def{0} {10}*({11}value{10}){0} {10}={0} {4}1{0} {10}*{0} {11}value{0}
{5}def{0} {10}**({11}value{10}){0} {10}={0} {4}1{0} {10}**{0} {11}value{0}
{5}def{0} {10}/({11}value{10}){0} {10}={0} {4}1{0} {10}/{0} {11}value{0}
{5}def{0} {10}%({11}value{10}){0} {10}={0} {4}1{0} {10}%{0} {11}value{0}
{5}def{0} {10}&({11}value{10}){0} {10}={0} {4}1{0} {10}&{0} {11}value{0}
{5}def{0} {10}^({11}value{10}){0} {10}={0} {4}1{0} {10}^{0} {11}value{0}
{5}def{0} {10}>>({11}value{10}){0} {10}={0} {4}1{0} {10}>>{0} {11}value{0}
{5}def{0} {10}<<({11}value{10}){0} {10}={0} {4}1{0} {10}<<{0} {11}value{0}
{5}def{0} {10}==({11}other{10}){0} {10}={0} {5}true{0}
{5}def{0} {10}!=({11}other{10}){0} {10}={0} {5}true{0}
{5}def{0} {10}===({11}other{10}){0} {10}={0} {5}true{0}
{5}def{0} {10}=~({11}other{10}){0} {10}={0} {5}true{0}
{5}def{0} {10}<=>({11}other{10}){0} {10}={0} {5}true{0}
{5}def{0} {10}<({11}other{10}){0} {10}={0} {5}true{0}
{5}def{0} {10}<=({11}other{10}){0} {10}={0} {5}true{0}
{5}def{0} {10}>({11}other{10}){0} {10}={0} {5}true{0}
{5}def{0} {10}>=({11}other{10}){0} {10}={0} {5}true{0}
{2}# element reference and assignment{0}
{5}def{0} {10}[]({11}a{10},{0} {11}b{10}){0} {10}={0} {11}puts{10}({11}a{0} {10}+{0} {11}b{10}){0}
{5}def{0} {10}[]=({11}a{10},{0} {11}b{10},{0} {11}c{10}){0}
{11}puts{0} {11}a{0} {10}+{0} {11}b{0} {10}+{0} {11}c{0}
{5}end{0}
{2}# array decomposition{0}
{5}def{0} {9}dec{10}((({11}a{10},{0} {11}b{10}),{0} {11}c{10})){0} {10}={0} {11}puts{10}({11}a{0} {10}+{0} {11}b{0} {10}+{0} {11}c{10}){0}
{2}# class method{0}
{5}def{0} {29}self{10}.{9}say{10}(*{11}s{10}){0} {10}={0} {11}puts{10}({11}s{10}){0}
{2}# test short method name{0}
{5}def{0} {9}a{0} {10}={0} {4}1{0}
{5}def{0} {9}ab{0} {10}={0} {4}1{0}
{5}end{0}
{2}# class method{0}
{5}def{0} {11}String{10}.{9}hello{0}
{6}"Hello, world!"{0}
{5}end{0}
{2}# singleton method{0}
{11}greeting{0} {10}={0} {6}"Hello"{0}
{5}def{0} {11}greeting{10}.{9}broaden{0}
{5}self{0} {10}+{0} {6}", world!"{0}
{5}end{0}
{2}# one line definition{0}
{5}def{0} {9}a{10}({11}b{10},{0} {11}c{10}){0} {11}b{10};{0} {11}c{0} {5}end{0}
{2}# parentheses omitted{0}
{5}def{0} {9}ab{0} {11}c{0}
{11}puts{0} {11}c{0}
{5}end{0}
{2}# Test folding of multi-line SCE_RB_STRING_QW{0}
{11}puts{0} {28}%W(
a
b
c
){0}

View File

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

View File

@ -0,0 +1,9 @@
0 400 0 # Test that final \n in indented heredoc (2nd example) is styled as SCE_RB_HERE_Q not SCE_RB_HERE_DELIM
2 400 0 + <<T
0 401 0 | X
0 401 0 | T
1 400 0
2 400 0 + <<-T
0 401 0 | X
0 401 0 | T
0 400 0

View File

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

View File

@ -0,0 +1,13 @@
# heredoc method call, other argument
puts <<~EOT.chomp
squiggly heredoc
EOT
puts <<ONE, __FILE__, __LINE__
content for heredoc one
ONE
# heredoc prevStyle == SCE_RB_GLOBAL
$stdout.puts <<~EOT.chomp
squiggly heredoc
EOT

View File

@ -0,0 +1,14 @@
0 400 0 # heredoc method call, other argument
2 400 0 + puts <<~EOT.chomp
0 401 0 | squiggly heredoc
0 401 0 | EOT
1 400 0
2 400 0 + puts <<ONE, __FILE__, __LINE__
0 401 0 | content for heredoc one
0 401 0 | ONE
1 400 0
0 400 0 # heredoc prevStyle == SCE_RB_GLOBAL
2 400 0 + $stdout.puts <<~EOT.chomp
0 401 0 | squiggly heredoc
0 401 0 | EOT
0 400 0

View File

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

View File

@ -0,0 +1,29 @@
# -*- coding: utf-8 -*-
# single character strings
puts ?a
puts ?\n
puts ?\s
puts ?\\#
puts ?\u{41}
puts ?\C-a
puts ?\M-a
puts ?\M-\C-a
puts ?\C-\M-a
puts ?あ
puts ?"
puts ?/
puts ?[[1, 2]
puts ?/\
# symbol and ternary operator
ab = /\d+/
cd = /\w+/
puts :ab, :cd, :/, :[]
puts :/\
# TODO: space after '?' and ':' is not needed
puts true ?ab : cd
puts true ? /\d+/ : /\w+/
puts false ?ab : cd
puts false ? /\d+/ : /\w+/

View File

@ -0,0 +1,30 @@
0 400 0 # -*- coding: utf-8 -*-
1 400 0
0 400 0 # single character strings
0 400 0 puts ?a
0 400 0 puts ?\n
0 400 0 puts ?\s
0 400 0 puts ?\\#
0 400 0 puts ?\u{41}
0 400 0 puts ?\C-a
0 400 0 puts ?\M-a
0 400 0 puts ?\M-\C-a
0 400 0 puts ?\C-\M-a
0 400 0 puts ?あ
0 400 0 puts ?"
0 400 0 puts ?/
0 400 0 puts ?[[1, 2]
0 400 0 puts ?/\
1 400 0
0 400 0 # symbol and ternary operator
0 400 0 ab = /\d+/
0 400 0 cd = /\w+/
0 400 0 puts :ab, :cd, :/, :[]
0 400 0 puts :/\
1 400 0
0 400 0 # TODO: space after '?' and ':' is not needed
0 400 0 puts true ?ab : cd
0 400 0 puts true ? /\d+/ : /\w+/
0 400 0 puts false ?ab : cd
0 400 0 puts false ? /\d+/ : /\w+/
0 400 0

View File

@ -0,0 +1,29 @@
{2}# -*- coding: utf-8 -*-{0}
{2}# single character strings{0}
{11}puts{0} {4}?a{0}
{11}puts{0} {4}?\n{0}
{11}puts{0} {4}?\s{0}
{11}puts{0} {4}?\\{2}#{0}
{11}puts{0} {4}?\u{10}{{4}41{10}}{0}
{11}puts{0} {4}?\C-a{0}
{11}puts{0} {4}?\M-a{0}
{11}puts{0} {4}?\M-\C-a{0}
{11}puts{0} {4}?\C-\M-a{0}
{11}puts{0} {4}?あ{0}
{11}puts{0} {4}?"{0}
{11}puts{0} {4}?/{0}
{11}puts{0} {4}?[{10}[{4}1{10},{0} {4}2{10}]{0}
{11}puts{0} {4}?/{0}\
{2}# symbol and ternary operator{0}
{11}ab{0} {10}={0} {12}/\d+/{0}
{11}cd{0} {10}={0} {12}/\w+/{0}
{11}puts{0} {14}:ab{10},{0} {14}:cd{10},{0} {14}:/{10},{0} {14}:[]{0}
{11}puts{0} {14}:/{0}\
{2}# TODO: space after '?' and ':' is not needed{0}
{11}puts{0} {5}true{0} {10}?{11}ab{0} {10}:{0} {11}cd{0}
{11}puts{0} {5}true{0} {10}?{0} {12}/\d+/{0} {10}:{0} {12}/\w+/{0}
{11}puts{0} {5}false{0} {10}?{11}ab{0} {10}:{0} {11}cd{0}
{11}puts{0} {5}false{0} {10}?{0} {12}/\d+/{0} {10}:{0} {12}/\w+/{0}

View File

@ -1,4 +1,4 @@
lexer.*.rb=ruby
keywords.*.rb=begin class def do end if module return self super true while \
keywords.*.rb=begin class def do end false if module return self super true while \
__FILE__ __LINE__
fold=1

View File

@ -0,0 +1,3 @@
lexer.*.vhd=vhdl
fold=1

View File

@ -0,0 +1,57 @@
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_arith.all;
entity x is
port(
rst : in std_logic;
clk : in std_logic;
d : in std_logic;
q : out std_logic_vector;
a, b : in std_logic;
v : out std_logic
);
end x;
architecture behavioral of x is
signal q_i : std_logic_vector(q'range);
begin
v <= a when b = '1' else '0';
gen: for j in q'low to q'high generate
gen_first: if j = q'low generate
variable foo : boolean := false;
begin
stage1: process (rst, clk) begin
if rst = '1' then
q_i(j) <= '0';
elsif rising_edge(clk) then
q_i(j) <= d;
case a is
when 1 =>
when 2 =>
when others =>
end case;
end if;
end process;
else generate
stages: process (rst, clk)
begin
if rst = '1' then
q_i(j) <= '0';
elsif rising_edge(clk) then
for u in 0 to 7 loop
q_i(j) <= q_i(j - 1);
end loop;
end if;
end process;
end generate;
end generate;
L: case expression generate
when choice1 =>
when choice2 =>
end generate L;
end behavioral;

View File

@ -0,0 +1,58 @@
0 400 400 library ieee;
0 400 400 use ieee.std_logic_1164.all;
0 400 400 use ieee.std_logic_arith.all;
1 400 400
2 400 401 + entity x is
2 401 402 + port(
0 402 402 | rst : in std_logic;
0 402 402 | clk : in std_logic;
0 402 402 | d : in std_logic;
0 402 402 | q : out std_logic_vector;
0 402 402 | a, b : in std_logic;
0 402 402 | v : out std_logic
0 402 401 | );
0 401 400 | end x;
1 400 400
2 400 401 + architecture behavioral of x is
0 401 401 | signal q_i : std_logic_vector(q'range);
2 400 401 + begin
1 401 401 |
0 401 401 | v <= a when b = '1' else '0';
1 401 401 |
2 401 402 + gen: for j in q'low to q'high generate
2 402 403 + gen_first: if j = q'low generate
0 403 403 | variable foo : boolean := false;
2 402 403 + begin
2 403 404 + stage1: process (rst, clk) begin
2 404 405 + if rst = '1' then
0 405 405 | q_i(j) <= '0';
2 404 405 + elsif rising_edge(clk) then
0 405 405 | q_i(j) <= d;
2 405 406 + case a is
0 406 406 | when 1 =>
0 406 406 | when 2 =>
0 406 406 | when others =>
0 406 405 | end case;
0 405 404 | end if;
0 404 403 | end process;
2 402 403 + else generate
2 403 404 + stages: process (rst, clk)
0 404 404 | begin
2 404 405 + if rst = '1' then
0 405 405 | q_i(j) <= '0';
2 404 405 + elsif rising_edge(clk) then
2 405 406 + for u in 0 to 7 loop
0 406 406 | q_i(j) <= q_i(j - 1);
0 406 405 | end loop;
0 405 404 | end if;
0 404 403 | end process;
0 403 402 | end generate;
0 402 401 | end generate;
1 401 401 |
2 401 402 + L: case expression generate
0 402 402 | when choice1 =>
0 402 402 | when choice2 =>
0 402 401 | end generate L;
1 401 401 |
0 401 400 | end behavioral;
0 400 0

View File

@ -0,0 +1,57 @@
{6}library{0} {6}ieee{5};{0}
{6}use{0} {6}ieee{5}.{6}std_logic_1164{5}.{6}all{5};{0}
{6}use{0} {6}ieee{5}.{6}std_logic_arith{5}.{6}all{5};{0}
{6}entity{0} {6}x{0} {6}is{0}
{6}port{5}({0}
{6}rst{0} {5}:{0} {6}in{0} {6}std_logic{5};{0}
{6}clk{0} {5}:{0} {6}in{0} {6}std_logic{5};{0}
{6}d{0} {5}:{0} {6}in{0} {6}std_logic{5};{0}
{6}q{0} {5}:{0} {6}out{0} {6}std_logic_vector{5};{0}
{6}a{5},{0} {6}b{0} {5}:{0} {6}in{0} {6}std_logic{5};{0}
{6}v{0} {5}:{0} {6}out{0} {6}std_logic{0}
{5});{0}
{6}end{0} {6}x{5};{0}
{6}architecture{0} {6}behavioral{0} {6}of{0} {6}x{0} {6}is{0}
{6}signal{0} {6}q_i{0} {5}:{0} {6}std_logic_vector{5}({6}q{0}'{6}range{5});{0}
{6}begin{0}
{6}v{0} {5}<={0} {6}a{0} {6}when{0} {6}b{0} {5}={0} {4}'1'{0} {6}else{0} {4}'0'{5};{0}
{6}gen{5}:{0} {6}for{0} {6}j{0} {6}in{0} {6}q{0}'{6}low{0} {6}to{0} {6}q{0}'{6}high{0} {6}generate{0}
{6}gen_first{5}:{0} {6}if{0} {6}j{0} {5}={0} {6}q{0}'{6}low{0} {6}generate{0}
{6}variable{0} {6}foo{0} {5}:{0} {6}boolean{0} {5}:={0} {6}false{5};{0}
{6}begin{0}
{6}stage1{5}:{0} {6}process{0} {5}({6}rst{5},{0} {6}clk{5}){0} {6}begin{0}
{6}if{0} {6}rst{0} {5}={0} {4}'1'{0} {6}then{0}
{6}q_i{5}({6}j{5}){0} {5}<={0} {4}'0'{5};{0}
{6}elsif{0} {6}rising_edge{5}({6}clk{5}){0} {6}then{0}
{6}q_i{5}({6}j{5}){0} {5}<={0} {6}d{5};{0}
{6}case{0} {6}a{0} {6}is{0}
{6}when{0} {3}1{0} {5}=>{0}
{6}when{0} {3}2{0} {5}=>{0}
{6}when{0} {6}others{0} {5}=>{0}
{6}end{0} {6}case{5};{0}
{6}end{0} {6}if{5};{0}
{6}end{0} {6}process{5};{0}
{6}else{0} {6}generate{0}
{6}stages{5}:{0} {6}process{0} {5}({6}rst{5},{0} {6}clk{5}){0}
{6}begin{0}
{6}if{0} {6}rst{0} {5}={0} {4}'1'{0} {6}then{0}
{6}q_i{5}({6}j{5}){0} {5}<={0} {4}'0'{5};{0}
{6}elsif{0} {6}rising_edge{5}({6}clk{5}){0} {6}then{0}
{6}for{0} {6}u{0} {6}in{0} {3}0{0} {6}to{0} {3}7{0} {6}loop{0}
{6}q_i{5}({6}j{5}){0} {5}<={0} {6}q_i{5}({6}j{0} {5}-{0} {3}1{5});{0}
{6}end{0} {6}loop{5};{0}
{6}end{0} {6}if{5};{0}
{6}end{0} {6}process{5};{0}
{6}end{0} {6}generate{5};{0}
{6}end{0} {6}generate{5};{0}
{6}L{5}:{0} {6}case{0} {6}expression{0} {6}generate{0}
{6}when{0} {6}choice1{0} {5}=>{0}
{6}when{0} {6}choice2{0} {5}=>{0}
{6}end{0} {6}generate{0} {6}L{5};{0}
{6}end{0} {6}behavioral{5};{0}

View File

@ -1 +1 @@
516
517

View File

@ -16,6 +16,7 @@
#include "ScintillaTypes.h"
#include "ScintillaMessages.h"
#include "ScintillaCall.h"
#include "ScintillaStructures.h"
namespace Scintilla {
@ -51,7 +52,7 @@ intptr_t ScintillaCall::CallString(Message msg, uintptr_t wParam, const char *s)
}
std::string ScintillaCall::CallReturnString(Message msg, uintptr_t wParam) {
size_t len = CallPointer(msg, wParam, nullptr);
const size_t len = CallPointer(msg, wParam, nullptr);
if (len) {
std::string value(len, '\0');
CallPointer(msg, wParam, value.data());
@ -110,6 +111,17 @@ std::string ScintillaCall::StringOfSpan(Span span) {
}
}
std::string ScintillaCall::StringOfRange(Span span) {
if (span.Length() == 0) {
return std::string();
} else {
std::string text(span.Length(), '\0');
TextRangeFull tr{ {span.start, span.end}, text.data() };
GetTextRangeFull(&tr);
return text;
}
}
Position ScintillaCall::ReplaceTarget(std::string_view text) {
return ScintillaCall::CallString(Message::ReplaceTarget, text.length(), text.data());
}
@ -1127,10 +1139,18 @@ Position ScintillaCall::FindText(Scintilla::FindOption searchFlags, void *ft) {
return CallPointer(Message::FindText, static_cast<uintptr_t>(searchFlags), ft);
}
Position ScintillaCall::FindTextFull(Scintilla::FindOption searchFlags, void *ft) {
return CallPointer(Message::FindTextFull, static_cast<uintptr_t>(searchFlags), ft);
}
Position ScintillaCall::FormatRange(bool draw, void *fr) {
return CallPointer(Message::FormatRange, draw, fr);
}
Position ScintillaCall::FormatRangeFull(bool draw, void *fr) {
return CallPointer(Message::FormatRangeFull, draw, fr);
}
Line ScintillaCall::FirstVisibleLine() {
return Call(Message::GetFirstVisibleLine);
}
@ -1187,6 +1207,10 @@ Position ScintillaCall::GetTextRange(void *tr) {
return CallPointer(Message::GetTextRange, 0, tr);
}
Position ScintillaCall::GetTextRangeFull(void *tr) {
return CallPointer(Message::GetTextRangeFull, 0, tr);
}
void ScintillaCall::HideSelection(bool hide) {
Call(Message::HideSelection, hide);
}

View File

@ -1952,7 +1952,7 @@ void ListBoxImpl::Create(Window & /*parent*/, int /*ctrlID*/, Scintilla::Interna
styleMask: NSWindowStyleMaskBorderless
backing: NSBackingStoreBuffered
defer: NO];
[winLB setLevel: NSFloatingWindowLevel];
[winLB setLevel: NSModalPanelWindowLevel+1];
[winLB setHasShadow: YES];
NSRect scRect = NSMakeRect(0, 0, lbRect.size.width, lbRect.size.height);
scroller = [[NSScrollView alloc] initWithFrame: scRect];

View File

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

View File

@ -565,7 +565,7 @@
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = NO;
CURRENT_PROJECT_VERSION = 5.2.2;
CURRENT_PROJECT_VERSION = 5.2.3;
DEBUG_INFORMATION_FORMAT = dwarf;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
@ -627,7 +627,7 @@
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = NO;
CURRENT_PROJECT_VERSION = 5.2.2;
CURRENT_PROJECT_VERSION = 5.2.3;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
ENABLE_NS_ASSERTIONS = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
@ -657,7 +657,7 @@
CODE_SIGN_IDENTITY = "-";
CODE_SIGN_STYLE = Manual;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 5.2.2;
CURRENT_PROJECT_VERSION = 5.2.3;
DEFINES_MODULE = YES;
DEVELOPMENT_TEAM = "";
DYLIB_COMPATIBILITY_VERSION = 1;
@ -691,7 +691,7 @@
CODE_SIGN_IDENTITY = "-";
CODE_SIGN_STYLE = Manual;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 5.2.2;
CURRENT_PROJECT_VERSION = 5.2.3;
DEFINES_MODULE = YES;
DEVELOPMENT_TEAM = "";
DYLIB_COMPATIBILITY_VERSION = 1;

View File

@ -567,7 +567,6 @@ class CaseFolderDBCS : public CaseFolderTable {
CFStringEncoding encoding;
public:
explicit CaseFolderDBCS(CFStringEncoding encoding_) : encoding(encoding_) {
StandardASCII();
}
size_t Fold(char *folded, size_t sizeFolded, const char *mixed, size_t lenMixed) override {
if ((lenMixed == 1) && (sizeFolded > 0)) {
@ -606,7 +605,6 @@ std::unique_ptr<CaseFolder> ScintillaCocoa::CaseFolderForEncoding() {
vs.styles[StyleDefault].characterSet);
if (pdoc->dbcsCodePage == 0) {
std::unique_ptr<CaseFolderTable> pcf = std::make_unique<CaseFolderTable>();
pcf->StandardASCII();
// Only for single byte encodings
for (int i=0x80; i<0x100; i++) {
char sCharacter[2] = "A";
@ -1178,7 +1176,7 @@ void ScintillaCocoa::CreateCallTipWindow(PRectangle rc) {
styleMask: NSWindowStyleMaskBorderless
backing: NSBackingStoreBuffered
defer: NO];
[callTip setLevel: NSFloatingWindowLevel];
[callTip setLevel: NSModalPanelWindowLevel+1];
[callTip setHasShadow: YES];
NSRect ctContent = NSMakeRect(0, 0, rc.Width(), rc.Height());
CallTipView *caption = [[CallTipView alloc] initWithFrame: ctContent];

View File

@ -86,8 +86,8 @@
<p>With Scintilla 4.x, it was most common for applications to set a lexer either by lexer name or lexer ID (<span class="name">SCLEX_...</span>) by calling
<code>SCI_SETLEXERLANGUAGE("&lt;name&gt;")</code> or <code>SCI_SETLEXER(SCLEX_*)</code>.</p>
<p>With Scintilla 5, the normal technique s to call Lexilla's <span class="name">CreateLexer</span> function
with a lexer name then apply the result with
<p>With Scintilla 5, the normal technique is to call Lexilla's <span class="name">CreateLexer</span> function
with a lexer name, then apply the result with
Scintilla's <span class="name">SCI_SETILEXER</span> method:<br />
<code>ILexer5 *pLexer = CreateLexer("&lt;name&gt;")<br />
SCI_SETILEXER(pLexer)</code></p>

View File

@ -129,7 +129,7 @@
<h1>Scintilla Documentation</h1>
<p>Last edited 9 March 2022 NH</p>
<p>Last edited 15 May 2022 NH</p>
<p style="background:#90F0C0">Scintilla 5 has moved the lexers from Scintilla into a new
<a href="Lexilla.html">Lexilla</a> project.<br />
@ -531,6 +531,7 @@
<a class="message" href="#SCI_SETREADONLY">SCI_SETREADONLY(bool readOnly)</a><br />
<a class="message" href="#SCI_GETREADONLY">SCI_GETREADONLY &rarr; bool</a><br />
<a class="message" href="#SCI_GETTEXTRANGE">SCI_GETTEXTRANGE(&lt;unused&gt;, Sci_TextRange *tr) &rarr; position</a><br />
<a class="message" href="#SCI_GETTEXTRANGEFULL">SCI_GETTEXTRANGEFULL(&lt;unused&gt;, Sci_TextRangeFull *tr) &rarr; position</a><br />
<a class="message" href="#SCI_ALLOCATE">SCI_ALLOCATE(position bytes)</a><br />
<a class="message" href="#SCI_ALLOCATELINES">SCI_ALLOCATELINES(line lines)</a><br />
<a class="message" href="#SCI_ADDTEXT">SCI_ADDTEXT(position length, const char *text)</a><br />
@ -614,13 +615,17 @@
only, attempts to modify the text cause the <a class="message"
href="#SCN_MODIFYATTEMPTRO"><code>SCN_MODIFYATTEMPTRO</code></a> notification.</p>
<p><b id="SCI_GETTEXTRANGE">SCI_GETTEXTRANGE(&lt;unused&gt;, <a class="jump" href="#Sci_TextRange">Sci_TextRange</a> *tr) &rarr; position</b><br />
<p>
<b id="SCI_GETTEXTRANGE">SCI_GETTEXTRANGE(&lt;unused&gt;, <a class="jump" href="#Sci_TextRange">Sci_TextRange</a> *tr) &rarr; position</b><br />
<b id="SCI_GETTEXTRANGEFULL">SCI_GETTEXTRANGEFULL(&lt;unused&gt;, <a class="jump" href="#Sci_TextRangeFull">Sci_TextRangeFull</a> *tr) &rarr; position</b><br />
This collects the text between the positions <code>cpMin</code> and <code>cpMax</code> and
copies it to <code>lpstrText</code> (see <code>struct Sci_TextRange</code> in
<code>Scintilla.h</code>). If <code>cpMax</code> is -1, text is returned to the end of the
document. The text is 0 terminated, so you must supply a buffer that is at least 1 character
longer than the number of characters you wish to read. The return value is the length of the
returned text not including the terminating 0.</p>
<p><code>SCI_GETTEXTRANGEFULL</code> uses 64-bit positions on all platforms so is safe for documents larger than 2GB.
It should always be used in preference to <code>SCI_GETTEXTRANGE</code> which will be deprecated in a future release.</p>
<p>See also: <code><a class="seealso" href="#SCI_GETSELTEXT">SCI_GETSELTEXT</a>,
<a class="seealso" href="#SCI_GETLINE">SCI_GETLINE</a>,
@ -721,8 +726,9 @@
These structures are defined to be exactly the same shape as the Win32 <code>TEXTRANGE</code>
and <code>CHARRANGE</code>, so that older code that treats Scintilla as a RichEdit will
work.</p>
<p>In a future release the type <code>Sci_PositionCR</code> will be redefined to be 64-bits when Scintilla is
built for 64-bits on all platforms.</p>
<p>In a future release, these types will be deprecated.
<a class="seealso" href="#SCI_MARGINSETSTYLEOFFSET">SCI_GETTEXTRANGEFULL</a>, <code>Sci_TextRangeFull</code>
and <code>Sci_CharacterRangeFull</code> should be used instead.</p>
<pre>
typedef long Sci_PositionCR;
@ -735,6 +741,23 @@ struct Sci_TextRange {
struct Sci_CharacterRange chrg;
char *lpstrText;
};
</pre>
<p><b id="Sci_TextRangeFull">Sci_TextRangeFull</b> and <b id="Sci_CharacterRangeFull">Sci_CharacterRangeFull</b><br />
These structures are the same as <code>Sci_TextRange</code> and <code>Sci_CharacterRange</code> except that positions are
always 64-bit in 64-bit builds so will work on documents larger than 2GB.</p>
<pre>
typedef ptrdiff_t Sci_Position;
struct Sci_CharacterRangeFull {
Sci_Position cpMin;
Sci_Position cpMax;
};
struct Sci_TextRangeFull {
struct Sci_CharacterRangeFull chrg;
char *lpstrText;
};
</pre>
<h3 id="EncodedAccess">Specific to GTK, Cocoa and Windows only: Access to encoded text</h3>
@ -1033,13 +1056,15 @@ struct Sci_TextRange {
See the documentation of your C++ runtime for details on what is supported.</p>
<code><a class="message" href="#SCI_FINDTEXT">SCI_FINDTEXT(int searchFlags, Sci_TextToFind *ft) &rarr; position</a><br />
<a class="message" href="#SCI_FINDTEXTFULL">SCI_FINDTEXTFULL(int searchFlags, Sci_TextToFindFull *ft) &rarr; position</a><br />
<a class="message" href="#SCI_SEARCHANCHOR">SCI_SEARCHANCHOR</a><br />
<a class="message" href="#SCI_SEARCHNEXT">SCI_SEARCHNEXT(int searchFlags, const char *text) &rarr; position</a><br />
<a class="message" href="#SCI_SEARCHPREV">SCI_SEARCHPREV(int searchFlags, const char *text) &rarr; position</a><br />
</code>
<p><b id="SCI_FINDTEXT">SCI_FINDTEXT(int searchFlags, <a class="jump" href="#Sci_TextToFind">Sci_TextToFind</a> *ft) &rarr; position</b><br />
This message searches for text in the document. It does not use or move the current selection.
<b id="SCI_FINDTEXT">SCI_FINDTEXTFULL(int searchFlags, <a class="jump" href="#Sci_TextToFindFull">Sci_TextToFindFull</a> *ft) &rarr; position</b><br />
These messages search for text in the document. They do not use or move the current selection.
The <a class="jump" href="#searchFlags"><code class="parameter">searchFlags</code></a> argument controls the
search type, which includes regular expression searches.</p>
@ -1047,13 +1072,14 @@ struct Sci_TextRange {
search backwards to find the previous occurrence of a search string by setting the end of the
search range before the start.</p>
<p>The <code>Sci_TextToFind</code> structure is defined in <code>Scintilla.h</code>; set
<p>The <code>Sci_TextToFind</code> and <code>Sci_TextToFindFull</code> structures are defined in <code>Scintilla.h</code>; set
<code>chrg.cpMin</code> and <code>chrg.cpMax</code> with the range of positions in the document
to search. You can search backwards by
setting <code>chrg.cpMax</code> less than <code>chrg.cpMin</code>.
Set the <code>lpstrText</code> member of <code>Sci_TextToFind</code> to point at a zero terminated
text string holding the search pattern. If your language makes the use of <code>Sci_TextToFind</code>
difficult, you should consider using <code>SCI_SEARCHINTARGET</code> instead.</p>
difficult, you should consider using <code>SCI_SEARCHINTARGET</code> instead.
On 64-bit Win32, <code>SCI_FINDTEXT</code> is limited to the first 2G of text and <code>SCI_FINDTEXTFULL</code> removes this limitation.</p>
<p>The return value is -1 if the search fails or the position of the start of the found text if
it succeeds. The <code>chrgText.cpMin</code> and <code>chrgText.cpMax</code> members of
@ -1071,6 +1097,16 @@ struct Sci_TextToFind {
const char *lpstrText; // the search pattern (zero terminated)
struct Sci_CharacterRange chrgText; // returned as position of matching text
};
</pre>
<p><b id="Sci_TextToFindFull">Sci_TextToFindFull</b><br />
This structure extends <code>Sci_TextToFind</code> to support huge documents on Win32.</p>
<pre>
struct Sci_TextToFindFull {
struct <a class="jump" href="#Sci_CharacterRangeFull">Sci_CharacterRangeFull</a> chrg; // range to search
const char *lpstrText; // the search pattern (zero terminated)
struct Sci_CharacterRangeFull chrgText; // returned as position of matching text
};
</pre>
<p><b id="SCI_SEARCHANCHOR">SCI_SEARCHANCHOR</b><br />
@ -6633,6 +6669,7 @@ struct Sci_TextToFind {
and on Cocoa <code>CGContextRef</code> is used.</p>
<code><a class="message" href="#SCI_FORMATRANGE">SCI_FORMATRANGE(bool draw, Sci_RangeToFormat *fr) &rarr; position</a><br />
<a class="message" href="#SCI_FORMATRANGEFULL">SCI_FORMATRANGEFULL(bool draw, Sci_RangeToFormatFull *fr) &rarr; position</a><br />
<a class="message" href="#SCI_SETPRINTMAGNIFICATION">SCI_SETPRINTMAGNIFICATION(int
magnification)</a><br />
<a class="message" href="#SCI_GETPRINTMAGNIFICATION">SCI_GETPRINTMAGNIFICATION &rarr; int</a><br />
@ -6643,6 +6680,7 @@ struct Sci_TextToFind {
</code>
<p><b id="SCI_FORMATRANGE">SCI_FORMATRANGE(bool draw, Sci_RangeToFormat *fr) &rarr; position</b><br />
<b id="SCI_FORMATRANGEFULL">SCI_FORMATRANGEFULL(bool draw, Sci_RangeToFormatFull *fr) &rarr; position</b><br />
This call renders a range of text into a device context. If you use
this for printing, you will probably want to arrange a page header and footer; Scintilla does
not do this for you. See <code>SciTEWin::Print()</code> in <code>SciTEWinDlg.cxx</code> for an
@ -6651,7 +6689,8 @@ struct Sci_TextToFind {
<p><code class="parameter">draw</code> controls if any output is done. Set this to false if you are paginating
(for example, if you use this with MFC you will need to paginate in
<code>OnBeginPrinting()</code> before you output each page.</p>
<code>OnBeginPrinting()</code> before you output each page.
On 64-bit Win32, <code>SCI_FORMATRANGE</code> is limited to the first 2G of text and <code>SCI_FORMATRANGEFULL</code> removes this limitation.</p>
<pre>
struct Sci_Rectangle { int left; int top; int right; int bottom; };
@ -6662,6 +6701,14 @@ struct Sci_RangeToFormat {
Sci_Rectangle rcPage; // Physically printable page size
Sci_CharacterRange chrg; // Range of characters to print
};
struct Sci_RangeToFormatFull {
Sci_SurfaceID hdc; // The Surface ID we print to
Sci_SurfaceID hdcTarget; // The Surface ID we use for measuring (may be same as hdc)
Sci_Rectangle rc; // Rectangle in which to print
Sci_Rectangle rcPage; // Physically printable page size
Sci_CharacterRangeFull chrg; // Range of characters to print
};
</pre>
<p>On Windows, <code>hdc</code> and <code>hdcTarget</code> should both be set to the device context handle

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/scintilla522.zip">
<font size="4"> <a href="https://www.scintilla.org/scintilla523.zip">
Windows</a>&nbsp;&nbsp;
<a href="https://www.scintilla.org/scintilla522.tgz">
<a href="https://www.scintilla.org/scintilla523.tgz">
GTK/Linux</a>&nbsp;&nbsp;
</font>
</td>
@ -42,7 +42,7 @@
containing very few restrictions.
</p>
<h3>
Release 5.2.2
Release 5.2.3
</h3>
<h4>
Source Code
@ -50,8 +50,8 @@
The source code package contains all of the source code for Scintilla but no binary
executable code and is available in
<ul>
<li><a href="https://www.scintilla.org/scintilla522.zip">zip format</a> (1.3M) commonly used on Windows</li>
<li><a href="https://www.scintilla.org/scintilla522.tgz">tgz format</a> (1.2M) commonly used on Linux and compatible operating systems</li>
<li><a href="https://www.scintilla.org/scintilla523.zip">zip format</a> (1.3M) commonly used on Windows</li>
<li><a href="https://www.scintilla.org/scintilla523.tgz">tgz format</a> (1.2M) commonly used on Linux and compatible operating systems</li>
</ul>
Instructions for building on both Windows and Linux are included in the readme file.
<h4>

View File

@ -573,6 +573,52 @@
</tr>
</table>
<h2>Releases</h2>
<h3>
<a href="https://www.scintilla.org/scintilla523.zip">Release 5.2.3</a>
</h3>
<ul>
<li>
Released 22 May 2022.
</li>
<li>
Duplicate APIs to support 64-bit document positions on Win32:
SCI_GETTEXTRANGEFULL, SCI_FINDTEXTFULL, and SCI_FORMATRANGEFULL.
This adds new types to Scintilla.iface which may impact downstream projects.
Applications should move to these APIs from their predecessors as they will be deprecated.
</li>
<li>
Improve performance of SCI_FOLDALL(SC_FOLDACTION_EXPAND) by not lexing whole document
as it does not depend on folding structure.
</li>
<li>
Fix partial updates and non-responsive scroll bars on Xorg.
This defers scroll bar changes to an idle task so could affect applications that depend on
the scroll position being updated.
<a href="https://sourceforge.net/p/scintilla/bugs/2322/">Bug #2322</a>,
<a href="https://sourceforge.net/p/scintilla/bugs/2196/">Bug #2196</a>,
<a href="https://sourceforge.net/p/scintilla/bugs/2312/">Bug #2312</a>.
</li>
<li>
Fix problem with horizontally inverted glyphs with buffered drawing and WS_EX_LAYOUTRTL set on Win32 GDI.
<a href="https://sourceforge.net/p/scintilla/feature-requests/1435/">Feature #1435</a>.
</li>
<li>
Fix ARM64 builds with Visual C++ due to unsupported CETCOMPAT flag.
<a href="https://sourceforge.net/p/scintilla/bugs/2324/">Bug #2324</a>.
</li>
<li>
On Cocoa, place autocompletion lists and calltips on a higher window level so they can be seen
when invoked from a modal dialog.
<a href="https://sourceforge.net/p/scintilla/bugs/2329/">Bug #2329</a>.
</li>
<li>
For Qt 6, fix "modified" signal when text is null but length non-0.
<a href="https://sourceforge.net/p/scintilla/bugs/2328/">Bug #2328</a>.
</li>
<li>
Fix pink selection background when printing by making it completely transparent.
</li>
</ul>
<h3>
<a href="https://www.scintilla.org/scintilla522.zip">Release 5.2.2</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="20220331" />
<meta name="Date.Modified" content="20220522" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<style type="text/css">
#versionlist {
@ -56,8 +56,8 @@
GTK, and macOS</font>
</td>
<td width="40%" align="right">
<font color="#FFCC99" size="3"> Release version 5.2.2<br />
Site last modified March 31 2022</font>
<font color="#FFCC99" size="3"> Release version 5.2.3<br />
Site last modified May 22 2022</font>
</td>
<td width="20%">
&nbsp;
@ -66,28 +66,26 @@
</table>
<table bgcolor="#000000" width="100%" cellspacing="0" cellpadding="0" border="0">
<tr>
<td width="100%" style="background: url(https://www.scintilla.org/SciBreak.jpg) no-repeat;height:150px;">
<td width="100%" style="background: url(SciBreak.jpg) no-repeat;height:150px;">
&nbsp;
</td>
</tr>
</table>
<ul id="versionlist">
<li>Version 5.2.3 adds 64-bit safe APIs and fixes scrollbar on GTK with Xorg.</li>
<li>Version 5.2.2 on GTK, scroll horizontally with Shift + Scroll Wheel.</li>
<li>Version 5.2.1 fixes leaks on GTK.</li>
<li>Version 5.2.0 adds multithreaded layout to significantly improve performance for very wide lines.</li>
<li>Version 5.1.5 changes string-returning APIs to be more consistent and removes ScintillaEditPy.</li>
<li>Version 5.1.4 fixes primary selection paste within one instance on GTK.</li>
<li>Version 5.1.3 fixes a layout bug with monospaced fonts on Cocoa.</li>
</ul>
<ul id="menu">
<li id="remote1"><a href="https://www.scintilla.org/SciTEImage.html">Screenshot</a></li>
<li id="remote2"><a href="https://www.scintilla.org/ScintillaDownload.html">Download</a></li>
<li><a href="https://www.scintilla.org/ScintillaDoc.html">Documentation</a></li>
<li><a href="https://www.scintilla.org/ScintillaToDo.html">Bugs</a></li>
<li><a href="ScintillaDoc.html">Documentation</a></li>
<li><a href="ScintillaToDo.html">Bugs</a></li>
<li id="remote3"><a href="https://www.scintilla.org/Lexilla.html">Lexilla</a></li>
<li id="remote4"><a href="https://www.scintilla.org/SciTE.html">SciTE</a></li>
<li><a href="https://www.scintilla.org/ScintillaHistory.html">History</a></li>
<li><a href="https://www.scintilla.org/ScintillaRelated.html">Related</a></li>
<li><a href="ScintillaHistory.html">History</a></li>
<li><a href="ScintillaRelated.html">Related</a></li>
<li id="remote5"><a href="https://www.scintilla.org/Privacy.html">Privacy</a></li>
</ul>
<script type="text/javascript" language="JavaScript"><!--
@ -100,7 +98,7 @@ if (!IsRemote()) { //if NOT remote...
}
//--></script>
<p>
<a href="https://www.scintilla.org/ScintillaDoc.html">Scintilla</a> is a free source code editing component.
<a href="ScintillaDoc.html">Scintilla</a> is a free source code editing component.
It comes with complete source code and a <a href="https://www.scintilla.org/License.txt">license</a> that
permits use in any free project or commercial product.
</p>
@ -149,13 +147,13 @@ if (!IsRemote()) { //if NOT remote...
<a href="https://sourceforge.net/projects/scintilla/">Scintilla project page</a>.
</p>
<p>
<a href="https://www.scintilla.org/ScintillaRelated.html">Related sites.</a>
<a href="ScintillaRelated.html">Related sites.</a>
</p>
<p>
<a href="https://www.scintilla.org/ScintillaToDo.html">Bugs and To Do list.</a>
<a href="ScintillaToDo.html">Bugs and To Do list.</a>
</p>
<p>
<a href="https://www.scintilla.org/ScintillaHistory.html">History and contribution credits.</a>
<a href="ScintillaHistory.html">History and contribution credits.</a>
</p>
<p>
<a href="https://www.scintilla.org/Icons.html">Icons that can be used with Scintilla.</a>

View File

@ -214,10 +214,7 @@ const Supports SupportsGTK[] = {
Supports::FractionalStrokeWidth,
Supports::TranslucentStroke,
Supports::PixelModification,
#if defined(G_OS_UNIX) && !defined(__APPLE__)
// Pango is not thread-safe on Win32 or macOS
Supports::ThreadSafeMeasureWidths,
#endif
};
}

View File

@ -259,6 +259,10 @@ ScintillaGTK::~ScintillaGTK() {
g_source_remove(styleIdleID);
styleIdleID = 0;
}
if (scrollBarIdleID) {
g_source_remove(scrollBarIdleID);
scrollBarIdleID = 0;
}
ClearPrimarySelection();
wPreedit.Destroy();
if (settingsHandlerId) {
@ -1109,6 +1113,7 @@ bool ScintillaGTK::ModifyScrollBars(Sci::Line nMax, Sci::Line nPage) {
#if !GTK_CHECK_VERSION(3,18,0)
gtk_adjustment_changed(GTK_ADJUSTMENT(adjustmentv));
#endif
gtk_adjustment_set_value(GTK_ADJUSTMENT(adjustmentv), static_cast<gdouble>(topLine));
modified = true;
}
@ -1130,6 +1135,7 @@ bool ScintillaGTK::ModifyScrollBars(Sci::Line nMax, Sci::Line nPage) {
#if !GTK_CHECK_VERSION(3,18,0)
gtk_adjustment_changed(GTK_ADJUSTMENT(adjustmenth));
#endif
gtk_adjustment_set_value(GTK_ADJUSTMENT(adjustmenth), xOffset);
modified = true;
}
if (modified && (paintState == PaintState::painting)) {
@ -1144,6 +1150,27 @@ void ScintillaGTK::ReconfigureScrollBars() {
Resize(static_cast<int>(rc.Width()), static_cast<int>(rc.Height()));
}
void ScintillaGTK::SetScrollBars() {
if (scrollBarIdleID) {
// Only allow one scroll bar change to be queued
return;
}
constexpr gint priorityScrollBar = GDK_PRIORITY_REDRAW + 5;
// On GTK, unlike other platforms, modifying scrollbars inside some events including
// resizes causes problems. Deferring the modification to a lower priority (125) idle
// event avoids the problems. This code did not always work when the priority was
// higher than GTK's resize (GTK_PRIORITY_RESIZE=110) or redraw
// (GDK_PRIORITY_REDRAW=120) idle tasks.
scrollBarIdleID = gdk_threads_add_idle_full(priorityScrollBar,
[](gpointer pSci) -> gboolean {
ScintillaGTK *sciThis = static_cast<ScintillaGTK *>(pSci);
sciThis->ChangeScrollBars();
sciThis->scrollBarIdleID = 0;
return FALSE;
},
this, nullptr);
}
void ScintillaGTK::NotifyChange() {
g_signal_emit(G_OBJECT(sci), scintilla_signals[COMMAND_SIGNAL], 0,
Platform::LongFromTwoShorts(GetCtrlID(), SCEN_CHANGE), PWidget(wMain));
@ -1193,7 +1220,6 @@ class CaseFolderDBCS : public CaseFolderTable {
const char *charSet;
public:
explicit CaseFolderDBCS(const char *charSet_) noexcept : charSet(charSet_) {
StandardASCII();
}
size_t Fold(char *folded, size_t sizeFolded, const char *mixed, size_t lenMixed) override {
if ((lenMixed == 1) && (sizeFolded > 0)) {
@ -1230,7 +1256,6 @@ std::unique_ptr<CaseFolder> ScintillaGTK::CaseFolderForEncoding() {
if (charSetBuffer) {
if (pdoc->dbcsCodePage == 0) {
std::unique_ptr<CaseFolderTable> pcf = std::make_unique<CaseFolderTable>();
pcf->StandardASCII();
// Only for single byte encodings
for (int i=0x80; i<0x100; i++) {
char sCharacter[2] = "A";

View File

@ -82,6 +82,7 @@ class ScintillaGTK : public ScintillaBase {
bool repaintFullWindow;
guint styleIdleID;
guint scrollBarIdleID = 0;
FontOptions fontOptionsPrevious;
int accessibilityEnabled;
AtkObject *accessible;
@ -133,6 +134,7 @@ private:
void SetHorizontalScrollPos() override;
bool ModifyScrollBars(Sci::Line nMax, Sci::Line nPage) override;
void ReconfigureScrollBars() override;
void SetScrollBars() override;
void NotifyChange() override;
void NotifyFocus(bool focus) override;
void NotifyParent(Scintilla::NotificationData scn) override;

View File

@ -128,6 +128,7 @@ CaseConvert.o: \
../src/UniConversion.h
CaseFolder.o: \
../src/CaseFolder.cxx \
../src/CharacterType.h \
../src/CaseFolder.h \
../src/CaseConvert.h
CellBuffer.o: \

View File

@ -475,7 +475,9 @@ typedef sptr_t (*SciFnDirectStatus)(sptr_t ptr, unsigned int iMessage, uptr_t wP
#define SCFIND_POSIX 0x00400000
#define SCFIND_CXX11REGEX 0x00800000
#define SCI_FINDTEXT 2150
#define SCI_FINDTEXTFULL 2196
#define SCI_FORMATRANGE 2151
#define SCI_FORMATRANGEFULL 2777
#define SCI_GETFIRSTVISIBLELINE 2152
#define SCI_GETLINE 2153
#define SCI_GETLINECOUNT 2154
@ -488,6 +490,7 @@ typedef sptr_t (*SciFnDirectStatus)(sptr_t ptr, unsigned int iMessage, uptr_t wP
#define SCI_SETSEL 2160
#define SCI_GETSELTEXT 2161
#define SCI_GETTEXTRANGE 2162
#define SCI_GETTEXTRANGEFULL 2039
#define SCI_HIDESELECTION 2163
#define SCI_POINTXFROMPOSITION 2164
#define SCI_POINTYFROMPOSITION 2165
@ -1272,17 +1275,33 @@ struct Sci_CharacterRange {
Sci_PositionCR cpMax;
};
struct Sci_CharacterRangeFull {
Sci_Position cpMin;
Sci_Position cpMax;
};
struct Sci_TextRange {
struct Sci_CharacterRange chrg;
char *lpstrText;
};
struct Sci_TextRangeFull {
struct Sci_CharacterRangeFull chrg;
char *lpstrText;
};
struct Sci_TextToFind {
struct Sci_CharacterRange chrg;
const char *lpstrText;
struct Sci_CharacterRange chrgText;
};
struct Sci_TextToFindFull {
struct Sci_CharacterRangeFull chrg;
const char *lpstrText;
struct Sci_CharacterRangeFull chrgText;
};
typedef void *Sci_SurfaceID;
struct Sci_Rectangle {
@ -1303,6 +1322,14 @@ struct Sci_RangeToFormat {
struct Sci_CharacterRange chrg;
};
struct Sci_RangeToFormatFull {
Sci_SurfaceID hdc;
Sci_SurfaceID hdcTarget;
struct Sci_Rectangle rc;
struct Sci_Rectangle rcPage;
struct Sci_CharacterRangeFull chrg;
};
#ifndef __cplusplus
/* For the GTK+ platform, g-ir-scanner needs to have these typedefs. This
* is not required in C++ code and actually seems to break ScintillaEditPy */

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