From c813c65a565f815d7d01f10d1518f4571a31f45f Mon Sep 17 00:00:00 2001 From: Neil Date: Sat, 24 May 2014 07:48:25 +1000 Subject: Avoid a runtime warning from Dr. Memory. --- win32/ScintillaWin.cxx | 1 + 1 file changed, 1 insertion(+) diff --git a/win32/ScintillaWin.cxx b/win32/ScintillaWin.cxx index 762960685..07f801a78 100644 --- a/win32/ScintillaWin.cxx +++ b/win32/ScintillaWin.cxx @@ -1338,6 +1338,7 @@ void ScintillaWin::SetTrackMouseLeaveEvent(bool on) { tme.cbSize = sizeof(tme); tme.dwFlags = TME_LEAVE; tme.hwndTrack = MainHWND(); + tme.dwHoverTime = HOVER_DEFAULT; // Unused but triggers Dr. Memory if not initialized TrackMouseEventFn(&tme); } trackedMouseLeave = on; -- cgit v1.2.3 From e744d191cb5398139666d188dac7c94358ba512c Mon Sep 17 00:00:00 2001 From: Neil Date: Sat, 24 May 2014 08:49:35 +1000 Subject: Fix raw string recognition so that R"xxx(blah)xxx" is styled as SCE_C_STRINGRAW. --- doc/ScintillaHistory.html | 11 +++++++++++ lexers/LexCPP.cxx | 14 +++++++++++--- 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/doc/ScintillaHistory.html b/doc/ScintillaHistory.html index 852503b86..f23191ff2 100644 --- a/doc/ScintillaHistory.html +++ b/doc/ScintillaHistory.html @@ -459,6 +459,17 @@ Icons Copyright(C) 1998 by Dean S. Jones
+

+ Release 3.4.3 +

+

Release 3.4.2

diff --git a/lexers/LexCPP.cxx b/lexers/LexCPP.cxx index 7fe680991..e8b705b1f 100644 --- a/lexers/LexCPP.cxx +++ b/lexers/LexCPP.cxx @@ -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); } -- cgit v1.2.3 From f84a69d28698468076c0abc82fe9bb3ddf060a68 Mon Sep 17 00:00:00 2001 From: Neil Date: Sat, 24 May 2014 09:26:35 +1000 Subject: Moving declaration inside loop to prevent a 'scope can be reduced' warning. --- lexers/LexPS.cxx | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lexers/LexPS.cxx b/lexers/LexPS.cxx index 3661c4b66..ae2635368 100644 --- a/lexers/LexPS.cxx +++ b/lexers/LexPS.cxx @@ -296,11 +296,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) { -- cgit v1.2.3 From fcac0c91a9742c41838516f98f95e91dd262f688 Mon Sep 17 00:00:00 2001 From: Neil Date: Sat, 24 May 2014 09:27:21 +1000 Subject: Removing use of style byte indicator in PostScript lexer. --- lexers/LexPS.cxx | 28 ++++++---------------------- 1 file changed, 6 insertions(+), 22 deletions(-) diff --git a/lexers/LexPS.cxx b/lexers/LexPS.cxx index ae2635368..2c8917dae 100644 --- a/lexers/LexPS.cxx +++ b/lexers/LexPS.cxx @@ -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 #include #include @@ -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(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(INDIC2_MASK)); - styler.ColourTo(tokenpos, INDIC2_MASK); - styler.Flush(); - styler.StartAt(tokenpos); - styler.StartSegment(tokenpos); - } } if (sc.atLineEnd) -- cgit v1.2.3 From 524a5429eaae34e45769c39e44f1c7c10b1c5eff Mon Sep 17 00:00:00 2001 From: Neil Date: Sat, 24 May 2014 09:28:04 +1000 Subject: Removing use of style byte indicator in Scriptol lexer. --- lexers/LexScriptol.cxx | 32 +------------------------------- 1 file changed, 1 insertion(+), 31 deletions(-) diff --git a/lexers/LexScriptol.cxx b/lexers/LexScriptol.cxx index 31747b88e..40ef0de58 100644 --- a/lexers/LexScriptol.cxx +++ b/lexers/LexScriptol.cxx @@ -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(64); - char chGood = static_cast(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(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)) -- cgit v1.2.3 From aff335283c4ea47a38375ef6950ee2c285ddee70 Mon Sep 17 00:00:00 2001 From: Neil Date: Sat, 24 May 2014 09:29:24 +1000 Subject: Removing style byte indicators. --- doc/ScintillaDoc.html | 139 ++++++++++++++++--------------------------------- lexers/LexHTML.cxx | 11 ++-- lexers/LexMySQL.cxx | 2 +- lexers/LexPerl.cxx | 2 +- lexers/LexRuby.cxx | 5 +- lexlib/LexAccessor.h | 20 ++----- lexlib/LexerModule.cxx | 12 +---- lexlib/LexerModule.h | 9 +--- lexlib/StyleContext.h | 4 +- src/CellBuffer.cxx | 13 +++-- src/CellBuffer.h | 4 +- src/Document.cxx | 22 +++----- src/Document.h | 5 -- src/Editor.cxx | 78 ++++++--------------------- src/PositionCache.cxx | 5 -- src/PositionCache.h | 2 - src/ScintillaBase.cxx | 10 +--- src/ViewStyle.h | 2 +- test/simpleTests.py | 4 -- 19 files changed, 99 insertions(+), 250 deletions(-) diff --git a/doc/ScintillaDoc.html b/doc/ScintillaDoc.html index 5350e8537..e0880b071 100644 --- a/doc/ScintillaDoc.html +++ b/doc/ScintillaDoc.html @@ -364,20 +364,9 @@

Text retrieval and modification

-

Each byte in a Scintilla document is followed by an associated byte of styling +

Each byte in a Scintilla document is associated with a byte of styling information. The combination of a character byte and a style byte is called a cell. Style bytes - are interpreted an index into an array of styles. - Style bytes may be split into an index and a set of indicator bits - but this use is discouraged and indicators should now use - SCI_INDICATORFILLRANGE - and related calls. - The default split is with the index in the low 5 bits and 3 high bits as indicators. This allows 32 fundamental styles, which is enough for most - languages, and three independent indicators so that, for example, syntax errors, deprecated - names and bad indentation could all be displayed at once. The number of bits used for styles - can be altered with SCI_SETSTYLEBITS up to a maximum of 8 bits. - The remaining bits can be used for indicators.

+ are interpreted an index into an array of styles.

In this document, 'character' normally refers to a byte even when multi-byte characters are used. Lengths measure the numbers of bytes, not the amount of characters in those bytes.

@@ -421,8 +410,6 @@ SCI_GETSTYLEAT(int position)
SCI_GETSTYLEDTEXT(<unused>, Sci_TextRange *tr)
- SCI_SETSTYLEBITS(int bits)
- SCI_GETSTYLEBITS
SCI_RELEASEALLEXTENDEDSTYLES
SCI_ALLOCATEEXTENDEDSTYLES(int numberStyles)
SCI_TARGETASUTF8(<unused>, char *s)
@@ -570,14 +557,6 @@ This returns the style at pos in the document, or 0 if pos is negative or past the end of the document.

-

SCI_SETSTYLEBITS(int bits)
- SCI_GETSTYLEBITS
- This pair of routines sets and reads back the number of bits in each cell to use for styling, - to a maximum of 8 style bits. The remaining bits can be used as indicators. The standard - setting is SCI_SETSTYLEBITS(5). - The number of styling bits needed by the current lexer can be found with - SCI_GETSTYLEBITSNEEDED.

-

SCI_RELEASEALLEXTENDEDSTYLES
SCI_ALLOCATEEXTENDEDSTYLES(int numberStyles)
Extended styles are used for features like textual margins and annotations as well as internally by Scintilla. @@ -2329,12 +2308,7 @@ struct Sci_TextToFind {

Styling

-

The styling messages allow you to assign styles to text. The standard Scintilla settings - divide the 8 style bits available for each character into 5 bits (0 to 4 = styles 0 to 31) that set a style and three bits (5 to 7) that - define indicators. You can change the balance between - styles and indicators with SCI_SETSTYLEBITS. If your styling needs can be met by +

The styling messages allow you to assign styles to text. If your styling needs can be met by one of the standard lexers, or if you can write your own, then a lexer is probably the easiest way to style your document. If you choose to use the container to do the styling you can use the SCI_SETLEXER command to select @@ -2345,7 +2319,7 @@ struct Sci_TextToFind { use the styling commands to mark errors detected by a compiler. The following commands can be used.

SCI_GETENDSTYLED
- SCI_STARTSTYLING(int position, int mask)
+ SCI_STARTSTYLING(int position, int unused)
SCI_SETSTYLING(int length, int style)
SCI_SETSTYLINGEX(int length, const char *styles)
@@ -2363,31 +2337,23 @@ struct Sci_TextToFind { container. The container can send SCI_GETENDSTYLED to work out where it needs to start styling. Scintilla will always ask to style whole lines.

-

SCI_STARTSTYLING(int pos, int mask)
- This prepares for styling by setting the styling position pos to start at and a - mask indicating which bits of the style bytes can be set. The mask allows styling - to occur over several passes, with, for example, basic styling done on an initial pass to - ensure that the text of the code is seen quickly and correctly, and then a second slower pass, - detecting syntax errors and using indicators to show where these are. For example, with the - standard settings of 5 style bits and 3 indicator bits, you would use a mask value - of 31 (0x1f) if you were setting text styles and did not want to change the indicators. After +

SCI_STARTSTYLING(int pos, int unused)
+ This prepares for styling by setting the styling position pos to start at. + The unused argument was used in earlier versions but is now ignored. + After SCI_STARTSTYLING, send multiple SCI_SETSTYLING messages for each lexical entity to style.

SCI_SETSTYLING(int length, int style)
This message sets the style of length characters starting at the styling position - and then increases the styling position by length, ready for the next call. If - sCell is the style byte, the operation is:
- if ((sCell & mask) != style) sCell = (sCell & ~mask) | (style & - mask);
+ and then increases the styling position by length, ready for the next call.

SCI_SETSTYLINGEX(int length, const char *styles)
As an alternative to SCI_SETSTYLING, which applies the same style to each byte, you can use this message which specifies the styles for each of length bytes from the styling position and then increases the styling position by length, ready for - the next call. The length styling bytes pointed at by styles should - not contain any bits not set in mask.

+ the next call.

SCI_SETLINESTATE(int line, int value)
SCI_GETLINESTATE(int line)
@@ -2405,9 +2371,8 @@ struct Sci_TextToFind {

While the style setting messages mentioned above change the style numbers associated with text, these messages define how those style numbers are interpreted visually. There are 256 - lexer styles that can be set, numbered 0 to STYLE_MAX (255). Unless you use SCI_SETSTYLEBITS to change the number - of style bits, styles 0 to 31 are used to set the text attributes. There are also some + lexer styles that can be set, numbered 0 to STYLE_MAX (255). + There are also some predefined numbered styles starting at 32, The following STYLE_* constants are defined.

@@ -2504,9 +2469,7 @@ struct Sci_TextToFind { 255 This is not a style but is the number of the maximum style that can be set. Styles - between STYLE_LASTPREDEFINED and STYLE_MAX would be appropriate - if you used SCI_SETSTYLEBITS - to set more than 5 style bits. + between STYLE_LASTPREDEFINED and STYLE_MAX may be used. @@ -3196,9 +3159,6 @@ struct Sci_TextToFind {

Other settings

- SCI_SETUSEPALETTE(bool - allowPaletteUse)
- SCI_GETUSEPALETTE
SCI_SETBUFFEREDDRAW(bool isBuffered)
SCI_GETBUFFEREDDRAW
SCI_SETTWOPHASEDRAW(bool twoPhase)
@@ -3839,10 +3799,7 @@ struct Sci_TextToFind {

Indicators are used to display additional information over the top of styling. They can be used to show, for example, syntax errors, deprecated names and bad indentation - by drawing underlines under text or boxes around text. Originally, Scintilla stored indicator information in - the style bytes but this has proved limiting, so now up to 32 separately stored indicators may be used. - While style byte indicators currently still work, they will soon be removed so all the bits in each style - byte can be used for lexical states.

+ by drawing underlines under text or boxes around text.

Indicators may be displayed as simple underlines, squiggly underlines, a line of small 'T' shapes, a line of diagonal hatching, a strike-out or a rectangle around the text.

@@ -3853,6 +3810,12 @@ struct Sci_TextToFind { by lexers (0..7) and a range for use by containers (8=INDIC_CONTAINER .. 31=INDIC_MAX).

+

Originally, Scintilla used a different technique for indicators but this + has been removed + and the APIs perform no action. + While both techniques were supported, the term "modern indicators" was used for the + newer implementation.

+ SCI_INDICSETSTYLE(int indicatorNumber, int indicatorStyle)
SCI_INDICGETSTYLE(int indicatorNumber)
@@ -4074,12 +4037,10 @@ struct Sci_TextToFind {

SCI_INDICSETUNDER(int indicatorNumber, bool under)
SCI_INDICGETUNDER(int indicatorNumber)
These two messages set and get whether an indicator is drawn under text or over(default). - Drawing under text works only for modern indicators when two phase drawing + Drawing under text works only for indicators when two phase drawing is enabled.

-

Modern Indicators

- -

Modern indicators are stored in a format similar to run length encoding which is efficient in both +

Indicators are stored in a format similar to run length encoding which is efficient in both speed and storage for sparse information.

An indicator may store different values for each range but currently all values are drawn the same. In the future, it may be possible to draw different values in different styles.

@@ -4146,32 +4107,8 @@ struct Sci_TextToFind { This message hides the find indicator.

-

Style Byte Indicators (deprecated)

-

By default, Scintilla organizes the style byte associated with each text byte as 5 bits of - style information (for 32 styles) and 3 bits of indicator information for 3 independent - indicators so that, for example, syntax errors, deprecated names and bad indentation could all - be displayed at once.

- -

The indicators are set using SCI_STARTSTYLING with a INDICS_MASK mask - and SCI_SETSTYLING with the values - INDIC0_MASK, INDIC1_MASK and INDIC2_MASK.

- -

If you are using indicators in a buffer that has a lexer active - (see SCI_SETLEXER), - you must save lexing state information before setting any indicators and restore it afterwards. - Use SCI_GETENDSTYLED - to retrieve the current "styled to" position and - SCI_STARTSTYLING - to reset the styling position and mask (0x1f in the default layout of 5 style bits and 3 indicator bits) - when you are done.

- -

The number of bits used for styles can be altered with SCI_SETSTYLEBITS from 0 to 8 bits. The remaining bits - can be used for indicators, so there can be from 1 to 8 indicators. However, the - INDIC*_MASK constants defined in Scintilla.h all assume 5 bits of - styling information and 3 indicators. If you use a different arrangement, you must define your - own constants.

+

Earlier versions of Scintilla allowed partitioning style bytes + between style numbers and indicators and provided APIs for setting and querying this.

Autocompletion

@@ -5968,7 +5905,6 @@ sptr_t CallScintilla(unsigned int iMessage, uptr_t wParam, sptr_t lParam){ SCI_DESCRIBEKEYWORDSETS(<unused>, char *descriptions)
SCI_SETKEYWORDS(int keyWordSet, const char *keyWordList)
- SCI_GETSTYLEBITSNEEDED
SCI_GETSUBSTYLEBASES(<unused>, char *styles)
SCI_DISTANCETOSECONDARYSTYLES
@@ -6118,11 +6054,6 @@ sptr_t CallScintilla(unsigned int iMessage, uptr_t wParam, sptr_t lParam){

SCI_DESCRIBEKEYWORDSETS(<unused>, char *descriptions)
A description of all of the keyword sets separated by "\n" is returned by SCI_DESCRIBEKEYWORDSETS.

-

SCI_GETSTYLEBITSNEEDED
- Retrieve the number of bits the current lexer needs for styling. This should normally be the argument - to SCI_SETSTYLEBITS. -

-

Substyles

Lexers may support several different sublanguages and each sublanguage may want to style some number of sets of identifiers (or similar lexemes such as documentation keywords) uniquely. Preallocating a large number for each @@ -6441,6 +6372,8 @@ segments then changing the statement #define BEOS 0 to #defin document. The lexer can call ChangeLexerState to signal to the document that it should relex and display more.

+

For StartStyling the mask argument has no effect. It was used in version 3.4.2 and earlier.

+

SetErrorStatus is used to notify the document of exceptions. Exceptions should not be thrown over build boundaries as the two sides may be built with different compilers or incompatible @@ -7481,6 +7414,20 @@ EM_FORMATRANGE SCI_GETUSEPALETTE Deprecated
Scintilla no longer supports palette mode. The last version to support palettes was 2.29. Any calls to these methods should be removed.

+ +

The following are features that should be removed from calling code but are still + defined to avoid breaking callers.

+ +

SCI_SETSTYLEBITS(int bits) Deprecated
+ SCI_GETSTYLEBITS Deprecated
+ SCI_GETSTYLEBITSNEEDED Deprecated
+ INDIC0_MASK, INDIC1_MASK, INDIC2_MASK, INDICS_MASK Deprecated
+ Scintilla no longer supports style byte indicators. The last version to support style byte indicators was 3.4.2. + Any use of these symbols should be removed and replaced with standard indicators. + SCI_GETSTYLEBITS and SCI_GETSTYLEBITSNEEDED always return 8, + indicating that 8 bits are used for styling and there are 256 styles.

+

+

Edit messages never supported by Scintilla

@@ -7517,6 +7464,12 @@ EM_SETTARGETDEVICE
     that makes sense. As it is not intended for use in a word processor, some edit messages can not
     be sensibly handled. Unsupported messages have no effect.

+

Removed features

+ +

Previous versions of Scintilla allowed indicators to be stord in bits of each style byte. + This was deprecated in 2007 and removed in 2014 with release 3.4.3. + All uses of style byte indicators should be replaced with standard indicators.

+

Building Scintilla

To build Scintilla or SciTE, see the README file present in both the Scintilla and SciTE diff --git a/lexers/LexHTML.cxx b/lexers/LexHTML.cxx index f5da934d2..d6b0b31bc 100644 --- a/lexers/LexHTML.cxx +++ b/lexers/LexHTML.cxx @@ -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(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(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); diff --git a/lexers/LexMySQL.cxx b/lexers/LexMySQL.cxx index d3e0033b0..b873ccda1 100644 --- a/lexers/LexMySQL.cxx +++ b/lexers/LexMySQL.cxx @@ -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); diff --git a/lexers/LexPerl.cxx b/lexers/LexPerl.cxx index 8fa516b34..b4a2dd12e 100644 --- a/lexers/LexPerl.cxx +++ b/lexers/LexPerl.cxx @@ -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); diff --git a/lexers/LexRuby.cxx b/lexers/LexRuby.cxx index e19a5147e..f818d3d47 100644 --- a/lexers/LexRuby.cxx +++ b/lexers/LexRuby.cxx @@ -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); diff --git a/lexlib/LexAccessor.h b/lexlib/LexAccessor.h index 45a3a0a93..35e15726c 100644 --- a/lexlib/LexAccessor.h +++ b/lexlib/LexAccessor.h @@ -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(pAccess->StyleAt(position) & mask); + return static_cast(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(chAttr)); } else { - if (chAttr != chWhile) - chFlags = 0; - chAttr = static_cast(chAttr | chFlags); for (unsigned int i = startSeg; i <= pos; i++) { assert((startPosStyling + validLen) < Length()); styleBuf[validLen++] = static_cast(chAttr); diff --git a/lexlib/LexerModule.cxx b/lexlib/LexerModule.cxx index c77b31775..5b25f84ec 100644 --- a/lexlib/LexerModule.cxx +++ b/lexlib/LexerModule.cxx @@ -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(); diff --git a/lexlib/LexerModule.h b/lexlib/LexerModule.h index 35fa30c69..ee092e68f 100644 --- a/lexlib/LexerModule.h +++ b/lexlib/LexerModule.h @@ -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, diff --git a/lexlib/StyleContext.h b/lexlib/StyleContext.h index 9b5ce5dff..837386cef 100644 --- a/lexlib/StyleContext.h +++ b/lexlib/StyleContext.h @@ -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); diff --git a/src/CellBuffer.cxx b/src/CellBuffer.cxx index c05060865..0c56c9e92 100644 --- a/src/CellBuffer.cxx +++ b/src/CellBuffer.cxx @@ -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((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((curVal & ~mask) | styleValue)); + if (curVal != styleValue) { + style.SetValueAt(position, styleValue); changed = true; } position++; diff --git a/src/CellBuffer.h b/src/CellBuffer.h index 6b719de27..f07b45983 100644 --- a/src/CellBuffer.h +++ b/src/CellBuffer.h @@ -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); diff --git a/src/Document.cxx b/src/Document.cxx index 0108669c2..b986a1cfd 100644 --- a/src/Document.cxx +++ b/src/Document.cxx @@ -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(StyleAt(position) & stylingBitsMask); + char styBrace = static_cast(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(StyleAt(position) & stylingBitsMask); + char styAtPos = static_cast(StyleAt(position)); if ((position > GetEndStyled()) || (styAtPos == styBrace)) { if (chAtPos == chBrace) depth++; diff --git a/src/Document.h b/src/Document.h index e2414bd36..8212db674 100644 --- a/src/Document.h +++ b/src/Document.h @@ -206,7 +206,6 @@ private: CellBuffer cb; CharClassify charClass; CaseFolder *pcf; - char stylingMask; int endStyled; int styleClock; int enteredModification; @@ -229,9 +228,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 +365,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); diff --git a/src/Editor.cxx b/src/Editor.cxx index 4966d8efd..7fbe39c38 100644 --- a/src/Editor.cxx +++ b/src/Editor.cxx @@ -885,9 +885,8 @@ bool Editor::RangeContainsProtected(int start, int end) const { start = end; end = t; } - int mask = pdoc->stylingBitsMask; for (int pos = start; pos < end; pos++) { - if (vs.styles[pdoc->StyleAt(pos) & mask].IsProtected()) + if (vs.styles[pdoc->StyleAt(pos)].IsProtected()) return true; } } @@ -916,17 +915,16 @@ SelectionPosition Editor::MovePositionOutsideChar(SelectionPosition pos, int mov if (posMoved != pos.Position()) pos.SetPosition(posMoved); if (vs.ProtectionActive()) { - int mask = pdoc->stylingBitsMask; 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()) && - (vs.styles[pdoc->StyleAt(pos.Position()) & mask].IsProtected())) + (vs.styles[pdoc->StyleAt(pos.Position())].IsProtected())) pos.Add(1); } } 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) && - (vs.styles[pdoc->StyleAt(pos.Position() - 1) & mask].IsProtected())) + (vs.styles[pdoc->StyleAt(pos.Position() - 1)].IsProtected())) pos.Add(-1); } } @@ -2178,7 +2176,6 @@ void Editor::LayoutLine(int line, Surface *surface, ViewStyle &vstyle, LineLayou if (lineLength == ll->numCharsInLine) { // See if chars, styles, indicators, are all the same bool allSame = true; - const int styleMask = pdoc->stylingBitsMask; // Check base line layout char styleByte = 0; int numCharsInLine = 0; @@ -2187,9 +2184,7 @@ void Editor::LayoutLine(int line, Surface *surface, ViewStyle &vstyle, LineLayou char chDoc = pdoc->CharAt(charInDoc); styleByte = pdoc->StyleAt(charInDoc); allSame = allSame && - (ll->styles[numCharsInLine] == static_cast(styleByte & styleMask)); - allSame = allSame && - (ll->indicators[numCharsInLine] == static_cast(styleByte & ~styleMask)); + (ll->styles[numCharsInLine] == static_cast(styleByte)); if (vstyle.styles[ll->styles[numCharsInLine]].caseForce == Style::caseMixed) allSame = allSame && (ll->chars[numCharsInLine] == chDoc); @@ -2223,8 +2218,6 @@ void Editor::LayoutLine(int line, Surface *surface, ViewStyle &vstyle, LineLayou ll->edgeColumn = -1; } - const int styleMask = pdoc->stylingBitsMask; - ll->styleBitsSet = 0; // Fill base line layout const int lineLength = posLineEnd - posLineStart; pdoc->GetCharRange(ll->chars, posLineStart, lineLength); @@ -2233,11 +2226,9 @@ void Editor::LayoutLine(int line, Surface *surface, ViewStyle &vstyle, LineLayou const int numCharsInLine = (vstyle.viewEOL) ? lineLength : numCharsBeforeEOL; for (int styleInLine = 0; styleInLine < numCharsInLine; styleInLine++) { const unsigned char styleByte = ll->styles[styleInLine]; - ll->styleBitsSet |= styleByte; - ll->styles[styleInLine] = styleByte & styleMask; - ll->indicators[styleInLine] = static_cast(styleByte & ~styleMask); + ll->styles[styleInLine] = styleByte; } - 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) { for (int charInLine = 0; charInLinechars[charInLine]; @@ -2251,7 +2242,6 @@ 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 ll->chars[numCharsInLine] = 0; // Also triggers processing in the loops as this is a control character ll->styles[numCharsInLine] = styleByteLast; // For eolFilled - ll->indicators[numCharsInLine] = 0; // Layout the line, determining the position of each character, // with an extra element at the end for the end of the line. @@ -2508,7 +2498,6 @@ void Editor::DrawEOL(Surface *surface, ViewStyle &vsDraw, PRectangle rcLine, Lin bool drawWrapMarkEnd, ColourDesired wrapColour) { const int posLineStart = pdoc->LineStart(line); - const int styleMask = pdoc->stylingBitsMask; PRectangle rcSegment = rcLine; const bool lastSubLine = subLine == (ll->lines - 1); @@ -2523,7 +2512,7 @@ void Editor::DrawEOL(Surface *surface, ViewStyle &vsDraw, PRectangle rcLine, Lin if (virtualSpace) { rcSegment.left = xEol + xStart; rcSegment.right = xEol + xStart + virtualSpace; - surface->FillRectangle(rcSegment, overrideBackground ? background : vsDraw.styles[ll->styles[ll->numCharsInLine] & styleMask].back); + surface->FillRectangle(rcSegment, overrideBackground ? background : vsDraw.styles[ll->styles[ll->numCharsInLine]].back); 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)))); for (size_t r=0; rFillRectangle(rcSegment, background); } else if (line < pdoc->LinesTotal() - 1) { - surface->FillRectangle(rcSegment, vsDraw.styles[ll->styles[ll->numCharsInLine] & styleMask].back); - } else if (vsDraw.styles[ll->styles[ll->numCharsInLine] & styleMask].eolFilled) { - 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]].eolFilled) { + surface->FillRectangle(rcSegment, vsDraw.styles[ll->styles[ll->numCharsInLine]].back); } else { surface->FillRectangle(rcSegment, vsDraw.styles[STYLE_DEFAULT].back); } @@ -2629,8 +2618,8 @@ void Editor::DrawEOL(Surface *surface, ViewStyle &vsDraw, PRectangle rcLine, Lin } else { if (overrideBackground) { surface->FillRectangle(rcSegment, background); - } else if (vsDraw.styles[ll->styles[ll->numCharsInLine] & styleMask].eolFilled) { - surface->FillRectangle(rcSegment, vsDraw.styles[ll->styles[ll->numCharsInLine] & styleMask].back); + } else if (vsDraw.styles[ll->styles[ll->numCharsInLine]].eolFilled) { + surface->FillRectangle(rcSegment, vsDraw.styles[ll->styles[ll->numCharsInLine]].back); } else { surface->FillRectangle(rcSegment, vsDraw.styles[STYLE_DEFAULT].back); } @@ -2672,38 +2661,6 @@ void Editor::DrawIndicators(Surface *surface, ViewStyle &vsDraw, int line, int x const int lineStart = ll->LineStart(subLine); 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) { if (under == vsDraw.indicators[deco->indicator].under) { int startPos = posLineStart + lineStart; @@ -6536,7 +6493,7 @@ void Editor::ButtonDown(Point pt, unsigned int curTime, bool shift, bool ctrl, b } 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) { @@ -8647,12 +8604,11 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) { InvalidateStyleRedraw(); break; case SCI_SETSTYLEBITS: - vs.EnsureStyle((1 << wParam) - 1); - pdoc->SetStylingBits(static_cast(wParam)); + vs.EnsureStyle(0xff); break; case SCI_GETSTYLEBITS: - return pdoc->stylingBits; + return 8; case SCI_SETLINESTATE: return pdoc->SetLineState(static_cast(wParam), static_cast(lParam)); diff --git a/src/PositionCache.cxx b/src/PositionCache.cxx index 2a120c1cf..e425ebe69 100644 --- a/src/PositionCache.cxx +++ b/src/PositionCache.cxx @@ -59,8 +59,6 @@ LineLayout::LineLayout(int maxLineLength_) : edgeColumn(0), chars(0), styles(0), - styleBitsSet(0), - indicators(0), positions(0), hsStart(0), hsEnd(0), @@ -81,7 +79,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 +91,6 @@ void LineLayout::Free() { chars = 0; delete []styles; styles = 0; - delete []indicators; - indicators = 0; delete []positions; positions = 0; delete []lineStarts; diff --git a/src/PositionCache.h b/src/PositionCache.h index d8ea0119d..614c81d38 100644 --- a/src/PositionCache.h +++ b/src/PositionCache.h @@ -39,8 +39,6 @@ public: int edgeColumn; char *chars; unsigned char *styles; - int styleBitsSet; - char *indicators; XYPOSITION *positions; char bracePreviousStyles[2]; diff --git a/src/ScintillaBase.cxx b/src/ScintillaBase.cxx index 9736c52f0..32ad962e8 100644 --- a/src/ScintillaBase.cxx +++ b/src/ScintillaBase.cxx @@ -492,7 +492,6 @@ public: void SetLexerLanguage(const char *languageName); const char *DescribeWordListSets(); void SetWordList(int n, const char *wl); - int GetStyleBitsNeeded() const; const char *GetName() const; void *PrivateCall(int operation, void *pointer); const char *PropertyNames(); @@ -594,10 +593,6 @@ void LexState::SetWordList(int n, const char *wl) { } } -int LexState::GetStyleBitsNeeded() const { - return lexCurrent ? lexCurrent->GetStyleBitsNeeded() : 5; -} - const char *LexState::GetName() const { return lexCurrent ? lexCurrent->languageName : ""; } @@ -740,8 +735,7 @@ void ScintillaBase::NotifyStyleToNeeded(int endStyleNeeded) { void ScintillaBase::NotifyLexerChanged(Document *, void *) { #ifdef SCI_LEXER - int bits = DocumentLexState()->GetStyleBitsNeeded(); - vs.EnsureStyle((1 << bits) - 1); + vs.EnsureStyle(0xff); #endif } @@ -982,7 +976,7 @@ sptr_t ScintillaBase::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lPara DocumentLexState()->PrivateCall(wParam, reinterpret_cast(lParam))); case SCI_GETSTYLEBITSNEEDED: - return DocumentLexState()->GetStyleBitsNeeded(); + return 8; case SCI_PROPERTYNAMES: return StringResult(lParam, DocumentLexState()->PropertyNames()); diff --git a/src/ViewStyle.h b/src/ViewStyle.h index be9d8abfc..4dfb14a33 100644 --- a/src/ViewStyle.h +++ b/src/ViewStyle.h @@ -157,7 +157,7 @@ public: ViewStyle(); ViewStyle(const ViewStyle &source); ~ViewStyle(); - void Init(size_t stylesSize_=64); + void Init(size_t stylesSize_=256); void Refresh(Surface &surface, int tabInChars); void ReleaseAllExtendedStyles(); int AllocateExtendedStyles(int numberStyles); diff --git a/test/simpleTests.py b/test/simpleTests.py index 3ca01f569..2b92d1d66 100644 --- a/test/simpleTests.py +++ b/test/simpleTests.py @@ -57,10 +57,6 @@ class TestSimple(unittest.TestCase): self.ed.StartStyling(0,0xf) self.ed.SetStyling(1, 5) self.assertEquals(self.ed.StyledTextRange(0, 2), b"x\005y\003") - # Set the mask so 0 bit changed but not 2 bit - self.ed.StartStyling(0,0x1) - self.ed.SetStyling(1, 0) - self.assertEquals(self.ed.StyledTextRange(0, 2), b"x\004y\003") self.ed.StartStyling(0,0xff) self.ed.SetStylingEx(2, b"\100\101") -- cgit v1.2.3 From aba660e18c19beaada7cc75c21a81760c0ee976e Mon Sep 17 00:00:00 2001 From: Neil Date: Sat, 24 May 2014 09:39:22 +1000 Subject: Remove suppression that is no longer needed. --- cppcheck.suppress | 1 - 1 file changed, 1 deletion(-) diff --git a/cppcheck.suppress b/cppcheck.suppress index 483822454..10bf9dbf3 100644 --- a/cppcheck.suppress +++ b/cppcheck.suppress @@ -26,7 +26,6 @@ variableScope:scintilla/lexers/LexOpal.cxx variableScope:scintilla/lexers/LexOthers.cxx variableScope:scintilla/lexers/LexPB.cxx noCopyConstructor:scintilla/lexers/LexPerl.cxx -variableScope:scintilla/lexers/LexPS.cxx variableScope:scintilla/lexers/LexRuby.cxx uninitMemberVar:scintilla/lexers/LexRuby.cxx variableScope:scintilla/lexers/LexSpecman.cxx -- cgit v1.2.3 From 0e25a153a1970e5b895072f265c02bac9fd7f3fa Mon Sep 17 00:00:00 2001 From: Neil Date: Sat, 24 May 2014 10:20:06 +1000 Subject: SCI_AUTOCSETMULTI allows setting whether autocompletion text is inserted at each selection when multiple selections are active. From Mitchell Foral. --- doc/ScintillaDoc.html | 10 +++++++++- doc/ScintillaHistory.html | 4 ++++ include/Scintilla.h | 4 ++++ include/Scintilla.iface | 10 ++++++++++ src/ScintillaBase.cxx | 34 +++++++++++++++++++++++++++++++--- src/ScintillaBase.h | 1 + 6 files changed, 59 insertions(+), 4 deletions(-) diff --git a/doc/ScintillaDoc.html b/doc/ScintillaDoc.html index e0880b071..7187eeb24 100644 --- a/doc/ScintillaDoc.html +++ b/doc/ScintillaDoc.html @@ -82,7 +82,7 @@

Scintilla Documentation

-

Last edited 1 May 2014 NH

+

Last edited 24 May 2014 NH

There is an overview of the internal design of Scintilla.
@@ -4160,6 +4160,8 @@ struct Sci_TextToFind { SCI_AUTOCGETIGNORECASE
SCI_AUTOCSETCASEINSENSITIVEBEHAVIOUR(int behaviour)
SCI_AUTOCGETCASEINSENSITIVEBEHAVIOUR
+ SCI_AUTOCSETMULTI(int multi)
+ SCI_AUTOCGETMULTI
SCI_AUTOCSETORDER(int order)
SCI_AUTOCGETORDER
SCI_AUTOCSETAUTOHIDE(bool autoHide)
@@ -4277,6 +4279,12 @@ struct Sci_TextToFind { This corresponds to a behaviour property of SC_CASEINSENSITIVEBEHAVIOUR_RESPECTCASE (0). If you want autocompletion to ignore case at all, choose SC_CASEINSENSITIVEBEHAVIOUR_IGNORECASE (1).

+

SCI_AUTOCSETMULTI(int multi)
+ SCI_AUTOCGETMULTI
+ When autocompleting with multiple selections present, the autocompleted text can go into just the main selection with + SC_MULTIAUTOC_ONCE (0) or into each selection with SC_MULTIAUTOC_EACH (1). + The default is SC_MULTIAUTOC_ONCE.

+

SCI_AUTOCSETORDER(int order)
SCI_AUTOCGETORDER
The default setting SC_ORDER_PRESORTED (0) requires that the list be provided in alphabetical sorted order. diff --git a/doc/ScintillaHistory.html b/doc/ScintillaHistory.html index f23191ff2..78cbeaa5d 100644 --- a/doc/ScintillaHistory.html +++ b/doc/ScintillaHistory.html @@ -467,6 +467,10 @@ Released 22 May 2014.

  • + When multiple selections are active, autocompletion text may be inserted at each selection with new + SCI_AUTOCSETMULTI method. +
  • +
  • C++ lexer fixes raw string recognition so that R"xxx(blah)xxx" is styled as SCE_C_STRINGRAW.
  • diff --git a/include/Scintilla.h b/include/Scintilla.h index f8744c1c0..9bb0ca905 100644 --- a/include/Scintilla.h +++ b/include/Scintilla.h @@ -717,6 +717,10 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam, #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 diff --git a/include/Scintilla.iface b/include/Scintilla.iface index f6b17bca8..3e5f51b9c 100644 --- a/include/Scintilla.iface +++ b/include/Scintilla.iface @@ -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 diff --git a/src/ScintillaBase.cxx b/src/ScintillaBase.cxx index 32ad962e8..e39b5e2a8 100644 --- a/src/ScintillaBase.cxx +++ b/src/ScintillaBase.cxx @@ -57,6 +57,7 @@ ScintillaBase::ScintillaBase() { displayPopupMenu = true; listType = 0; maxListWidth = 0; + multiAutoCMode = SC_MULTIAUTOC_ONCE; } ScintillaBase::~ScintillaBase() { @@ -197,9 +198,29 @@ void ScintillaBase::AutoCompleteDoubleClick(void *p) { void ScintillaBase::AutoCompleteInsert(Position startPos, int removeLen, const char *text, int textLen) { UndoGroup ug(pdoc); - pdoc->DeleteChars(startPos, removeLen); - const int lengthInserted = pdoc->InsertString(startPos, text, textLen); - SetEmptySelection(startPos + lengthInserted); + if (multiAutoCMode == SC_MULTIAUTOC_ONCE) { + pdoc->DeleteChars(startPos, removeLen); + const int lengthInserted = pdoc->InsertString(startPos, text, textLen); + SetEmptySelection(startPos + lengthInserted); + } else { + // SC_MULTIAUTOC_EACH + for (size_t r=0; r= 0) { + pdoc->DeleteChars(positionInsert - removeLen, 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) { @@ -813,6 +834,13 @@ sptr_t ScintillaBase::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lPara case SCI_AUTOCGETCASEINSENSITIVEBEHAVIOUR: return ac.ignoreCaseBehaviour; + case SCI_AUTOCSETMULTI: + multiAutoCMode = static_cast(wParam); + break; + + case SCI_AUTOCGETMULTI: + return multiAutoCMode; + case SCI_AUTOCSETORDER: ac.autoSort = static_cast(wParam); break; diff --git a/src/ScintillaBase.h b/src/ScintillaBase.h index 59ffea41e..8440ebecc 100644 --- a/src/ScintillaBase.h +++ b/src/ScintillaBase.h @@ -46,6 +46,7 @@ protected: int listType; ///< 0 is an autocomplete list int maxListWidth; /// Maximum width of list, in average character widths + int multiAutoCMode; /// Mode for autocompleting when multiple selections are present #ifdef SCI_LEXER LexState *DocumentLexState(); -- cgit v1.2.3 From b0296d86a48642f2f381c3e0b11a022482ae25e3 Mon Sep 17 00:00:00 2001 From: Neil Date: Sat, 24 May 2014 15:15:49 +1000 Subject: Header include statements are now in a standardised order with that order defined in scripts/HeaderOrder.txt. --- cocoa/PlatCocoa.h | 8 +-- cocoa/PlatCocoa.mm | 20 ++++--- cocoa/ScintillaCocoa.h | 8 +-- gtk/ScintillaGTK.cxx | 28 +++++----- lexers/LexCPP.cxx | 2 +- lexers/LexDMIS.cxx | 6 +- lexers/LexECL.cxx | 2 +- lexers/LexEScript.cxx | 2 +- lexers/LexHaskell.cxx | 2 +- lexers/LexRust.cxx | 2 +- lexers/LexSpecman.cxx | 2 +- lexers/LexVHDL.cxx | 2 +- lexers/LexVisualProlog.cxx | 2 +- lexlib/Accessor.cxx | 2 +- lexlib/CharacterSet.cxx | 2 +- lexlib/LexerBase.cxx | 2 +- lexlib/LexerModule.cxx | 2 +- lexlib/LexerNoExceptions.cxx | 2 +- lexlib/LexerSimple.cxx | 2 +- lexlib/StyleContext.cxx | 2 +- lexlib/WordList.cxx | 2 +- scripts/HeaderOrder.txt | 128 +++++++++++++++++++++++++++++++++++++++++++ src/CaseFolder.cxx | 2 +- src/Catalogue.cxx | 2 +- src/Document.cxx | 4 +- src/Editor.cxx | 2 +- src/ExternalLexer.cxx | 2 +- src/Indicator.cxx | 2 +- src/PositionCache.cxx | 2 +- src/ScintillaBase.cxx | 11 +++- win32/PlatWin.cxx | 2 +- win32/ScintillaWin.cxx | 23 ++++---- 32 files changed, 210 insertions(+), 72 deletions(-) create mode 100644 scripts/HeaderOrder.txt diff --git a/cocoa/PlatCocoa.h b/cocoa/PlatCocoa.h index 06b7a1f5b..60977c92e 100644 --- a/cocoa/PlatCocoa.h +++ b/cocoa/PlatCocoa.h @@ -7,14 +7,14 @@ #ifndef PLATCOCOA_H #define PLATCOCOA_H -#include -#include -#include - #include #include +#include +#include +#include + #include #include "QuartzTextLayout.h" diff --git a/cocoa/PlatCocoa.mm b/cocoa/PlatCocoa.mm index a0a0e8943..2225631a6 100644 --- a/cocoa/PlatCocoa.mm +++ b/cocoa/PlatCocoa.mm @@ -12,25 +12,27 @@ * This file is dual licensed under LGPL v2.1 and the Scintilla license (http://www.scintilla.org/License.txt). */ -#import "Platform.h" -#import "ScintillaView.h" -#import "ScintillaCocoa.h" -#import "PlatCocoa.h" +#include +#include +#include #include #include -#include -#include -#include + #include #include #include +#import + +#import "Platform.h" +#import "ScintillaView.h" +#import "ScintillaCocoa.h" +#import "PlatCocoa.h" + #include "StringCopy.h" #include "XPM.h" -#import - using namespace Scintilla; extern sptr_t scintilla_send_message(void* sci, unsigned int iMessage, uptr_t wParam, sptr_t lParam); diff --git a/cocoa/ScintillaCocoa.h b/cocoa/ScintillaCocoa.h index 7e4ed7214..8fa2d196b 100644 --- a/cocoa/ScintillaCocoa.h +++ b/cocoa/ScintillaCocoa.h @@ -14,11 +14,11 @@ */ #include -#include #include -#include #include +#include +#include #include #include @@ -40,18 +40,18 @@ #include "XPM.h" #include "LineMarker.h" #include "Style.h" -#include "AutoComplete.h" #include "ViewStyle.h" #include "CharClassify.h" #include "Decoration.h" #include "CaseFolder.h" #include "Document.h" +#include "CaseConvert.h" #include "Selection.h" #include "PositionCache.h" #include "Editor.h" +#include "AutoComplete.h" #include "ScintillaBase.h" -#include "CaseConvert.h" extern "C" NSString* ScintillaRecPboardType; diff --git a/gtk/ScintillaGTK.cxx b/gtk/ScintillaGTK.cxx index 17a439952..f74971b1b 100644 --- a/gtk/ScintillaGTK.cxx +++ b/gtk/ScintillaGTK.cxx @@ -6,9 +6,9 @@ #include #include #include -#include #include #include +#include #include #include @@ -16,15 +16,17 @@ #include #include +#include +#include #include #include -#include "Platform.h" - -#if PLAT_GTK_WIN32 +#if defined(__WIN32__) || defined(_MSC_VER) #include #endif +#include "Platform.h" + #include "ILexer.h" #include "Scintilla.h" #include "ScintillaWidget.h" @@ -32,6 +34,9 @@ #include "SciLexer.h" #endif #include "StringCopy.h" +#ifdef SCI_LEXER +#include "LexerModule.h" +#endif #include "SplitVector.h" #include "Partitioning.h" #include "RunStyles.h" @@ -43,28 +48,25 @@ #include "XPM.h" #include "LineMarker.h" #include "Style.h" -#include "AutoComplete.h" #include "ViewStyle.h" -#include "Decoration.h" #include "CharClassify.h" +#include "Decoration.h" #include "CaseFolder.h" #include "Document.h" +#include "CaseConvert.h" +#include "UniConversion.h" #include "Selection.h" #include "PositionCache.h" #include "Editor.h" +#include "AutoComplete.h" #include "ScintillaBase.h" -#include "UniConversion.h" -#include "CaseConvert.h" - -#include "scintilla-marshal.h" #ifdef SCI_LEXER -#include -#include -#include "LexerModule.h" #include "ExternalLexer.h" #endif +#include "scintilla-marshal.h" + #include "Converter.h" #if defined(__clang__) diff --git a/lexers/LexCPP.cxx b/lexers/LexCPP.cxx index e8b705b1f..b8b48aa52 100644 --- a/lexers/LexCPP.cxx +++ b/lexers/LexCPP.cxx @@ -8,10 +8,10 @@ #include #include -#include #include #include #include +#include #include #include diff --git a/lexers/LexDMIS.cxx b/lexers/LexDMIS.cxx index 7f23ba96b..a903e9da6 100644 --- a/lexers/LexDMIS.cxx +++ b/lexers/LexDMIS.cxx @@ -13,14 +13,14 @@ #include #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; diff --git a/lexers/LexECL.cxx b/lexers/LexECL.cxx index 6a08d58c2..d8065f722 100644 --- a/lexers/LexECL.cxx +++ b/lexers/LexECL.cxx @@ -7,10 +7,10 @@ #include #include -#include #include #include #include +#include #ifdef _MSC_VER #pragma warning(disable: 4786) diff --git a/lexers/LexEScript.cxx b/lexers/LexEScript.cxx index 9a7560e1e..28466bc8e 100644 --- a/lexers/LexEScript.cxx +++ b/lexers/LexEScript.cxx @@ -6,10 +6,10 @@ #include #include -#include #include #include #include +#include #include "ILexer.h" #include "Scintilla.h" diff --git a/lexers/LexHaskell.cxx b/lexers/LexHaskell.cxx index e10cb8c81..24355fa4e 100644 --- a/lexers/LexHaskell.cxx +++ b/lexers/LexHaskell.cxx @@ -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; diff --git a/lexers/LexRust.cxx b/lexers/LexRust.cxx index bf59933af..8a3020532 100644 --- a/lexers/LexRust.cxx +++ b/lexers/LexRust.cxx @@ -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; diff --git a/lexers/LexSpecman.cxx b/lexers/LexSpecman.cxx index 1b96482ea..918edaf98 100644 --- a/lexers/LexSpecman.cxx +++ b/lexers/LexSpecman.cxx @@ -8,10 +8,10 @@ #include #include -#include #include #include #include +#include #include "ILexer.h" #include "Scintilla.h" diff --git a/lexers/LexVHDL.cxx b/lexers/LexVHDL.cxx index 88d8efb27..189416425 100644 --- a/lexers/LexVHDL.cxx +++ b/lexers/LexVHDL.cxx @@ -12,10 +12,10 @@ #include #include -#include #include #include #include +#include #include "ILexer.h" #include "Scintilla.h" diff --git a/lexers/LexVisualProlog.cxx b/lexers/LexVisualProlog.cxx index 0acdb26a1..24e19e24e 100644 --- a/lexers/LexVisualProlog.cxx +++ b/lexers/LexVisualProlog.cxx @@ -13,10 +13,10 @@ #include #include -#include #include #include #include +#include #ifdef _MSC_VER #pragma warning(disable: 4786) diff --git a/lexlib/Accessor.cxx b/lexlib/Accessor.cxx index 61661626f..f67737d4d 100644 --- a/lexlib/Accessor.cxx +++ b/lexlib/Accessor.cxx @@ -8,9 +8,9 @@ #include #include #include -#include #include #include +#include #include "ILexer.h" #include "Scintilla.h" diff --git a/lexlib/CharacterSet.cxx b/lexlib/CharacterSet.cxx index 2f41df116..0ab2cc0cc 100644 --- a/lexlib/CharacterSet.cxx +++ b/lexlib/CharacterSet.cxx @@ -9,8 +9,8 @@ #include #include #include -#include #include +#include #include "CharacterSet.h" diff --git a/lexlib/LexerBase.cxx b/lexlib/LexerBase.cxx index 0e86562bf..bbef3f159 100644 --- a/lexlib/LexerBase.cxx +++ b/lexlib/LexerBase.cxx @@ -8,9 +8,9 @@ #include #include #include -#include #include #include +#include #include "ILexer.h" #include "Scintilla.h" diff --git a/lexlib/LexerModule.cxx b/lexlib/LexerModule.cxx index 5b25f84ec..6cefbee77 100644 --- a/lexlib/LexerModule.cxx +++ b/lexlib/LexerModule.cxx @@ -8,9 +8,9 @@ #include #include #include -#include #include #include +#include #include diff --git a/lexlib/LexerNoExceptions.cxx b/lexlib/LexerNoExceptions.cxx index 5f31f2268..9ebae2af0 100644 --- a/lexlib/LexerNoExceptions.cxx +++ b/lexlib/LexerNoExceptions.cxx @@ -8,9 +8,9 @@ #include #include #include -#include #include #include +#include #include "ILexer.h" #include "Scintilla.h" diff --git a/lexlib/LexerSimple.cxx b/lexlib/LexerSimple.cxx index 5489ab886..4d0e178ca 100644 --- a/lexlib/LexerSimple.cxx +++ b/lexlib/LexerSimple.cxx @@ -8,9 +8,9 @@ #include #include #include -#include #include #include +#include #include diff --git a/lexlib/StyleContext.cxx b/lexlib/StyleContext.cxx index ec0c5047c..9429c5ba8 100644 --- a/lexlib/StyleContext.cxx +++ b/lexlib/StyleContext.cxx @@ -8,8 +8,8 @@ #include #include #include -#include #include +#include #include "ILexer.h" diff --git a/lexlib/WordList.cxx b/lexlib/WordList.cxx index 10b6fe349..68b384a95 100644 --- a/lexlib/WordList.cxx +++ b/lexlib/WordList.cxx @@ -8,8 +8,8 @@ #include #include #include -#include #include +#include #include diff --git a/scripts/HeaderOrder.txt b/scripts/HeaderOrder.txt new file mode 100644 index 000000000..96af584d3 --- /dev/null +++ b/scripts/HeaderOrder.txt @@ -0,0 +1,128 @@ +// Define the standard order in which to include header files +// All platform headers should be included before Scintilla headers +// and each of these groups are then divided into directory groups. + +// C standard library +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +// C++ wrappers of C standard library +#include +#include +#include +#include +#include + +// C++ standard library +#include +#include +#include +#include +#include +#include +#include +#include + +// GTK+ headers +#include +#include +#include +#include +#include + +// Windows headers +#include +#include +#include +#include +#include +#include +#include +#include + +// Cocoa headers +#include + +// Scintilla headers + +// Non-platform-specific headers + +// include +#include "Platform.h" + +#include "ILexer.h" +#include "Scintilla.h" +#include "ScintillaWidget.h" + +#include "SciLexer.h" + +// lexlib +#include "StringCopy.h" +#include "PropSetSimple.h" +#include "WordList.h" +#include "LexAccessor.h" +#include "Accessor.h" +#include "StyleContext.h" +#include "CharacterSet.h" +#include "CharacterCategory.h" +#include "LexerModule.h" +#include "OptionSet.h" +#include "SparseState.h" +#include "SubStyles.h" +#include "LexerBase.h" +#include "LexerSimple.h" +#include "LexerNoExceptions.h" + +// src +#include "Catalogue.h" + +#include "SplitVector.h" +#include "Partitioning.h" +#include "RunStyles.h" +#include "ContractionState.h" +#include "CellBuffer.h" +#include "CallTip.h" +#include "KeyMap.h" +#include "Indicator.h" +#include "XPM.h" +#include "LineMarker.h" +#include "Style.h" +#include "ViewStyle.h" +#include "CharClassify.h" +#include "Decoration.h" +#include "CaseFolder.h" +#include "Document.h" +#include "CaseConvert.h" +#include "UniConversion.h" +#include "UnicodeFromUTF8.h" +#include "Selection.h" +#include "PositionCache.h" +#include "FontQuality.h" +#include "Editor.h" + +#include "AutoComplete.h" +#include "ScintillaBase.h" + +#include "ExternalLexer.h" + +// Platform-specific headers + +// win32 +#include "PlatWin.h" + +// gtk +#include "Converter.h" + +// cocoa +#include "QuartzTextStyle.h" +#include "QuartzTextStyleAttribute.h" +#import "InfoBarCommunicator.h" +#include "InfoBar.h" diff --git a/src/CaseFolder.cxx b/src/CaseFolder.cxx index 44a94da6f..200ac99b8 100644 --- a/src/CaseFolder.cxx +++ b/src/CaseFolder.cxx @@ -8,9 +8,9 @@ #include #include +#include "CaseFolder.h" #include "CaseConvert.h" #include "UniConversion.h" -#include "CaseFolder.h" #ifdef SCI_NAMESPACE using namespace Scintilla; diff --git a/src/Catalogue.cxx b/src/Catalogue.cxx index c507296d2..ac1fc3818 100644 --- a/src/Catalogue.cxx +++ b/src/Catalogue.cxx @@ -8,9 +8,9 @@ #include #include #include -#include #include #include +#include #include diff --git a/src/Document.cxx b/src/Document.cxx index b986a1cfd..32d5f1896 100644 --- a/src/Document.cxx +++ b/src/Document.cxx @@ -8,8 +8,8 @@ #include #include #include -#include #include +#include #include #include @@ -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" diff --git a/src/Editor.cxx b/src/Editor.cxx index 7fbe39c38..63d45158b 100644 --- a/src/Editor.cxx +++ b/src/Editor.cxx @@ -8,9 +8,9 @@ #include #include #include -#include #include #include +#include #include #include diff --git a/src/ExternalLexer.cxx b/src/ExternalLexer.cxx index 682320889..25d83ceb8 100644 --- a/src/ExternalLexer.cxx +++ b/src/ExternalLexer.cxx @@ -8,8 +8,8 @@ #include #include #include -#include #include +#include #include diff --git a/src/Indicator.cxx b/src/Indicator.cxx index 63735d480..e51067a38 100644 --- a/src/Indicator.cxx +++ b/src/Indicator.cxx @@ -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; diff --git a/src/PositionCache.cxx b/src/PositionCache.cxx index e425ebe69..0d2033bb9 100644 --- a/src/PositionCache.cxx +++ b/src/PositionCache.cxx @@ -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" diff --git a/src/ScintillaBase.cxx b/src/ScintillaBase.cxx index e39b5e2a8..9430a54e0 100644 --- a/src/ScintillaBase.cxx +++ b/src/ScintillaBase.cxx @@ -8,8 +8,8 @@ #include #include #include -#include #include +#include #include #include @@ -21,12 +21,17 @@ #include "ILexer.h" #include "Scintilla.h" -#include "PropSetSimple.h" #ifdef SCI_LEXER #include "SciLexer.h" +#endif + +#include "PropSetSimple.h" + +#ifdef SCI_LEXER #include "LexerModule.h" #include "Catalogue.h" #endif + #include "SplitVector.h" #include "Partitioning.h" #include "RunStyles.h" @@ -39,7 +44,6 @@ #include "LineMarker.h" #include "Style.h" #include "ViewStyle.h" -#include "AutoComplete.h" #include "CharClassify.h" #include "Decoration.h" #include "CaseFolder.h" @@ -47,6 +51,7 @@ #include "Selection.h" #include "PositionCache.h" #include "Editor.h" +#include "AutoComplete.h" #include "ScintillaBase.h" #ifdef SCI_NAMESPACE diff --git a/win32/PlatWin.cxx b/win32/PlatWin.cxx index 082a177e6..9eb45e804 100644 --- a/win32/PlatWin.cxx +++ b/win32/PlatWin.cxx @@ -8,10 +8,10 @@ #include #include #include -#include #include #include #include +#include #include #include diff --git a/win32/ScintillaWin.cxx b/win32/ScintillaWin.cxx index 07f801a78..a83c92ef6 100644 --- a/win32/ScintillaWin.cxx +++ b/win32/ScintillaWin.cxx @@ -8,8 +8,8 @@ #include #include #include -#include #include +#include #include #include @@ -26,6 +26,8 @@ #include #include #include +#include +#include #if defined(NTDDI_WIN7) && !defined(DISABLE_D2D) #define USE_D2D 1 @@ -43,9 +45,11 @@ #ifdef SCI_LEXER #include "SciLexer.h" -#include "LexerModule.h" #endif #include "StringCopy.h" +#ifdef SCI_LEXER +#include "LexerModule.h" +#endif #include "SplitVector.h" #include "Partitioning.h" #include "RunStyles.h" @@ -57,25 +61,26 @@ #include "XPM.h" #include "LineMarker.h" #include "Style.h" -#include "AutoComplete.h" #include "ViewStyle.h" #include "CharClassify.h" #include "Decoration.h" #include "CaseFolder.h" #include "Document.h" +#include "CaseConvert.h" +#include "UniConversion.h" #include "Selection.h" #include "PositionCache.h" #include "Editor.h" -#include "ScintillaBase.h" -#include "UniConversion.h" -#include "CaseConvert.h" -#include "PlatWin.h" +#include "AutoComplete.h" +#include "ScintillaBase.h" #ifdef SCI_LEXER #include "ExternalLexer.h" #endif +#include "PlatWin.h" + #ifndef SPI_GETWHEELSCROLLLINES #define SPI_GETWHEELSCROLLLINES 104 #endif @@ -88,10 +93,6 @@ #define UNICODE_NOCHAR 0xFFFF #endif -#include -#include -#include - #ifndef MK_ALT #define MK_ALT 32 #endif -- cgit v1.2.3 From 8b447b76bbc110e055a0637657f5f00c65cc98dd Mon Sep 17 00:00:00 2001 From: Neil Hodgson Date: Sun, 25 May 2014 08:53:25 +1000 Subject: Handle cases where multiple selection autocompletion requires removing previous text. From Mitchell Foral. --- src/ScintillaBase.cxx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/ScintillaBase.cxx b/src/ScintillaBase.cxx index 9430a54e0..d42dfc7ff 100644 --- a/src/ScintillaBase.cxx +++ b/src/ScintillaBase.cxx @@ -215,7 +215,8 @@ void ScintillaBase::AutoCompleteInsert(Position startPos, int removeLen, const c int positionInsert = sel.Range(r).Start().Position(); positionInsert = InsertSpace(positionInsert, sel.Range(r).caret.VirtualSpace()); if (positionInsert - removeLen >= 0) { - pdoc->DeleteChars(positionInsert - removeLen, removeLen); + positionInsert -= removeLen; + pdoc->DeleteChars(positionInsert, removeLen); } const int lengthInserted = pdoc->InsertString(positionInsert, text, textLen); if (lengthInserted > 0) { -- cgit v1.2.3