diff options
53 files changed, 400 insertions, 385 deletions
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 <cstring> -#include <cstdio> -#include <cstdlib> - #include <assert.h> #include <sys/time.h> +#include <cstdlib> +#include <cstring> +#include <cstdio> + #include <Cocoa/Cocoa.h> #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 <assert.h> +#include <sys/time.h> +#include <cstdlib> #include <cstring> #include <cstdio> -#include <cstdlib> -#include <assert.h> -#include <sys/time.h> + #include <stdexcept> #include <vector> #include <map> +#import <Foundation/NSGeometry.h> + +#import "Platform.h" +#import "ScintillaView.h" +#import "ScintillaCocoa.h" +#import "PlatCocoa.h" + #include "StringCopy.h" #include "XPM.h" -#import <Foundation/NSGeometry.h> - 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 <stdlib.h> -#include <string> #include <stdio.h> -#include <ctype.h> #include <time.h> +#include <ctype.h> +#include <string> #include <vector> #include <map> @@ -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/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
diff --git a/doc/ScintillaDoc.html b/doc/ScintillaDoc.html index 5350e8537..7187eeb24 100644 --- a/doc/ScintillaDoc.html +++ b/doc/ScintillaDoc.html @@ -82,7 +82,7 @@ <h1>Scintilla Documentation</h1> - <p>Last edited 1 May 2014 NH</p> + <p>Last edited 24 May 2014 NH</p> <p>There is <a class="jump" href="Design.html">an overview of the internal design of Scintilla</a>.<br /> @@ -364,20 +364,9 @@ <h2 id="TextRetrievalAndModification">Text retrieval and modification</h2> - <p>Each byte in a Scintilla document is followed by an associated byte of styling + <p>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 - <a class="message" href ="#SCI_INDICATORFILLRANGE">SCI_INDICATORFILLRANGE</a> - and related calls. - The default split is with the index in the low 5 bits and 3 high bits as <a class="jump" - href="#Indicators">indicators</a>. 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 <a class="message" - href="#SCI_SETSTYLEBITS"><code>SCI_SETSTYLEBITS</code></a> up to a maximum of 8 bits. - The remaining bits can be used for indicators.</p> + are interpreted an index into an array of styles.</p> <p>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.</p> @@ -421,8 +410,6 @@ <a class="message" href="#SCI_GETSTYLEAT">SCI_GETSTYLEAT(int position)</a><br /> <a class="message" href="#SCI_GETSTYLEDTEXT">SCI_GETSTYLEDTEXT(<unused>, Sci_TextRange *tr)</a><br /> - <a class="message" href="#SCI_SETSTYLEBITS">SCI_SETSTYLEBITS(int bits)</a><br /> - <a class="message" href="#SCI_GETSTYLEBITS">SCI_GETSTYLEBITS</a><br /> <a class="message" href="#SCI_RELEASEALLEXTENDEDSTYLES">SCI_RELEASEALLEXTENDEDSTYLES</a><br /> <a class="message" href="#SCI_ALLOCATEEXTENDEDSTYLES">SCI_ALLOCATEEXTENDEDSTYLES(int numberStyles)</a><br /> <a class="message" href="#SCI_TARGETASUTF8">SCI_TARGETASUTF8(<unused>, char *s)</a><br /> @@ -570,14 +557,6 @@ This returns the style at <code>pos</code> in the document, or 0 if <code>pos</code> is negative or past the end of the document.</p> - <p><b id="SCI_SETSTYLEBITS">SCI_SETSTYLEBITS(int bits)</b><br /> - <b id="SCI_GETSTYLEBITS">SCI_GETSTYLEBITS</b><br /> - 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 <code>SCI_SETSTYLEBITS(5)</code>. - The number of styling bits needed by the current lexer can be found with - <a class="message" href="#SCI_GETSTYLEBITSNEEDED">SCI_GETSTYLEBITSNEEDED</a>.</p> - <p><b id="SCI_RELEASEALLEXTENDEDSTYLES">SCI_RELEASEALLEXTENDEDSTYLES</b><br /> <b id="SCI_ALLOCATEEXTENDEDSTYLES">SCI_ALLOCATEEXTENDEDSTYLES(int numberStyles)</b><br /> Extended styles are used for features like textual margins and annotations as well as internally by Scintilla. @@ -2329,12 +2308,7 @@ struct Sci_TextToFind { <h2 id="Styling">Styling</h2> - <p>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 = <a class="jump" - href="#StyleDefinition">styles 0 to 31</a>) that set a style and three bits (5 to 7) that - define <a class="jump" href="#Indicators">indicators</a>. You can change the balance between - styles and indicators with <a class="message" - href="#SCI_SETSTYLEBITS"><code>SCI_SETSTYLEBITS</code></a>. If your styling needs can be met by + <p>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 <a class="message" href="#SCI_SETLEXER"><code>SCI_SETLEXER</code></a> 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.</p> <code><a class="message" href="#SCI_GETENDSTYLED">SCI_GETENDSTYLED</a><br /> - <a class="message" href="#SCI_STARTSTYLING">SCI_STARTSTYLING(int position, int mask)</a><br /> + <a class="message" href="#SCI_STARTSTYLING">SCI_STARTSTYLING(int position, int unused)</a><br /> <a class="message" href="#SCI_SETSTYLING">SCI_SETSTYLING(int length, int style)</a><br /> <a class="message" href="#SCI_SETSTYLINGEX">SCI_SETSTYLINGEX(int length, const char *styles)</a><br /> @@ -2363,31 +2337,23 @@ struct Sci_TextToFind { container. The container can send <code>SCI_GETENDSTYLED</code> to work out where it needs to start styling. Scintilla will always ask to style whole lines.</p> - <p><b id="SCI_STARTSTYLING">SCI_STARTSTYLING(int pos, int mask)</b><br /> - This prepares for styling by setting the styling position <code>pos</code> to start at and a - <code>mask</code> 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 <code>mask</code> value - of 31 (0x1f) if you were setting text styles and did not want to change the indicators. After + <p><b id="SCI_STARTSTYLING">SCI_STARTSTYLING(int pos, int unused)</b><br /> + This prepares for styling by setting the styling position <code>pos</code> to start at. + The unused argument was used in earlier versions but is now ignored. + After <code>SCI_STARTSTYLING</code>, send multiple <code>SCI_SETSTYLING</code> messages for each lexical entity to style.</p> <p><b id="SCI_SETSTYLING">SCI_SETSTYLING(int length, int style)</b><br /> This message sets the style of <code>length</code> characters starting at the styling position - and then increases the styling position by <code>length</code>, ready for the next call. If - <code>sCell</code> is the style byte, the operation is:<br /> - <code>if ((sCell & mask) != style) sCell = (sCell & ~mask) | (style & - mask);</code><br /> + and then increases the styling position by <code>length</code>, ready for the next call.<br /> </p> <p><b id="SCI_SETSTYLINGEX">SCI_SETSTYLINGEX(int length, const char *styles)</b><br /> As an alternative to <code>SCI_SETSTYLING</code>, which applies the same style to each byte, you can use this message which specifies the styles for each of <code>length</code> bytes from the styling position and then increases the styling position by <code>length</code>, ready for - the next call. The <code>length</code> styling bytes pointed at by <code>styles</code> should - not contain any bits not set in mask.</p> + the next call.</p> <p><b id="SCI_SETLINESTATE">SCI_SETLINESTATE(int line, int value)</b><br /> <b id="SCI_GETLINESTATE">SCI_GETLINESTATE(int line)</b><br /> @@ -2405,9 +2371,8 @@ struct Sci_TextToFind { <p>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 <code>STYLE_MAX</code> (255). Unless you use <a - class="message" href="#SCI_SETSTYLEBITS"><code>SCI_SETSTYLEBITS</code></a> 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 <code>STYLE_MAX</code> (255). + There are also some predefined numbered styles starting at 32, The following <code>STYLE_</code>* constants are defined.</p> @@ -2504,9 +2469,7 @@ struct Sci_TextToFind { <td>255</td> <td>This is not a style but is the number of the maximum style that can be set. Styles - between <code>STYLE_LASTPREDEFINED</code> and <code>STYLE_MAX</code> would be appropriate - if you used <a class="message" href="#SCI_SETSTYLEBITS"><code>SCI_SETSTYLEBITS</code></a> - to set more than 5 style bits.</td> + between <code>STYLE_LASTPREDEFINED</code> and <code>STYLE_MAX</code> may be used.</td> </tr> </tbody> </table> @@ -3196,9 +3159,6 @@ struct Sci_TextToFind { </p> <h2 id="OtherSettings">Other settings</h2> - <code><a class="message" href="#SCI_SETUSEPALETTE">SCI_SETUSEPALETTE(bool - allowPaletteUse)</a><br /> - <a class="message" href="#SCI_GETUSEPALETTE">SCI_GETUSEPALETTE</a><br /> <a class="message" href="#SCI_SETBUFFEREDDRAW">SCI_SETBUFFEREDDRAW(bool isBuffered)</a><br /> <a class="message" href="#SCI_GETBUFFEREDDRAW">SCI_GETBUFFEREDDRAW</a><br /> <a class="message" href="#SCI_SETTWOPHASEDRAW">SCI_SETTWOPHASEDRAW(bool twoPhase)</a><br /> @@ -3839,10 +3799,7 @@ struct Sci_TextToFind { <p>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.</p> + by drawing underlines under text or boxes around text.</p> <p>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.</p> @@ -3853,6 +3810,12 @@ struct Sci_TextToFind { by lexers (0..7) and a range for use by containers (8=<code>INDIC_CONTAINER</code> .. 31=<code>INDIC_MAX</code>).</p> + <p>Originally, Scintilla used a different technique for indicators but this + has been <a href="#RemovedFeatures">removed</a> + and the APIs perform <a href="#StyleByteIndicators">no action</a>. + While both techniques were supported, the term "modern indicators" was used for the + newer implementation.</p> + <code><a class="message" href="#SCI_INDICSETSTYLE">SCI_INDICSETSTYLE(int indicatorNumber, int indicatorStyle)</a><br /> <a class="message" href="#SCI_INDICGETSTYLE">SCI_INDICGETSTYLE(int indicatorNumber)</a><br /> @@ -4074,12 +4037,10 @@ struct Sci_TextToFind { <p><b id="SCI_INDICSETUNDER">SCI_INDICSETUNDER(int indicatorNumber, bool under)</b><br /> <b id="SCI_INDICGETUNDER">SCI_INDICGETUNDER(int indicatorNumber)</b><br /> 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 <a class="message" href="#SCI_SETTWOPHASEDRAW">two phase drawing</a> + Drawing under text works only for indicators when <a class="message" href="#SCI_SETTWOPHASEDRAW">two phase drawing</a> is enabled.</p> - <h3 id="ModernIndicators">Modern Indicators</h3> - - <p>Modern indicators are stored in a format similar to run length encoding which is efficient in both + <p>Indicators are stored in a format similar to run length encoding which is efficient in both speed and storage for sparse information.</p> <p>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.</p> @@ -4146,32 +4107,8 @@ struct Sci_TextToFind { This message hides the find indicator. </p> - <h3 id="StyleByteIndicators">Style Byte Indicators (deprecated)</h3> - <p>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.</p> - - <p>The indicators are set using <a class="message" - href="#SCI_STARTSTYLING"><code>SCI_STARTSTYLING</code></a> with a <code>INDICS_MASK</code> mask - and <a class="message" href="#SCI_SETSTYLING"><code>SCI_SETSTYLING</code></a> with the values - <code>INDIC0_MASK</code>, <code>INDIC1_MASK</code> and <code>INDIC2_MASK</code>.</p> - - <p>If you are using indicators in a buffer that has a lexer active - (see <a class="message" href="#SCI_SETLEXER"><code>SCI_SETLEXER</code></a>), - you must save lexing state information before setting any indicators and restore it afterwards. - Use <a class="message" href="#SCI_GETENDSTYLED"><code>SCI_GETENDSTYLED</code></a> - to retrieve the current "styled to" position and - <a class="message" href="#SCI_STARTSTYLING"><code>SCI_STARTSTYLING</code></a> - to reset the styling position and mask (<code>0x1f </code> in the default layout of 5 style bits and 3 indicator bits) - when you are done.</p> - - <p>The number of bits used for styles can be altered with <a class="message" - href="#SCI_SETSTYLEBITS"><code>SCI_SETSTYLEBITS</code></a> from 0 to 8 bits. The remaining bits - can be used for indicators, so there can be from 1 to 8 indicators. However, the - <code>INDIC*_MASK</code> constants defined in <code>Scintilla.h</code> all assume 5 bits of - styling information and 3 indicators. If you use a different arrangement, you must define your - own constants.</p> + <p>Earlier versions of Scintilla allowed <a href="#StyleByteIndicators">partitioning style bytes</a> + between style numbers and indicators and provided APIs for setting and querying this.</p> <h2 id="Autocompletion">Autocompletion</h2> @@ -4223,6 +4160,8 @@ struct Sci_TextToFind { <a class="message" href="#SCI_AUTOCGETIGNORECASE">SCI_AUTOCGETIGNORECASE</a><br /> <a class="message" href="#SCI_AUTOCSETCASEINSENSITIVEBEHAVIOUR">SCI_AUTOCSETCASEINSENSITIVEBEHAVIOUR(int behaviour)</a><br /> <a class="message" href="#SCI_AUTOCGETCASEINSENSITIVEBEHAVIOUR">SCI_AUTOCGETCASEINSENSITIVEBEHAVIOUR</a><br /> + <a class="message" href="#SCI_AUTOCSETMULTI">SCI_AUTOCSETMULTI(int multi)</a><br /> + <a class="message" href="#SCI_AUTOCGETMULTI">SCI_AUTOCGETMULTI</a><br /> <a class="message" href="#SCI_AUTOCSETORDER">SCI_AUTOCSETORDER(int order)</a><br /> <a class="message" href="#SCI_AUTOCGETORDER">SCI_AUTOCGETORDER</a><br /> <a class="message" href="#SCI_AUTOCSETAUTOHIDE">SCI_AUTOCSETAUTOHIDE(bool autoHide)</a><br /> @@ -4340,6 +4279,12 @@ struct Sci_TextToFind { This corresponds to a behaviour property of <code>SC_CASEINSENSITIVEBEHAVIOUR_RESPECTCASE</code> (0). If you want autocompletion to ignore case at all, choose <code>SC_CASEINSENSITIVEBEHAVIOUR_IGNORECASE</code> (1).</p> + <p><b id="SCI_AUTOCSETMULTI">SCI_AUTOCSETMULTI(int multi)</b><br /> + <b id="SCI_AUTOCGETMULTI">SCI_AUTOCGETMULTI</b><br /> + When autocompleting with multiple selections present, the autocompleted text can go into just the main selection with + <code>SC_MULTIAUTOC_ONCE</code> (0) or into each selection with <code>SC_MULTIAUTOC_EACH</code> (1). + The default is <code>SC_MULTIAUTOC_ONCE</code>.</p> + <p><b id="SCI_AUTOCSETORDER">SCI_AUTOCSETORDER(int order)</b><br /> <b id="SCI_AUTOCGETORDER">SCI_AUTOCGETORDER</b><br /> The default setting <code>SC_ORDER_PRESORTED</code> (0) requires that the list be provided in alphabetical sorted order. @@ -5968,7 +5913,6 @@ sptr_t CallScintilla(unsigned int iMessage, uptr_t wParam, sptr_t lParam){ <a class="message" href="#SCI_DESCRIBEKEYWORDSETS">SCI_DESCRIBEKEYWORDSETS(<unused>, char *descriptions)</a><br /> <a class="message" href="#SCI_SETKEYWORDS">SCI_SETKEYWORDS(int keyWordSet, const char *keyWordList)</a><br /> - <a class="message" href="#SCI_GETSTYLEBITSNEEDED">SCI_GETSTYLEBITSNEEDED</a><br /> <a class="message" href="#SCI_GETSUBSTYLEBASES">SCI_GETSUBSTYLEBASES(<unused>, char *styles)</a><br /> <a class="message" href="#SCI_DISTANCETOSECONDARYSTYLES">SCI_DISTANCETOSECONDARYSTYLES</a><br /> @@ -6118,11 +6062,6 @@ sptr_t CallScintilla(unsigned int iMessage, uptr_t wParam, sptr_t lParam){ <p><b id="SCI_DESCRIBEKEYWORDSETS">SCI_DESCRIBEKEYWORDSETS(<unused>, char *descriptions)</b><br /> A description of all of the keyword sets separated by "\n" is returned by <code>SCI_DESCRIBEKEYWORDSETS</code>.</p> - <p><b id="SCI_GETSTYLEBITSNEEDED">SCI_GETSTYLEBITSNEEDED</b><br /> - Retrieve the number of bits the current lexer needs for styling. This should normally be the argument - to <a class="message" href="#SCI_SETSTYLEBITS">SCI_SETSTYLEBITS</a>. - </p> - <h3 id="Substyles">Substyles</h3> <p>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 +6380,8 @@ segments then changing the statement <code>#define BEOS 0</code> to <code>#defin document. The lexer can call <code>ChangeLexerState</code> to signal to the document that it should relex and display more.</p> +<p>For <code>StartStyling</code> the mask argument has no effect. It was used in version 3.4.2 and earlier.</p> + <p><code>SetErrorStatus</code> 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 +7422,20 @@ EM_FORMATRANGE <b id="SCI_GETUSEPALETTE">SCI_GETUSEPALETTE</b> Deprecated<br /> Scintilla no longer supports palette mode. The last version to support palettes was 2.29. Any calls to these methods should be removed.</p> + + <p>The following are features that should be removed from calling code but are still + defined to avoid breaking callers.</p> + + <p id="StyleByteIndicators"><b id="SCI_SETSTYLEBITS">SCI_SETSTYLEBITS(int bits)</b> Deprecated<br /> + <b id="SCI_GETSTYLEBITS">SCI_GETSTYLEBITS</b> Deprecated<br /> + <b id="SCI_GETSTYLEBITSNEEDED">SCI_GETSTYLEBITSNEEDED</b> Deprecated<br /> + <code>INDIC0_MASK</code>, <code>INDIC1_MASK</code>, <code>INDIC2_MASK</code>, <code>INDICS_MASK</code> Deprecated<br /> + 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 <a href="#Indicators">standard indicators</a>. + <code>SCI_GETSTYLEBITS</code> and <code>SCI_GETSTYLEBITSNEEDED</code> always return 8, + indicating that 8 bits are used for styling and there are 256 styles.</p> + </p> + <h2 id="EditMessagesNeverSupportedByScintilla">Edit messages never supported by Scintilla</h2> <pre> @@ -7517,6 +7472,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.</p> + <h2 id="RemovedFeatures">Removed features</h2> + + <p>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 <a href="#Indicators">standard indicators</a>.</p> + <h2 id="BuildingScintilla">Building Scintilla</h2> <p>To build Scintilla or SciTE, see the README file present in both the Scintilla and SciTE diff --git a/doc/ScintillaHistory.html b/doc/ScintillaHistory.html index 99eb8a7be..b18da0f72 100644 --- a/doc/ScintillaHistory.html +++ b/doc/ScintillaHistory.html @@ -460,6 +460,21 @@ </li> </ul> <h3> + <a href="http://prdownloads.sourceforge.net/scintilla/scite344.zip?download">Release 3.4.4</a> + </h3> + <ul> + <li> + Released 27 May 2014. + </li> + <li> + When multiple selections are active, autocompletion text may be inserted at each selection with new + SCI_AUTOCSETMULTI method. + </li> + <li> + C++ lexer fixes raw string recognition so that R"xxx(blah)xxx" is styled as SCE_C_STRINGRAW. + </li> + </ul> + <h3> <a href="http://prdownloads.sourceforge.net/scintilla/scite343.zip?download">Release 3.4.3</a> </h3> <ul> 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 <stdlib.h> #include <string.h> #include <stdio.h> -#include <ctype.h> #include <time.h> #include <assert.h> +#include <ctype.h> #include <new> #include <string> @@ -16,15 +16,17 @@ #include <map> #include <algorithm> +#include <glib.h> +#include <gmodule.h> #include <gtk/gtk.h> #include <gdk/gdkkeysyms.h> -#include "Platform.h" - -#if PLAT_GTK_WIN32 +#if defined(__WIN32__) || defined(_MSC_VER) #include <windows.h> #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 <glib.h> -#include <gmodule.h> -#include "LexerModule.h" #include "ExternalLexer.h" #endif +#include "scintilla-marshal.h" + #include "Converter.h" #if defined(__clang__) 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/lexers/LexCPP.cxx b/lexers/LexCPP.cxx index 7fe680991..b8b48aa52 100644 --- a/lexers/LexCPP.cxx +++ b/lexers/LexCPP.cxx @@ -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); } 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 <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; 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 <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) 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 <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" 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<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); 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/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/LexPS.cxx b/lexers/LexPS.cxx index 3661c4b66..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 <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) { 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/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/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<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)) 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 <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" 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 <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" 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 <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) 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 <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" 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 <stdlib.h> #include <string.h> #include <stdio.h> -#include <ctype.h> #include <assert.h> +#include <ctype.h> #include "CharacterSet.h" 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<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); 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 <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" diff --git a/lexlib/LexerModule.cxx b/lexlib/LexerModule.cxx index c77b31775..6cefbee77 100644 --- a/lexlib/LexerModule.cxx +++ b/lexlib/LexerModule.cxx @@ -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(); 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/LexerNoExceptions.cxx b/lexlib/LexerNoExceptions.cxx index 5f31f2268..9ebae2af0 100644 --- a/lexlib/LexerNoExceptions.cxx +++ b/lexlib/LexerNoExceptions.cxx @@ -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" 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 <stdlib.h> #include <string.h> #include <stdio.h> -#include <ctype.h> #include <stdarg.h> #include <assert.h> +#include <ctype.h> #include <string> 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 <stdlib.h> #include <string.h> #include <stdio.h> -#include <ctype.h> #include <assert.h> +#include <ctype.h> #include "ILexer.h" 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/lexlib/WordList.cxx b/lexlib/WordList.cxx index 10b6fe349..68b384a95 100644 --- a/lexlib/WordList.cxx +++ b/lexlib/WordList.cxx @@ -8,8 +8,8 @@ #include <stdlib.h> #include <string.h> #include <stdio.h> -#include <ctype.h> #include <stdarg.h> +#include <ctype.h> #include <algorithm> 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 <stdlib.h> +#include <string.h> +#include <stdio.h> +#include <stddef.h> +#include <stdarg.h> +#include <time.h> +#include <math.h> +#include <assert.h> +#include <ctype.h> +#include <limits.h> + +// C++ wrappers of C standard library +#include <cstdlib> +#include <cassert> +#include <cstring> +#include <cctype> +#include <cstdio> + +// C++ standard library +#include <stdexcept> +#include <new> +#include <string> +#include <vector> +#include <map> +#include <set> +#include <algorithm> +#include <memory> + +// GTK+ headers +#include <glib.h> +#include <gmodule.h> +#include <gdk/gdk.h> +#include <gtk/gtk.h> +#include <gdk/gdkkeysyms.h> + +// Windows headers +#include <windows.h> +#include <commctrl.h> +#include <richedit.h> +#include <windowsx.h> +#include <zmouse.h> +#include <ole2.h> +#include <d2d1.h> +#include <dwrite.h> + +// Cocoa headers +#include <Cocoa/Cocoa.h> + +// 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 <vector> #include <algorithm> +#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 <stdlib.h> #include <string.h> #include <stdio.h> -#include <ctype.h> #include <stdarg.h> #include <assert.h> +#include <ctype.h> #include <vector> 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<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++; 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..32d5f1896 100644 --- a/src/Document.cxx +++ b/src/Document.cxx @@ -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++; 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..63d45158b 100644 --- a/src/Editor.cxx +++ b/src/Editor.cxx @@ -8,9 +8,9 @@ #include <stdlib.h> #include <string.h> #include <stdio.h> -#include <ctype.h> #include <math.h> #include <assert.h> +#include <ctype.h> #include <string> #include <vector> @@ -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<unsigned char>(styleByte & styleMask)); - allSame = allSame && - (ll->indicators[numCharsInLine] == static_cast<char>(styleByte & ~styleMask)); + (ll->styles[numCharsInLine] == static_cast<unsigned char>(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<char>(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; charInLine<lineLength; charInLine++) { char chDoc = ll->chars[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; r<sel.Count(); r++) { @@ -2607,9 +2596,9 @@ void Editor::DrawEOL(Surface *surface, ViewStyle &vsDraw, PRectangle rcLine, Lin if (overrideBackground) { surface->FillRectangle(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<int>(wParam)); + vs.EnsureStyle(0xff); break; case SCI_GETSTYLEBITS: - return pdoc->stylingBits; + return 8; case SCI_SETLINESTATE: return pdoc->SetLineState(static_cast<int>(wParam), static_cast<int>(lParam)); 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 <stdlib.h> #include <string.h> #include <stdio.h> -#include <ctype.h> #include <assert.h> +#include <ctype.h> #include <string> 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 2a120c1cf..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" @@ -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..d42dfc7ff 100644 --- a/src/ScintillaBase.cxx +++ b/src/ScintillaBase.cxx @@ -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> @@ -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 @@ -57,6 +62,7 @@ ScintillaBase::ScintillaBase() { displayPopupMenu = true; listType = 0; maxListWidth = 0; + multiAutoCMode = SC_MULTIAUTOC_ONCE; } ScintillaBase::~ScintillaBase() { @@ -197,9 +203,30 @@ 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<sel.Count(); r++) { + if (!RangeContainsProtected(sel.Range(r).Start().Position(), + sel.Range(r).End().Position())) { + int positionInsert = sel.Range(r).Start().Position(); + positionInsert = InsertSpace(positionInsert, sel.Range(r).caret.VirtualSpace()); + if (positionInsert - removeLen >= 0) { + positionInsert -= removeLen; + pdoc->DeleteChars(positionInsert, removeLen); + } + const int lengthInserted = pdoc->InsertString(positionInsert, text, textLen); + if (lengthInserted > 0) { + sel.Range(r).caret.SetPosition(positionInsert + lengthInserted); + sel.Range(r).anchor.SetPosition(positionInsert + lengthInserted); + } + sel.Range(r).ClearVirtualSpace(); + } + } + } } void ScintillaBase::AutoCompleteStart(int lenEntered, const char *list) { @@ -492,7 +519,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 +620,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 +762,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 } @@ -819,6 +840,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<int>(wParam); + break; + + case SCI_AUTOCGETMULTI: + return multiAutoCMode; + case SCI_AUTOCSETORDER: ac.autoSort = static_cast<int>(wParam); break; @@ -982,7 +1010,7 @@ sptr_t ScintillaBase::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lPara DocumentLexState()->PrivateCall(wParam, reinterpret_cast<void *>(lParam))); case SCI_GETSTYLEBITSNEEDED: - return DocumentLexState()->GetStyleBitsNeeded(); + return 8; case SCI_PROPERTYNAMES: return StringResult(lParam, DocumentLexState()->PropertyNames()); 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(); 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") diff --git a/win32/PlatWin.cxx b/win32/PlatWin.cxx index 507075a77..fda07875a 100644 --- a/win32/PlatWin.cxx +++ b/win32/PlatWin.cxx @@ -8,10 +8,10 @@ #include <stdlib.h> #include <string.h> #include <stdio.h> -#include <ctype.h> #include <stdarg.h> #include <time.h> #include <math.h> +#include <ctype.h> #include <limits.h> #include <vector> diff --git a/win32/ScintillaWin.cxx b/win32/ScintillaWin.cxx index d4f0415e8..c3a6beefb 100644 --- a/win32/ScintillaWin.cxx +++ b/win32/ScintillaWin.cxx @@ -8,8 +8,8 @@ #include <stdlib.h> #include <string.h> #include <stdio.h> -#include <ctype.h> #include <assert.h> +#include <ctype.h> #include <limits.h> #include <new> @@ -26,6 +26,8 @@ #include <commctrl.h> #include <richedit.h> #include <windowsx.h> +#include <zmouse.h> +#include <ole2.h> #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 <commctrl.h> -#include <zmouse.h> -#include <ole2.h> - #ifndef MK_ALT #define MK_ALT 32 #endif @@ -1338,6 +1339,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; |