Update Scintilla from 3.4.3 to 3.4.4

This commit is contained in:
ARATA Mizuki
2015-06-15 01:32:06 +02:00
committed by Vadim Zeitlin
parent 40fa003072
commit 7ebb51a895
60 changed files with 423 additions and 459 deletions
+8
View File
@@ -310,6 +310,8 @@ class WXDLLIMPEXP_FWD_CORE wxScrollBar;
#define wxSTC_SEL_THIN 3
#define wxSTC_CASEINSENSITIVEBEHAVIOUR_RESPECTCASE 0
#define wxSTC_CASEINSENSITIVEBEHAVIOUR_IGNORECASE 1
#define wxSTC_MULTIAUTOC_ONCE 0
#define wxSTC_MULTIAUTOC_EACH 1
#define wxSTC_ORDER_PRESORTED 0
#define wxSTC_ORDER_PERFORMSORT 1
#define wxSTC_ORDER_CUSTOM 2
@@ -4149,6 +4151,12 @@ public:
// Get auto-completion case insensitive behaviour.
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.
void AutoCompSetOrder(int order);
+12
View File
@@ -266,6 +266,8 @@
#define wxSTC_SEL_THIN 3
#define wxSTC_CASEINSENSITIVEBEHAVIOUR_RESPECTCASE 0
#define wxSTC_CASEINSENSITIVEBEHAVIOUR_IGNORECASE 1
#define wxSTC_MULTIAUTOC_ONCE 0
#define wxSTC_MULTIAUTOC_EACH 1
#define wxSTC_ORDER_PRESORTED 0
#define wxSTC_ORDER_PERFORMSORT 1
#define wxSTC_ORDER_CUSTOM 2
@@ -5095,6 +5097,16 @@ public:
*/
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.
*/
+2
View File
@@ -406,6 +406,8 @@ methodOverrideMap = {
'AutoCGetMaxHeight' : ('AutoCompGetMaxHeight', 0, 0, 0),
'AutoCSetCaseInsensitiveBehaviour' : ('AutoCompSetCaseInsensitiveBehaviour', 0, 0, 0),
'AutoCGetCaseInsensitiveBehaviour' : ('AutoCompGetCaseInsensitiveBehaviour', 0, 0, 0),
'AutoCSetMulti' : ('AutoCompSetMulti', 0, 0, 0),
'AutoCGetMulti' : ('AutoCompGetMulti', 0, 0, 0),
'AutoCSetOrder' : ('AutoCompSetOrder', 0, 0, 0),
'AutoCGetOrder' : ('AutoCompGetOrder', 0, 0, 0),
+1 -1
View File
@@ -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
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.
+6 -2
View File
@@ -728,6 +728,10 @@ inline int isascii(int c) { return !(c & ~0x7F); }
#define SC_CASEINSENSITIVEBEHAVIOUR_IGNORECASE 1
#define SCI_AUTOCSETCASEINSENSITIVEBEHAVIOUR 2634
#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_PERFORMSORT 1
#define SC_ORDER_CUSTOM 2
@@ -1028,7 +1032,7 @@ inline int isascii(int c) { return !(c & ~0x7F); }
* CHARRANGE, TEXTRANGE, FINDTEXTEX, FORMATRANGE, and NMHDR structs.
* So older code that treats Scintilla as a RichEdit will work. */
#ifdef SCI_NAMESPACE
#if defined(__cplusplus) && defined(SCI_NAMESPACE)
namespace Scintilla {
#endif
@@ -1120,7 +1124,7 @@ struct SCNotification {
int updated; /* SCN_UPDATEUI */
};
#ifdef SCI_NAMESPACE
#if defined(__cplusplus) && defined(SCI_NAMESPACE)
}
#endif
+10
View File
@@ -1884,6 +1884,16 @@ set void AutoCSetCaseInsensitiveBehaviour=2634(int behaviour,)
# Get auto-completion case insensitive behaviour.
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_
val SC_ORDER_PRESORTED=0
val SC_ORDER_PERFORMSORT=1
+10 -1
View File
@@ -767,6 +767,7 @@ static void FoldBashDoc(unsigned int startPos, int length, int, WordList *[],
bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0;
unsigned int endPos = startPos + length;
int visibleChars = 0;
int skipHereCh = 0;
int lineCurrent = styler.GetLine(startPos);
int levelPrev = styler.LevelAt(lineCurrent) & SC_FOLDLEVELNUMBERMASK;
int levelCurrent = levelPrev;
@@ -798,7 +799,15 @@ static void FoldBashDoc(unsigned int startPos, int length, int, WordList *[],
// Here Document folding
if (style == SCE_SH_HERE_DELIM) {
if (ch == '<' && chNext == '<') {
levelCurrent++;
if (styler.SafeGetCharAt(i + 2) == '<') {
skipHereCh = 1;
} else {
if (skipHereCh == 0) {
levelCurrent++;
} else {
skipHereCh = 0;
}
}
}
} else if (style == SCE_SH_HERE_Q && styler.StyleAt(i+1) == SCE_SH_DEFAULT) {
levelCurrent--;
+16 -6
View File
@@ -8,10 +8,10 @@
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <stdio.h>
#include <stdarg.h>
#include <assert.h>
#include <ctype.h>
#include <string>
#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 == 2) && literalString && (s[0] == 'u') && (s[1] == '8'));
if (valid) {
if (literalString)
sc.ChangeState((raw ? SCE_C_STRINGRAW : SCE_C_STRING)|activitySet);
else
if (literalString) {
if (raw) {
// 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);
}
} else {
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])))
endName++;
std::string key = restOfLine.substr(startName, endName-startName);
if (restOfLine[endName] == '(') {
if ((endName < restOfLine.length()) && (restOfLine.at(endName) == '(')) {
// Macro
size_t endArgs = endName;
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;
while ((startValue < restOfLine.length()) && IsSpaceOrTab(restOfLine[startValue]))
startValue++;
std::string value = restOfLine.substr(startValue);
std::string value;
if (startValue < restOfLine.length())
value = restOfLine.substr(startValue);
preprocessorDefinitions[key] = SymbolValue(value, args);
ppDefineHistory.push_back(PPDefinition(lineCurrent, key, value, false, args));
definitionsChanged = true;
+3 -3
View File
@@ -13,14 +13,14 @@
#include <cctype>
#include "ILexer.h"
#include "SciLexer.h"
#include "Scintilla.h"
#include "SciLexer.h"
#include "LexerModule.h"
#include "WordList.h"
#include "LexAccessor.h"
#include "StyleContext.h"
#include "CharacterSet.h"
#include "WordList.h"
#include "LexerModule.h"
#ifdef SCI_NAMESPACE
using namespace Scintilla;
+1 -1
View File
@@ -7,10 +7,10 @@
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <stdio.h>
#include <stdarg.h>
#include <assert.h>
#include <ctype.h>
#ifdef _MSC_VER
#pragma warning(disable: 4786)
+1 -1
View File
@@ -6,10 +6,10 @@
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <stdio.h>
#include <stdarg.h>
#include <assert.h>
#include <ctype.h>
#include "ILexer.h"
#include "Scintilla.h"
+5 -6
View File
@@ -576,8 +576,7 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
WordList &keywords5 = *keywordlists[4];
WordList &keywords6 = *keywordlists[5]; // SGML (DTD) keywords
// Lexer for HTML requires more lexical states (8 bits worth) than most lexers
styler.StartAt(startPos, static_cast<unsigned char>(STYLE_MAX));
styler.StartAt(startPos);
char prevWord[200];
prevWord[0] = '\0';
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)
state = SCE_H_DEFAULT;
}
styler.StartAt(startPos, static_cast<unsigned char>(STYLE_MAX));
styler.StartAt(startPos);
int lineCurrent = styler.GetLine(startPos);
int lineState;
@@ -2180,6 +2179,6 @@ static const char * const phpscriptWordListDesc[] = {
0,
};
LexerModule lmHTML(SCLEX_HTML, ColouriseHTMLDoc, "hypertext", 0, htmlWordListDesc, 8);
LexerModule lmXML(SCLEX_XML, ColouriseXMLDoc, "xml", 0, htmlWordListDesc, 8);
LexerModule lmPHPSCRIPT(SCLEX_PHPSCRIPT, ColourisePHPScriptDoc, "phpscript", 0, phpscriptWordListDesc, 8);
LexerModule lmHTML(SCLEX_HTML, ColouriseHTMLDoc, "hypertext", 0, htmlWordListDesc);
LexerModule lmXML(SCLEX_XML, ColouriseXMLDoc, "xml", 0, htmlWordListDesc);
LexerModule lmPHPSCRIPT(SCLEX_PHPSCRIPT, ColourisePHPScriptDoc, "phpscript", 0, phpscriptWordListDesc);
+1 -1
View File
@@ -38,9 +38,9 @@
#include "Accessor.h"
#include "StyleContext.h"
#include "CharacterSet.h"
#include "CharacterCategory.h"
#include "LexerModule.h"
#include "OptionSet.h"
#include "CharacterCategory.h"
#ifdef SCI_NAMESPACE
using namespace Scintilla;
+1 -1
View File
@@ -570,4 +570,4 @@ static const char * const mysqlWordListDesc[] = {
0
};
LexerModule lmMySQL(SCLEX_MYSQL, ColouriseMySQLDoc, "mysql", FoldMySQLDoc, mysqlWordListDesc, 7);
LexerModule lmMySQL(SCLEX_MYSQL, ColouriseMySQLDoc, "mysql", FoldMySQLDoc, mysqlWordListDesc);
+7 -24
View File
@@ -6,6 +6,12 @@
** 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 <string.h>
#include <stdio.h>
@@ -72,7 +78,6 @@ static void ColourisePSDoc(
StyleContext sc(startPos, length, initStyle, styler);
bool tokenizing = styler.GetPropertyInt("ps.tokenize") != 0;
int pslevel = styler.GetPropertyInt("ps.level", 3);
int lineCurrent = styler.GetLine(startPos);
int nestTextCurrent = 0;
@@ -83,15 +88,6 @@ static void ColourisePSDoc(
bool numHasExponent = 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()) {
if (sc.atLineStart)
lineCurrent = styler.GetLine(sc.currentPos);
@@ -196,7 +192,6 @@ static void ColourisePSDoc(
// Determine if a new state should be entered.
if (sc.state == SCE_C_DEFAULT) {
unsigned int tokenpos = sc.currentPos;
if (sc.ch == '[' || sc.ch == ']') {
sc.SetState(SCE_PS_PAREN_ARRAY);
@@ -262,17 +257,6 @@ static void ColourisePSDoc(
} else if (!IsAWhitespaceChar(sc.ch)) {
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)
@@ -296,11 +280,10 @@ static void FoldPSDoc(unsigned int startPos, int length, int, WordList *[],
int levelNext = levelCurrent;
char chNext = styler[startPos];
int styleNext = styler.StyleAt(startPos);
int style;
for (unsigned int i = startPos; i < endPos; i++) {
char ch = chNext;
chNext = styler.SafeGetCharAt(i + 1);
style = styleNext;
int style = styleNext;
styleNext = styler.StyleAt(i + 1);
bool atEOL = (ch == '\r' && chNext != '\n') || (ch == '\n'); //mac??
if ((style & 31) == SCE_PS_PAREN_PROC) {
+1 -1
View File
@@ -1726,4 +1726,4 @@ void SCI_METHOD LexerPerl::Fold(unsigned int startPos, int length, int /* initSt
styler.SetLevel(lineCurrent, levelPrev | flagsNext);
}
LexerModule lmPerl(SCLEX_PERL, LexerPerl::LexerFactoryPerl, "perl", perlWordListDesc, 8);
LexerModule lmPerl(SCLEX_PERL, LexerPerl::LexerFactoryPerl, "perl", perlWordListDesc);
+2 -3
View File
@@ -705,8 +705,7 @@ static void ColouriseRbDoc(unsigned int startPos, int length, int initStyle,
char chPrev = styler.SafeGetCharAt(startPos - 1);
char chNext = styler.SafeGetCharAt(startPos);
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, 127);
styler.StartAt(startPos);
styler.StartSegment(startPos);
static int q_states[] = {SCE_RB_STRING_Q,
@@ -1776,4 +1775,4 @@ static const char * const rubyWordListDesc[] = {
0
};
LexerModule lmRuby(SCLEX_RUBY, ColouriseRbDoc, "ruby", FoldRbDoc, rubyWordListDesc, 6);
LexerModule lmRuby(SCLEX_RUBY, ColouriseRbDoc, "ruby", FoldRbDoc, rubyWordListDesc);
+1 -1
View File
@@ -21,6 +21,7 @@
#include "Scintilla.h"
#include "SciLexer.h"
#include "PropSetSimple.h"
#include "WordList.h"
#include "LexAccessor.h"
#include "Accessor.h"
@@ -28,7 +29,6 @@
#include "CharacterSet.h"
#include "LexerModule.h"
#include "OptionSet.h"
#include "PropSetSimple.h"
#ifdef SCI_NAMESPACE
using namespace Scintilla;
+1 -31
View File
@@ -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];
int whingeLevel = styler.GetPropertyInt("tab.timmy.whinge.level");
char prevWord[200];
prevWord[0] = '\0';
if (length == 0) return;
@@ -143,37 +142,9 @@ static void ColouriseSolDoc(unsigned int startPos, int length, int initStyle,
char chPrev2 = ' ';
char chNext = styler[startPos];
styler.StartSegment(startPos);
bool atStartLine = true;
int spaceFlags = 0;
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;
chNext = styler.SafeGetCharAt(i + 1);
@@ -185,7 +156,6 @@ static void ColouriseSolDoc(unsigned int startPos, int length, int initStyle,
{
styler.ColourTo(i, state);
}
atStartLine = true;
}
if (styler.IsLeadByte(ch))
+1 -1
View File
@@ -8,10 +8,10 @@
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <stdio.h>
#include <stdarg.h>
#include <assert.h>
#include <ctype.h>
#include "ILexer.h"
#include "Scintilla.h"
+1 -1
View File
@@ -358,7 +358,7 @@ static const char * const tclWordListDesc[] = {
"TK Keywords",
"iTCL Keywords",
"tkCommands",
"expand"
"expand",
"user1",
"user2",
"user3",
+1 -1
View File
@@ -12,10 +12,10 @@
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <stdio.h>
#include <stdarg.h>
#include <assert.h>
#include <ctype.h>
#include "ILexer.h"
#include "Scintilla.h"
+1 -1
View File
@@ -13,10 +13,10 @@
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <stdio.h>
#include <stdarg.h>
#include <assert.h>
#include <ctype.h>
#ifdef _MSC_VER
#pragma warning(disable: 4786)
+1 -1
View File
@@ -8,9 +8,9 @@
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <ctype.h>
#include <stdarg.h>
#include <assert.h>
#include <ctype.h>
#include "ILexer.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.
// The array is in ascending order so can be searched using binary search.
// 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
// alphabetic languages.
+1 -1
View File
@@ -9,8 +9,8 @@
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <ctype.h>
#include <assert.h>
#include <ctype.h>
#include "CharacterSet.h"
+4 -16
View File
@@ -29,11 +29,8 @@ private:
int codePage;
enum EncodingType encodingType;
int lenDoc;
int mask;
char styleBuf[bufferSize];
int validLen;
char chFlags;
char chWhile;
unsigned int startSeg;
int startPosStyling;
int documentVersion;
@@ -58,7 +55,7 @@ public:
codePage(pAccess->CodePage()),
encodingType(enc8bit),
lenDoc(pAccess->Length()),
mask(127), validLen(0), chFlags(0), chWhile(0),
validLen(0),
startSeg(0), startPosStyling(0),
documentVersion(pAccess->Version()) {
switch (codePage) {
@@ -111,7 +108,7 @@ public:
return true;
}
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 {
return pAccess->LineFromPosition(position);
@@ -152,16 +149,10 @@ public:
return pAccess->SetLineState(line, state);
}
// Style setting
void StartAt(unsigned int start, char chMask=31) {
// Store the mask specified for use with StyleAt.
mask = chMask;
pAccess->StartStyling(start, chMask);
void StartAt(unsigned int start) {
pAccess->StartStyling(start, '\377');
startPosStyling = start;
}
void SetFlags(char chFlags_, char chWhile_) {
chFlags = chFlags_;
chWhile = chWhile_;
}
unsigned int GetStartSegment() const {
return startSeg;
}
@@ -182,9 +173,6 @@ public:
// Too big for buffer so send directly
pAccess->SetStyleFor(pos - startSeg + 1, static_cast<char>(chAttr));
} else {
if (chAttr != chWhile)
chFlags = 0;
chAttr = static_cast<char>(chAttr | chFlags);
for (unsigned int i = startSeg; i <= pos; i++) {
assert((startPosStyling + validLen) < Length());
styleBuf[validLen++] = static_cast<char>(chAttr);
+1 -1
View File
@@ -8,9 +8,9 @@
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <ctype.h>
#include <stdarg.h>
#include <assert.h>
#include <ctype.h>
#include "ILexer.h"
#include "Scintilla.h"
+3 -11
View File
@@ -8,9 +8,9 @@
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <ctype.h>
#include <stdarg.h>
#include <assert.h>
#include <ctype.h>
#include <string>
@@ -34,28 +34,24 @@ LexerModule::LexerModule(int language_,
LexerFunction fnLexer_,
const char *languageName_,
LexerFunction fnFolder_,
const char *const wordListDescriptions_[],
int styleBits_) :
const char *const wordListDescriptions_[]) :
language(language_),
fnLexer(fnLexer_),
fnFolder(fnFolder_),
fnFactory(0),
wordListDescriptions(wordListDescriptions_),
styleBits(styleBits_),
languageName(languageName_) {
}
LexerModule::LexerModule(int language_,
LexerFactoryFunction fnFactory_,
const char *languageName_,
const char * const wordListDescriptions_[],
int styleBits_) :
const char * const wordListDescriptions_[]) :
language(language_),
fnLexer(0),
fnFolder(0),
fnFactory(fnFactory_),
wordListDescriptions(wordListDescriptions_),
styleBits(styleBits_),
languageName(languageName_) {
}
@@ -82,10 +78,6 @@ const char *LexerModule::GetWordListDescription(int index) const {
}
}
int LexerModule::GetStyleBitsNeeded() const {
return styleBits;
}
ILexer *LexerModule::Create() const {
if (fnFactory)
return fnFactory();
+2 -7
View File
@@ -31,7 +31,6 @@ protected:
LexerFunction fnFolder;
LexerFactoryFunction fnFactory;
const char * const * wordListDescriptions;
int styleBits;
public:
const char *languageName;
@@ -39,13 +38,11 @@ public:
LexerFunction fnLexer_,
const char *languageName_=0,
LexerFunction fnFolder_=0,
const char * const wordListDescriptions_[] = NULL,
int styleBits_=5);
const char * const wordListDescriptions_[] = NULL);
LexerModule(int language_,
LexerFactoryFunction fnFactory_,
const char *languageName_,
const char * const wordListDescriptions_[] = NULL,
int styleBits_=8);
const char * const wordListDescriptions_[] = NULL);
virtual ~LexerModule() {
}
int GetLanguage() const { return language; }
@@ -54,8 +51,6 @@ public:
int GetNumWordLists() const;
const char *GetWordListDescription(int index) const;
int GetStyleBitsNeeded() const;
ILexer *Create() const;
virtual void Lex(unsigned int startPos, int length, int initStyle,
@@ -8,9 +8,9 @@
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <ctype.h>
#include <stdarg.h>
#include <assert.h>
#include <ctype.h>
#include "ILexer.h"
#include "Scintilla.h"
+1 -1
View File
@@ -8,9 +8,9 @@
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <ctype.h>
#include <stdarg.h>
#include <assert.h>
#include <ctype.h>
#include <string>
+1 -1
View File
@@ -8,8 +8,8 @@
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <ctype.h>
#include <assert.h>
#include <ctype.h>
#include "ILexer.h"
+2 -2
View File
@@ -66,7 +66,7 @@ public:
int widthNext;
StyleContext(unsigned int startPos, unsigned int length,
int initStyle, LexAccessor &styler_, char chMask=31) :
int initStyle, LexAccessor &styler_, char chMask='\377') :
styler(styler_),
multiByteAccess(0),
endPos(startPos + length),
@@ -86,7 +86,7 @@ public:
if (styler.Encoding() != enc8bit) {
multiByteAccess = styler.MultiByteAccess();
}
styler.StartAt(startPos, chMask);
styler.StartAt(startPos /*, chMask*/);
styler.StartSegment(startPos);
currentLine = styler.GetLine(startPos);
lineStartNext = styler.LineStart(currentLine+1);
+1 -1
View File
@@ -8,8 +8,8 @@
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <ctype.h>
#include <stdarg.h>
#include <ctype.h>
#include <algorithm>
+1 -1
View File
@@ -8,9 +8,9 @@
#include <vector>
#include <algorithm>
#include "CaseFolder.h"
#include "CaseConvert.h"
#include "UniConversion.h"
#include "CaseFolder.h"
#ifdef SCI_NAMESPACE
using namespace Scintilla;
+1 -1
View File
@@ -8,9 +8,9 @@
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <ctype.h>
#include <stdarg.h>
#include <assert.h>
#include <ctype.h>
#include <vector>
+6 -7
View File
@@ -413,25 +413,24 @@ const char *CellBuffer::InsertString(int position, const char *s, int insertLeng
return data;
}
bool CellBuffer::SetStyleAt(int position, char styleValue, char mask) {
styleValue &= mask;
bool CellBuffer::SetStyleAt(int position, char styleValue) {
char curVal = style.ValueAt(position);
if ((curVal & mask) != styleValue) {
style.SetValueAt(position, static_cast<char>((curVal & ~mask) | styleValue));
if (curVal != styleValue) {
style.SetValueAt(position, styleValue);
return true;
} else {
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;
PLATFORM_ASSERT(lengthStyle == 0 ||
(lengthStyle > 0 && lengthStyle + position <= style.Length()));
while (lengthStyle--) {
char curVal = style.ValueAt(position);
if ((curVal & mask) != styleValue) {
style.SetValueAt(position, static_cast<char>((curVal & ~mask) | styleValue));
if (curVal != styleValue) {
style.SetValueAt(position, styleValue);
changed = true;
}
position++;
+2 -2
View File
@@ -180,8 +180,8 @@ public:
/// 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.
bool SetStyleAt(int position, char styleValue, char mask='\377');
bool SetStyleFor(int position, int length, char styleValue, char mask);
bool SetStyleAt(int position, char styleValue);
bool SetStyleFor(int position, int length, char styleValue);
const char *DeleteChars(int position, int deleteLength, bool &startSequence);
+8 -18
View File
@@ -8,8 +8,8 @@
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <ctype.h>
#include <assert.h>
#include <ctype.h>
#include <string>
#include <vector>
@@ -20,13 +20,13 @@
#include "ILexer.h"
#include "Scintilla.h"
#include "CharacterSet.h"
#include "SplitVector.h"
#include "Partitioning.h"
#include "RunStyles.h"
#include "CellBuffer.h"
#include "PerLine.h"
#include "CharClassify.h"
#include "CharacterSet.h"
#include "Decoration.h"
#include "CaseFolder.h"
#include "Document.h"
@@ -58,7 +58,7 @@ void LexInterface::Colourise(int start, int end) {
int styleStart = 0;
if (start > 0)
styleStart = pdoc->StyleAt(start - 1) & pdoc->stylingBitsMask;
styleStart = pdoc->StyleAt(start - 1);
if (len > 0) {
instance->Lex(start, len, styleStart, pdoc);
@@ -90,9 +90,6 @@ Document::Document() {
#endif
dbcsCodePage = 0;
lineEndBitSet = SC_LINE_END_TYPE_DEFAULT;
stylingBits = 5;
stylingBitsMask = 0x1F;
stylingMask = 0;
endStyled = 0;
styleClock = 0;
enteredModification = 0;
@@ -1712,13 +1709,7 @@ int Document::GetCharsOfClass(CharClassify::cc characterClass, unsigned char *bu
return charClass.GetCharsOfClass(characterClass, buffer);
}
void Document::SetStylingBits(int bits) {
stylingBits = bits;
stylingBitsMask = (1 << stylingBits) - 1;
}
void SCI_METHOD Document::StartStyling(int position, char mask) {
stylingMask = mask;
void SCI_METHOD Document::StartStyling(int position, char) {
endStyled = position;
}
@@ -1727,9 +1718,8 @@ bool SCI_METHOD Document::SetStyleFor(int length, char style) {
return false;
} else {
enteredStyling++;
style &= stylingMask;
int prevEndStyled = endStyled;
if (cb.SetStyleFor(endStyled, length, style, stylingMask)) {
if (cb.SetStyleFor(endStyled, length, style)) {
DocModification mh(SC_MOD_CHANGESTYLE | SC_PERFORMED_USER,
prevEndStyled, length);
NotifyModified(mh);
@@ -1750,7 +1740,7 @@ bool SCI_METHOD Document::SetStyles(int length, const char *styles) {
int endMod = 0;
for (int iPos = 0; iPos < length; iPos++, endStyled++) {
PLATFORM_ASSERT(endStyled < Length());
if (cb.SetStyleAt(endStyled, styles[iPos], stylingMask)) {
if (cb.SetStyleAt(endStyled, styles[iPos])) {
if (!didChange) {
startMod = endStyled;
}
@@ -2080,7 +2070,7 @@ int Document::BraceMatch(int position, int /*maxReStyle*/) {
char chSeek = BraceOpposite(chBrace);
if (chSeek == '\0')
return - 1;
char styBrace = static_cast<char>(StyleAt(position) & stylingBitsMask);
char styBrace = static_cast<char>(StyleAt(position));
int direction = -1;
if (chBrace == '(' || chBrace == '[' || chBrace == '{' || chBrace == '<')
direction = 1;
@@ -2088,7 +2078,7 @@ int Document::BraceMatch(int position, int /*maxReStyle*/) {
position = NextPosition(position, direction);
while ((position >= 0) && (position < Length())) {
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 (chAtPos == chBrace)
depth++;
+4 -5
View File
@@ -39,6 +39,10 @@ public:
start(start_), end(end_) {
}
bool operator==(const Range &other) const {
return (start == other.start) && (end == other.end);
}
bool Valid() const {
return (start != invalidPosition) && (end != invalidPosition);
}
@@ -206,7 +210,6 @@ private:
CellBuffer cb;
CharClassify charClass;
CaseFolder *pcf;
char stylingMask;
int endStyled;
int styleClock;
int enteredModification;
@@ -229,9 +232,6 @@ public:
LexInterface *pli;
int stylingBits;
int stylingBitsMask;
int eolMode;
/// Can also be SC_CP_UTF8 to enable UTF-8 mode
int dbcsCodePage;
@@ -369,7 +369,6 @@ public:
void SetDefaultCharClasses(bool includeWordClass);
void SetCharClasses(const unsigned char *chars, CharClassify::cc newCharClass);
int GetCharsOfClass(CharClassify::cc charClass, unsigned char *buffer);
void SetStylingBits(int bits);
void SCI_METHOD StartStyling(int position, char mask);
bool SCI_METHOD SetStyleFor(int length, char style);
bool SCI_METHOD SetStyles(int length, const char *styles);
File diff suppressed because it is too large Load Diff
+14 -16
View File
@@ -309,8 +309,7 @@ protected: // ScintillaBase subclass needs access to much of Editor
ContractionState cs;
// Hotspot support
int hsStart;
int hsEnd;
Range hotspot;
// Wrapping support
int wrapWidth;
@@ -435,27 +434,26 @@ protected: // ScintillaBase subclass needs access to much of Editor
int SubstituteMarkerIfEmpty(int markerCheck, int markerDefault) const;
void PaintSelMargin(Surface *surface, PRectangle &rc);
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);
ColourDesired SelectionBackground(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 SelectionBackground(const ViewStyle &vsDraw, bool main) 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);
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,
bool overrideBackground, ColourDesired background,
bool drawWrapMark, ColourDesired wrapColour);
static void DrawIndicator(int indicNum, int startPos, int endPos, Surface *surface, ViewStyle &vsDraw,
ColourOptional background);
static void DrawIndicator(int indicNum, int startPos, int endPos, Surface *surface, const ViewStyle &vsDraw,
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);
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);
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);
void DrawBlockCaret(Surface *surface, ViewStyle &vsDraw, LineLayout *ll, int subLine,
int xStart, int offset, int posCaret, PRectangle rcCaret, ColourDesired caretColour);
void DrawCarets(Surface *surface, ViewStyle &vsDraw, int line, int xStart,
void DrawBlockCaret(Surface *surface, const ViewStyle &vsDraw, LineLayout *ll, int subLine,
int xStart, int offset, int posCaret, PRectangle rcCaret, ColourDesired caretColour) const;
void DrawCarets(Surface *surface, const ViewStyle &vsDraw, int line, int xStart,
PRectangle rcLine, LineLayout *ll, int subLine);
void RefreshPixMaps(Surface *surfaceWindow);
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 PointIsHotspot(Point pt);
void SetHotSpotRange(Point *pt);
void GetHotSpotRange(int &hsStart, int &hsEnd) const;
Range GetHotSpotRange() const;
int CodePage() const;
virtual bool ValidCodePage(int /* codePage */) const { return true; }
+1 -1
View File
@@ -8,8 +8,8 @@
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <ctype.h>
#include <assert.h>
#include <ctype.h>
#include <string>
+2 -2
View File
@@ -11,8 +11,8 @@
#include "Platform.h"
#include "Scintilla.h"
#include "XPM.h"
#include "Indicator.h"
#include "XPM.h"
#ifdef SCI_NAMESPACE
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));
}
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);
int ymid = static_cast<int>(rc.bottom + rc.top) / 2;
if (style == INDIC_SQUIGGLE) {
+1 -1
View File
@@ -23,7 +23,7 @@ public:
int outlineAlpha;
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
+1 -1
View File
@@ -71,7 +71,7 @@ static void DrawMinus(Surface *surface, int centreX, int centreY, int armSize, C
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 body = back;
ColourDesired tail = back;
+1 -1
View File
@@ -66,7 +66,7 @@ public:
void SetXPM(const char *textForm);
void SetXPM(const char *const *linesForm);
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
+18 -23
View File
@@ -17,6 +17,7 @@
#include "Platform.h"
#include "ILexer.h"
#include "Scintilla.h"
#include "SplitVector.h"
@@ -32,7 +33,6 @@
#include "ViewStyle.h"
#include "CharClassify.h"
#include "Decoration.h"
#include "ILexer.h"
#include "CaseFolder.h"
#include "Document.h"
#include "UniConversion.h"
@@ -54,16 +54,12 @@ LineLayout::LineLayout(int maxLineLength_) :
validity(llInvalid),
xHighlightGuide(0),
highlightColumn(0),
psel(NULL),
containsCaret(false),
edgeColumn(0),
chars(0),
styles(0),
styleBitsSet(0),
indicators(0),
positions(0),
hsStart(0),
hsEnd(0),
hotspot(0,0),
widthLine(wrapWidthInfinite),
lines(1),
wrapIndent(0) {
@@ -81,7 +77,6 @@ void LineLayout::Resize(int maxLineLength_) {
Free();
chars = new char[maxLineLength_ + 1];
styles = new unsigned char[maxLineLength_ + 1];
indicators = new char[maxLineLength_ + 1];
// Extra position allocated as sometimes the Windows
// GetTextExtentExPoint API writes an extra element.
positions = new XYPOSITION[maxLineLength_ + 1 + 1];
@@ -94,8 +89,6 @@ void LineLayout::Free() {
chars = 0;
delete []styles;
styles = 0;
delete []indicators;
indicators = 0;
delete []positions;
positions = 0;
delete []lineStarts;
@@ -153,7 +146,7 @@ void LineLayout::SetLineStart(int line, int 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) {
if (!ignoreStyle && rangeLine.ContainsCharacter(braces[0])) {
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])) {
int braceOffset = braces[0] - rangeLine.start;
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);
if (!startByteHasReprs[static_cast<unsigned char>(charBytes[0])])
return 0;
MapRepresentation::iterator it = mapReprs.find(KeyFromString(charBytes, len));
MapRepresentation::const_iterator it = mapReprs.find(KeyFromString(charBytes, len));
if (it != mapReprs.end()) {
return &(it->second);
}
@@ -445,8 +438,8 @@ void BreakFinder::Insert(int val) {
}
}
BreakFinder::BreakFinder(LineLayout *ll_, int lineStart_, int lineEnd_, int posLineStart_,
int xStart, bool breakForSelection, Document *pdoc_, SpecialRepresentations *preprs_) :
BreakFinder::BreakFinder(const LineLayout *ll_, const Selection *psel, int lineStart_, int lineEnd_, int posLineStart_,
int xStart, bool breakForSelection, const Document *pdoc_, const SpecialRepresentations *preprs_) :
ll(ll_),
lineStart(lineStart_),
lineEnd(lineEnd_),
@@ -472,8 +465,8 @@ BreakFinder::BreakFinder(LineLayout *ll_, int lineStart_, int lineEnd_, int posL
SelectionPosition posStart(posLineStart);
SelectionPosition posEnd(posLineStart + lineEnd);
SelectionSegment segmentLine(posStart, posEnd);
for (size_t r=0; r<ll->psel->Count(); r++) {
SelectionSegment portion = ll->psel->Range(r).Intersect(segmentLine);
for (size_t r=0; r<psel->Count(); r++) {
SelectionSegment portion = psel->Range(r).Intersect(segmentLine);
if (!(portion.start == portion.end)) {
if (portion.start.IsValid())
Insert(portion.start.Position() - posLineStart);
@@ -500,7 +493,7 @@ TextSegment BreakFinder::Next() {
charWidth = UTF8DrawBytes(reinterpret_cast<unsigned char *>(ll->chars) + nextBreak, lineEnd - nextBreak);
else if (encodingFamily == efDBCS)
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])) ||
repr ||
(nextBreak == saeNext)) {
@@ -565,7 +558,7 @@ void PositionCacheEntry::Set(unsigned int styleNumber_, const char *s_,
for (unsigned int i=0; i<len; 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_,
unsigned int len_, XYPOSITION *positions_) const {
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++) {
positions_[i] = positions[i];
}
@@ -642,7 +635,7 @@ void PositionCache::SetSize(size_t 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) {
allClear = false;
@@ -672,7 +665,8 @@ void PositionCache::MeasureWidths(Surface *surface, ViewStyle &vstyle, unsigned
XYPOSITION xStartSegment = 0;
while (startSegment < len) {
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++) {
positions[startSegment + inSeg] += xStartSegment;
}
@@ -680,7 +674,8 @@ void PositionCache::MeasureWidths(Surface *surface, ViewStyle &vstyle, unsigned
startSegment += lenSegment;
}
} 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()) {
// Store into cache
+12 -16
View File
@@ -34,19 +34,15 @@ public:
enum validLevel { llInvalid, llCheckTextAndStyle, llPositions, llLines } validity;
int xHighlightGuide;
bool highlightColumn;
Selection *psel;
bool containsCaret;
int edgeColumn;
char *chars;
unsigned char *styles;
int styleBitsSet;
char *indicators;
XYPOSITION *positions;
char bracePreviousStyles[2];
// Hotspot support
int hsStart;
int hsEnd;
Range hotspot;
// Wrapped line support
int widthLine;
@@ -63,9 +59,9 @@ public:
Range SubLineRange(int line) const;
bool InLine(int offset, int line) const;
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);
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 FindPositionFromX(XYPOSITION x, Range range, bool charPosition) const;
Point PointFromPosition(int posInLine, int lineHeight) const;
@@ -132,7 +128,7 @@ public:
SpecialRepresentations();
void SetRepresentation(const char *charBytes, const char *value);
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;
void Clear();
};
@@ -140,8 +136,8 @@ public:
struct TextSegment {
int start;
int length;
Representation *representation;
TextSegment(int start_=0, int length_=0, Representation *representation_=0) :
const Representation *representation;
TextSegment(int start_=0, int length_=0, const Representation *representation_=0) :
start(start_), length(length_), representation(representation_) {
}
int end() const {
@@ -151,7 +147,7 @@ struct TextSegment {
// Class to break a line of text into shorter runs at sensible places.
class BreakFinder {
LineLayout *ll;
const LineLayout *ll;
int lineStart;
int lineEnd;
int posLineStart;
@@ -160,9 +156,9 @@ class BreakFinder {
unsigned int saeCurrentPos;
int saeNext;
int subBreak;
Document *pdoc;
const Document *pdoc;
EncodingFamily encodingFamily;
SpecialRepresentations *preprs;
const SpecialRepresentations *preprs;
void Insert(int val);
// Private so BreakFinder objects can not be copied
BreakFinder(const BreakFinder &);
@@ -172,8 +168,8 @@ public:
enum { lengthStartSubdivision = 300 };
// Try to make each subdivided run lengthEachSubdivision or shorter.
enum { lengthEachSubdivision = 100 };
BreakFinder(LineLayout *ll_, int lineStart_, int lineEnd_, int posLineStart_,
int xStart, bool breakForSelection, Document *pdoc_, SpecialRepresentations *preprs_);
BreakFinder(const LineLayout *ll_, const Selection *psel, int lineStart_, int lineEnd_, int posLineStart_,
int xStart, bool breakForSelection, const Document *pdoc_, const SpecialRepresentations *preprs_);
~BreakFinder();
TextSegment Next();
bool More() const;
@@ -191,7 +187,7 @@ public:
void Clear();
void SetSize(size_t 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);
};

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