Update Scintilla from 3.4.3 to 3.4.4
This commit is contained in:
committed by
Vadim Zeitlin
parent
40fa003072
commit
7ebb51a895
@@ -310,6 +310,8 @@ class WXDLLIMPEXP_FWD_CORE wxScrollBar;
|
|||||||
#define wxSTC_SEL_THIN 3
|
#define wxSTC_SEL_THIN 3
|
||||||
#define wxSTC_CASEINSENSITIVEBEHAVIOUR_RESPECTCASE 0
|
#define wxSTC_CASEINSENSITIVEBEHAVIOUR_RESPECTCASE 0
|
||||||
#define wxSTC_CASEINSENSITIVEBEHAVIOUR_IGNORECASE 1
|
#define wxSTC_CASEINSENSITIVEBEHAVIOUR_IGNORECASE 1
|
||||||
|
#define wxSTC_MULTIAUTOC_ONCE 0
|
||||||
|
#define wxSTC_MULTIAUTOC_EACH 1
|
||||||
#define wxSTC_ORDER_PRESORTED 0
|
#define wxSTC_ORDER_PRESORTED 0
|
||||||
#define wxSTC_ORDER_PERFORMSORT 1
|
#define wxSTC_ORDER_PERFORMSORT 1
|
||||||
#define wxSTC_ORDER_CUSTOM 2
|
#define wxSTC_ORDER_CUSTOM 2
|
||||||
@@ -4149,6 +4151,12 @@ public:
|
|||||||
// Get auto-completion case insensitive behaviour.
|
// Get auto-completion case insensitive behaviour.
|
||||||
int AutoCompGetCaseInsensitiveBehaviour() const;
|
int AutoCompGetCaseInsensitiveBehaviour() const;
|
||||||
|
|
||||||
|
// Change the effect of autocompleting when there are multiple selections.
|
||||||
|
void AutoCompSetMulti(int multi);
|
||||||
|
|
||||||
|
// Retrieve the effect of autocompleting when there are multiple selections..
|
||||||
|
int AutoCompGetMulti() const;
|
||||||
|
|
||||||
// Set the way autocompletion lists are ordered.
|
// Set the way autocompletion lists are ordered.
|
||||||
void AutoCompSetOrder(int order);
|
void AutoCompSetOrder(int order);
|
||||||
|
|
||||||
|
@@ -266,6 +266,8 @@
|
|||||||
#define wxSTC_SEL_THIN 3
|
#define wxSTC_SEL_THIN 3
|
||||||
#define wxSTC_CASEINSENSITIVEBEHAVIOUR_RESPECTCASE 0
|
#define wxSTC_CASEINSENSITIVEBEHAVIOUR_RESPECTCASE 0
|
||||||
#define wxSTC_CASEINSENSITIVEBEHAVIOUR_IGNORECASE 1
|
#define wxSTC_CASEINSENSITIVEBEHAVIOUR_IGNORECASE 1
|
||||||
|
#define wxSTC_MULTIAUTOC_ONCE 0
|
||||||
|
#define wxSTC_MULTIAUTOC_EACH 1
|
||||||
#define wxSTC_ORDER_PRESORTED 0
|
#define wxSTC_ORDER_PRESORTED 0
|
||||||
#define wxSTC_ORDER_PERFORMSORT 1
|
#define wxSTC_ORDER_PERFORMSORT 1
|
||||||
#define wxSTC_ORDER_CUSTOM 2
|
#define wxSTC_ORDER_CUSTOM 2
|
||||||
@@ -5095,6 +5097,16 @@ public:
|
|||||||
*/
|
*/
|
||||||
int AutoCompGetCaseInsensitiveBehaviour() const;
|
int AutoCompGetCaseInsensitiveBehaviour() const;
|
||||||
|
|
||||||
|
/**
|
||||||
|
Change the effect of autocompleting when there are multiple selections.
|
||||||
|
*/
|
||||||
|
void AutoCompSetMulti(int multi);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Retrieve the effect of autocompleting when there are multiple selections..
|
||||||
|
*/
|
||||||
|
int AutoCompGetMulti() const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Set the way autocompletion lists are ordered.
|
Set the way autocompletion lists are ordered.
|
||||||
*/
|
*/
|
||||||
|
@@ -406,6 +406,8 @@ methodOverrideMap = {
|
|||||||
'AutoCGetMaxHeight' : ('AutoCompGetMaxHeight', 0, 0, 0),
|
'AutoCGetMaxHeight' : ('AutoCompGetMaxHeight', 0, 0, 0),
|
||||||
'AutoCSetCaseInsensitiveBehaviour' : ('AutoCompSetCaseInsensitiveBehaviour', 0, 0, 0),
|
'AutoCSetCaseInsensitiveBehaviour' : ('AutoCompSetCaseInsensitiveBehaviour', 0, 0, 0),
|
||||||
'AutoCGetCaseInsensitiveBehaviour' : ('AutoCompGetCaseInsensitiveBehaviour', 0, 0, 0),
|
'AutoCGetCaseInsensitiveBehaviour' : ('AutoCompGetCaseInsensitiveBehaviour', 0, 0, 0),
|
||||||
|
'AutoCSetMulti' : ('AutoCompSetMulti', 0, 0, 0),
|
||||||
|
'AutoCGetMulti' : ('AutoCompGetMulti', 0, 0, 0),
|
||||||
'AutoCSetOrder' : ('AutoCompSetOrder', 0, 0, 0),
|
'AutoCSetOrder' : ('AutoCompSetOrder', 0, 0, 0),
|
||||||
'AutoCGetOrder' : ('AutoCompGetOrder', 0, 0, 0),
|
'AutoCGetOrder' : ('AutoCompGetOrder', 0, 0, 0),
|
||||||
|
|
||||||
|
@@ -3,7 +3,7 @@ directories from the Scintilla source distribution. All other code
|
|||||||
needed to implement Scintilla on top of wxWidgets is located in the
|
needed to implement Scintilla on top of wxWidgets is located in the
|
||||||
directory above this one.
|
directory above this one.
|
||||||
|
|
||||||
The current version of the Scintilla code is 3.4.3
|
The current version of the Scintilla code is 3.4.4
|
||||||
|
|
||||||
These are the basic steps needed to update the version of Scintilla used by wxSTC.
|
These are the basic steps needed to update the version of Scintilla used by wxSTC.
|
||||||
|
|
||||||
|
@@ -728,6 +728,10 @@ inline int isascii(int c) { return !(c & ~0x7F); }
|
|||||||
#define SC_CASEINSENSITIVEBEHAVIOUR_IGNORECASE 1
|
#define SC_CASEINSENSITIVEBEHAVIOUR_IGNORECASE 1
|
||||||
#define SCI_AUTOCSETCASEINSENSITIVEBEHAVIOUR 2634
|
#define SCI_AUTOCSETCASEINSENSITIVEBEHAVIOUR 2634
|
||||||
#define SCI_AUTOCGETCASEINSENSITIVEBEHAVIOUR 2635
|
#define SCI_AUTOCGETCASEINSENSITIVEBEHAVIOUR 2635
|
||||||
|
#define SC_MULTIAUTOC_ONCE 0
|
||||||
|
#define SC_MULTIAUTOC_EACH 1
|
||||||
|
#define SCI_AUTOCSETMULTI 2636
|
||||||
|
#define SCI_AUTOCGETMULTI 2637
|
||||||
#define SC_ORDER_PRESORTED 0
|
#define SC_ORDER_PRESORTED 0
|
||||||
#define SC_ORDER_PERFORMSORT 1
|
#define SC_ORDER_PERFORMSORT 1
|
||||||
#define SC_ORDER_CUSTOM 2
|
#define SC_ORDER_CUSTOM 2
|
||||||
@@ -1028,7 +1032,7 @@ inline int isascii(int c) { return !(c & ~0x7F); }
|
|||||||
* CHARRANGE, TEXTRANGE, FINDTEXTEX, FORMATRANGE, and NMHDR structs.
|
* CHARRANGE, TEXTRANGE, FINDTEXTEX, FORMATRANGE, and NMHDR structs.
|
||||||
* So older code that treats Scintilla as a RichEdit will work. */
|
* So older code that treats Scintilla as a RichEdit will work. */
|
||||||
|
|
||||||
#ifdef SCI_NAMESPACE
|
#if defined(__cplusplus) && defined(SCI_NAMESPACE)
|
||||||
namespace Scintilla {
|
namespace Scintilla {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -1120,7 +1124,7 @@ struct SCNotification {
|
|||||||
int updated; /* SCN_UPDATEUI */
|
int updated; /* SCN_UPDATEUI */
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifdef SCI_NAMESPACE
|
#if defined(__cplusplus) && defined(SCI_NAMESPACE)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@@ -1884,6 +1884,16 @@ set void AutoCSetCaseInsensitiveBehaviour=2634(int behaviour,)
|
|||||||
# Get auto-completion case insensitive behaviour.
|
# Get auto-completion case insensitive behaviour.
|
||||||
get int AutoCGetCaseInsensitiveBehaviour=2635(,)
|
get int AutoCGetCaseInsensitiveBehaviour=2635(,)
|
||||||
|
|
||||||
|
enu MultiAutoComplete=SC_MULTIAUTOC_
|
||||||
|
val SC_MULTIAUTOC_ONCE=0
|
||||||
|
val SC_MULTIAUTOC_EACH=1
|
||||||
|
|
||||||
|
# Change the effect of autocompleting when there are multiple selections.
|
||||||
|
set void AutoCSetMulti=2636(int multi,)
|
||||||
|
|
||||||
|
# Retrieve the effect of autocompleting when there are multiple selections..
|
||||||
|
get int AutoCGetMulti=2637(,)
|
||||||
|
|
||||||
enu Ordering=SC_ORDER_
|
enu Ordering=SC_ORDER_
|
||||||
val SC_ORDER_PRESORTED=0
|
val SC_ORDER_PRESORTED=0
|
||||||
val SC_ORDER_PERFORMSORT=1
|
val SC_ORDER_PERFORMSORT=1
|
||||||
|
@@ -767,6 +767,7 @@ static void FoldBashDoc(unsigned int startPos, int length, int, WordList *[],
|
|||||||
bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0;
|
bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0;
|
||||||
unsigned int endPos = startPos + length;
|
unsigned int endPos = startPos + length;
|
||||||
int visibleChars = 0;
|
int visibleChars = 0;
|
||||||
|
int skipHereCh = 0;
|
||||||
int lineCurrent = styler.GetLine(startPos);
|
int lineCurrent = styler.GetLine(startPos);
|
||||||
int levelPrev = styler.LevelAt(lineCurrent) & SC_FOLDLEVELNUMBERMASK;
|
int levelPrev = styler.LevelAt(lineCurrent) & SC_FOLDLEVELNUMBERMASK;
|
||||||
int levelCurrent = levelPrev;
|
int levelCurrent = levelPrev;
|
||||||
@@ -798,7 +799,15 @@ static void FoldBashDoc(unsigned int startPos, int length, int, WordList *[],
|
|||||||
// Here Document folding
|
// Here Document folding
|
||||||
if (style == SCE_SH_HERE_DELIM) {
|
if (style == SCE_SH_HERE_DELIM) {
|
||||||
if (ch == '<' && chNext == '<') {
|
if (ch == '<' && chNext == '<') {
|
||||||
|
if (styler.SafeGetCharAt(i + 2) == '<') {
|
||||||
|
skipHereCh = 1;
|
||||||
|
} else {
|
||||||
|
if (skipHereCh == 0) {
|
||||||
levelCurrent++;
|
levelCurrent++;
|
||||||
|
} else {
|
||||||
|
skipHereCh = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else if (style == SCE_SH_HERE_Q && styler.StyleAt(i+1) == SCE_SH_DEFAULT) {
|
} else if (style == SCE_SH_HERE_Q && styler.StyleAt(i+1) == SCE_SH_DEFAULT) {
|
||||||
levelCurrent--;
|
levelCurrent--;
|
||||||
|
@@ -8,10 +8,10 @@
|
|||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <ctype.h>
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
#include <ctype.h>
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
@@ -821,10 +821,18 @@ void SCI_METHOD LexerCPP::Lex(unsigned int startPos, int length, int initStyle,
|
|||||||
((lenS == 1) && ((s[0] == 'L') || (s[0] == 'u') || (s[0] == 'U'))) ||
|
((lenS == 1) && ((s[0] == 'L') || (s[0] == 'u') || (s[0] == 'U'))) ||
|
||||||
((lenS == 2) && literalString && (s[0] == 'u') && (s[1] == '8'));
|
((lenS == 2) && literalString && (s[0] == 'u') && (s[1] == '8'));
|
||||||
if (valid) {
|
if (valid) {
|
||||||
if (literalString)
|
if (literalString) {
|
||||||
sc.ChangeState((raw ? SCE_C_STRINGRAW : SCE_C_STRING)|activitySet);
|
if (raw) {
|
||||||
else
|
// Set the style of the string prefix to SCE_C_STRINGRAW but then change to
|
||||||
|
// SCE_C_DEFAULT as that allows the raw string start code to run.
|
||||||
|
sc.ChangeState(SCE_C_STRINGRAW|activitySet);
|
||||||
|
sc.SetState(SCE_C_DEFAULT|activitySet);
|
||||||
|
} else {
|
||||||
|
sc.ChangeState(SCE_C_STRING|activitySet);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
sc.ChangeState(SCE_C_CHARACTER|activitySet);
|
sc.ChangeState(SCE_C_CHARACTER|activitySet);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
sc.SetState(SCE_C_DEFAULT | activitySet);
|
sc.SetState(SCE_C_DEFAULT | activitySet);
|
||||||
}
|
}
|
||||||
@@ -1203,7 +1211,7 @@ void SCI_METHOD LexerCPP::Lex(unsigned int startPos, int length, int initStyle,
|
|||||||
while ((endName < restOfLine.length()) && setWord.Contains(static_cast<unsigned char>(restOfLine[endName])))
|
while ((endName < restOfLine.length()) && setWord.Contains(static_cast<unsigned char>(restOfLine[endName])))
|
||||||
endName++;
|
endName++;
|
||||||
std::string key = restOfLine.substr(startName, endName-startName);
|
std::string key = restOfLine.substr(startName, endName-startName);
|
||||||
if (restOfLine[endName] == '(') {
|
if ((endName < restOfLine.length()) && (restOfLine.at(endName) == '(')) {
|
||||||
// Macro
|
// Macro
|
||||||
size_t endArgs = endName;
|
size_t endArgs = endName;
|
||||||
while ((endArgs < restOfLine.length()) && (restOfLine[endArgs] != ')'))
|
while ((endArgs < restOfLine.length()) && (restOfLine[endArgs] != ')'))
|
||||||
@@ -1212,7 +1220,9 @@ void SCI_METHOD LexerCPP::Lex(unsigned int startPos, int length, int initStyle,
|
|||||||
size_t startValue = endArgs+1;
|
size_t startValue = endArgs+1;
|
||||||
while ((startValue < restOfLine.length()) && IsSpaceOrTab(restOfLine[startValue]))
|
while ((startValue < restOfLine.length()) && IsSpaceOrTab(restOfLine[startValue]))
|
||||||
startValue++;
|
startValue++;
|
||||||
std::string value = restOfLine.substr(startValue);
|
std::string value;
|
||||||
|
if (startValue < restOfLine.length())
|
||||||
|
value = restOfLine.substr(startValue);
|
||||||
preprocessorDefinitions[key] = SymbolValue(value, args);
|
preprocessorDefinitions[key] = SymbolValue(value, args);
|
||||||
ppDefineHistory.push_back(PPDefinition(lineCurrent, key, value, false, args));
|
ppDefineHistory.push_back(PPDefinition(lineCurrent, key, value, false, args));
|
||||||
definitionsChanged = true;
|
definitionsChanged = true;
|
||||||
|
@@ -13,14 +13,14 @@
|
|||||||
#include <cctype>
|
#include <cctype>
|
||||||
|
|
||||||
#include "ILexer.h"
|
#include "ILexer.h"
|
||||||
#include "SciLexer.h"
|
|
||||||
#include "Scintilla.h"
|
#include "Scintilla.h"
|
||||||
|
#include "SciLexer.h"
|
||||||
|
|
||||||
#include "LexerModule.h"
|
#include "WordList.h"
|
||||||
#include "LexAccessor.h"
|
#include "LexAccessor.h"
|
||||||
#include "StyleContext.h"
|
#include "StyleContext.h"
|
||||||
#include "CharacterSet.h"
|
#include "CharacterSet.h"
|
||||||
#include "WordList.h"
|
#include "LexerModule.h"
|
||||||
|
|
||||||
#ifdef SCI_NAMESPACE
|
#ifdef SCI_NAMESPACE
|
||||||
using namespace Scintilla;
|
using namespace Scintilla;
|
||||||
|
@@ -7,10 +7,10 @@
|
|||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <ctype.h>
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
#include <ctype.h>
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
#pragma warning(disable: 4786)
|
#pragma warning(disable: 4786)
|
||||||
|
@@ -6,10 +6,10 @@
|
|||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <ctype.h>
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
#include <ctype.h>
|
||||||
|
|
||||||
#include "ILexer.h"
|
#include "ILexer.h"
|
||||||
#include "Scintilla.h"
|
#include "Scintilla.h"
|
||||||
|
@@ -576,8 +576,7 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
|
|||||||
WordList &keywords5 = *keywordlists[4];
|
WordList &keywords5 = *keywordlists[4];
|
||||||
WordList &keywords6 = *keywordlists[5]; // SGML (DTD) keywords
|
WordList &keywords6 = *keywordlists[5]; // SGML (DTD) keywords
|
||||||
|
|
||||||
// Lexer for HTML requires more lexical states (8 bits worth) than most lexers
|
styler.StartAt(startPos);
|
||||||
styler.StartAt(startPos, static_cast<unsigned char>(STYLE_MAX));
|
|
||||||
char prevWord[200];
|
char prevWord[200];
|
||||||
prevWord[0] = '\0';
|
prevWord[0] = '\0';
|
||||||
char phpStringDelimiter[200]; // PHP is not limited in length, we are
|
char phpStringDelimiter[200]; // PHP is not limited in length, we are
|
||||||
@@ -609,7 +608,7 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
|
|||||||
if (startPos == 0)
|
if (startPos == 0)
|
||||||
state = SCE_H_DEFAULT;
|
state = SCE_H_DEFAULT;
|
||||||
}
|
}
|
||||||
styler.StartAt(startPos, static_cast<unsigned char>(STYLE_MAX));
|
styler.StartAt(startPos);
|
||||||
|
|
||||||
int lineCurrent = styler.GetLine(startPos);
|
int lineCurrent = styler.GetLine(startPos);
|
||||||
int lineState;
|
int lineState;
|
||||||
@@ -2180,6 +2179,6 @@ static const char * const phpscriptWordListDesc[] = {
|
|||||||
0,
|
0,
|
||||||
};
|
};
|
||||||
|
|
||||||
LexerModule lmHTML(SCLEX_HTML, ColouriseHTMLDoc, "hypertext", 0, htmlWordListDesc, 8);
|
LexerModule lmHTML(SCLEX_HTML, ColouriseHTMLDoc, "hypertext", 0, htmlWordListDesc);
|
||||||
LexerModule lmXML(SCLEX_XML, ColouriseXMLDoc, "xml", 0, htmlWordListDesc, 8);
|
LexerModule lmXML(SCLEX_XML, ColouriseXMLDoc, "xml", 0, htmlWordListDesc);
|
||||||
LexerModule lmPHPSCRIPT(SCLEX_PHPSCRIPT, ColourisePHPScriptDoc, "phpscript", 0, phpscriptWordListDesc, 8);
|
LexerModule lmPHPSCRIPT(SCLEX_PHPSCRIPT, ColourisePHPScriptDoc, "phpscript", 0, phpscriptWordListDesc);
|
||||||
|
@@ -38,9 +38,9 @@
|
|||||||
#include "Accessor.h"
|
#include "Accessor.h"
|
||||||
#include "StyleContext.h"
|
#include "StyleContext.h"
|
||||||
#include "CharacterSet.h"
|
#include "CharacterSet.h"
|
||||||
|
#include "CharacterCategory.h"
|
||||||
#include "LexerModule.h"
|
#include "LexerModule.h"
|
||||||
#include "OptionSet.h"
|
#include "OptionSet.h"
|
||||||
#include "CharacterCategory.h"
|
|
||||||
|
|
||||||
#ifdef SCI_NAMESPACE
|
#ifdef SCI_NAMESPACE
|
||||||
using namespace Scintilla;
|
using namespace Scintilla;
|
||||||
|
@@ -570,4 +570,4 @@ static const char * const mysqlWordListDesc[] = {
|
|||||||
0
|
0
|
||||||
};
|
};
|
||||||
|
|
||||||
LexerModule lmMySQL(SCLEX_MYSQL, ColouriseMySQLDoc, "mysql", FoldMySQLDoc, mysqlWordListDesc, 7);
|
LexerModule lmMySQL(SCLEX_MYSQL, ColouriseMySQLDoc, "mysql", FoldMySQLDoc, mysqlWordListDesc);
|
||||||
|
@@ -6,6 +6,12 @@
|
|||||||
** The License.txt file describes the conditions under which this software may be distributed.
|
** The License.txt file describes the conditions under which this software may be distributed.
|
||||||
**/
|
**/
|
||||||
|
|
||||||
|
// Previous releases of this lexer included support for marking token starts with
|
||||||
|
// a style byte indicator. This was used by the wxGhostscript IDE/debugger.
|
||||||
|
// Style byte indicators were removed in version 3.4.3.
|
||||||
|
// Anyone wanting to restore this functionality for wxGhostscript using 'modern'
|
||||||
|
// indicators can examine the earlier source in the Mercurial repository.
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
@@ -72,7 +78,6 @@ static void ColourisePSDoc(
|
|||||||
|
|
||||||
StyleContext sc(startPos, length, initStyle, styler);
|
StyleContext sc(startPos, length, initStyle, styler);
|
||||||
|
|
||||||
bool tokenizing = styler.GetPropertyInt("ps.tokenize") != 0;
|
|
||||||
int pslevel = styler.GetPropertyInt("ps.level", 3);
|
int pslevel = styler.GetPropertyInt("ps.level", 3);
|
||||||
int lineCurrent = styler.GetLine(startPos);
|
int lineCurrent = styler.GetLine(startPos);
|
||||||
int nestTextCurrent = 0;
|
int nestTextCurrent = 0;
|
||||||
@@ -83,15 +88,6 @@ static void ColourisePSDoc(
|
|||||||
bool numHasExponent = false;
|
bool numHasExponent = false;
|
||||||
bool numHasSign = false;
|
bool numHasSign = false;
|
||||||
|
|
||||||
// Clear out existing tokenization
|
|
||||||
if (tokenizing && length > 0) {
|
|
||||||
styler.StartAt(startPos, static_cast<char>(INDIC2_MASK));
|
|
||||||
styler.ColourTo(startPos + length-1, 0);
|
|
||||||
styler.Flush();
|
|
||||||
styler.StartAt(startPos);
|
|
||||||
styler.StartSegment(startPos);
|
|
||||||
}
|
|
||||||
|
|
||||||
for (; sc.More(); sc.Forward()) {
|
for (; sc.More(); sc.Forward()) {
|
||||||
if (sc.atLineStart)
|
if (sc.atLineStart)
|
||||||
lineCurrent = styler.GetLine(sc.currentPos);
|
lineCurrent = styler.GetLine(sc.currentPos);
|
||||||
@@ -196,7 +192,6 @@ static void ColourisePSDoc(
|
|||||||
|
|
||||||
// Determine if a new state should be entered.
|
// Determine if a new state should be entered.
|
||||||
if (sc.state == SCE_C_DEFAULT) {
|
if (sc.state == SCE_C_DEFAULT) {
|
||||||
unsigned int tokenpos = sc.currentPos;
|
|
||||||
|
|
||||||
if (sc.ch == '[' || sc.ch == ']') {
|
if (sc.ch == '[' || sc.ch == ']') {
|
||||||
sc.SetState(SCE_PS_PAREN_ARRAY);
|
sc.SetState(SCE_PS_PAREN_ARRAY);
|
||||||
@@ -262,17 +257,6 @@ static void ColourisePSDoc(
|
|||||||
} else if (!IsAWhitespaceChar(sc.ch)) {
|
} else if (!IsAWhitespaceChar(sc.ch)) {
|
||||||
sc.SetState(SCE_PS_NAME);
|
sc.SetState(SCE_PS_NAME);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Mark the start of tokens
|
|
||||||
if (tokenizing && sc.state != SCE_C_DEFAULT && sc.state != SCE_PS_COMMENT &&
|
|
||||||
sc.state != SCE_PS_DSC_COMMENT && sc.state != SCE_PS_DSC_VALUE) {
|
|
||||||
styler.Flush();
|
|
||||||
styler.StartAt(tokenpos, static_cast<char>(INDIC2_MASK));
|
|
||||||
styler.ColourTo(tokenpos, INDIC2_MASK);
|
|
||||||
styler.Flush();
|
|
||||||
styler.StartAt(tokenpos);
|
|
||||||
styler.StartSegment(tokenpos);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sc.atLineEnd)
|
if (sc.atLineEnd)
|
||||||
@@ -296,11 +280,10 @@ static void FoldPSDoc(unsigned int startPos, int length, int, WordList *[],
|
|||||||
int levelNext = levelCurrent;
|
int levelNext = levelCurrent;
|
||||||
char chNext = styler[startPos];
|
char chNext = styler[startPos];
|
||||||
int styleNext = styler.StyleAt(startPos);
|
int styleNext = styler.StyleAt(startPos);
|
||||||
int style;
|
|
||||||
for (unsigned int i = startPos; i < endPos; i++) {
|
for (unsigned int i = startPos; i < endPos; i++) {
|
||||||
char ch = chNext;
|
char ch = chNext;
|
||||||
chNext = styler.SafeGetCharAt(i + 1);
|
chNext = styler.SafeGetCharAt(i + 1);
|
||||||
style = styleNext;
|
int style = styleNext;
|
||||||
styleNext = styler.StyleAt(i + 1);
|
styleNext = styler.StyleAt(i + 1);
|
||||||
bool atEOL = (ch == '\r' && chNext != '\n') || (ch == '\n'); //mac??
|
bool atEOL = (ch == '\r' && chNext != '\n') || (ch == '\n'); //mac??
|
||||||
if ((style & 31) == SCE_PS_PAREN_PROC) {
|
if ((style & 31) == SCE_PS_PAREN_PROC) {
|
||||||
|
@@ -1726,4 +1726,4 @@ void SCI_METHOD LexerPerl::Fold(unsigned int startPos, int length, int /* initSt
|
|||||||
styler.SetLevel(lineCurrent, levelPrev | flagsNext);
|
styler.SetLevel(lineCurrent, levelPrev | flagsNext);
|
||||||
}
|
}
|
||||||
|
|
||||||
LexerModule lmPerl(SCLEX_PERL, LexerPerl::LexerFactoryPerl, "perl", perlWordListDesc, 8);
|
LexerModule lmPerl(SCLEX_PERL, LexerPerl::LexerFactoryPerl, "perl", perlWordListDesc);
|
||||||
|
@@ -705,8 +705,7 @@ static void ColouriseRbDoc(unsigned int startPos, int length, int initStyle,
|
|||||||
char chPrev = styler.SafeGetCharAt(startPos - 1);
|
char chPrev = styler.SafeGetCharAt(startPos - 1);
|
||||||
char chNext = styler.SafeGetCharAt(startPos);
|
char chNext = styler.SafeGetCharAt(startPos);
|
||||||
bool is_real_number = true; // Differentiate between constants and ?-sequences.
|
bool is_real_number = true; // Differentiate between constants and ?-sequences.
|
||||||
// Ruby uses a different mask because bad indentation is marked by oring with 32
|
styler.StartAt(startPos);
|
||||||
styler.StartAt(startPos, 127);
|
|
||||||
styler.StartSegment(startPos);
|
styler.StartSegment(startPos);
|
||||||
|
|
||||||
static int q_states[] = {SCE_RB_STRING_Q,
|
static int q_states[] = {SCE_RB_STRING_Q,
|
||||||
@@ -1776,4 +1775,4 @@ static const char * const rubyWordListDesc[] = {
|
|||||||
0
|
0
|
||||||
};
|
};
|
||||||
|
|
||||||
LexerModule lmRuby(SCLEX_RUBY, ColouriseRbDoc, "ruby", FoldRbDoc, rubyWordListDesc, 6);
|
LexerModule lmRuby(SCLEX_RUBY, ColouriseRbDoc, "ruby", FoldRbDoc, rubyWordListDesc);
|
||||||
|
@@ -21,6 +21,7 @@
|
|||||||
#include "Scintilla.h"
|
#include "Scintilla.h"
|
||||||
#include "SciLexer.h"
|
#include "SciLexer.h"
|
||||||
|
|
||||||
|
#include "PropSetSimple.h"
|
||||||
#include "WordList.h"
|
#include "WordList.h"
|
||||||
#include "LexAccessor.h"
|
#include "LexAccessor.h"
|
||||||
#include "Accessor.h"
|
#include "Accessor.h"
|
||||||
@@ -28,7 +29,6 @@
|
|||||||
#include "CharacterSet.h"
|
#include "CharacterSet.h"
|
||||||
#include "LexerModule.h"
|
#include "LexerModule.h"
|
||||||
#include "OptionSet.h"
|
#include "OptionSet.h"
|
||||||
#include "PropSetSimple.h"
|
|
||||||
|
|
||||||
#ifdef SCI_NAMESPACE
|
#ifdef SCI_NAMESPACE
|
||||||
using namespace Scintilla;
|
using namespace Scintilla;
|
||||||
|
@@ -127,11 +127,10 @@ static void ColouriseSolDoc(unsigned int startPos, int length, int initStyle,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
styler.StartAt(startPos, 127);
|
styler.StartAt(startPos);
|
||||||
|
|
||||||
WordList &keywords = *keywordlists[0];
|
WordList &keywords = *keywordlists[0];
|
||||||
|
|
||||||
int whingeLevel = styler.GetPropertyInt("tab.timmy.whinge.level");
|
|
||||||
char prevWord[200];
|
char prevWord[200];
|
||||||
prevWord[0] = '\0';
|
prevWord[0] = '\0';
|
||||||
if (length == 0) return;
|
if (length == 0) return;
|
||||||
@@ -143,37 +142,9 @@ static void ColouriseSolDoc(unsigned int startPos, int length, int initStyle,
|
|||||||
char chPrev2 = ' ';
|
char chPrev2 = ' ';
|
||||||
char chNext = styler[startPos];
|
char chNext = styler[startPos];
|
||||||
styler.StartSegment(startPos);
|
styler.StartSegment(startPos);
|
||||||
bool atStartLine = true;
|
|
||||||
int spaceFlags = 0;
|
|
||||||
for (int i = startPos; i < lengthDoc; i++)
|
for (int i = startPos; i < lengthDoc; i++)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (atStartLine)
|
|
||||||
{
|
|
||||||
char chBad = static_cast<char>(64);
|
|
||||||
char chGood = static_cast<char>(0);
|
|
||||||
char chFlags = chGood;
|
|
||||||
|
|
||||||
if (whingeLevel == 1)
|
|
||||||
{
|
|
||||||
chFlags = (spaceFlags & wsInconsistent) ? chBad : chGood;
|
|
||||||
}
|
|
||||||
else if (whingeLevel == 2)
|
|
||||||
{
|
|
||||||
chFlags = (spaceFlags & wsSpaceTab) ? chBad : chGood;
|
|
||||||
}
|
|
||||||
else if (whingeLevel == 3)
|
|
||||||
{
|
|
||||||
chFlags = (spaceFlags & wsSpace) ? chBad : chGood;
|
|
||||||
}
|
|
||||||
else if (whingeLevel == 4)
|
|
||||||
{
|
|
||||||
chFlags = (spaceFlags & wsTab) ? chBad : chGood;
|
|
||||||
}
|
|
||||||
styler.SetFlags(chFlags, static_cast<char>(state));
|
|
||||||
atStartLine = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
char ch = chNext;
|
char ch = chNext;
|
||||||
chNext = styler.SafeGetCharAt(i + 1);
|
chNext = styler.SafeGetCharAt(i + 1);
|
||||||
|
|
||||||
@@ -185,7 +156,6 @@ static void ColouriseSolDoc(unsigned int startPos, int length, int initStyle,
|
|||||||
{
|
{
|
||||||
styler.ColourTo(i, state);
|
styler.ColourTo(i, state);
|
||||||
}
|
}
|
||||||
atStartLine = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (styler.IsLeadByte(ch))
|
if (styler.IsLeadByte(ch))
|
||||||
|
@@ -8,10 +8,10 @@
|
|||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <ctype.h>
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
#include <ctype.h>
|
||||||
|
|
||||||
#include "ILexer.h"
|
#include "ILexer.h"
|
||||||
#include "Scintilla.h"
|
#include "Scintilla.h"
|
||||||
|
@@ -358,7 +358,7 @@ static const char * const tclWordListDesc[] = {
|
|||||||
"TK Keywords",
|
"TK Keywords",
|
||||||
"iTCL Keywords",
|
"iTCL Keywords",
|
||||||
"tkCommands",
|
"tkCommands",
|
||||||
"expand"
|
"expand",
|
||||||
"user1",
|
"user1",
|
||||||
"user2",
|
"user2",
|
||||||
"user3",
|
"user3",
|
||||||
|
@@ -12,10 +12,10 @@
|
|||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <ctype.h>
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
#include <ctype.h>
|
||||||
|
|
||||||
#include "ILexer.h"
|
#include "ILexer.h"
|
||||||
#include "Scintilla.h"
|
#include "Scintilla.h"
|
||||||
|
@@ -13,10 +13,10 @@
|
|||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <ctype.h>
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
#include <ctype.h>
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
#pragma warning(disable: 4786)
|
#pragma warning(disable: 4786)
|
||||||
|
@@ -8,9 +8,9 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <ctype.h>
|
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
#include <ctype.h>
|
||||||
|
|
||||||
#include "ILexer.h"
|
#include "ILexer.h"
|
||||||
#include "Scintilla.h"
|
#include "Scintilla.h"
|
||||||
|
@@ -3287,7 +3287,7 @@ const int nRanges = ELEMENTS(catRanges);
|
|||||||
// Initial version has 3249 entries and adds about 13K to the executable.
|
// Initial version has 3249 entries and adds about 13K to the executable.
|
||||||
// The array is in ascending order so can be searched using binary search.
|
// The array is in ascending order so can be searched using binary search.
|
||||||
// Therefore the average call takes log2(3249) = 12 comparisons.
|
// Therefore the average call takes log2(3249) = 12 comparisons.
|
||||||
// For speed, it may be an useful to make a linear table for the common values,
|
// For speed, it may be useful to make a linear table for the common values,
|
||||||
// possibly for 0..0xff for most Western European text or 0..0xfff for most
|
// possibly for 0..0xff for most Western European text or 0..0xfff for most
|
||||||
// alphabetic languages.
|
// alphabetic languages.
|
||||||
|
|
||||||
|
@@ -9,8 +9,8 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <ctype.h>
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
#include <ctype.h>
|
||||||
|
|
||||||
#include "CharacterSet.h"
|
#include "CharacterSet.h"
|
||||||
|
|
||||||
|
@@ -29,11 +29,8 @@ private:
|
|||||||
int codePage;
|
int codePage;
|
||||||
enum EncodingType encodingType;
|
enum EncodingType encodingType;
|
||||||
int lenDoc;
|
int lenDoc;
|
||||||
int mask;
|
|
||||||
char styleBuf[bufferSize];
|
char styleBuf[bufferSize];
|
||||||
int validLen;
|
int validLen;
|
||||||
char chFlags;
|
|
||||||
char chWhile;
|
|
||||||
unsigned int startSeg;
|
unsigned int startSeg;
|
||||||
int startPosStyling;
|
int startPosStyling;
|
||||||
int documentVersion;
|
int documentVersion;
|
||||||
@@ -58,7 +55,7 @@ public:
|
|||||||
codePage(pAccess->CodePage()),
|
codePage(pAccess->CodePage()),
|
||||||
encodingType(enc8bit),
|
encodingType(enc8bit),
|
||||||
lenDoc(pAccess->Length()),
|
lenDoc(pAccess->Length()),
|
||||||
mask(127), validLen(0), chFlags(0), chWhile(0),
|
validLen(0),
|
||||||
startSeg(0), startPosStyling(0),
|
startSeg(0), startPosStyling(0),
|
||||||
documentVersion(pAccess->Version()) {
|
documentVersion(pAccess->Version()) {
|
||||||
switch (codePage) {
|
switch (codePage) {
|
||||||
@@ -111,7 +108,7 @@ public:
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
char StyleAt(int position) const {
|
char StyleAt(int position) const {
|
||||||
return static_cast<char>(pAccess->StyleAt(position) & mask);
|
return static_cast<char>(pAccess->StyleAt(position));
|
||||||
}
|
}
|
||||||
int GetLine(int position) const {
|
int GetLine(int position) const {
|
||||||
return pAccess->LineFromPosition(position);
|
return pAccess->LineFromPosition(position);
|
||||||
@@ -152,16 +149,10 @@ public:
|
|||||||
return pAccess->SetLineState(line, state);
|
return pAccess->SetLineState(line, state);
|
||||||
}
|
}
|
||||||
// Style setting
|
// Style setting
|
||||||
void StartAt(unsigned int start, char chMask=31) {
|
void StartAt(unsigned int start) {
|
||||||
// Store the mask specified for use with StyleAt.
|
pAccess->StartStyling(start, '\377');
|
||||||
mask = chMask;
|
|
||||||
pAccess->StartStyling(start, chMask);
|
|
||||||
startPosStyling = start;
|
startPosStyling = start;
|
||||||
}
|
}
|
||||||
void SetFlags(char chFlags_, char chWhile_) {
|
|
||||||
chFlags = chFlags_;
|
|
||||||
chWhile = chWhile_;
|
|
||||||
}
|
|
||||||
unsigned int GetStartSegment() const {
|
unsigned int GetStartSegment() const {
|
||||||
return startSeg;
|
return startSeg;
|
||||||
}
|
}
|
||||||
@@ -182,9 +173,6 @@ public:
|
|||||||
// Too big for buffer so send directly
|
// Too big for buffer so send directly
|
||||||
pAccess->SetStyleFor(pos - startSeg + 1, static_cast<char>(chAttr));
|
pAccess->SetStyleFor(pos - startSeg + 1, static_cast<char>(chAttr));
|
||||||
} else {
|
} else {
|
||||||
if (chAttr != chWhile)
|
|
||||||
chFlags = 0;
|
|
||||||
chAttr = static_cast<char>(chAttr | chFlags);
|
|
||||||
for (unsigned int i = startSeg; i <= pos; i++) {
|
for (unsigned int i = startSeg; i <= pos; i++) {
|
||||||
assert((startPosStyling + validLen) < Length());
|
assert((startPosStyling + validLen) < Length());
|
||||||
styleBuf[validLen++] = static_cast<char>(chAttr);
|
styleBuf[validLen++] = static_cast<char>(chAttr);
|
||||||
|
@@ -8,9 +8,9 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <ctype.h>
|
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
#include <ctype.h>
|
||||||
|
|
||||||
#include "ILexer.h"
|
#include "ILexer.h"
|
||||||
#include "Scintilla.h"
|
#include "Scintilla.h"
|
||||||
|
@@ -8,9 +8,9 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <ctype.h>
|
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
#include <ctype.h>
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
@@ -34,28 +34,24 @@ LexerModule::LexerModule(int language_,
|
|||||||
LexerFunction fnLexer_,
|
LexerFunction fnLexer_,
|
||||||
const char *languageName_,
|
const char *languageName_,
|
||||||
LexerFunction fnFolder_,
|
LexerFunction fnFolder_,
|
||||||
const char *const wordListDescriptions_[],
|
const char *const wordListDescriptions_[]) :
|
||||||
int styleBits_) :
|
|
||||||
language(language_),
|
language(language_),
|
||||||
fnLexer(fnLexer_),
|
fnLexer(fnLexer_),
|
||||||
fnFolder(fnFolder_),
|
fnFolder(fnFolder_),
|
||||||
fnFactory(0),
|
fnFactory(0),
|
||||||
wordListDescriptions(wordListDescriptions_),
|
wordListDescriptions(wordListDescriptions_),
|
||||||
styleBits(styleBits_),
|
|
||||||
languageName(languageName_) {
|
languageName(languageName_) {
|
||||||
}
|
}
|
||||||
|
|
||||||
LexerModule::LexerModule(int language_,
|
LexerModule::LexerModule(int language_,
|
||||||
LexerFactoryFunction fnFactory_,
|
LexerFactoryFunction fnFactory_,
|
||||||
const char *languageName_,
|
const char *languageName_,
|
||||||
const char * const wordListDescriptions_[],
|
const char * const wordListDescriptions_[]) :
|
||||||
int styleBits_) :
|
|
||||||
language(language_),
|
language(language_),
|
||||||
fnLexer(0),
|
fnLexer(0),
|
||||||
fnFolder(0),
|
fnFolder(0),
|
||||||
fnFactory(fnFactory_),
|
fnFactory(fnFactory_),
|
||||||
wordListDescriptions(wordListDescriptions_),
|
wordListDescriptions(wordListDescriptions_),
|
||||||
styleBits(styleBits_),
|
|
||||||
languageName(languageName_) {
|
languageName(languageName_) {
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -82,10 +78,6 @@ const char *LexerModule::GetWordListDescription(int index) const {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int LexerModule::GetStyleBitsNeeded() const {
|
|
||||||
return styleBits;
|
|
||||||
}
|
|
||||||
|
|
||||||
ILexer *LexerModule::Create() const {
|
ILexer *LexerModule::Create() const {
|
||||||
if (fnFactory)
|
if (fnFactory)
|
||||||
return fnFactory();
|
return fnFactory();
|
||||||
|
@@ -31,7 +31,6 @@ protected:
|
|||||||
LexerFunction fnFolder;
|
LexerFunction fnFolder;
|
||||||
LexerFactoryFunction fnFactory;
|
LexerFactoryFunction fnFactory;
|
||||||
const char * const * wordListDescriptions;
|
const char * const * wordListDescriptions;
|
||||||
int styleBits;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
const char *languageName;
|
const char *languageName;
|
||||||
@@ -39,13 +38,11 @@ public:
|
|||||||
LexerFunction fnLexer_,
|
LexerFunction fnLexer_,
|
||||||
const char *languageName_=0,
|
const char *languageName_=0,
|
||||||
LexerFunction fnFolder_=0,
|
LexerFunction fnFolder_=0,
|
||||||
const char * const wordListDescriptions_[] = NULL,
|
const char * const wordListDescriptions_[] = NULL);
|
||||||
int styleBits_=5);
|
|
||||||
LexerModule(int language_,
|
LexerModule(int language_,
|
||||||
LexerFactoryFunction fnFactory_,
|
LexerFactoryFunction fnFactory_,
|
||||||
const char *languageName_,
|
const char *languageName_,
|
||||||
const char * const wordListDescriptions_[] = NULL,
|
const char * const wordListDescriptions_[] = NULL);
|
||||||
int styleBits_=8);
|
|
||||||
virtual ~LexerModule() {
|
virtual ~LexerModule() {
|
||||||
}
|
}
|
||||||
int GetLanguage() const { return language; }
|
int GetLanguage() const { return language; }
|
||||||
@@ -54,8 +51,6 @@ public:
|
|||||||
int GetNumWordLists() const;
|
int GetNumWordLists() const;
|
||||||
const char *GetWordListDescription(int index) const;
|
const char *GetWordListDescription(int index) const;
|
||||||
|
|
||||||
int GetStyleBitsNeeded() const;
|
|
||||||
|
|
||||||
ILexer *Create() const;
|
ILexer *Create() const;
|
||||||
|
|
||||||
virtual void Lex(unsigned int startPos, int length, int initStyle,
|
virtual void Lex(unsigned int startPos, int length, int initStyle,
|
||||||
|
@@ -8,9 +8,9 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <ctype.h>
|
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
#include <ctype.h>
|
||||||
|
|
||||||
#include "ILexer.h"
|
#include "ILexer.h"
|
||||||
#include "Scintilla.h"
|
#include "Scintilla.h"
|
||||||
|
@@ -8,9 +8,9 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <ctype.h>
|
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
#include <ctype.h>
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
|
@@ -8,8 +8,8 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <ctype.h>
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
#include <ctype.h>
|
||||||
|
|
||||||
#include "ILexer.h"
|
#include "ILexer.h"
|
||||||
|
|
||||||
|
@@ -66,7 +66,7 @@ public:
|
|||||||
int widthNext;
|
int widthNext;
|
||||||
|
|
||||||
StyleContext(unsigned int startPos, unsigned int length,
|
StyleContext(unsigned int startPos, unsigned int length,
|
||||||
int initStyle, LexAccessor &styler_, char chMask=31) :
|
int initStyle, LexAccessor &styler_, char chMask='\377') :
|
||||||
styler(styler_),
|
styler(styler_),
|
||||||
multiByteAccess(0),
|
multiByteAccess(0),
|
||||||
endPos(startPos + length),
|
endPos(startPos + length),
|
||||||
@@ -86,7 +86,7 @@ public:
|
|||||||
if (styler.Encoding() != enc8bit) {
|
if (styler.Encoding() != enc8bit) {
|
||||||
multiByteAccess = styler.MultiByteAccess();
|
multiByteAccess = styler.MultiByteAccess();
|
||||||
}
|
}
|
||||||
styler.StartAt(startPos, chMask);
|
styler.StartAt(startPos /*, chMask*/);
|
||||||
styler.StartSegment(startPos);
|
styler.StartSegment(startPos);
|
||||||
currentLine = styler.GetLine(startPos);
|
currentLine = styler.GetLine(startPos);
|
||||||
lineStartNext = styler.LineStart(currentLine+1);
|
lineStartNext = styler.LineStart(currentLine+1);
|
||||||
|
@@ -8,8 +8,8 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <ctype.h>
|
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
|
#include <ctype.h>
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
|
@@ -8,9 +8,9 @@
|
|||||||
#include <vector>
|
#include <vector>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
|
#include "CaseFolder.h"
|
||||||
#include "CaseConvert.h"
|
#include "CaseConvert.h"
|
||||||
#include "UniConversion.h"
|
#include "UniConversion.h"
|
||||||
#include "CaseFolder.h"
|
|
||||||
|
|
||||||
#ifdef SCI_NAMESPACE
|
#ifdef SCI_NAMESPACE
|
||||||
using namespace Scintilla;
|
using namespace Scintilla;
|
||||||
|
@@ -8,9 +8,9 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <ctype.h>
|
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
#include <ctype.h>
|
||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
@@ -413,25 +413,24 @@ const char *CellBuffer::InsertString(int position, const char *s, int insertLeng
|
|||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CellBuffer::SetStyleAt(int position, char styleValue, char mask) {
|
bool CellBuffer::SetStyleAt(int position, char styleValue) {
|
||||||
styleValue &= mask;
|
|
||||||
char curVal = style.ValueAt(position);
|
char curVal = style.ValueAt(position);
|
||||||
if ((curVal & mask) != styleValue) {
|
if (curVal != styleValue) {
|
||||||
style.SetValueAt(position, static_cast<char>((curVal & ~mask) | styleValue));
|
style.SetValueAt(position, styleValue);
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CellBuffer::SetStyleFor(int position, int lengthStyle, char styleValue, char mask) {
|
bool CellBuffer::SetStyleFor(int position, int lengthStyle, char styleValue) {
|
||||||
bool changed = false;
|
bool changed = false;
|
||||||
PLATFORM_ASSERT(lengthStyle == 0 ||
|
PLATFORM_ASSERT(lengthStyle == 0 ||
|
||||||
(lengthStyle > 0 && lengthStyle + position <= style.Length()));
|
(lengthStyle > 0 && lengthStyle + position <= style.Length()));
|
||||||
while (lengthStyle--) {
|
while (lengthStyle--) {
|
||||||
char curVal = style.ValueAt(position);
|
char curVal = style.ValueAt(position);
|
||||||
if ((curVal & mask) != styleValue) {
|
if (curVal != styleValue) {
|
||||||
style.SetValueAt(position, static_cast<char>((curVal & ~mask) | styleValue));
|
style.SetValueAt(position, styleValue);
|
||||||
changed = true;
|
changed = true;
|
||||||
}
|
}
|
||||||
position++;
|
position++;
|
||||||
|
@@ -180,8 +180,8 @@ public:
|
|||||||
|
|
||||||
/// Setting styles for positions outside the range of the buffer is safe and has no effect.
|
/// Setting styles for positions outside the range of the buffer is safe and has no effect.
|
||||||
/// @return true if the style of a character is changed.
|
/// @return true if the style of a character is changed.
|
||||||
bool SetStyleAt(int position, char styleValue, char mask='\377');
|
bool SetStyleAt(int position, char styleValue);
|
||||||
bool SetStyleFor(int position, int length, char styleValue, char mask);
|
bool SetStyleFor(int position, int length, char styleValue);
|
||||||
|
|
||||||
const char *DeleteChars(int position, int deleteLength, bool &startSequence);
|
const char *DeleteChars(int position, int deleteLength, bool &startSequence);
|
||||||
|
|
||||||
|
@@ -8,8 +8,8 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <ctype.h>
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
#include <ctype.h>
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
@@ -20,13 +20,13 @@
|
|||||||
#include "ILexer.h"
|
#include "ILexer.h"
|
||||||
#include "Scintilla.h"
|
#include "Scintilla.h"
|
||||||
|
|
||||||
|
#include "CharacterSet.h"
|
||||||
#include "SplitVector.h"
|
#include "SplitVector.h"
|
||||||
#include "Partitioning.h"
|
#include "Partitioning.h"
|
||||||
#include "RunStyles.h"
|
#include "RunStyles.h"
|
||||||
#include "CellBuffer.h"
|
#include "CellBuffer.h"
|
||||||
#include "PerLine.h"
|
#include "PerLine.h"
|
||||||
#include "CharClassify.h"
|
#include "CharClassify.h"
|
||||||
#include "CharacterSet.h"
|
|
||||||
#include "Decoration.h"
|
#include "Decoration.h"
|
||||||
#include "CaseFolder.h"
|
#include "CaseFolder.h"
|
||||||
#include "Document.h"
|
#include "Document.h"
|
||||||
@@ -58,7 +58,7 @@ void LexInterface::Colourise(int start, int end) {
|
|||||||
|
|
||||||
int styleStart = 0;
|
int styleStart = 0;
|
||||||
if (start > 0)
|
if (start > 0)
|
||||||
styleStart = pdoc->StyleAt(start - 1) & pdoc->stylingBitsMask;
|
styleStart = pdoc->StyleAt(start - 1);
|
||||||
|
|
||||||
if (len > 0) {
|
if (len > 0) {
|
||||||
instance->Lex(start, len, styleStart, pdoc);
|
instance->Lex(start, len, styleStart, pdoc);
|
||||||
@@ -90,9 +90,6 @@ Document::Document() {
|
|||||||
#endif
|
#endif
|
||||||
dbcsCodePage = 0;
|
dbcsCodePage = 0;
|
||||||
lineEndBitSet = SC_LINE_END_TYPE_DEFAULT;
|
lineEndBitSet = SC_LINE_END_TYPE_DEFAULT;
|
||||||
stylingBits = 5;
|
|
||||||
stylingBitsMask = 0x1F;
|
|
||||||
stylingMask = 0;
|
|
||||||
endStyled = 0;
|
endStyled = 0;
|
||||||
styleClock = 0;
|
styleClock = 0;
|
||||||
enteredModification = 0;
|
enteredModification = 0;
|
||||||
@@ -1712,13 +1709,7 @@ int Document::GetCharsOfClass(CharClassify::cc characterClass, unsigned char *bu
|
|||||||
return charClass.GetCharsOfClass(characterClass, buffer);
|
return charClass.GetCharsOfClass(characterClass, buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Document::SetStylingBits(int bits) {
|
void SCI_METHOD Document::StartStyling(int position, char) {
|
||||||
stylingBits = bits;
|
|
||||||
stylingBitsMask = (1 << stylingBits) - 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
void SCI_METHOD Document::StartStyling(int position, char mask) {
|
|
||||||
stylingMask = mask;
|
|
||||||
endStyled = position;
|
endStyled = position;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1727,9 +1718,8 @@ bool SCI_METHOD Document::SetStyleFor(int length, char style) {
|
|||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
enteredStyling++;
|
enteredStyling++;
|
||||||
style &= stylingMask;
|
|
||||||
int prevEndStyled = endStyled;
|
int prevEndStyled = endStyled;
|
||||||
if (cb.SetStyleFor(endStyled, length, style, stylingMask)) {
|
if (cb.SetStyleFor(endStyled, length, style)) {
|
||||||
DocModification mh(SC_MOD_CHANGESTYLE | SC_PERFORMED_USER,
|
DocModification mh(SC_MOD_CHANGESTYLE | SC_PERFORMED_USER,
|
||||||
prevEndStyled, length);
|
prevEndStyled, length);
|
||||||
NotifyModified(mh);
|
NotifyModified(mh);
|
||||||
@@ -1750,7 +1740,7 @@ bool SCI_METHOD Document::SetStyles(int length, const char *styles) {
|
|||||||
int endMod = 0;
|
int endMod = 0;
|
||||||
for (int iPos = 0; iPos < length; iPos++, endStyled++) {
|
for (int iPos = 0; iPos < length; iPos++, endStyled++) {
|
||||||
PLATFORM_ASSERT(endStyled < Length());
|
PLATFORM_ASSERT(endStyled < Length());
|
||||||
if (cb.SetStyleAt(endStyled, styles[iPos], stylingMask)) {
|
if (cb.SetStyleAt(endStyled, styles[iPos])) {
|
||||||
if (!didChange) {
|
if (!didChange) {
|
||||||
startMod = endStyled;
|
startMod = endStyled;
|
||||||
}
|
}
|
||||||
@@ -2080,7 +2070,7 @@ int Document::BraceMatch(int position, int /*maxReStyle*/) {
|
|||||||
char chSeek = BraceOpposite(chBrace);
|
char chSeek = BraceOpposite(chBrace);
|
||||||
if (chSeek == '\0')
|
if (chSeek == '\0')
|
||||||
return - 1;
|
return - 1;
|
||||||
char styBrace = static_cast<char>(StyleAt(position) & stylingBitsMask);
|
char styBrace = static_cast<char>(StyleAt(position));
|
||||||
int direction = -1;
|
int direction = -1;
|
||||||
if (chBrace == '(' || chBrace == '[' || chBrace == '{' || chBrace == '<')
|
if (chBrace == '(' || chBrace == '[' || chBrace == '{' || chBrace == '<')
|
||||||
direction = 1;
|
direction = 1;
|
||||||
@@ -2088,7 +2078,7 @@ int Document::BraceMatch(int position, int /*maxReStyle*/) {
|
|||||||
position = NextPosition(position, direction);
|
position = NextPosition(position, direction);
|
||||||
while ((position >= 0) && (position < Length())) {
|
while ((position >= 0) && (position < Length())) {
|
||||||
char chAtPos = CharAt(position);
|
char chAtPos = CharAt(position);
|
||||||
char styAtPos = static_cast<char>(StyleAt(position) & stylingBitsMask);
|
char styAtPos = static_cast<char>(StyleAt(position));
|
||||||
if ((position > GetEndStyled()) || (styAtPos == styBrace)) {
|
if ((position > GetEndStyled()) || (styAtPos == styBrace)) {
|
||||||
if (chAtPos == chBrace)
|
if (chAtPos == chBrace)
|
||||||
depth++;
|
depth++;
|
||||||
|
@@ -39,6 +39,10 @@ public:
|
|||||||
start(start_), end(end_) {
|
start(start_), end(end_) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool operator==(const Range &other) const {
|
||||||
|
return (start == other.start) && (end == other.end);
|
||||||
|
}
|
||||||
|
|
||||||
bool Valid() const {
|
bool Valid() const {
|
||||||
return (start != invalidPosition) && (end != invalidPosition);
|
return (start != invalidPosition) && (end != invalidPosition);
|
||||||
}
|
}
|
||||||
@@ -206,7 +210,6 @@ private:
|
|||||||
CellBuffer cb;
|
CellBuffer cb;
|
||||||
CharClassify charClass;
|
CharClassify charClass;
|
||||||
CaseFolder *pcf;
|
CaseFolder *pcf;
|
||||||
char stylingMask;
|
|
||||||
int endStyled;
|
int endStyled;
|
||||||
int styleClock;
|
int styleClock;
|
||||||
int enteredModification;
|
int enteredModification;
|
||||||
@@ -229,9 +232,6 @@ public:
|
|||||||
|
|
||||||
LexInterface *pli;
|
LexInterface *pli;
|
||||||
|
|
||||||
int stylingBits;
|
|
||||||
int stylingBitsMask;
|
|
||||||
|
|
||||||
int eolMode;
|
int eolMode;
|
||||||
/// Can also be SC_CP_UTF8 to enable UTF-8 mode
|
/// Can also be SC_CP_UTF8 to enable UTF-8 mode
|
||||||
int dbcsCodePage;
|
int dbcsCodePage;
|
||||||
@@ -369,7 +369,6 @@ public:
|
|||||||
void SetDefaultCharClasses(bool includeWordClass);
|
void SetDefaultCharClasses(bool includeWordClass);
|
||||||
void SetCharClasses(const unsigned char *chars, CharClassify::cc newCharClass);
|
void SetCharClasses(const unsigned char *chars, CharClassify::cc newCharClass);
|
||||||
int GetCharsOfClass(CharClassify::cc charClass, unsigned char *buffer);
|
int GetCharsOfClass(CharClassify::cc charClass, unsigned char *buffer);
|
||||||
void SetStylingBits(int bits);
|
|
||||||
void SCI_METHOD StartStyling(int position, char mask);
|
void SCI_METHOD StartStyling(int position, char mask);
|
||||||
bool SCI_METHOD SetStyleFor(int length, char style);
|
bool SCI_METHOD SetStyleFor(int length, char style);
|
||||||
bool SCI_METHOD SetStyles(int length, const char *styles);
|
bool SCI_METHOD SetStyles(int length, const char *styles);
|
||||||
|
@@ -8,9 +8,9 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <ctype.h>
|
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
#include <ctype.h>
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
@@ -220,8 +220,7 @@ Editor::Editor() {
|
|||||||
|
|
||||||
convertPastes = true;
|
convertPastes = true;
|
||||||
|
|
||||||
hsStart = -1;
|
hotspot = Range(invalidPosition);
|
||||||
hsEnd = -1;
|
|
||||||
|
|
||||||
llc.SetLevel(LineLayoutCache::llcCaret);
|
llc.SetLevel(LineLayoutCache::llcCaret);
|
||||||
posCache.SetSize(0x400);
|
posCache.SetSize(0x400);
|
||||||
@@ -885,9 +884,8 @@ bool Editor::RangeContainsProtected(int start, int end) const {
|
|||||||
start = end;
|
start = end;
|
||||||
end = t;
|
end = t;
|
||||||
}
|
}
|
||||||
int mask = pdoc->stylingBitsMask;
|
|
||||||
for (int pos = start; pos < end; pos++) {
|
for (int pos = start; pos < end; pos++) {
|
||||||
if (vs.styles[pdoc->StyleAt(pos) & mask].IsProtected())
|
if (vs.styles[pdoc->StyleAt(pos)].IsProtected())
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -916,17 +914,16 @@ SelectionPosition Editor::MovePositionOutsideChar(SelectionPosition pos, int mov
|
|||||||
if (posMoved != pos.Position())
|
if (posMoved != pos.Position())
|
||||||
pos.SetPosition(posMoved);
|
pos.SetPosition(posMoved);
|
||||||
if (vs.ProtectionActive()) {
|
if (vs.ProtectionActive()) {
|
||||||
int mask = pdoc->stylingBitsMask;
|
|
||||||
if (moveDir > 0) {
|
if (moveDir > 0) {
|
||||||
if ((pos.Position() > 0) && vs.styles[pdoc->StyleAt(pos.Position() - 1) & mask].IsProtected()) {
|
if ((pos.Position() > 0) && vs.styles[pdoc->StyleAt(pos.Position() - 1)].IsProtected()) {
|
||||||
while ((pos.Position() < pdoc->Length()) &&
|
while ((pos.Position() < pdoc->Length()) &&
|
||||||
(vs.styles[pdoc->StyleAt(pos.Position()) & mask].IsProtected()))
|
(vs.styles[pdoc->StyleAt(pos.Position())].IsProtected()))
|
||||||
pos.Add(1);
|
pos.Add(1);
|
||||||
}
|
}
|
||||||
} else if (moveDir < 0) {
|
} else if (moveDir < 0) {
|
||||||
if (vs.styles[pdoc->StyleAt(pos.Position()) & mask].IsProtected()) {
|
if (vs.styles[pdoc->StyleAt(pos.Position())].IsProtected()) {
|
||||||
while ((pos.Position() > 0) &&
|
while ((pos.Position() > 0) &&
|
||||||
(vs.styles[pdoc->StyleAt(pos.Position() - 1) & mask].IsProtected()))
|
(vs.styles[pdoc->StyleAt(pos.Position() - 1)].IsProtected()))
|
||||||
pos.Add(-1);
|
pos.Add(-1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1741,7 +1738,7 @@ int Editor::SubstituteMarkerIfEmpty(int markerCheck, int markerDefault) const {
|
|||||||
return markerCheck;
|
return markerCheck;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ValidStyledText(ViewStyle &vs, size_t styleOffset, const StyledText &st) {
|
bool ValidStyledText(const ViewStyle &vs, size_t styleOffset, const StyledText &st) {
|
||||||
if (st.multipleStyles) {
|
if (st.multipleStyles) {
|
||||||
for (size_t iStyle=0; iStyle<st.length; iStyle++) {
|
for (size_t iStyle=0; iStyle<st.length; iStyle++) {
|
||||||
if (!vs.ValidStyle(styleOffset + st.styles[iStyle]))
|
if (!vs.ValidStyle(styleOffset + st.styles[iStyle]))
|
||||||
@@ -1754,7 +1751,7 @@ bool ValidStyledText(ViewStyle &vs, size_t styleOffset, const StyledText &st) {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int WidthStyledText(Surface *surface, ViewStyle &vs, int styleOffset,
|
static int WidthStyledText(Surface *surface, const ViewStyle &vs, int styleOffset,
|
||||||
const char *text, const unsigned char *styles, size_t len) {
|
const char *text, const unsigned char *styles, size_t len) {
|
||||||
int width = 0;
|
int width = 0;
|
||||||
size_t start = 0;
|
size_t start = 0;
|
||||||
@@ -1763,14 +1760,15 @@ static int WidthStyledText(Surface *surface, ViewStyle &vs, int styleOffset,
|
|||||||
size_t endSegment = start;
|
size_t endSegment = start;
|
||||||
while ((endSegment+1 < len) && (static_cast<size_t>(styles[endSegment+1]) == style))
|
while ((endSegment+1 < len) && (static_cast<size_t>(styles[endSegment+1]) == style))
|
||||||
endSegment++;
|
endSegment++;
|
||||||
width += static_cast<int>(surface->WidthText(vs.styles[style + styleOffset].font, text + start,
|
FontAlias fontText = vs.styles[style + styleOffset].font;
|
||||||
|
width += static_cast<int>(surface->WidthText(fontText, text + start,
|
||||||
static_cast<int>(endSegment - start + 1)));
|
static_cast<int>(endSegment - start + 1)));
|
||||||
start = endSegment + 1;
|
start = endSegment + 1;
|
||||||
}
|
}
|
||||||
return width;
|
return width;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int WidestLineWidth(Surface *surface, ViewStyle &vs, int styleOffset, const StyledText &st) {
|
static int WidestLineWidth(Surface *surface, const ViewStyle &vs, int styleOffset, const StyledText &st) {
|
||||||
int widthMax = 0;
|
int widthMax = 0;
|
||||||
size_t start = 0;
|
size_t start = 0;
|
||||||
while (start < st.length) {
|
while (start < st.length) {
|
||||||
@@ -1779,7 +1777,8 @@ static int WidestLineWidth(Surface *surface, ViewStyle &vs, int styleOffset, con
|
|||||||
if (st.multipleStyles) {
|
if (st.multipleStyles) {
|
||||||
widthSubLine = WidthStyledText(surface, vs, styleOffset, st.text + start, st.styles + start, lenLine);
|
widthSubLine = WidthStyledText(surface, vs, styleOffset, st.text + start, st.styles + start, lenLine);
|
||||||
} else {
|
} else {
|
||||||
widthSubLine = static_cast<int>(surface->WidthText(vs.styles[styleOffset + st.style].font,
|
FontAlias fontText = vs.styles[styleOffset + st.style].font;
|
||||||
|
widthSubLine = static_cast<int>(surface->WidthText(fontText,
|
||||||
st.text + start, static_cast<int>(lenLine)));
|
st.text + start, static_cast<int>(lenLine)));
|
||||||
}
|
}
|
||||||
if (widthSubLine > widthMax)
|
if (widthSubLine > widthMax)
|
||||||
@@ -1789,7 +1788,13 @@ static int WidestLineWidth(Surface *surface, ViewStyle &vs, int styleOffset, con
|
|||||||
return widthMax;
|
return widthMax;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DrawStyledText(Surface *surface, ViewStyle &vs, int styleOffset, PRectangle rcText, int ascent,
|
static void DrawTextInStyle(Surface *surface, PRectangle rcText, const Style &style, XYPOSITION ybase, const char *s, size_t length) {
|
||||||
|
FontAlias fontText = style.font;
|
||||||
|
surface->DrawTextNoClip(rcText, fontText, ybase, s, static_cast<int>(length),
|
||||||
|
style.fore, style.back);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void DrawStyledText(Surface *surface, const ViewStyle &vs, int styleOffset, PRectangle rcText,
|
||||||
const StyledText &st, size_t start, size_t length) {
|
const StyledText &st, size_t start, size_t length) {
|
||||||
|
|
||||||
if (st.multipleStyles) {
|
if (st.multipleStyles) {
|
||||||
@@ -1797,30 +1802,25 @@ void DrawStyledText(Surface *surface, ViewStyle &vs, int styleOffset, PRectangle
|
|||||||
size_t i = 0;
|
size_t i = 0;
|
||||||
while (i < length) {
|
while (i < length) {
|
||||||
size_t end = i;
|
size_t end = i;
|
||||||
int style = st.styles[i + start];
|
size_t style = st.styles[i + start];
|
||||||
while (end < length-1 && st.styles[start+end+1] == style)
|
while (end < length-1 && st.styles[start+end+1] == style)
|
||||||
end++;
|
end++;
|
||||||
style += styleOffset;
|
style += styleOffset;
|
||||||
int width = static_cast<int>(surface->WidthText(vs.styles[style].font,
|
FontAlias fontText = vs.styles[style].font;
|
||||||
|
const int width = static_cast<int>(surface->WidthText(fontText,
|
||||||
st.text + start + i, static_cast<int>(end - i + 1)));
|
st.text + start + i, static_cast<int>(end - i + 1)));
|
||||||
PRectangle rcSegment = rcText;
|
PRectangle rcSegment = rcText;
|
||||||
rcSegment.left = static_cast<XYPOSITION>(x);
|
rcSegment.left = static_cast<XYPOSITION>(x);
|
||||||
rcSegment.right = static_cast<XYPOSITION>(x + width + 1);
|
rcSegment.right = static_cast<XYPOSITION>(x + width + 1);
|
||||||
surface->DrawTextNoClip(rcSegment, vs.styles[style].font,
|
DrawTextInStyle(surface, rcSegment, vs.styles[style], rcText.top + vs.maxAscent,
|
||||||
static_cast<XYPOSITION>(ascent), st.text + start + i,
|
st.text + start + i, end - i + 1);
|
||||||
static_cast<int>(end - i + 1),
|
|
||||||
vs.styles[style].fore,
|
|
||||||
vs.styles[style].back);
|
|
||||||
x += width;
|
x += width;
|
||||||
i = end + 1;
|
i = end + 1;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
size_t style = st.style + styleOffset;
|
const size_t style = st.style + styleOffset;
|
||||||
surface->DrawTextNoClip(rcText, vs.styles[style].font,
|
DrawTextInStyle(surface, rcText, vs.styles[style], rcText.top + vs.maxAscent,
|
||||||
rcText.top + vs.maxAscent, st.text + start,
|
st.text + start, length);
|
||||||
static_cast<int>(length),
|
|
||||||
vs.styles[style].fore,
|
|
||||||
vs.styles[style].back);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1832,6 +1832,13 @@ void Editor::PaintSelMargin(Surface *surfWindow, PRectangle &rc) {
|
|||||||
RefreshStyleData();
|
RefreshStyleData();
|
||||||
RefreshPixMaps(surfWindow);
|
RefreshPixMaps(surfWindow);
|
||||||
|
|
||||||
|
// On GTK+ with Ubuntu overlay scroll bars, the surface may have been finished
|
||||||
|
// at this point. The Initialised call checks for this case and sets the status
|
||||||
|
// to be bad which avoids crashes in following calls.
|
||||||
|
if (!surfWindow->Initialised()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
PRectangle rcMargin = GetClientRectangle();
|
PRectangle rcMargin = GetClientRectangle();
|
||||||
Point ptOrigin = GetVisibleOriginInMain();
|
Point ptOrigin = GetVisibleOriginInMain();
|
||||||
rcMargin.Move(0, -ptOrigin.y);
|
rcMargin.Move(0, -ptOrigin.y);
|
||||||
@@ -2057,10 +2064,8 @@ void Editor::PaintSelMargin(Surface *surfWindow, PRectangle &rc) {
|
|||||||
XYPOSITION width = surface->WidthText(vs.styles[STYLE_LINENUMBER].font, number, istrlen(number));
|
XYPOSITION width = surface->WidthText(vs.styles[STYLE_LINENUMBER].font, number, istrlen(number));
|
||||||
XYPOSITION xpos = rcNumber.right - width - vs.marginNumberPadding;
|
XYPOSITION xpos = rcNumber.right - width - vs.marginNumberPadding;
|
||||||
rcNumber.left = xpos;
|
rcNumber.left = xpos;
|
||||||
surface->DrawTextNoClip(rcNumber, vs.styles[STYLE_LINENUMBER].font,
|
DrawTextInStyle(surface, rcNumber, vs.styles[STYLE_LINENUMBER],
|
||||||
rcNumber.top + vs.maxAscent, number, istrlen(number),
|
rcNumber.top + vs.maxAscent, number, strlen(number));
|
||||||
vs.styles[STYLE_LINENUMBER].fore,
|
|
||||||
vs.styles[STYLE_LINENUMBER].back);
|
|
||||||
} else if (vs.wrapVisualFlags & SC_WRAPVISUALFLAG_MARGIN) {
|
} else if (vs.wrapVisualFlags & SC_WRAPVISUALFLAG_MARGIN) {
|
||||||
PRectangle rcWrapMarker = rcMarker;
|
PRectangle rcWrapMarker = rcMarker;
|
||||||
rcWrapMarker.right -= 3;
|
rcWrapMarker.right -= 3;
|
||||||
@@ -2077,7 +2082,7 @@ void Editor::PaintSelMargin(Surface *surfWindow, PRectangle &rc) {
|
|||||||
int width = WidestLineWidth(surface, vs, vs.marginStyleOffset, stMargin);
|
int width = WidestLineWidth(surface, vs, vs.marginStyleOffset, stMargin);
|
||||||
rcMarker.left = rcMarker.right - width - 3;
|
rcMarker.left = rcMarker.right - width - 3;
|
||||||
}
|
}
|
||||||
DrawStyledText(surface, vs, vs.marginStyleOffset, rcMarker, static_cast<int>(rcMarker.top) + vs.maxAscent,
|
DrawStyledText(surface, vs, vs.marginStyleOffset, rcMarker,
|
||||||
stMargin, 0, stMargin.length);
|
stMargin, 0, stMargin.length);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2157,8 +2162,7 @@ LineLayout *Editor::RetrieveLineLayout(int lineNumber) {
|
|||||||
* Copy the given @a line and its styles from the document into local arrays.
|
* Copy the given @a line and its styles from the document into local arrays.
|
||||||
* Also determine the x position at which each character starts.
|
* Also determine the x position at which each character starts.
|
||||||
*/
|
*/
|
||||||
void Editor::LayoutLine(int line, Surface *surface, ViewStyle &vstyle, LineLayout *ll, int width) {
|
void Editor::LayoutLine(int line, Surface *surface, const ViewStyle &vstyle, LineLayout *ll, int width) {
|
||||||
//void LayoutLine(int line, Surface *surface, ViewStyle &vstyle, LineLayout *ll, int width, Document *pdoc, PositionCache &posCache, SpecialRepresentations &reprs) {
|
|
||||||
if (!ll)
|
if (!ll)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@@ -2178,7 +2182,6 @@ void Editor::LayoutLine(int line, Surface *surface, ViewStyle &vstyle, LineLayou
|
|||||||
if (lineLength == ll->numCharsInLine) {
|
if (lineLength == ll->numCharsInLine) {
|
||||||
// See if chars, styles, indicators, are all the same
|
// See if chars, styles, indicators, are all the same
|
||||||
bool allSame = true;
|
bool allSame = true;
|
||||||
const int styleMask = pdoc->stylingBitsMask;
|
|
||||||
// Check base line layout
|
// Check base line layout
|
||||||
char styleByte = 0;
|
char styleByte = 0;
|
||||||
int numCharsInLine = 0;
|
int numCharsInLine = 0;
|
||||||
@@ -2187,9 +2190,7 @@ void Editor::LayoutLine(int line, Surface *surface, ViewStyle &vstyle, LineLayou
|
|||||||
char chDoc = pdoc->CharAt(charInDoc);
|
char chDoc = pdoc->CharAt(charInDoc);
|
||||||
styleByte = pdoc->StyleAt(charInDoc);
|
styleByte = pdoc->StyleAt(charInDoc);
|
||||||
allSame = allSame &&
|
allSame = allSame &&
|
||||||
(ll->styles[numCharsInLine] == static_cast<unsigned char>(styleByte & styleMask));
|
(ll->styles[numCharsInLine] == static_cast<unsigned char>(styleByte));
|
||||||
allSame = allSame &&
|
|
||||||
(ll->indicators[numCharsInLine] == static_cast<char>(styleByte & ~styleMask));
|
|
||||||
if (vstyle.styles[ll->styles[numCharsInLine]].caseForce == Style::caseMixed)
|
if (vstyle.styles[ll->styles[numCharsInLine]].caseForce == Style::caseMixed)
|
||||||
allSame = allSame &&
|
allSame = allSame &&
|
||||||
(ll->chars[numCharsInLine] == chDoc);
|
(ll->chars[numCharsInLine] == chDoc);
|
||||||
@@ -2223,8 +2224,6 @@ void Editor::LayoutLine(int line, Surface *surface, ViewStyle &vstyle, LineLayou
|
|||||||
ll->edgeColumn = -1;
|
ll->edgeColumn = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
const int styleMask = pdoc->stylingBitsMask;
|
|
||||||
ll->styleBitsSet = 0;
|
|
||||||
// Fill base line layout
|
// Fill base line layout
|
||||||
const int lineLength = posLineEnd - posLineStart;
|
const int lineLength = posLineEnd - posLineStart;
|
||||||
pdoc->GetCharRange(ll->chars, posLineStart, lineLength);
|
pdoc->GetCharRange(ll->chars, posLineStart, lineLength);
|
||||||
@@ -2233,11 +2232,9 @@ void Editor::LayoutLine(int line, Surface *surface, ViewStyle &vstyle, LineLayou
|
|||||||
const int numCharsInLine = (vstyle.viewEOL) ? lineLength : numCharsBeforeEOL;
|
const int numCharsInLine = (vstyle.viewEOL) ? lineLength : numCharsBeforeEOL;
|
||||||
for (int styleInLine = 0; styleInLine < numCharsInLine; styleInLine++) {
|
for (int styleInLine = 0; styleInLine < numCharsInLine; styleInLine++) {
|
||||||
const unsigned char styleByte = ll->styles[styleInLine];
|
const unsigned char styleByte = ll->styles[styleInLine];
|
||||||
ll->styleBitsSet |= styleByte;
|
ll->styles[styleInLine] = styleByte;
|
||||||
ll->styles[styleInLine] = styleByte & styleMask;
|
|
||||||
ll->indicators[styleInLine] = static_cast<char>(styleByte & ~styleMask);
|
|
||||||
}
|
}
|
||||||
const unsigned char styleByteLast = ((lineLength > 0) ? ll->styles[lineLength-1] : 0) & styleMask;
|
const unsigned char styleByteLast = (lineLength > 0) ? ll->styles[lineLength-1] : 0;
|
||||||
if (vstyle.someStylesForceCase) {
|
if (vstyle.someStylesForceCase) {
|
||||||
for (int charInLine = 0; charInLine<lineLength; charInLine++) {
|
for (int charInLine = 0; charInLine<lineLength; charInLine++) {
|
||||||
char chDoc = ll->chars[charInLine];
|
char chDoc = ll->chars[charInLine];
|
||||||
@@ -2251,14 +2248,13 @@ void Editor::LayoutLine(int line, Surface *surface, ViewStyle &vstyle, LineLayou
|
|||||||
// Extra element at the end of the line to hold end x position and act as
|
// Extra element at the end of the line to hold end x position and act as
|
||||||
ll->chars[numCharsInLine] = 0; // Also triggers processing in the loops as this is a control character
|
ll->chars[numCharsInLine] = 0; // Also triggers processing in the loops as this is a control character
|
||||||
ll->styles[numCharsInLine] = styleByteLast; // For eolFilled
|
ll->styles[numCharsInLine] = styleByteLast; // For eolFilled
|
||||||
ll->indicators[numCharsInLine] = 0;
|
|
||||||
|
|
||||||
// Layout the line, determining the position of each character,
|
// Layout the line, determining the position of each character,
|
||||||
// with an extra element at the end for the end of the line.
|
// with an extra element at the end for the end of the line.
|
||||||
ll->positions[0] = 0;
|
ll->positions[0] = 0;
|
||||||
bool lastSegItalics = false;
|
bool lastSegItalics = false;
|
||||||
|
|
||||||
BreakFinder bfLayout(ll, 0, numCharsInLine, posLineStart, 0, false, pdoc, &reprs);
|
BreakFinder bfLayout(ll, NULL, 0, numCharsInLine, posLineStart, 0, false, pdoc, &reprs);
|
||||||
while (bfLayout.More()) {
|
while (bfLayout.More()) {
|
||||||
|
|
||||||
const TextSegment ts = bfLayout.Next();
|
const TextSegment ts = bfLayout.Next();
|
||||||
@@ -2390,14 +2386,14 @@ void Editor::LayoutLine(int line, Surface *surface, ViewStyle &vstyle, LineLayou
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ColourDesired Editor::SelectionBackground(ViewStyle &vsDraw, bool main) const {
|
ColourDesired Editor::SelectionBackground(const ViewStyle &vsDraw, bool main) const {
|
||||||
return main ?
|
return main ?
|
||||||
(primarySelection ? vsDraw.selColours.back : vsDraw.selBackground2) :
|
(primarySelection ? vsDraw.selColours.back : vsDraw.selBackground2) :
|
||||||
vsDraw.selAdditionalBackground;
|
vsDraw.selAdditionalBackground;
|
||||||
}
|
}
|
||||||
|
|
||||||
ColourDesired Editor::TextBackground(ViewStyle &vsDraw, bool overrideBackground,
|
ColourDesired Editor::TextBackground(const ViewStyle &vsDraw,
|
||||||
ColourDesired background, int inSelection, bool inHotspot, int styleMain, int i, LineLayout *ll) const {
|
ColourOptional background, int inSelection, bool inHotspot, int styleMain, int i, LineLayout *ll) const {
|
||||||
if (inSelection == 1) {
|
if (inSelection == 1) {
|
||||||
if (vsDraw.selColours.back.isSet && (vsDraw.selAlpha == SC_ALPHA_NOALPHA)) {
|
if (vsDraw.selColours.back.isSet && (vsDraw.selAlpha == SC_ALPHA_NOALPHA)) {
|
||||||
return SelectionBackground(vsDraw, true);
|
return SelectionBackground(vsDraw, true);
|
||||||
@@ -2414,7 +2410,7 @@ ColourDesired Editor::TextBackground(ViewStyle &vsDraw, bool overrideBackground,
|
|||||||
if (inHotspot && vsDraw.hotspotColours.back.isSet)
|
if (inHotspot && vsDraw.hotspotColours.back.isSet)
|
||||||
return vsDraw.hotspotColours.back;
|
return vsDraw.hotspotColours.back;
|
||||||
}
|
}
|
||||||
if (overrideBackground && (styleMain != STYLE_BRACELIGHT) && (styleMain != STYLE_BRACEBAD)) {
|
if (background.isSet && (styleMain != STYLE_BRACELIGHT) && (styleMain != STYLE_BRACEBAD)) {
|
||||||
return background;
|
return background;
|
||||||
} else {
|
} else {
|
||||||
return vsDraw.styles[styleMain].back;
|
return vsDraw.styles[styleMain].back;
|
||||||
@@ -2478,12 +2474,12 @@ static void SimpleAlphaRectangle(Surface *surface, PRectangle rc, ColourDesired
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void DrawTextBlob(Surface *surface, ViewStyle &vsDraw, PRectangle rcSegment,
|
void DrawTextBlob(Surface *surface, const ViewStyle &vsDraw, PRectangle rcSegment,
|
||||||
const char *s, ColourDesired textBack, ColourDesired textFore, bool twoPhaseDraw) {
|
const char *s, ColourDesired textBack, ColourDesired textFore, bool twoPhaseDraw) {
|
||||||
if (!twoPhaseDraw) {
|
if (!twoPhaseDraw) {
|
||||||
surface->FillRectangle(rcSegment, textBack);
|
surface->FillRectangle(rcSegment, textBack);
|
||||||
}
|
}
|
||||||
Font &ctrlCharsFont = vsDraw.styles[STYLE_CONTROLCHAR].font;
|
FontAlias ctrlCharsFont = vsDraw.styles[STYLE_CONTROLCHAR].font;
|
||||||
int normalCharHeight = static_cast<int>(surface->Ascent(ctrlCharsFont) -
|
int normalCharHeight = static_cast<int>(surface->Ascent(ctrlCharsFont) -
|
||||||
surface->InternalLeading(ctrlCharsFont));
|
surface->InternalLeading(ctrlCharsFont));
|
||||||
PRectangle rcCChar = rcSegment;
|
PRectangle rcCChar = rcSegment;
|
||||||
@@ -2502,13 +2498,11 @@ void DrawTextBlob(Surface *surface, ViewStyle &vsDraw, PRectangle rcSegment,
|
|||||||
textBack, textFore);
|
textBack, textFore);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Editor::DrawEOL(Surface *surface, ViewStyle &vsDraw, PRectangle rcLine, LineLayout *ll,
|
void Editor::DrawEOL(Surface *surface, const ViewStyle &vsDraw, PRectangle rcLine, LineLayout *ll,
|
||||||
int line, int lineEnd, int xStart, int subLine, XYACCUMULATOR subLineStart,
|
int line, int lineEnd, int xStart, int subLine, XYACCUMULATOR subLineStart,
|
||||||
bool overrideBackground, ColourDesired background,
|
ColourOptional background) {
|
||||||
bool drawWrapMarkEnd, ColourDesired wrapColour) {
|
|
||||||
|
|
||||||
const int posLineStart = pdoc->LineStart(line);
|
const int posLineStart = pdoc->LineStart(line);
|
||||||
const int styleMask = pdoc->stylingBitsMask;
|
|
||||||
PRectangle rcSegment = rcLine;
|
PRectangle rcSegment = rcLine;
|
||||||
|
|
||||||
const bool lastSubLine = subLine == (ll->lines - 1);
|
const bool lastSubLine = subLine == (ll->lines - 1);
|
||||||
@@ -2523,7 +2517,7 @@ void Editor::DrawEOL(Surface *surface, ViewStyle &vsDraw, PRectangle rcLine, Lin
|
|||||||
if (virtualSpace) {
|
if (virtualSpace) {
|
||||||
rcSegment.left = xEol + xStart;
|
rcSegment.left = xEol + xStart;
|
||||||
rcSegment.right = xEol + xStart + virtualSpace;
|
rcSegment.right = xEol + xStart + virtualSpace;
|
||||||
surface->FillRectangle(rcSegment, overrideBackground ? background : vsDraw.styles[ll->styles[ll->numCharsInLine] & styleMask].back);
|
surface->FillRectangle(rcSegment, background.isSet ? background : vsDraw.styles[ll->styles[ll->numCharsInLine]].back);
|
||||||
if (!hideSelection && ((vsDraw.selAlpha == SC_ALPHA_NOALPHA) || (vsDraw.selAdditionalAlpha == SC_ALPHA_NOALPHA))) {
|
if (!hideSelection && ((vsDraw.selAlpha == SC_ALPHA_NOALPHA) || (vsDraw.selAdditionalAlpha == SC_ALPHA_NOALPHA))) {
|
||||||
SelectionSegment virtualSpaceRange(SelectionPosition(pdoc->LineEnd(line)), SelectionPosition(pdoc->LineEnd(line), sel.VirtualSpaceFor(pdoc->LineEnd(line))));
|
SelectionSegment virtualSpaceRange(SelectionPosition(pdoc->LineEnd(line)), SelectionPosition(pdoc->LineEnd(line), sel.VirtualSpaceFor(pdoc->LineEnd(line))));
|
||||||
for (size_t r=0; r<sel.Count(); r++) {
|
for (size_t r=0; r<sel.Count(); r++) {
|
||||||
@@ -2564,11 +2558,11 @@ void Editor::DrawEOL(Surface *surface, ViewStyle &vsDraw, PRectangle rcLine, Lin
|
|||||||
const char *ctrlChar;
|
const char *ctrlChar;
|
||||||
unsigned char chEOL = ll->chars[eolPos];
|
unsigned char chEOL = ll->chars[eolPos];
|
||||||
int styleMain = ll->styles[eolPos];
|
int styleMain = ll->styles[eolPos];
|
||||||
ColourDesired textBack = TextBackground(vsDraw, overrideBackground, background, eolInSelection, false, styleMain, eolPos, ll);
|
ColourDesired textBack = TextBackground(vsDraw, background, eolInSelection, false, styleMain, eolPos, ll);
|
||||||
if (UTF8IsAscii(chEOL)) {
|
if (UTF8IsAscii(chEOL)) {
|
||||||
ctrlChar = ControlCharacterString(chEOL);
|
ctrlChar = ControlCharacterString(chEOL);
|
||||||
} else {
|
} else {
|
||||||
Representation *repr = reprs.RepresentationFromCharacter(ll->chars + eolPos, ll->numCharsInLine - eolPos);
|
const Representation *repr = reprs.RepresentationFromCharacter(ll->chars + eolPos, ll->numCharsInLine - eolPos);
|
||||||
if (repr) {
|
if (repr) {
|
||||||
ctrlChar = repr->stringRep.c_str();
|
ctrlChar = repr->stringRep.c_str();
|
||||||
eolPos = ll->numCharsInLine;
|
eolPos = ll->numCharsInLine;
|
||||||
@@ -2604,12 +2598,12 @@ void Editor::DrawEOL(Surface *surface, ViewStyle &vsDraw, PRectangle rcLine, Lin
|
|||||||
if (eolInSelection && vsDraw.selColours.back.isSet && (line < pdoc->LinesTotal() - 1) && (alpha == SC_ALPHA_NOALPHA)) {
|
if (eolInSelection && vsDraw.selColours.back.isSet && (line < pdoc->LinesTotal() - 1) && (alpha == SC_ALPHA_NOALPHA)) {
|
||||||
surface->FillRectangle(rcSegment, SelectionBackground(vsDraw, eolInSelection == 1));
|
surface->FillRectangle(rcSegment, SelectionBackground(vsDraw, eolInSelection == 1));
|
||||||
} else {
|
} else {
|
||||||
if (overrideBackground) {
|
if (background.isSet) {
|
||||||
surface->FillRectangle(rcSegment, background);
|
surface->FillRectangle(rcSegment, background);
|
||||||
} else if (line < pdoc->LinesTotal() - 1) {
|
} else if (line < pdoc->LinesTotal() - 1) {
|
||||||
surface->FillRectangle(rcSegment, vsDraw.styles[ll->styles[ll->numCharsInLine] & styleMask].back);
|
surface->FillRectangle(rcSegment, vsDraw.styles[ll->styles[ll->numCharsInLine]].back);
|
||||||
} else if (vsDraw.styles[ll->styles[ll->numCharsInLine] & styleMask].eolFilled) {
|
} else if (vsDraw.styles[ll->styles[ll->numCharsInLine]].eolFilled) {
|
||||||
surface->FillRectangle(rcSegment, vsDraw.styles[ll->styles[ll->numCharsInLine] & styleMask].back);
|
surface->FillRectangle(rcSegment, vsDraw.styles[ll->styles[ll->numCharsInLine]].back);
|
||||||
} else {
|
} else {
|
||||||
surface->FillRectangle(rcSegment, vsDraw.styles[STYLE_DEFAULT].back);
|
surface->FillRectangle(rcSegment, vsDraw.styles[STYLE_DEFAULT].back);
|
||||||
}
|
}
|
||||||
@@ -2627,10 +2621,10 @@ void Editor::DrawEOL(Surface *surface, ViewStyle &vsDraw, PRectangle rcLine, Lin
|
|||||||
if (eolInSelection && vsDraw.selEOLFilled && vsDraw.selColours.back.isSet && (line < pdoc->LinesTotal() - 1) && (alpha == SC_ALPHA_NOALPHA)) {
|
if (eolInSelection && vsDraw.selEOLFilled && vsDraw.selColours.back.isSet && (line < pdoc->LinesTotal() - 1) && (alpha == SC_ALPHA_NOALPHA)) {
|
||||||
surface->FillRectangle(rcSegment, SelectionBackground(vsDraw, eolInSelection == 1));
|
surface->FillRectangle(rcSegment, SelectionBackground(vsDraw, eolInSelection == 1));
|
||||||
} else {
|
} else {
|
||||||
if (overrideBackground) {
|
if (background.isSet) {
|
||||||
surface->FillRectangle(rcSegment, background);
|
surface->FillRectangle(rcSegment, background);
|
||||||
} else if (vsDraw.styles[ll->styles[ll->numCharsInLine] & styleMask].eolFilled) {
|
} else if (vsDraw.styles[ll->styles[ll->numCharsInLine]].eolFilled) {
|
||||||
surface->FillRectangle(rcSegment, vsDraw.styles[ll->styles[ll->numCharsInLine] & styleMask].back);
|
surface->FillRectangle(rcSegment, vsDraw.styles[ll->styles[ll->numCharsInLine]].back);
|
||||||
} else {
|
} else {
|
||||||
surface->FillRectangle(rcSegment, vsDraw.styles[STYLE_DEFAULT].back);
|
surface->FillRectangle(rcSegment, vsDraw.styles[STYLE_DEFAULT].back);
|
||||||
}
|
}
|
||||||
@@ -2639,6 +2633,14 @@ void Editor::DrawEOL(Surface *surface, ViewStyle &vsDraw, PRectangle rcLine, Lin
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool drawWrapMarkEnd = false;
|
||||||
|
|
||||||
|
if (vsDraw.wrapVisualFlags & SC_WRAPVISUALFLAG_END) {
|
||||||
|
if (subLine + 1 < ll->lines) {
|
||||||
|
drawWrapMarkEnd = ll->LineStart(subLine + 1) != 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (drawWrapMarkEnd) {
|
if (drawWrapMarkEnd) {
|
||||||
PRectangle rcPlace = rcSegment;
|
PRectangle rcPlace = rcSegment;
|
||||||
|
|
||||||
@@ -2650,11 +2652,11 @@ void Editor::DrawEOL(Surface *surface, ViewStyle &vsDraw, PRectangle rcLine, Lin
|
|||||||
rcPlace.right = rcLine.right;
|
rcPlace.right = rcLine.right;
|
||||||
rcPlace.left = rcPlace.right - vsDraw.aveCharWidth;
|
rcPlace.left = rcPlace.right - vsDraw.aveCharWidth;
|
||||||
}
|
}
|
||||||
DrawWrapMarker(surface, rcPlace, true, wrapColour);
|
DrawWrapMarker(surface, rcPlace, true, vsDraw.WrapColour());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Editor::DrawIndicator(int indicNum, int startPos, int endPos, Surface *surface, ViewStyle &vsDraw,
|
void Editor::DrawIndicator(int indicNum, int startPos, int endPos, Surface *surface, const ViewStyle &vsDraw,
|
||||||
int xStart, PRectangle rcLine, LineLayout *ll, int subLine) {
|
int xStart, PRectangle rcLine, LineLayout *ll, int subLine) {
|
||||||
const XYPOSITION subLineStart = ll->positions[ll->LineStart(subLine)];
|
const XYPOSITION subLineStart = ll->positions[ll->LineStart(subLine)];
|
||||||
PRectangle rcIndic(
|
PRectangle rcIndic(
|
||||||
@@ -2665,45 +2667,13 @@ void Editor::DrawIndicator(int indicNum, int startPos, int endPos, Surface *surf
|
|||||||
vsDraw.indicators[indicNum].Draw(surface, rcIndic, rcLine);
|
vsDraw.indicators[indicNum].Draw(surface, rcIndic, rcLine);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Editor::DrawIndicators(Surface *surface, ViewStyle &vsDraw, int line, int xStart,
|
void Editor::DrawIndicators(Surface *surface, const ViewStyle &vsDraw, int line, int xStart,
|
||||||
PRectangle rcLine, LineLayout *ll, int subLine, int lineEnd, bool under) {
|
PRectangle rcLine, LineLayout *ll, int subLine, int lineEnd, bool under) {
|
||||||
// Draw decorators
|
// Draw decorators
|
||||||
const int posLineStart = pdoc->LineStart(line);
|
const int posLineStart = pdoc->LineStart(line);
|
||||||
const int lineStart = ll->LineStart(subLine);
|
const int lineStart = ll->LineStart(subLine);
|
||||||
const int posLineEnd = posLineStart + lineEnd;
|
const int posLineEnd = posLineStart + lineEnd;
|
||||||
|
|
||||||
if (!under) {
|
|
||||||
// Draw indicators
|
|
||||||
// foreach indicator...
|
|
||||||
for (int indicnum = 0, mask = 1 << pdoc->stylingBits; mask < 0x100; indicnum++) {
|
|
||||||
if (!(mask & ll->styleBitsSet)) {
|
|
||||||
mask <<= 1;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
int startPos = -1;
|
|
||||||
// foreach style pos in line...
|
|
||||||
for (int indicPos = lineStart; indicPos <= lineEnd; indicPos++) {
|
|
||||||
// look for starts...
|
|
||||||
if (startPos < 0) {
|
|
||||||
// NOT in indicator run, looking for START
|
|
||||||
if (indicPos < lineEnd && (ll->indicators[indicPos] & mask))
|
|
||||||
startPos = indicPos;
|
|
||||||
}
|
|
||||||
// ... or ends
|
|
||||||
if (startPos >= 0) {
|
|
||||||
// IN indicator run, looking for END
|
|
||||||
if (indicPos >= lineEnd || !(ll->indicators[indicPos] & mask)) {
|
|
||||||
// AT end of indicator run, DRAW it!
|
|
||||||
DrawIndicator(indicnum, startPos, indicPos, surface, vsDraw, xStart, rcLine, ll, subLine);
|
|
||||||
// RESET control var
|
|
||||||
startPos = -1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
mask <<= 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for (Decoration *deco = pdoc->decorations.root; deco; deco = deco->next) {
|
for (Decoration *deco = pdoc->decorations.root; deco; deco = deco->next) {
|
||||||
if (under == vsDraw.indicators[deco->indicator].under) {
|
if (under == vsDraw.indicators[deco->indicator].under) {
|
||||||
int startPos = posLineStart + lineStart;
|
int startPos = posLineStart + lineStart;
|
||||||
@@ -2725,9 +2695,9 @@ void Editor::DrawIndicators(Surface *surface, ViewStyle &vsDraw, int line, int x
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Use indicators to highlight matching braces
|
// Use indicators to highlight matching braces
|
||||||
if ((vs.braceHighlightIndicatorSet && (bracesMatchStyle == STYLE_BRACELIGHT)) ||
|
if ((vsDraw.braceHighlightIndicatorSet && (bracesMatchStyle == STYLE_BRACELIGHT)) ||
|
||||||
(vs.braceBadLightIndicatorSet && (bracesMatchStyle == STYLE_BRACEBAD))) {
|
(vsDraw.braceBadLightIndicatorSet && (bracesMatchStyle == STYLE_BRACEBAD))) {
|
||||||
int braceIndicator = (bracesMatchStyle == STYLE_BRACELIGHT) ? vs.braceHighlightIndicator : vs.braceBadLightIndicator;
|
int braceIndicator = (bracesMatchStyle == STYLE_BRACELIGHT) ? vsDraw.braceHighlightIndicator : vsDraw.braceBadLightIndicator;
|
||||||
if (under == vsDraw.indicators[braceIndicator].under) {
|
if (under == vsDraw.indicators[braceIndicator].under) {
|
||||||
Range rangeLine(posLineStart + lineStart, posLineEnd);
|
Range rangeLine(posLineStart + lineStart, posLineEnd);
|
||||||
if (rangeLine.ContainsCharacter(braces[0])) {
|
if (rangeLine.ContainsCharacter(braces[0])) {
|
||||||
@@ -2746,7 +2716,7 @@ void Editor::DrawIndicators(Surface *surface, ViewStyle &vsDraw, int line, int x
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Editor::DrawAnnotation(Surface *surface, ViewStyle &vsDraw, int line, int xStart,
|
void Editor::DrawAnnotation(Surface *surface, const ViewStyle &vsDraw, int line, int xStart,
|
||||||
PRectangle rcLine, LineLayout *ll, int subLine) {
|
PRectangle rcLine, LineLayout *ll, int subLine) {
|
||||||
int indent = static_cast<int>(pdoc->GetLineIndentation(line) * vsDraw.spaceWidth);
|
int indent = static_cast<int>(pdoc->GetLineIndentation(line) * vsDraw.spaceWidth);
|
||||||
PRectangle rcSegment = rcLine;
|
PRectangle rcSegment = rcLine;
|
||||||
@@ -2755,15 +2725,15 @@ void Editor::DrawAnnotation(Surface *surface, ViewStyle &vsDraw, int line, int x
|
|||||||
if (stAnnotation.text && ValidStyledText(vsDraw, vsDraw.annotationStyleOffset, stAnnotation)) {
|
if (stAnnotation.text && ValidStyledText(vsDraw, vsDraw.annotationStyleOffset, stAnnotation)) {
|
||||||
surface->FillRectangle(rcSegment, vsDraw.styles[0].back);
|
surface->FillRectangle(rcSegment, vsDraw.styles[0].back);
|
||||||
rcSegment.left = static_cast<XYPOSITION>(xStart);
|
rcSegment.left = static_cast<XYPOSITION>(xStart);
|
||||||
if (trackLineWidth || (vs.annotationVisible == ANNOTATION_BOXED)) {
|
if (trackLineWidth || (vsDraw.annotationVisible == ANNOTATION_BOXED)) {
|
||||||
// Only care about calculating width if tracking or need to draw box
|
// Only care about calculating width if tracking or need to draw box
|
||||||
int widthAnnotation = WidestLineWidth(surface, vsDraw, vsDraw.annotationStyleOffset, stAnnotation);
|
int widthAnnotation = WidestLineWidth(surface, vsDraw, vsDraw.annotationStyleOffset, stAnnotation);
|
||||||
if (vs.annotationVisible == ANNOTATION_BOXED) {
|
if (vsDraw.annotationVisible == ANNOTATION_BOXED) {
|
||||||
widthAnnotation += static_cast<int>(vsDraw.spaceWidth * 2); // Margins
|
widthAnnotation += static_cast<int>(vsDraw.spaceWidth * 2); // Margins
|
||||||
}
|
}
|
||||||
if (widthAnnotation > lineWidthMaxSeen)
|
if (widthAnnotation > lineWidthMaxSeen)
|
||||||
lineWidthMaxSeen = widthAnnotation;
|
lineWidthMaxSeen = widthAnnotation;
|
||||||
if (vs.annotationVisible == ANNOTATION_BOXED) {
|
if (vsDraw.annotationVisible == ANNOTATION_BOXED) {
|
||||||
rcSegment.left = static_cast<XYPOSITION>(xStart + indent);
|
rcSegment.left = static_cast<XYPOSITION>(xStart + indent);
|
||||||
rcSegment.right = rcSegment.left + widthAnnotation;
|
rcSegment.right = rcSegment.left + widthAnnotation;
|
||||||
}
|
}
|
||||||
@@ -2778,14 +2748,14 @@ void Editor::DrawAnnotation(Surface *surface, ViewStyle &vsDraw, int line, int x
|
|||||||
lineInAnnotation++;
|
lineInAnnotation++;
|
||||||
}
|
}
|
||||||
PRectangle rcText = rcSegment;
|
PRectangle rcText = rcSegment;
|
||||||
if (vs.annotationVisible == ANNOTATION_BOXED) {
|
if (vsDraw.annotationVisible == ANNOTATION_BOXED) {
|
||||||
surface->FillRectangle(rcText,
|
surface->FillRectangle(rcText,
|
||||||
vsDraw.styles[stAnnotation.StyleAt(start) + vsDraw.annotationStyleOffset].back);
|
vsDraw.styles[stAnnotation.StyleAt(start) + vsDraw.annotationStyleOffset].back);
|
||||||
rcText.left += vsDraw.spaceWidth;
|
rcText.left += vsDraw.spaceWidth;
|
||||||
}
|
}
|
||||||
DrawStyledText(surface, vsDraw, vsDraw.annotationStyleOffset, rcText, static_cast<int>(rcText.top + vsDraw.maxAscent),
|
DrawStyledText(surface, vsDraw, vsDraw.annotationStyleOffset, rcText,
|
||||||
stAnnotation, start, lengthAnnotation);
|
stAnnotation, start, lengthAnnotation);
|
||||||
if (vs.annotationVisible == ANNOTATION_BOXED) {
|
if (vsDraw.annotationVisible == ANNOTATION_BOXED) {
|
||||||
surface->PenColour(vsDraw.styles[vsDraw.annotationStyleOffset].fore);
|
surface->PenColour(vsDraw.styles[vsDraw.annotationStyleOffset].fore);
|
||||||
surface->MoveTo(static_cast<int>(rcSegment.left), static_cast<int>(rcSegment.top));
|
surface->MoveTo(static_cast<int>(rcSegment.left), static_cast<int>(rcSegment.top));
|
||||||
surface->LineTo(static_cast<int>(rcSegment.left), static_cast<int>(rcSegment.bottom));
|
surface->LineTo(static_cast<int>(rcSegment.left), static_cast<int>(rcSegment.bottom));
|
||||||
@@ -2803,7 +2773,7 @@ void Editor::DrawAnnotation(Surface *surface, ViewStyle &vsDraw, int line, int x
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Editor::DrawLine(Surface *surface, ViewStyle &vsDraw, int line, int lineVisible, int xStart,
|
void Editor::DrawLine(Surface *surface, const ViewStyle &vsDraw, int line, int lineVisible, int xStart,
|
||||||
PRectangle rcLine, LineLayout *ll, int subLine) {
|
PRectangle rcLine, LineLayout *ll, int subLine) {
|
||||||
|
|
||||||
if (subLine >= ll->lines) {
|
if (subLine >= ll->lines) {
|
||||||
@@ -2816,49 +2786,13 @@ void Editor::DrawLine(Surface *surface, ViewStyle &vsDraw, int line, int lineVis
|
|||||||
// Using one font for all control characters so it can be controlled independently to ensure
|
// Using one font for all control characters so it can be controlled independently to ensure
|
||||||
// the box goes around the characters tightly. Seems to be no way to work out what height
|
// the box goes around the characters tightly. Seems to be no way to work out what height
|
||||||
// is taken by an individual character - internal leading gives varying results.
|
// is taken by an individual character - internal leading gives varying results.
|
||||||
Font &ctrlCharsFont = vsDraw.styles[STYLE_CONTROLCHAR].font;
|
FontAlias ctrlCharsFont = vsDraw.styles[STYLE_CONTROLCHAR].font;
|
||||||
|
|
||||||
// See if something overrides the line background color: Either if caret is on the line
|
// See if something overrides the line background color.
|
||||||
// and background color is set for that, or if a marker is defined that forces its background
|
const ColourOptional background = vsDraw.Background(pdoc->GetMark(line), caret.active, ll->containsCaret);
|
||||||
// color onto the line, or if a marker is defined but has no selection margin in which to
|
|
||||||
// display itself (as long as it's not an SC_MARK_EMPTY marker). These are checked in order
|
|
||||||
// with the earlier taking precedence. When multiple markers cause background override,
|
|
||||||
// the color for the highest numbered one is used.
|
|
||||||
bool overrideBackground = false;
|
|
||||||
ColourDesired background;
|
|
||||||
if ((caret.active || vsDraw.alwaysShowCaretLineBackground) && vsDraw.showCaretLineBackground && (vsDraw.caretLineAlpha == SC_ALPHA_NOALPHA) && ll->containsCaret) {
|
|
||||||
overrideBackground = true;
|
|
||||||
background = vsDraw.caretLineBackground;
|
|
||||||
}
|
|
||||||
if (!overrideBackground) {
|
|
||||||
int marks = pdoc->GetMark(line);
|
|
||||||
for (int markBit = 0; (markBit < 32) && marks; markBit++) {
|
|
||||||
if ((marks & 1) && (vsDraw.markers[markBit].markType == SC_MARK_BACKGROUND) &&
|
|
||||||
(vsDraw.markers[markBit].alpha == SC_ALPHA_NOALPHA)) {
|
|
||||||
background = vsDraw.markers[markBit].back;
|
|
||||||
overrideBackground = true;
|
|
||||||
}
|
|
||||||
marks >>= 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!overrideBackground) {
|
|
||||||
if (vsDraw.maskInLine) {
|
|
||||||
int marksMasked = pdoc->GetMark(line) & vsDraw.maskInLine;
|
|
||||||
if (marksMasked) {
|
|
||||||
for (int markBit = 0; (markBit < 32) && marksMasked; markBit++) {
|
|
||||||
if ((marksMasked & 1) && (vsDraw.markers[markBit].markType != SC_MARK_EMPTY) &&
|
|
||||||
(vsDraw.markers[markBit].alpha == SC_ALPHA_NOALPHA)) {
|
|
||||||
overrideBackground = true;
|
|
||||||
background = vsDraw.markers[markBit].back;
|
|
||||||
}
|
|
||||||
marksMasked >>= 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const bool drawWhitespaceBackground = (vsDraw.viewWhitespace != wsInvisible) &&
|
const bool drawWhitespaceBackground = (vsDraw.viewWhitespace != wsInvisible) &&
|
||||||
(!overrideBackground) && (vsDraw.whitespaceColours.back.isSet);
|
(!background.isSet) && (vsDraw.whitespaceColours.back.isSet);
|
||||||
|
|
||||||
bool inIndentation = subLine == 0; // Do not handle indentation except on first subline.
|
bool inIndentation = subLine == 0; // Do not handle indentation except on first subline.
|
||||||
const XYPOSITION indentWidth = pdoc->IndentSize() * vsDraw.spaceWidth;
|
const XYPOSITION indentWidth = pdoc->IndentSize() * vsDraw.spaceWidth;
|
||||||
@@ -2878,16 +2812,6 @@ void Editor::DrawLine(Surface *surface, ViewStyle &vsDraw, int line, int lineVis
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const ColourDesired wrapColour = vsDraw.WrapColour();
|
|
||||||
|
|
||||||
bool drawWrapMarkEnd = false;
|
|
||||||
|
|
||||||
if (vsDraw.wrapVisualFlags & SC_WRAPVISUALFLAG_END) {
|
|
||||||
if (subLine + 1 < ll->lines) {
|
|
||||||
drawWrapMarkEnd = ll->LineStart(subLine + 1) != 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ll->wrapIndent != 0) {
|
if (ll->wrapIndent != 0) {
|
||||||
|
|
||||||
bool continuedWrapLine = false;
|
bool continuedWrapLine = false;
|
||||||
@@ -2903,7 +2827,7 @@ void Editor::DrawLine(Surface *surface, ViewStyle &vsDraw, int line, int lineVis
|
|||||||
rcPlace.right = rcPlace.left + ll->wrapIndent;
|
rcPlace.right = rcPlace.left + ll->wrapIndent;
|
||||||
|
|
||||||
// default bgnd here..
|
// default bgnd here..
|
||||||
surface->FillRectangle(rcSegment, overrideBackground ? background :
|
surface->FillRectangle(rcSegment, background.isSet ? background :
|
||||||
vsDraw.styles[STYLE_DEFAULT].back);
|
vsDraw.styles[STYLE_DEFAULT].back);
|
||||||
|
|
||||||
// main line style would be below but this would be inconsistent with end markers
|
// main line style would be below but this would be inconsistent with end markers
|
||||||
@@ -2918,7 +2842,7 @@ void Editor::DrawLine(Surface *surface, ViewStyle &vsDraw, int line, int lineVis
|
|||||||
else
|
else
|
||||||
rcPlace.right = rcPlace.left + vsDraw.aveCharWidth;
|
rcPlace.right = rcPlace.left + vsDraw.aveCharWidth;
|
||||||
|
|
||||||
DrawWrapMarker(surface, rcPlace, false, wrapColour);
|
DrawWrapMarker(surface, rcPlace, false, vsDraw.WrapColour());
|
||||||
}
|
}
|
||||||
|
|
||||||
xStart += static_cast<int>(ll->wrapIndent);
|
xStart += static_cast<int>(ll->wrapIndent);
|
||||||
@@ -2931,10 +2855,8 @@ void Editor::DrawLine(Surface *surface, ViewStyle &vsDraw, int line, int lineVis
|
|||||||
// Does not take margin into account but not significant
|
// Does not take margin into account but not significant
|
||||||
const int xStartVisible = static_cast<int>(subLineStart) - xStart;
|
const int xStartVisible = static_cast<int>(subLineStart) - xStart;
|
||||||
|
|
||||||
ll->psel = &sel;
|
|
||||||
|
|
||||||
if (twoPhaseDraw) {
|
if (twoPhaseDraw) {
|
||||||
BreakFinder bfBack(ll, lineStart, lineEnd, posLineStart, xStartVisible, selBackDrawn, pdoc, &reprs);
|
BreakFinder bfBack(ll, &sel, lineStart, lineEnd, posLineStart, xStartVisible, selBackDrawn, pdoc, &reprs);
|
||||||
|
|
||||||
// Background drawing loop
|
// Background drawing loop
|
||||||
while (bfBack.More()) {
|
while (bfBack.More()) {
|
||||||
@@ -2955,8 +2877,8 @@ void Editor::DrawLine(Surface *surface, ViewStyle &vsDraw, int line, int lineVis
|
|||||||
rcSegment.right = rcLine.right;
|
rcSegment.right = rcLine.right;
|
||||||
|
|
||||||
const int inSelection = hideSelection ? 0 : sel.CharacterInSelection(iDoc);
|
const int inSelection = hideSelection ? 0 : sel.CharacterInSelection(iDoc);
|
||||||
const bool inHotspot = (ll->hsStart != -1) && (iDoc >= ll->hsStart) && (iDoc < ll->hsEnd);
|
const bool inHotspot = (ll->hotspot.Valid()) && ll->hotspot.ContainsCharacter(iDoc);
|
||||||
ColourDesired textBack = TextBackground(vsDraw, overrideBackground, background, inSelection,
|
ColourDesired textBack = TextBackground(vsDraw, background, inSelection,
|
||||||
inHotspot, ll->styles[i], i, ll);
|
inHotspot, ll->styles[i], i, ll);
|
||||||
if (ts.representation) {
|
if (ts.representation) {
|
||||||
if (ll->chars[i] == '\t') {
|
if (ll->chars[i] == '\t') {
|
||||||
@@ -2997,8 +2919,7 @@ void Editor::DrawLine(Surface *surface, ViewStyle &vsDraw, int line, int lineVis
|
|||||||
}
|
}
|
||||||
|
|
||||||
DrawEOL(surface, vsDraw, rcLine, ll, line, lineEnd,
|
DrawEOL(surface, vsDraw, rcLine, ll, line, lineEnd,
|
||||||
xStart, subLine, subLineStart, overrideBackground, background,
|
xStart, subLine, subLineStart, background);
|
||||||
drawWrapMarkEnd, wrapColour);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
DrawIndicators(surface, vsDraw, line, xStart, rcLine, ll, subLine, lineEnd, true);
|
DrawIndicators(surface, vsDraw, line, xStart, rcLine, ll, subLine, lineEnd, true);
|
||||||
@@ -3027,7 +2948,7 @@ void Editor::DrawLine(Surface *surface, ViewStyle &vsDraw, int line, int lineVis
|
|||||||
|
|
||||||
inIndentation = subLine == 0; // Do not handle indentation except on first subline.
|
inIndentation = subLine == 0; // Do not handle indentation except on first subline.
|
||||||
// Foreground drawing loop
|
// Foreground drawing loop
|
||||||
BreakFinder bfFore(ll, lineStart, lineEnd, posLineStart, xStartVisible,
|
BreakFinder bfFore(ll, &sel, lineStart, lineEnd, posLineStart, xStartVisible,
|
||||||
((!twoPhaseDraw && selBackDrawn) || vsDraw.selColours.fore.isSet), pdoc, &reprs);
|
((!twoPhaseDraw && selBackDrawn) || vsDraw.selColours.fore.isSet), pdoc, &reprs);
|
||||||
|
|
||||||
while (bfFore.More()) {
|
while (bfFore.More()) {
|
||||||
@@ -3043,9 +2964,10 @@ void Editor::DrawLine(Surface *surface, ViewStyle &vsDraw, int line, int lineVis
|
|||||||
if (rcSegment.Intersects(rcLine)) {
|
if (rcSegment.Intersects(rcLine)) {
|
||||||
int styleMain = ll->styles[i];
|
int styleMain = ll->styles[i];
|
||||||
ColourDesired textFore = vsDraw.styles[styleMain].fore;
|
ColourDesired textFore = vsDraw.styles[styleMain].fore;
|
||||||
Font &textFont = vsDraw.styles[styleMain].font;
|
FontAlias textFont = vsDraw.styles[styleMain].font;
|
||||||
//hotspot foreground
|
//hotspot foreground
|
||||||
if (ll->hsStart != -1 && iDoc >= ll->hsStart && iDoc < hsEnd) {
|
const bool inHotspot = (ll->hotspot.Valid()) && ll->hotspot.ContainsCharacter(iDoc);
|
||||||
|
if (inHotspot) {
|
||||||
if (vsDraw.hotspotColours.fore.isSet)
|
if (vsDraw.hotspotColours.fore.isSet)
|
||||||
textFore = vsDraw.hotspotColours.fore;
|
textFore = vsDraw.hotspotColours.fore;
|
||||||
}
|
}
|
||||||
@@ -3053,8 +2975,7 @@ void Editor::DrawLine(Surface *surface, ViewStyle &vsDraw, int line, int lineVis
|
|||||||
if (inSelection && (vsDraw.selColours.fore.isSet)) {
|
if (inSelection && (vsDraw.selColours.fore.isSet)) {
|
||||||
textFore = (inSelection == 1) ? vsDraw.selColours.fore : vsDraw.selAdditionalForeground;
|
textFore = (inSelection == 1) ? vsDraw.selColours.fore : vsDraw.selAdditionalForeground;
|
||||||
}
|
}
|
||||||
const bool inHotspot = (ll->hsStart != -1) && (iDoc >= ll->hsStart) && (iDoc < ll->hsEnd);
|
ColourDesired textBack = TextBackground(vsDraw, background, inSelection, inHotspot, styleMain, i, ll);
|
||||||
ColourDesired textBack = TextBackground(vsDraw, overrideBackground, background, inSelection, inHotspot, styleMain, i, ll);
|
|
||||||
if (ts.representation) {
|
if (ts.representation) {
|
||||||
if (ll->chars[i] == '\t') {
|
if (ll->chars[i] == '\t') {
|
||||||
// Tab display
|
// Tab display
|
||||||
@@ -3130,8 +3051,8 @@ void Editor::DrawLine(Surface *surface, ViewStyle &vsDraw, int line, int lineVis
|
|||||||
}
|
}
|
||||||
PRectangle rcDot(xmid + xStart - static_cast<XYPOSITION>(subLineStart),
|
PRectangle rcDot(xmid + xStart - static_cast<XYPOSITION>(subLineStart),
|
||||||
rcSegment.top + vsDraw.lineHeight / 2, 0.0f, 0.0f);
|
rcSegment.top + vsDraw.lineHeight / 2, 0.0f, 0.0f);
|
||||||
rcDot.right = rcDot.left + vs.whitespaceSize;
|
rcDot.right = rcDot.left + vsDraw.whitespaceSize;
|
||||||
rcDot.bottom = rcDot.top + vs.whitespaceSize;
|
rcDot.bottom = rcDot.top + vsDraw.whitespaceSize;
|
||||||
surface->FillRectangle(rcDot, textFore);
|
surface->FillRectangle(rcDot, textFore);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -3152,7 +3073,7 @@ void Editor::DrawLine(Surface *surface, ViewStyle &vsDraw, int line, int lineVis
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (ll->hsStart != -1 && vsDraw.hotspotUnderline && iDoc >= ll->hsStart && iDoc < ll->hsEnd) {
|
if (ll->hotspot.Valid() && vsDraw.hotspotUnderline && ll->hotspot.ContainsCharacter(iDoc)) {
|
||||||
PRectangle rcUL = rcSegment;
|
PRectangle rcUL = rcSegment;
|
||||||
rcUL.top = rcUL.top + vsDraw.maxAscent + 1;
|
rcUL.top = rcUL.top + vsDraw.maxAscent + 1;
|
||||||
rcUL.bottom = rcUL.top + 1;
|
rcUL.bottom = rcUL.top + 1;
|
||||||
@@ -3225,8 +3146,7 @@ void Editor::DrawLine(Surface *surface, ViewStyle &vsDraw, int line, int lineVis
|
|||||||
// End of the drawing of the current line
|
// End of the drawing of the current line
|
||||||
if (!twoPhaseDraw) {
|
if (!twoPhaseDraw) {
|
||||||
DrawEOL(surface, vsDraw, rcLine, ll, line, lineEnd,
|
DrawEOL(surface, vsDraw, rcLine, ll, line, lineEnd,
|
||||||
xStart, subLine, subLineStart, overrideBackground, background,
|
xStart, subLine, subLineStart, background);
|
||||||
drawWrapMarkEnd, wrapColour);
|
|
||||||
}
|
}
|
||||||
if (!hideSelection && ((vsDraw.selAlpha != SC_ALPHA_NOALPHA) || (vsDraw.selAdditionalAlpha != SC_ALPHA_NOALPHA))) {
|
if (!hideSelection && ((vsDraw.selAlpha != SC_ALPHA_NOALPHA) || (vsDraw.selAdditionalAlpha != SC_ALPHA_NOALPHA))) {
|
||||||
// For each selection draw
|
// For each selection draw
|
||||||
@@ -3289,8 +3209,8 @@ void Editor::DrawLine(Surface *surface, ViewStyle &vsDraw, int line, int lineVis
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Editor::DrawBlockCaret(Surface *surface, ViewStyle &vsDraw, LineLayout *ll, int subLine,
|
void Editor::DrawBlockCaret(Surface *surface, const ViewStyle &vsDraw, LineLayout *ll, int subLine,
|
||||||
int xStart, int offset, int posCaret, PRectangle rcCaret, ColourDesired caretColour) {
|
int xStart, int offset, int posCaret, PRectangle rcCaret, ColourDesired caretColour) const {
|
||||||
|
|
||||||
int lineStart = ll->LineStart(subLine);
|
int lineStart = ll->LineStart(subLine);
|
||||||
int posBefore = posCaret;
|
int posBefore = posCaret;
|
||||||
@@ -3348,7 +3268,8 @@ void Editor::DrawBlockCaret(Surface *surface, ViewStyle &vsDraw, LineLayout *ll,
|
|||||||
// This character is where the caret block is, we override the colours
|
// This character is where the caret block is, we override the colours
|
||||||
// (inversed) for drawing the caret here.
|
// (inversed) for drawing the caret here.
|
||||||
int styleMain = ll->styles[offsetFirstChar];
|
int styleMain = ll->styles[offsetFirstChar];
|
||||||
surface->DrawTextClipped(rcCaret, vsDraw.styles[styleMain].font,
|
FontAlias fontText = vsDraw.styles[styleMain].font;
|
||||||
|
surface->DrawTextClipped(rcCaret, fontText,
|
||||||
rcCaret.top + vsDraw.maxAscent, ll->chars + offsetFirstChar,
|
rcCaret.top + vsDraw.maxAscent, ll->chars + offsetFirstChar,
|
||||||
numCharsToDraw, vsDraw.styles[styleMain].back,
|
numCharsToDraw, vsDraw.styles[styleMain].back,
|
||||||
caretColour);
|
caretColour);
|
||||||
@@ -3422,7 +3343,7 @@ void Editor::RefreshPixMaps(Surface *surfaceWindow) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Editor::DrawCarets(Surface *surface, ViewStyle &vsDraw, int lineDoc, int xStart,
|
void Editor::DrawCarets(Surface *surface, const ViewStyle &vsDraw, int lineDoc, int xStart,
|
||||||
PRectangle rcLine, LineLayout *ll, int subLine) {
|
PRectangle rcLine, LineLayout *ll, int subLine) {
|
||||||
// When drag is active it is the only caret drawn
|
// When drag is active it is the only caret drawn
|
||||||
bool drawDrag = posDrag.IsValid();
|
bool drawDrag = posDrag.IsValid();
|
||||||
@@ -3654,7 +3575,7 @@ void Editor::Paint(Surface *surfaceWindow, PRectangle rcArea) {
|
|||||||
ll->containsCaret = false;
|
ll->containsCaret = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
GetHotSpotRange(ll->hsStart, ll->hsEnd);
|
ll->hotspot = GetHotSpotRange();
|
||||||
|
|
||||||
PRectangle rcLine = rcTextArea;
|
PRectangle rcLine = rcTextArea;
|
||||||
rcLine.top = static_cast<XYPOSITION>(ypos);
|
rcLine.top = static_cast<XYPOSITION>(ypos);
|
||||||
@@ -6536,7 +6457,7 @@ void Editor::ButtonDown(Point pt, unsigned int curTime, bool shift, bool ctrl, b
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool Editor::PositionIsHotspot(int position) const {
|
bool Editor::PositionIsHotspot(int position) const {
|
||||||
return vs.styles[pdoc->StyleAt(position) & pdoc->stylingBitsMask].hotspot;
|
return vs.styles[pdoc->StyleAt(position)].hotspot;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Editor::PointIsHotspot(Point pt) {
|
bool Editor::PointIsHotspot(Point pt) {
|
||||||
@@ -6553,35 +6474,28 @@ void Editor::SetHotSpotRange(Point *pt) {
|
|||||||
// If we don't limit this to word characters then the
|
// If we don't limit this to word characters then the
|
||||||
// range can encompass more than the run range and then
|
// range can encompass more than the run range and then
|
||||||
// the underline will not be drawn properly.
|
// the underline will not be drawn properly.
|
||||||
int hsStart_ = pdoc->ExtendStyleRange(pos, -1, vs.hotspotSingleLine);
|
Range hsNew;
|
||||||
int hsEnd_ = pdoc->ExtendStyleRange(pos, 1, vs.hotspotSingleLine);
|
hsNew.start = pdoc->ExtendStyleRange(pos, -1, vs.hotspotSingleLine);
|
||||||
|
hsNew.end = pdoc->ExtendStyleRange(pos, 1, vs.hotspotSingleLine);
|
||||||
|
|
||||||
// Only invalidate the range if the hotspot range has changed...
|
// Only invalidate the range if the hotspot range has changed...
|
||||||
if (hsStart_ != hsStart || hsEnd_ != hsEnd) {
|
if (!(hsNew == hotspot)) {
|
||||||
if (hsStart != -1) {
|
if (hotspot.Valid()) {
|
||||||
InvalidateRange(hsStart, hsEnd);
|
InvalidateRange(hotspot.start, hotspot.end);
|
||||||
}
|
}
|
||||||
hsStart = hsStart_;
|
hotspot = hsNew;
|
||||||
hsEnd = hsEnd_;
|
InvalidateRange(hotspot.start, hotspot.end);
|
||||||
InvalidateRange(hsStart, hsEnd);
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (hsStart != -1) {
|
if (hotspot.Valid()) {
|
||||||
int hsStart_ = hsStart;
|
InvalidateRange(hotspot.start, hotspot.end);
|
||||||
int hsEnd_ = hsEnd;
|
|
||||||
hsStart = -1;
|
|
||||||
hsEnd = -1;
|
|
||||||
InvalidateRange(hsStart_, hsEnd_);
|
|
||||||
} else {
|
|
||||||
hsStart = -1;
|
|
||||||
hsEnd = -1;
|
|
||||||
}
|
}
|
||||||
|
hotspot = Range(invalidPosition);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Editor::GetHotSpotRange(int &hsStart_, int &hsEnd_) const {
|
Range Editor::GetHotSpotRange() const {
|
||||||
hsStart_ = hsStart;
|
return hotspot;
|
||||||
hsEnd_ = hsEnd;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Editor::ButtonMoveWithModifiers(Point pt, int modifiers) {
|
void Editor::ButtonMoveWithModifiers(Point pt, int modifiers) {
|
||||||
@@ -6668,7 +6582,7 @@ void Editor::ButtonMoveWithModifiers(Point pt, int modifiers) {
|
|||||||
}
|
}
|
||||||
EnsureCaretVisible(false, false, true);
|
EnsureCaretVisible(false, false, true);
|
||||||
|
|
||||||
if (hsStart != -1 && !PointIsHotspot(pt))
|
if (hotspot.Valid() && !PointIsHotspot(pt))
|
||||||
SetHotSpotRange(NULL);
|
SetHotSpotRange(NULL);
|
||||||
|
|
||||||
if (hotSpotClickPos != INVALID_POSITION && PositionFromLocation(pt,true,true) != hotSpotClickPos) {
|
if (hotSpotClickPos != INVALID_POSITION && PositionFromLocation(pt,true,true) != hotSpotClickPos) {
|
||||||
@@ -8647,12 +8561,11 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) {
|
|||||||
InvalidateStyleRedraw();
|
InvalidateStyleRedraw();
|
||||||
break;
|
break;
|
||||||
case SCI_SETSTYLEBITS:
|
case SCI_SETSTYLEBITS:
|
||||||
vs.EnsureStyle((1 << wParam) - 1);
|
vs.EnsureStyle(0xff);
|
||||||
pdoc->SetStylingBits(static_cast<int>(wParam));
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SCI_GETSTYLEBITS:
|
case SCI_GETSTYLEBITS:
|
||||||
return pdoc->stylingBits;
|
return 8;
|
||||||
|
|
||||||
case SCI_SETLINESTATE:
|
case SCI_SETLINESTATE:
|
||||||
return pdoc->SetLineState(static_cast<int>(wParam), static_cast<int>(lParam));
|
return pdoc->SetLineState(static_cast<int>(wParam), static_cast<int>(lParam));
|
||||||
@@ -9293,7 +9206,7 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) {
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case SCI_GETREPRESENTATION: {
|
case SCI_GETREPRESENTATION: {
|
||||||
Representation *repr = reprs.RepresentationFromCharacter(
|
const Representation *repr = reprs.RepresentationFromCharacter(
|
||||||
reinterpret_cast<const char *>(wParam), UTF8MaxBytes);
|
reinterpret_cast<const char *>(wParam), UTF8MaxBytes);
|
||||||
if (repr) {
|
if (repr) {
|
||||||
return StringResult(lParam, repr->stringRep.c_str());
|
return StringResult(lParam, repr->stringRep.c_str());
|
||||||
|
@@ -309,8 +309,7 @@ protected: // ScintillaBase subclass needs access to much of Editor
|
|||||||
ContractionState cs;
|
ContractionState cs;
|
||||||
|
|
||||||
// Hotspot support
|
// Hotspot support
|
||||||
int hsStart;
|
Range hotspot;
|
||||||
int hsEnd;
|
|
||||||
|
|
||||||
// Wrapping support
|
// Wrapping support
|
||||||
int wrapWidth;
|
int wrapWidth;
|
||||||
@@ -435,27 +434,26 @@ protected: // ScintillaBase subclass needs access to much of Editor
|
|||||||
int SubstituteMarkerIfEmpty(int markerCheck, int markerDefault) const;
|
int SubstituteMarkerIfEmpty(int markerCheck, int markerDefault) const;
|
||||||
void PaintSelMargin(Surface *surface, PRectangle &rc);
|
void PaintSelMargin(Surface *surface, PRectangle &rc);
|
||||||
LineLayout *RetrieveLineLayout(int lineNumber);
|
LineLayout *RetrieveLineLayout(int lineNumber);
|
||||||
void LayoutLine(int line, Surface *surface, ViewStyle &vstyle, LineLayout *ll,
|
void LayoutLine(int line, Surface *surface, const ViewStyle &vstyle, LineLayout *ll,
|
||||||
int width=LineLayout::wrapWidthInfinite);
|
int width=LineLayout::wrapWidthInfinite);
|
||||||
ColourDesired SelectionBackground(ViewStyle &vsDraw, bool main) const;
|
ColourDesired SelectionBackground(const ViewStyle &vsDraw, bool main) const;
|
||||||
ColourDesired TextBackground(ViewStyle &vsDraw, bool overrideBackground, ColourDesired background, int inSelection, bool inHotspot, int styleMain, int i, LineLayout *ll) const;
|
ColourDesired TextBackground(const ViewStyle &vsDraw, ColourOptional background, int inSelection, bool inHotspot, int styleMain, int i, LineLayout *ll) const;
|
||||||
void DrawIndentGuide(Surface *surface, int lineVisible, int lineHeight, int start, PRectangle rcSegment, bool highlight);
|
void DrawIndentGuide(Surface *surface, int lineVisible, int lineHeight, int start, PRectangle rcSegment, bool highlight);
|
||||||
static void DrawWrapMarker(Surface *surface, PRectangle rcPlace, bool isEndMarker, ColourDesired wrapColour);
|
static void DrawWrapMarker(Surface *surface, PRectangle rcPlace, bool isEndMarker, ColourDesired wrapColour);
|
||||||
void DrawEOL(Surface *surface, ViewStyle &vsDraw, PRectangle rcLine, LineLayout *ll,
|
void DrawEOL(Surface *surface, const ViewStyle &vsDraw, PRectangle rcLine, LineLayout *ll,
|
||||||
int line, int lineEnd, int xStart, int subLine, XYACCUMULATOR subLineStart,
|
int line, int lineEnd, int xStart, int subLine, XYACCUMULATOR subLineStart,
|
||||||
bool overrideBackground, ColourDesired background,
|
ColourOptional background);
|
||||||
bool drawWrapMark, ColourDesired wrapColour);
|
static void DrawIndicator(int indicNum, int startPos, int endPos, Surface *surface, const ViewStyle &vsDraw,
|
||||||
static void DrawIndicator(int indicNum, int startPos, int endPos, Surface *surface, ViewStyle &vsDraw,
|
|
||||||
int xStart, PRectangle rcLine, LineLayout *ll, int subLine);
|
int xStart, PRectangle rcLine, LineLayout *ll, int subLine);
|
||||||
void DrawIndicators(Surface *surface, ViewStyle &vsDraw, int line, int xStart,
|
void DrawIndicators(Surface *surface, const ViewStyle &vsDraw, int line, int xStart,
|
||||||
PRectangle rcLine, LineLayout *ll, int subLine, int lineEnd, bool under);
|
PRectangle rcLine, LineLayout *ll, int subLine, int lineEnd, bool under);
|
||||||
void DrawAnnotation(Surface *surface, ViewStyle &vsDraw, int line, int xStart,
|
void DrawAnnotation(Surface *surface, const ViewStyle &vsDraw, int line, int xStart,
|
||||||
PRectangle rcLine, LineLayout *ll, int subLine);
|
PRectangle rcLine, LineLayout *ll, int subLine);
|
||||||
void DrawLine(Surface *surface, ViewStyle &vsDraw, int line, int lineVisible, int xStart,
|
void DrawLine(Surface *surface, const ViewStyle &vsDraw, int line, int lineVisible, int xStart,
|
||||||
PRectangle rcLine, LineLayout *ll, int subLine);
|
PRectangle rcLine, LineLayout *ll, int subLine);
|
||||||
void DrawBlockCaret(Surface *surface, ViewStyle &vsDraw, LineLayout *ll, int subLine,
|
void DrawBlockCaret(Surface *surface, const ViewStyle &vsDraw, LineLayout *ll, int subLine,
|
||||||
int xStart, int offset, int posCaret, PRectangle rcCaret, ColourDesired caretColour);
|
int xStart, int offset, int posCaret, PRectangle rcCaret, ColourDesired caretColour) const;
|
||||||
void DrawCarets(Surface *surface, ViewStyle &vsDraw, int line, int xStart,
|
void DrawCarets(Surface *surface, const ViewStyle &vsDraw, int line, int xStart,
|
||||||
PRectangle rcLine, LineLayout *ll, int subLine);
|
PRectangle rcLine, LineLayout *ll, int subLine);
|
||||||
void RefreshPixMaps(Surface *surfaceWindow);
|
void RefreshPixMaps(Surface *surfaceWindow);
|
||||||
void Paint(Surface *surfaceWindow, PRectangle rcArea);
|
void Paint(Surface *surfaceWindow, PRectangle rcArea);
|
||||||
@@ -623,7 +621,7 @@ protected: // ScintillaBase subclass needs access to much of Editor
|
|||||||
bool PositionIsHotspot(int position) const;
|
bool PositionIsHotspot(int position) const;
|
||||||
bool PointIsHotspot(Point pt);
|
bool PointIsHotspot(Point pt);
|
||||||
void SetHotSpotRange(Point *pt);
|
void SetHotSpotRange(Point *pt);
|
||||||
void GetHotSpotRange(int &hsStart, int &hsEnd) const;
|
Range GetHotSpotRange() const;
|
||||||
|
|
||||||
int CodePage() const;
|
int CodePage() const;
|
||||||
virtual bool ValidCodePage(int /* codePage */) const { return true; }
|
virtual bool ValidCodePage(int /* codePage */) const { return true; }
|
||||||
|
@@ -8,8 +8,8 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <ctype.h>
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
#include <ctype.h>
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
|
@@ -11,8 +11,8 @@
|
|||||||
#include "Platform.h"
|
#include "Platform.h"
|
||||||
|
|
||||||
#include "Scintilla.h"
|
#include "Scintilla.h"
|
||||||
#include "XPM.h"
|
|
||||||
#include "Indicator.h"
|
#include "Indicator.h"
|
||||||
|
#include "XPM.h"
|
||||||
|
|
||||||
#ifdef SCI_NAMESPACE
|
#ifdef SCI_NAMESPACE
|
||||||
using namespace Scintilla;
|
using namespace Scintilla;
|
||||||
@@ -23,7 +23,7 @@ static PRectangle PixelGridAlign(const PRectangle &rc) {
|
|||||||
return PRectangle::FromInts(int(rc.left + 0.5), int(rc.top), int(rc.right + 0.5), int(rc.bottom));
|
return PRectangle::FromInts(int(rc.left + 0.5), int(rc.top), int(rc.right + 0.5), int(rc.bottom));
|
||||||
}
|
}
|
||||||
|
|
||||||
void Indicator::Draw(Surface *surface, const PRectangle &rc, const PRectangle &rcLine) {
|
void Indicator::Draw(Surface *surface, const PRectangle &rc, const PRectangle &rcLine) const {
|
||||||
surface->PenColour(fore);
|
surface->PenColour(fore);
|
||||||
int ymid = static_cast<int>(rc.bottom + rc.top) / 2;
|
int ymid = static_cast<int>(rc.bottom + rc.top) / 2;
|
||||||
if (style == INDIC_SQUIGGLE) {
|
if (style == INDIC_SQUIGGLE) {
|
||||||
|
@@ -23,7 +23,7 @@ public:
|
|||||||
int outlineAlpha;
|
int outlineAlpha;
|
||||||
Indicator() : style(INDIC_PLAIN), under(false), fore(ColourDesired(0,0,0)), fillAlpha(30), outlineAlpha(50) {
|
Indicator() : style(INDIC_PLAIN), under(false), fore(ColourDesired(0,0,0)), fillAlpha(30), outlineAlpha(50) {
|
||||||
}
|
}
|
||||||
void Draw(Surface *surface, const PRectangle &rc, const PRectangle &rcLine);
|
void Draw(Surface *surface, const PRectangle &rc, const PRectangle &rcLine) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifdef SCI_NAMESPACE
|
#ifdef SCI_NAMESPACE
|
||||||
|
@@ -71,7 +71,7 @@ static void DrawMinus(Surface *surface, int centreX, int centreY, int armSize, C
|
|||||||
surface->FillRectangle(rcH, fore);
|
surface->FillRectangle(rcH, fore);
|
||||||
}
|
}
|
||||||
|
|
||||||
void LineMarker::Draw(Surface *surface, PRectangle &rcWhole, Font &fontForCharacter, typeOfFold tFold, int marginStyle) {
|
void LineMarker::Draw(Surface *surface, PRectangle &rcWhole, Font &fontForCharacter, typeOfFold tFold, int marginStyle) const {
|
||||||
ColourDesired head = back;
|
ColourDesired head = back;
|
||||||
ColourDesired body = back;
|
ColourDesired body = back;
|
||||||
ColourDesired tail = back;
|
ColourDesired tail = back;
|
||||||
|
@@ -66,7 +66,7 @@ public:
|
|||||||
void SetXPM(const char *textForm);
|
void SetXPM(const char *textForm);
|
||||||
void SetXPM(const char *const *linesForm);
|
void SetXPM(const char *const *linesForm);
|
||||||
void SetRGBAImage(Point sizeRGBAImage, float scale, const unsigned char *pixelsRGBAImage);
|
void SetRGBAImage(Point sizeRGBAImage, float scale, const unsigned char *pixelsRGBAImage);
|
||||||
void Draw(Surface *surface, PRectangle &rc, Font &fontForCharacter, typeOfFold tFold, int marginStyle);
|
void Draw(Surface *surface, PRectangle &rc, Font &fontForCharacter, typeOfFold tFold, int marginStyle) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifdef SCI_NAMESPACE
|
#ifdef SCI_NAMESPACE
|
||||||
|
@@ -17,6 +17,7 @@
|
|||||||
|
|
||||||
#include "Platform.h"
|
#include "Platform.h"
|
||||||
|
|
||||||
|
#include "ILexer.h"
|
||||||
#include "Scintilla.h"
|
#include "Scintilla.h"
|
||||||
|
|
||||||
#include "SplitVector.h"
|
#include "SplitVector.h"
|
||||||
@@ -32,7 +33,6 @@
|
|||||||
#include "ViewStyle.h"
|
#include "ViewStyle.h"
|
||||||
#include "CharClassify.h"
|
#include "CharClassify.h"
|
||||||
#include "Decoration.h"
|
#include "Decoration.h"
|
||||||
#include "ILexer.h"
|
|
||||||
#include "CaseFolder.h"
|
#include "CaseFolder.h"
|
||||||
#include "Document.h"
|
#include "Document.h"
|
||||||
#include "UniConversion.h"
|
#include "UniConversion.h"
|
||||||
@@ -54,16 +54,12 @@ LineLayout::LineLayout(int maxLineLength_) :
|
|||||||
validity(llInvalid),
|
validity(llInvalid),
|
||||||
xHighlightGuide(0),
|
xHighlightGuide(0),
|
||||||
highlightColumn(0),
|
highlightColumn(0),
|
||||||
psel(NULL),
|
|
||||||
containsCaret(false),
|
containsCaret(false),
|
||||||
edgeColumn(0),
|
edgeColumn(0),
|
||||||
chars(0),
|
chars(0),
|
||||||
styles(0),
|
styles(0),
|
||||||
styleBitsSet(0),
|
|
||||||
indicators(0),
|
|
||||||
positions(0),
|
positions(0),
|
||||||
hsStart(0),
|
hotspot(0,0),
|
||||||
hsEnd(0),
|
|
||||||
widthLine(wrapWidthInfinite),
|
widthLine(wrapWidthInfinite),
|
||||||
lines(1),
|
lines(1),
|
||||||
wrapIndent(0) {
|
wrapIndent(0) {
|
||||||
@@ -81,7 +77,6 @@ void LineLayout::Resize(int maxLineLength_) {
|
|||||||
Free();
|
Free();
|
||||||
chars = new char[maxLineLength_ + 1];
|
chars = new char[maxLineLength_ + 1];
|
||||||
styles = new unsigned char[maxLineLength_ + 1];
|
styles = new unsigned char[maxLineLength_ + 1];
|
||||||
indicators = new char[maxLineLength_ + 1];
|
|
||||||
// Extra position allocated as sometimes the Windows
|
// Extra position allocated as sometimes the Windows
|
||||||
// GetTextExtentExPoint API writes an extra element.
|
// GetTextExtentExPoint API writes an extra element.
|
||||||
positions = new XYPOSITION[maxLineLength_ + 1 + 1];
|
positions = new XYPOSITION[maxLineLength_ + 1 + 1];
|
||||||
@@ -94,8 +89,6 @@ void LineLayout::Free() {
|
|||||||
chars = 0;
|
chars = 0;
|
||||||
delete []styles;
|
delete []styles;
|
||||||
styles = 0;
|
styles = 0;
|
||||||
delete []indicators;
|
|
||||||
indicators = 0;
|
|
||||||
delete []positions;
|
delete []positions;
|
||||||
positions = 0;
|
positions = 0;
|
||||||
delete []lineStarts;
|
delete []lineStarts;
|
||||||
@@ -153,7 +146,7 @@ void LineLayout::SetLineStart(int line, int start) {
|
|||||||
lineStarts[line] = start;
|
lineStarts[line] = start;
|
||||||
}
|
}
|
||||||
|
|
||||||
void LineLayout::SetBracesHighlight(Range rangeLine, Position braces[],
|
void LineLayout::SetBracesHighlight(Range rangeLine, const Position braces[],
|
||||||
char bracesMatchStyle, int xHighlight, bool ignoreStyle) {
|
char bracesMatchStyle, int xHighlight, bool ignoreStyle) {
|
||||||
if (!ignoreStyle && rangeLine.ContainsCharacter(braces[0])) {
|
if (!ignoreStyle && rangeLine.ContainsCharacter(braces[0])) {
|
||||||
int braceOffset = braces[0] - rangeLine.start;
|
int braceOffset = braces[0] - rangeLine.start;
|
||||||
@@ -175,7 +168,7 @@ void LineLayout::SetBracesHighlight(Range rangeLine, Position braces[],
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void LineLayout::RestoreBracesHighlight(Range rangeLine, Position braces[], bool ignoreStyle) {
|
void LineLayout::RestoreBracesHighlight(Range rangeLine, const Position braces[], bool ignoreStyle) {
|
||||||
if (!ignoreStyle && rangeLine.ContainsCharacter(braces[0])) {
|
if (!ignoreStyle && rangeLine.ContainsCharacter(braces[0])) {
|
||||||
int braceOffset = braces[0] - rangeLine.start;
|
int braceOffset = braces[0] - rangeLine.start;
|
||||||
if (braceOffset < numCharsInLine) {
|
if (braceOffset < numCharsInLine) {
|
||||||
@@ -410,11 +403,11 @@ void SpecialRepresentations::ClearRepresentation(const char *charBytes) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Representation *SpecialRepresentations::RepresentationFromCharacter(const char *charBytes, size_t len) {
|
const Representation *SpecialRepresentations::RepresentationFromCharacter(const char *charBytes, size_t len) const {
|
||||||
PLATFORM_ASSERT(len <= 4);
|
PLATFORM_ASSERT(len <= 4);
|
||||||
if (!startByteHasReprs[static_cast<unsigned char>(charBytes[0])])
|
if (!startByteHasReprs[static_cast<unsigned char>(charBytes[0])])
|
||||||
return 0;
|
return 0;
|
||||||
MapRepresentation::iterator it = mapReprs.find(KeyFromString(charBytes, len));
|
MapRepresentation::const_iterator it = mapReprs.find(KeyFromString(charBytes, len));
|
||||||
if (it != mapReprs.end()) {
|
if (it != mapReprs.end()) {
|
||||||
return &(it->second);
|
return &(it->second);
|
||||||
}
|
}
|
||||||
@@ -445,8 +438,8 @@ void BreakFinder::Insert(int val) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
BreakFinder::BreakFinder(LineLayout *ll_, int lineStart_, int lineEnd_, int posLineStart_,
|
BreakFinder::BreakFinder(const LineLayout *ll_, const Selection *psel, int lineStart_, int lineEnd_, int posLineStart_,
|
||||||
int xStart, bool breakForSelection, Document *pdoc_, SpecialRepresentations *preprs_) :
|
int xStart, bool breakForSelection, const Document *pdoc_, const SpecialRepresentations *preprs_) :
|
||||||
ll(ll_),
|
ll(ll_),
|
||||||
lineStart(lineStart_),
|
lineStart(lineStart_),
|
||||||
lineEnd(lineEnd_),
|
lineEnd(lineEnd_),
|
||||||
@@ -472,8 +465,8 @@ BreakFinder::BreakFinder(LineLayout *ll_, int lineStart_, int lineEnd_, int posL
|
|||||||
SelectionPosition posStart(posLineStart);
|
SelectionPosition posStart(posLineStart);
|
||||||
SelectionPosition posEnd(posLineStart + lineEnd);
|
SelectionPosition posEnd(posLineStart + lineEnd);
|
||||||
SelectionSegment segmentLine(posStart, posEnd);
|
SelectionSegment segmentLine(posStart, posEnd);
|
||||||
for (size_t r=0; r<ll->psel->Count(); r++) {
|
for (size_t r=0; r<psel->Count(); r++) {
|
||||||
SelectionSegment portion = ll->psel->Range(r).Intersect(segmentLine);
|
SelectionSegment portion = psel->Range(r).Intersect(segmentLine);
|
||||||
if (!(portion.start == portion.end)) {
|
if (!(portion.start == portion.end)) {
|
||||||
if (portion.start.IsValid())
|
if (portion.start.IsValid())
|
||||||
Insert(portion.start.Position() - posLineStart);
|
Insert(portion.start.Position() - posLineStart);
|
||||||
@@ -500,7 +493,7 @@ TextSegment BreakFinder::Next() {
|
|||||||
charWidth = UTF8DrawBytes(reinterpret_cast<unsigned char *>(ll->chars) + nextBreak, lineEnd - nextBreak);
|
charWidth = UTF8DrawBytes(reinterpret_cast<unsigned char *>(ll->chars) + nextBreak, lineEnd - nextBreak);
|
||||||
else if (encodingFamily == efDBCS)
|
else if (encodingFamily == efDBCS)
|
||||||
charWidth = pdoc->IsDBCSLeadByte(ll->chars[nextBreak]) ? 2 : 1;
|
charWidth = pdoc->IsDBCSLeadByte(ll->chars[nextBreak]) ? 2 : 1;
|
||||||
Representation *repr = preprs->RepresentationFromCharacter(ll->chars + nextBreak, charWidth);
|
const Representation *repr = preprs->RepresentationFromCharacter(ll->chars + nextBreak, charWidth);
|
||||||
if (((nextBreak > 0) && (ll->styles[nextBreak] != ll->styles[nextBreak - 1])) ||
|
if (((nextBreak > 0) && (ll->styles[nextBreak] != ll->styles[nextBreak - 1])) ||
|
||||||
repr ||
|
repr ||
|
||||||
(nextBreak == saeNext)) {
|
(nextBreak == saeNext)) {
|
||||||
@@ -565,7 +558,7 @@ void PositionCacheEntry::Set(unsigned int styleNumber_, const char *s_,
|
|||||||
for (unsigned int i=0; i<len; i++) {
|
for (unsigned int i=0; i<len; i++) {
|
||||||
positions[i] = positions_[i];
|
positions[i] = positions_[i];
|
||||||
}
|
}
|
||||||
memcpy(reinterpret_cast<char *>(positions + len), s_, len);
|
memcpy(reinterpret_cast<char *>(reinterpret_cast<void *>(positions + len)), s_, len);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -584,7 +577,7 @@ void PositionCacheEntry::Clear() {
|
|||||||
bool PositionCacheEntry::Retrieve(unsigned int styleNumber_, const char *s_,
|
bool PositionCacheEntry::Retrieve(unsigned int styleNumber_, const char *s_,
|
||||||
unsigned int len_, XYPOSITION *positions_) const {
|
unsigned int len_, XYPOSITION *positions_) const {
|
||||||
if ((styleNumber == styleNumber_) && (len == len_) &&
|
if ((styleNumber == styleNumber_) && (len == len_) &&
|
||||||
(memcmp(reinterpret_cast<char *>(positions + len), s_, len)== 0)) {
|
(memcmp(reinterpret_cast<char *>(reinterpret_cast<void *>(positions + len)), s_, len)== 0)) {
|
||||||
for (unsigned int i=0; i<len; i++) {
|
for (unsigned int i=0; i<len; i++) {
|
||||||
positions_[i] = positions[i];
|
positions_[i] = positions[i];
|
||||||
}
|
}
|
||||||
@@ -642,7 +635,7 @@ void PositionCache::SetSize(size_t size_) {
|
|||||||
pces.resize(size_);
|
pces.resize(size_);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PositionCache::MeasureWidths(Surface *surface, ViewStyle &vstyle, unsigned int styleNumber,
|
void PositionCache::MeasureWidths(Surface *surface, const ViewStyle &vstyle, unsigned int styleNumber,
|
||||||
const char *s, unsigned int len, XYPOSITION *positions, Document *pdoc) {
|
const char *s, unsigned int len, XYPOSITION *positions, Document *pdoc) {
|
||||||
|
|
||||||
allClear = false;
|
allClear = false;
|
||||||
@@ -672,7 +665,8 @@ void PositionCache::MeasureWidths(Surface *surface, ViewStyle &vstyle, unsigned
|
|||||||
XYPOSITION xStartSegment = 0;
|
XYPOSITION xStartSegment = 0;
|
||||||
while (startSegment < len) {
|
while (startSegment < len) {
|
||||||
unsigned int lenSegment = pdoc->SafeSegment(s + startSegment, len - startSegment, BreakFinder::lengthEachSubdivision);
|
unsigned int lenSegment = pdoc->SafeSegment(s + startSegment, len - startSegment, BreakFinder::lengthEachSubdivision);
|
||||||
surface->MeasureWidths(vstyle.styles[styleNumber].font, s + startSegment, lenSegment, positions + startSegment);
|
FontAlias fontStyle = vstyle.styles[styleNumber].font;
|
||||||
|
surface->MeasureWidths(fontStyle, s + startSegment, lenSegment, positions + startSegment);
|
||||||
for (unsigned int inSeg = 0; inSeg < lenSegment; inSeg++) {
|
for (unsigned int inSeg = 0; inSeg < lenSegment; inSeg++) {
|
||||||
positions[startSegment + inSeg] += xStartSegment;
|
positions[startSegment + inSeg] += xStartSegment;
|
||||||
}
|
}
|
||||||
@@ -680,7 +674,8 @@ void PositionCache::MeasureWidths(Surface *surface, ViewStyle &vstyle, unsigned
|
|||||||
startSegment += lenSegment;
|
startSegment += lenSegment;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
surface->MeasureWidths(vstyle.styles[styleNumber].font, s, len, positions);
|
FontAlias fontStyle = vstyle.styles[styleNumber].font;
|
||||||
|
surface->MeasureWidths(fontStyle, s, len, positions);
|
||||||
}
|
}
|
||||||
if (probe < pces.size()) {
|
if (probe < pces.size()) {
|
||||||
// Store into cache
|
// Store into cache
|
||||||
|
@@ -34,19 +34,15 @@ public:
|
|||||||
enum validLevel { llInvalid, llCheckTextAndStyle, llPositions, llLines } validity;
|
enum validLevel { llInvalid, llCheckTextAndStyle, llPositions, llLines } validity;
|
||||||
int xHighlightGuide;
|
int xHighlightGuide;
|
||||||
bool highlightColumn;
|
bool highlightColumn;
|
||||||
Selection *psel;
|
|
||||||
bool containsCaret;
|
bool containsCaret;
|
||||||
int edgeColumn;
|
int edgeColumn;
|
||||||
char *chars;
|
char *chars;
|
||||||
unsigned char *styles;
|
unsigned char *styles;
|
||||||
int styleBitsSet;
|
|
||||||
char *indicators;
|
|
||||||
XYPOSITION *positions;
|
XYPOSITION *positions;
|
||||||
char bracePreviousStyles[2];
|
char bracePreviousStyles[2];
|
||||||
|
|
||||||
// Hotspot support
|
// Hotspot support
|
||||||
int hsStart;
|
Range hotspot;
|
||||||
int hsEnd;
|
|
||||||
|
|
||||||
// Wrapped line support
|
// Wrapped line support
|
||||||
int widthLine;
|
int widthLine;
|
||||||
@@ -63,9 +59,9 @@ public:
|
|||||||
Range SubLineRange(int line) const;
|
Range SubLineRange(int line) const;
|
||||||
bool InLine(int offset, int line) const;
|
bool InLine(int offset, int line) const;
|
||||||
void SetLineStart(int line, int start);
|
void SetLineStart(int line, int start);
|
||||||
void SetBracesHighlight(Range rangeLine, Position braces[],
|
void SetBracesHighlight(Range rangeLine, const Position braces[],
|
||||||
char bracesMatchStyle, int xHighlight, bool ignoreStyle);
|
char bracesMatchStyle, int xHighlight, bool ignoreStyle);
|
||||||
void RestoreBracesHighlight(Range rangeLine, Position braces[], bool ignoreStyle);
|
void RestoreBracesHighlight(Range rangeLine, const Position braces[], bool ignoreStyle);
|
||||||
int FindBefore(XYPOSITION x, int lower, int upper) const;
|
int FindBefore(XYPOSITION x, int lower, int upper) const;
|
||||||
int FindPositionFromX(XYPOSITION x, Range range, bool charPosition) const;
|
int FindPositionFromX(XYPOSITION x, Range range, bool charPosition) const;
|
||||||
Point PointFromPosition(int posInLine, int lineHeight) const;
|
Point PointFromPosition(int posInLine, int lineHeight) const;
|
||||||
@@ -132,7 +128,7 @@ public:
|
|||||||
SpecialRepresentations();
|
SpecialRepresentations();
|
||||||
void SetRepresentation(const char *charBytes, const char *value);
|
void SetRepresentation(const char *charBytes, const char *value);
|
||||||
void ClearRepresentation(const char *charBytes);
|
void ClearRepresentation(const char *charBytes);
|
||||||
Representation *RepresentationFromCharacter(const char *charBytes, size_t len);
|
const Representation *RepresentationFromCharacter(const char *charBytes, size_t len) const;
|
||||||
bool Contains(const char *charBytes, size_t len) const;
|
bool Contains(const char *charBytes, size_t len) const;
|
||||||
void Clear();
|
void Clear();
|
||||||
};
|
};
|
||||||
@@ -140,8 +136,8 @@ public:
|
|||||||
struct TextSegment {
|
struct TextSegment {
|
||||||
int start;
|
int start;
|
||||||
int length;
|
int length;
|
||||||
Representation *representation;
|
const Representation *representation;
|
||||||
TextSegment(int start_=0, int length_=0, Representation *representation_=0) :
|
TextSegment(int start_=0, int length_=0, const Representation *representation_=0) :
|
||||||
start(start_), length(length_), representation(representation_) {
|
start(start_), length(length_), representation(representation_) {
|
||||||
}
|
}
|
||||||
int end() const {
|
int end() const {
|
||||||
@@ -151,7 +147,7 @@ struct TextSegment {
|
|||||||
|
|
||||||
// Class to break a line of text into shorter runs at sensible places.
|
// Class to break a line of text into shorter runs at sensible places.
|
||||||
class BreakFinder {
|
class BreakFinder {
|
||||||
LineLayout *ll;
|
const LineLayout *ll;
|
||||||
int lineStart;
|
int lineStart;
|
||||||
int lineEnd;
|
int lineEnd;
|
||||||
int posLineStart;
|
int posLineStart;
|
||||||
@@ -160,9 +156,9 @@ class BreakFinder {
|
|||||||
unsigned int saeCurrentPos;
|
unsigned int saeCurrentPos;
|
||||||
int saeNext;
|
int saeNext;
|
||||||
int subBreak;
|
int subBreak;
|
||||||
Document *pdoc;
|
const Document *pdoc;
|
||||||
EncodingFamily encodingFamily;
|
EncodingFamily encodingFamily;
|
||||||
SpecialRepresentations *preprs;
|
const SpecialRepresentations *preprs;
|
||||||
void Insert(int val);
|
void Insert(int val);
|
||||||
// Private so BreakFinder objects can not be copied
|
// Private so BreakFinder objects can not be copied
|
||||||
BreakFinder(const BreakFinder &);
|
BreakFinder(const BreakFinder &);
|
||||||
@@ -172,8 +168,8 @@ public:
|
|||||||
enum { lengthStartSubdivision = 300 };
|
enum { lengthStartSubdivision = 300 };
|
||||||
// Try to make each subdivided run lengthEachSubdivision or shorter.
|
// Try to make each subdivided run lengthEachSubdivision or shorter.
|
||||||
enum { lengthEachSubdivision = 100 };
|
enum { lengthEachSubdivision = 100 };
|
||||||
BreakFinder(LineLayout *ll_, int lineStart_, int lineEnd_, int posLineStart_,
|
BreakFinder(const LineLayout *ll_, const Selection *psel, int lineStart_, int lineEnd_, int posLineStart_,
|
||||||
int xStart, bool breakForSelection, Document *pdoc_, SpecialRepresentations *preprs_);
|
int xStart, bool breakForSelection, const Document *pdoc_, const SpecialRepresentations *preprs_);
|
||||||
~BreakFinder();
|
~BreakFinder();
|
||||||
TextSegment Next();
|
TextSegment Next();
|
||||||
bool More() const;
|
bool More() const;
|
||||||
@@ -191,7 +187,7 @@ public:
|
|||||||
void Clear();
|
void Clear();
|
||||||
void SetSize(size_t size_);
|
void SetSize(size_t size_);
|
||||||
size_t GetSize() const { return pces.size(); }
|
size_t GetSize() const { return pces.size(); }
|
||||||
void MeasureWidths(Surface *surface, ViewStyle &vstyle, unsigned int styleNumber,
|
void MeasureWidths(Surface *surface, const ViewStyle &vstyle, unsigned int styleNumber,
|
||||||
const char *s, unsigned int len, XYPOSITION *positions, Document *pdoc);
|
const char *s, unsigned int len, XYPOSITION *positions, Document *pdoc);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -8,8 +8,8 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <ctype.h>
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
#include <ctype.h>
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
@@ -21,12 +21,17 @@
|
|||||||
#include "ILexer.h"
|
#include "ILexer.h"
|
||||||
#include "Scintilla.h"
|
#include "Scintilla.h"
|
||||||
|
|
||||||
#include "PropSetSimple.h"
|
|
||||||
#ifdef SCI_LEXER
|
#ifdef SCI_LEXER
|
||||||
#include "SciLexer.h"
|
#include "SciLexer.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "PropSetSimple.h"
|
||||||
|
|
||||||
|
#ifdef SCI_LEXER
|
||||||
#include "LexerModule.h"
|
#include "LexerModule.h"
|
||||||
#include "Catalogue.h"
|
#include "Catalogue.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "SplitVector.h"
|
#include "SplitVector.h"
|
||||||
#include "Partitioning.h"
|
#include "Partitioning.h"
|
||||||
#include "RunStyles.h"
|
#include "RunStyles.h"
|
||||||
@@ -39,7 +44,6 @@
|
|||||||
#include "LineMarker.h"
|
#include "LineMarker.h"
|
||||||
#include "Style.h"
|
#include "Style.h"
|
||||||
#include "ViewStyle.h"
|
#include "ViewStyle.h"
|
||||||
#include "AutoComplete.h"
|
|
||||||
#include "CharClassify.h"
|
#include "CharClassify.h"
|
||||||
#include "Decoration.h"
|
#include "Decoration.h"
|
||||||
#include "CaseFolder.h"
|
#include "CaseFolder.h"
|
||||||
@@ -47,6 +51,7 @@
|
|||||||
#include "Selection.h"
|
#include "Selection.h"
|
||||||
#include "PositionCache.h"
|
#include "PositionCache.h"
|
||||||
#include "Editor.h"
|
#include "Editor.h"
|
||||||
|
#include "AutoComplete.h"
|
||||||
#include "ScintillaBase.h"
|
#include "ScintillaBase.h"
|
||||||
|
|
||||||
#ifdef SCI_NAMESPACE
|
#ifdef SCI_NAMESPACE
|
||||||
@@ -57,6 +62,7 @@ ScintillaBase::ScintillaBase() {
|
|||||||
displayPopupMenu = true;
|
displayPopupMenu = true;
|
||||||
listType = 0;
|
listType = 0;
|
||||||
maxListWidth = 0;
|
maxListWidth = 0;
|
||||||
|
multiAutoCMode = SC_MULTIAUTOC_ONCE;
|
||||||
}
|
}
|
||||||
|
|
||||||
ScintillaBase::~ScintillaBase() {
|
ScintillaBase::~ScintillaBase() {
|
||||||
@@ -197,9 +203,30 @@ void ScintillaBase::AutoCompleteDoubleClick(void *p) {
|
|||||||
|
|
||||||
void ScintillaBase::AutoCompleteInsert(Position startPos, int removeLen, const char *text, int textLen) {
|
void ScintillaBase::AutoCompleteInsert(Position startPos, int removeLen, const char *text, int textLen) {
|
||||||
UndoGroup ug(pdoc);
|
UndoGroup ug(pdoc);
|
||||||
|
if (multiAutoCMode == SC_MULTIAUTOC_ONCE) {
|
||||||
pdoc->DeleteChars(startPos, removeLen);
|
pdoc->DeleteChars(startPos, removeLen);
|
||||||
const int lengthInserted = pdoc->InsertString(startPos, text, textLen);
|
const int lengthInserted = pdoc->InsertString(startPos, text, textLen);
|
||||||
SetEmptySelection(startPos + lengthInserted);
|
SetEmptySelection(startPos + lengthInserted);
|
||||||
|
} else {
|
||||||
|
// SC_MULTIAUTOC_EACH
|
||||||
|
for (size_t r=0; r<sel.Count(); r++) {
|
||||||
|
if (!RangeContainsProtected(sel.Range(r).Start().Position(),
|
||||||
|
sel.Range(r).End().Position())) {
|
||||||
|
int positionInsert = sel.Range(r).Start().Position();
|
||||||
|
positionInsert = InsertSpace(positionInsert, sel.Range(r).caret.VirtualSpace());
|
||||||
|
if (positionInsert - removeLen >= 0) {
|
||||||
|
positionInsert -= removeLen;
|
||||||
|
pdoc->DeleteChars(positionInsert, removeLen);
|
||||||
|
}
|
||||||
|
const int lengthInserted = pdoc->InsertString(positionInsert, text, textLen);
|
||||||
|
if (lengthInserted > 0) {
|
||||||
|
sel.Range(r).caret.SetPosition(positionInsert + lengthInserted);
|
||||||
|
sel.Range(r).anchor.SetPosition(positionInsert + lengthInserted);
|
||||||
|
}
|
||||||
|
sel.Range(r).ClearVirtualSpace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScintillaBase::AutoCompleteStart(int lenEntered, const char *list) {
|
void ScintillaBase::AutoCompleteStart(int lenEntered, const char *list) {
|
||||||
@@ -492,7 +519,6 @@ public:
|
|||||||
void SetLexerLanguage(const char *languageName);
|
void SetLexerLanguage(const char *languageName);
|
||||||
const char *DescribeWordListSets();
|
const char *DescribeWordListSets();
|
||||||
void SetWordList(int n, const char *wl);
|
void SetWordList(int n, const char *wl);
|
||||||
int GetStyleBitsNeeded() const;
|
|
||||||
const char *GetName() const;
|
const char *GetName() const;
|
||||||
void *PrivateCall(int operation, void *pointer);
|
void *PrivateCall(int operation, void *pointer);
|
||||||
const char *PropertyNames();
|
const char *PropertyNames();
|
||||||
@@ -594,10 +620,6 @@ void LexState::SetWordList(int n, const char *wl) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int LexState::GetStyleBitsNeeded() const {
|
|
||||||
return lexCurrent ? lexCurrent->GetStyleBitsNeeded() : 5;
|
|
||||||
}
|
|
||||||
|
|
||||||
const char *LexState::GetName() const {
|
const char *LexState::GetName() const {
|
||||||
return lexCurrent ? lexCurrent->languageName : "";
|
return lexCurrent ? lexCurrent->languageName : "";
|
||||||
}
|
}
|
||||||
@@ -740,8 +762,7 @@ void ScintillaBase::NotifyStyleToNeeded(int endStyleNeeded) {
|
|||||||
|
|
||||||
void ScintillaBase::NotifyLexerChanged(Document *, void *) {
|
void ScintillaBase::NotifyLexerChanged(Document *, void *) {
|
||||||
#ifdef SCI_LEXER
|
#ifdef SCI_LEXER
|
||||||
int bits = DocumentLexState()->GetStyleBitsNeeded();
|
vs.EnsureStyle(0xff);
|
||||||
vs.EnsureStyle((1 << bits) - 1);
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -819,6 +840,13 @@ sptr_t ScintillaBase::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lPara
|
|||||||
case SCI_AUTOCGETCASEINSENSITIVEBEHAVIOUR:
|
case SCI_AUTOCGETCASEINSENSITIVEBEHAVIOUR:
|
||||||
return ac.ignoreCaseBehaviour;
|
return ac.ignoreCaseBehaviour;
|
||||||
|
|
||||||
|
case SCI_AUTOCSETMULTI:
|
||||||
|
multiAutoCMode = static_cast<int>(wParam);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case SCI_AUTOCGETMULTI:
|
||||||
|
return multiAutoCMode;
|
||||||
|
|
||||||
case SCI_AUTOCSETORDER:
|
case SCI_AUTOCSETORDER:
|
||||||
ac.autoSort = static_cast<int>(wParam);
|
ac.autoSort = static_cast<int>(wParam);
|
||||||
break;
|
break;
|
||||||
@@ -982,7 +1010,7 @@ sptr_t ScintillaBase::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lPara
|
|||||||
DocumentLexState()->PrivateCall(wParam, reinterpret_cast<void *>(lParam)));
|
DocumentLexState()->PrivateCall(wParam, reinterpret_cast<void *>(lParam)));
|
||||||
|
|
||||||
case SCI_GETSTYLEBITSNEEDED:
|
case SCI_GETSTYLEBITSNEEDED:
|
||||||
return DocumentLexState()->GetStyleBitsNeeded();
|
return 8;
|
||||||
|
|
||||||
case SCI_PROPERTYNAMES:
|
case SCI_PROPERTYNAMES:
|
||||||
return StringResult(lParam, DocumentLexState()->PropertyNames());
|
return StringResult(lParam, DocumentLexState()->PropertyNames());
|
||||||
|
@@ -46,6 +46,7 @@ protected:
|
|||||||
|
|
||||||
int listType; ///< 0 is an autocomplete list
|
int listType; ///< 0 is an autocomplete list
|
||||||
int maxListWidth; /// Maximum width of list, in average character widths
|
int maxListWidth; /// Maximum width of list, in average character widths
|
||||||
|
int multiAutoCMode; /// Mode for autocompleting when multiple selections are present
|
||||||
|
|
||||||
#ifdef SCI_LEXER
|
#ifdef SCI_LEXER
|
||||||
LexState *DocumentLexState();
|
LexState *DocumentLexState();
|
||||||
|
@@ -226,10 +226,18 @@ SelectionRange &Selection::Range(size_t r) {
|
|||||||
return ranges[r];
|
return ranges[r];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const SelectionRange &Selection::Range(size_t r) const {
|
||||||
|
return ranges[r];
|
||||||
|
}
|
||||||
|
|
||||||
SelectionRange &Selection::RangeMain() {
|
SelectionRange &Selection::RangeMain() {
|
||||||
return ranges[mainRange];
|
return ranges[mainRange];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const SelectionRange &Selection::RangeMain() const {
|
||||||
|
return ranges[mainRange];
|
||||||
|
}
|
||||||
|
|
||||||
SelectionPosition Selection::Start() const {
|
SelectionPosition Selection::Start() const {
|
||||||
if (IsRectangular()) {
|
if (IsRectangular()) {
|
||||||
return rangeRectangular.Start();
|
return rangeRectangular.Start();
|
||||||
|
@@ -156,7 +156,9 @@ public:
|
|||||||
size_t Main() const;
|
size_t Main() const;
|
||||||
void SetMain(size_t r);
|
void SetMain(size_t r);
|
||||||
SelectionRange &Range(size_t r);
|
SelectionRange &Range(size_t r);
|
||||||
|
const SelectionRange &Range(size_t r) const;
|
||||||
SelectionRange &RangeMain();
|
SelectionRange &RangeMain();
|
||||||
|
const SelectionRange &RangeMain() const;
|
||||||
SelectionPosition Start() const;
|
SelectionPosition Start() const;
|
||||||
bool MoveExtends() const;
|
bool MoveExtends() const;
|
||||||
void SetMoveExtends(bool moveExtends_);
|
void SetMoveExtends(bool moveExtends_);
|
||||||
|
@@ -19,6 +19,10 @@ using namespace Scintilla;
|
|||||||
FontAlias::FontAlias() {
|
FontAlias::FontAlias() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
FontAlias::FontAlias(const FontAlias &other) : Font() {
|
||||||
|
SetID(other.fid);
|
||||||
|
}
|
||||||
|
|
||||||
FontAlias::~FontAlias() {
|
FontAlias::~FontAlias() {
|
||||||
SetID(0);
|
SetID(0);
|
||||||
// ~Font will not release the actual font resource since it is now 0
|
// ~Font will not release the actual font resource since it is now 0
|
||||||
|
@@ -33,11 +33,11 @@ struct FontSpecification {
|
|||||||
|
|
||||||
// Just like Font but only has a copy of the FontID so should not delete it
|
// Just like Font but only has a copy of the FontID so should not delete it
|
||||||
class FontAlias : public Font {
|
class FontAlias : public Font {
|
||||||
// Private so FontAlias objects can not be copied
|
// Private so FontAlias objects can not be assigned except for intiialization
|
||||||
FontAlias(const FontAlias &);
|
|
||||||
FontAlias &operator=(const FontAlias &);
|
FontAlias &operator=(const FontAlias &);
|
||||||
public:
|
public:
|
||||||
FontAlias();
|
FontAlias();
|
||||||
|
FontAlias(const FontAlias &);
|
||||||
virtual ~FontAlias();
|
virtual ~FontAlias();
|
||||||
void MakeAlias(Font &fontOrigin);
|
void MakeAlias(Font &fontOrigin);
|
||||||
void ClearFont();
|
void ClearFont();
|
||||||
|
@@ -434,6 +434,43 @@ void ViewStyle::CalcLargestMarkerHeight() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// See if something overrides the line background color: Either if caret is on the line
|
||||||
|
// and background color is set for that, or if a marker is defined that forces its background
|
||||||
|
// color onto the line, or if a marker is defined but has no selection margin in which to
|
||||||
|
// display itself (as long as it's not an SC_MARK_EMPTY marker). These are checked in order
|
||||||
|
// with the earlier taking precedence. When multiple markers cause background override,
|
||||||
|
// the color for the highest numbered one is used.
|
||||||
|
ColourOptional ViewStyle::Background(int marksOfLine, bool caretActive, bool lineContainsCaret) const {
|
||||||
|
ColourOptional background;
|
||||||
|
if ((caretActive || alwaysShowCaretLineBackground) && showCaretLineBackground && (caretLineAlpha == SC_ALPHA_NOALPHA) && lineContainsCaret) {
|
||||||
|
background = ColourOptional(caretLineBackground, true);
|
||||||
|
}
|
||||||
|
if (!background.isSet && marksOfLine) {
|
||||||
|
int marks = marksOfLine;
|
||||||
|
for (int markBit = 0; (markBit < 32) && marks; markBit++) {
|
||||||
|
if ((marks & 1) && (markers[markBit].markType == SC_MARK_BACKGROUND) &&
|
||||||
|
(markers[markBit].alpha == SC_ALPHA_NOALPHA)) {
|
||||||
|
background = ColourOptional(markers[markBit].back, true);
|
||||||
|
}
|
||||||
|
marks >>= 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!background.isSet && maskInLine) {
|
||||||
|
int marksMasked = marksOfLine & maskInLine;
|
||||||
|
if (marksMasked) {
|
||||||
|
for (int markBit = 0; (markBit < 32) && marksMasked; markBit++) {
|
||||||
|
if ((marksMasked & 1) && (markers[markBit].markType != SC_MARK_EMPTY) &&
|
||||||
|
(markers[markBit].alpha == SC_ALPHA_NOALPHA)) {
|
||||||
|
background = ColourOptional(markers[markBit].back, true);
|
||||||
|
}
|
||||||
|
marksMasked >>= 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return background;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
ColourDesired ViewStyle::WrapColour() const {
|
ColourDesired ViewStyle::WrapColour() const {
|
||||||
if (whitespaceColours.fore.isSet)
|
if (whitespaceColours.fore.isSet)
|
||||||
return whitespaceColours.fore;
|
return whitespaceColours.fore;
|
||||||
|
@@ -157,7 +157,7 @@ public:
|
|||||||
ViewStyle();
|
ViewStyle();
|
||||||
ViewStyle(const ViewStyle &source);
|
ViewStyle(const ViewStyle &source);
|
||||||
~ViewStyle();
|
~ViewStyle();
|
||||||
void Init(size_t stylesSize_=64);
|
void Init(size_t stylesSize_=256);
|
||||||
void Refresh(Surface &surface, int tabInChars);
|
void Refresh(Surface &surface, int tabInChars);
|
||||||
void ReleaseAllExtendedStyles();
|
void ReleaseAllExtendedStyles();
|
||||||
int AllocateExtendedStyles(int numberStyles);
|
int AllocateExtendedStyles(int numberStyles);
|
||||||
@@ -169,6 +169,7 @@ public:
|
|||||||
int ExternalMarginWidth() const;
|
int ExternalMarginWidth() const;
|
||||||
bool ValidStyle(size_t styleIndex) const;
|
bool ValidStyle(size_t styleIndex) const;
|
||||||
void CalcLargestMarkerHeight();
|
void CalcLargestMarkerHeight();
|
||||||
|
ColourOptional Background(int marksOfLine, bool caretActive, bool lineContainsCaret) const;
|
||||||
ColourDesired WrapColour() const;
|
ColourDesired WrapColour() const;
|
||||||
bool SetWrapState(int wrapState_);
|
bool SetWrapState(int wrapState_);
|
||||||
bool SetWrapVisualFlags(int wrapVisualFlags_);
|
bool SetWrapVisualFlags(int wrapVisualFlags_);
|
||||||
|
@@ -3291,6 +3291,18 @@ int wxStyledTextCtrl::AutoCompGetCaseInsensitiveBehaviour() const
|
|||||||
return SendMsg(SCI_AUTOCGETCASEINSENSITIVEBEHAVIOUR, 0, 0);
|
return SendMsg(SCI_AUTOCGETCASEINSENSITIVEBEHAVIOUR, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Change the effect of autocompleting when there are multiple selections.
|
||||||
|
void wxStyledTextCtrl::AutoCompSetMulti(int multi)
|
||||||
|
{
|
||||||
|
SendMsg(SCI_AUTOCSETMULTI, multi, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Retrieve the effect of autocompleting when there are multiple selections..
|
||||||
|
int wxStyledTextCtrl::AutoCompGetMulti() const
|
||||||
|
{
|
||||||
|
return SendMsg(SCI_AUTOCGETMULTI, 0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
// Set the way autocompletion lists are ordered.
|
// Set the way autocompletion lists are ordered.
|
||||||
void wxStyledTextCtrl::AutoCompSetOrder(int order)
|
void wxStyledTextCtrl::AutoCompSetOrder(int order)
|
||||||
{
|
{
|
||||||
@@ -5323,7 +5335,7 @@ wxStyledTextEvent::wxStyledTextEvent(const wxStyledTextEvent& event):
|
|||||||
|
|
||||||
/*static*/ wxVersionInfo wxStyledTextCtrl::GetLibraryVersionInfo()
|
/*static*/ wxVersionInfo wxStyledTextCtrl::GetLibraryVersionInfo()
|
||||||
{
|
{
|
||||||
return wxVersionInfo("Scintilla", 3, 4, 3, "Scintilla 3.4.3");
|
return wxVersionInfo("Scintilla", 3, 4, 4, "Scintilla 3.4.4");
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // wxUSE_STC
|
#endif // wxUSE_STC
|
||||||
|
@@ -1205,7 +1205,7 @@ wxStyledTextEvent::wxStyledTextEvent(const wxStyledTextEvent& event):
|
|||||||
|
|
||||||
/*static*/ wxVersionInfo wxStyledTextCtrl::GetLibraryVersionInfo()
|
/*static*/ wxVersionInfo wxStyledTextCtrl::GetLibraryVersionInfo()
|
||||||
{
|
{
|
||||||
return wxVersionInfo("Scintilla", 3, 4, 3, "Scintilla 3.4.3");
|
return wxVersionInfo("Scintilla", 3, 4, 4, "Scintilla 3.4.4");
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // wxUSE_STC
|
#endif // wxUSE_STC
|
||||||
|
Reference in New Issue
Block a user