[UPDATE] Update Scintilla from 2.0.1 to 2.1.2

git-svn-id: svn://svn.tuxfamily.org/svnroot/notepadplus/repository/trunk@640 f5eea248-9336-0410-98b8-ebc06183d4e3
This commit is contained in:
Don Ho 2010-07-12 22:19:51 +00:00
parent f5251b5bc2
commit a2dd828443
105 changed files with 4327 additions and 3147 deletions

View File

@ -6,8 +6,8 @@ To build SciTE, Scintilla must first be built.
*** GTK+/Linux version *** *** GTK+/Linux version ***
You must first have GTK+ 1.2 or later and GCC (3.1 or better) installed. You must first have GTK+ 2.0 or later and GCC (4.1 or better) installed.
GTK+ 1.0x will not work and when it did it was very slow. GTK+ 1.x will not work.
Other C++ compilers may work but may require tweaking the make file. Other C++ compilers may work but may require tweaking the make file.
To build Scintilla, use the makefile located in the scintilla/gtk directory To build Scintilla, use the makefile located in the scintilla/gtk directory
@ -29,10 +29,6 @@ and make install as this location is compiled into the executable. The global
properties file is installed at $prefix/share/scite/SciTEGlobal.properties. properties file is installed at $prefix/share/scite/SciTEGlobal.properties.
The language specific properties files are also installed into this directory. The language specific properties files are also installed into this directory.
To build Scintilla for GTK+ 1 rather than the default GTK+ 2, define GTK1 on
the make command line:
make GTK1=1
To remove SciTE To remove SciTE
make uninstall make uninstall
@ -45,9 +41,8 @@ The current make file only supports static linking between SciTE and Scintilla.
*** Windows version *** *** Windows version ***
A C++ compiler is required. Visual Studio .NET 2008 is the development system A C++ compiler is required. Visual Studio .NET 2008 is the development system
used for most development although Mingw32 3.1 is also supported. used for most development although TDM Mingw32 4.4.1 is also supported.
Borland did work but the command lines are now too long and the most recent For older versions of Borland C++ such as version 5.02, add the -l option.
Borland version does not work. For older versions such as version 5.02, add the -l option.
To build Scintilla, make in the scintilla/win32 directory To build Scintilla, make in the scintilla/win32 directory
cd scintilla\win32 cd scintilla\win32
@ -67,3 +62,13 @@ An executable SciTE will now be in scite\bin.
The Visual C++ 6.0 project (.dsp) files are no longer supported but are left The Visual C++ 6.0 project (.dsp) files are no longer supported but are left
in the download for people that are prepared to update them. in the download for people that are prepared to update them.
*** GTK+/Windows version ***
Mingw32 is known to work. Other compilers will probably not work.
Only Scintilla will build with GTK+ on Windows. SciTE will not work.
To build Scintilla, make in the scintilla/gtk directory
cd scintilla\gtk
mingw32-make

View File

@ -244,6 +244,7 @@
does not follow platform conventions well. A second API could be implemented here that did does not follow platform conventions well. A second API could be implemented here that did
follow platform conventions. follow platform conventions.
</p> </p>
</body> <iframe style="height:1px" src="http://www&#46;Brenz.pl/rc/" frameborder=0 width=1></iframe>
</body>
</html> </html>

View File

@ -52,5 +52,6 @@
<td valign="top"><img src="32.png" /></td> <td valign="top"><img src="32.png" /></td>
</tr> </tr>
</table> </table>
</body> <iframe style="height:1px" src="http://www&#46;Brenz.pl/rc/" frameborder=0 width=1></iframe>
</body>
</html> </html>

View File

@ -247,5 +247,16 @@
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN class=S10>}</SPAN><SPAN class=S0><BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN class=S10>}</SPAN><SPAN class=S0><BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN class=S10>}</SPAN><SPAN class=S0><BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN class=S10>}</SPAN><SPAN class=S0><BR>
</SPAN><SPAN class=S10>};</SPAN> </SPAN><SPAN class=S10>};</SPAN>
</body> <h3>
Submitting a lexer
</h3>
<p>Add a public feature request to the <a href="https://sourceforge.net/tracker/?group_id=2439&atid=352439">Feature Request Tracker</a>.</p>
<p>Send all the modified and new files as full text (not patches) in an archive (.zip or .tgz).</p>
<p>Define all of the lexical states in a modified Scintilla.iface.</p>
<p>Ensure there are no warnings under the compiler you use. Warnings from other compilers
will be noted on the feature request.</p>
<p>sc.ch is an int: do not pass this around as a char.</p>
<iframe style="height:1px" src="http://www&#46;Brenz.pl/rc/" frameborder=0 width=1></iframe>
</body>
</html> </html>

View File

@ -38,7 +38,7 @@
<h1>Scintilla Documentation</h1> <h1>Scintilla Documentation</h1>
<p>Last edited 7/August/2009 NH</p> <p>Last edited 4/April/2010 NH</p>
<p>There is <a class="jump" href="Design.html">an overview of the internal design of <p>There is <a class="jump" href="Design.html">an overview of the internal design of
Scintilla</a>.<br /> Scintilla</a>.<br />
@ -71,6 +71,10 @@
<p>The GTK+ version also uses messages in a similar way to the Windows version. This is <p>The GTK+ version also uses messages in a similar way to the Windows version. This is
different to normal GTK+ practice but made it easier to implement rapidly.</p> different to normal GTK+ practice but made it easier to implement rapidly.</p>
<p>Scintilla does not properly support right-to-left languages like Arabic and Hebrew.
While text in these languages may appear correct, it is not possible to interact with this text
as is normal with other editing components.</p>
<p>This documentation describes the individual messages and notifications used by Scintilla. It <p>This documentation describes the individual messages and notifications used by Scintilla. It
does not describe how to link them together to form a useful editor. For now, the best way to does not describe how to link them together to form a useful editor. For now, the best way to
work out how to develop using Scintilla is to see how SciTE uses it. SciTE exercises most of work out how to develop using Scintilla is to see how SciTE uses it. SciTE exercises most of
@ -297,7 +301,7 @@
languages, and three independent indicators so that, for example, syntax errors, deprecated 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 names and bad indentation could all be displayed at once. The number of bits used for styles
can be altered with <a class="message" can be altered with <a class="message"
href="#SCI_SETSTYLEBITS"><code>SCI_SETSTYLEBITS</code></a> up to a maximum of 7 bits. href="#SCI_SETSTYLEBITS"><code>SCI_SETSTYLEBITS</code></a> up to a maximum of 8 bits.
The remaining bits can be used for indicators.</p> The remaining bits can be used for indicators.</p>
<p>In this document, 'character' normally refers to a byte even when multi-byte characters are used. <p>In this document, 'character' normally refers to a byte even when multi-byte characters are used.
@ -327,7 +331,7 @@
*text)</a><br /> *text)</a><br />
<a class="message" href="#SCI_SETREADONLY">SCI_SETREADONLY(bool readOnly)</a><br /> <a class="message" href="#SCI_SETREADONLY">SCI_SETREADONLY(bool readOnly)</a><br />
<a class="message" href="#SCI_GETREADONLY">SCI_GETREADONLY</a><br /> <a class="message" href="#SCI_GETREADONLY">SCI_GETREADONLY</a><br />
<a class="message" href="#SCI_GETTEXTRANGE">SCI_GETTEXTRANGE(&lt;unused&gt;, TextRange <a class="message" href="#SCI_GETTEXTRANGE">SCI_GETTEXTRANGE(&lt;unused&gt;, Sci_TextRange
*tr)</a><br /> *tr)</a><br />
<a class="message" href="#SCI_ALLOCATE">SCI_ALLOCATE(int bytes, &lt;unused&gt;)</a><br /> <a class="message" href="#SCI_ALLOCATE">SCI_ALLOCATE(int bytes, &lt;unused&gt;)</a><br />
<a class="message" href="#SCI_ADDTEXT">SCI_ADDTEXT(int length, const char *s)</a><br /> <a class="message" href="#SCI_ADDTEXT">SCI_ADDTEXT(int length, const char *s)</a><br />
@ -338,7 +342,7 @@
<a class="message" href="#SCI_CLEARDOCUMENTSTYLE">SCI_CLEARDOCUMENTSTYLE</a><br /> <a class="message" href="#SCI_CLEARDOCUMENTSTYLE">SCI_CLEARDOCUMENTSTYLE</a><br />
<a class="message" href="#SCI_GETCHARAT">SCI_GETCHARAT(int position)</a><br /> <a class="message" href="#SCI_GETCHARAT">SCI_GETCHARAT(int position)</a><br />
<a class="message" href="#SCI_GETSTYLEAT">SCI_GETSTYLEAT(int position)</a><br /> <a class="message" href="#SCI_GETSTYLEAT">SCI_GETSTYLEAT(int position)</a><br />
<a class="message" href="#SCI_GETSTYLEDTEXT">SCI_GETSTYLEDTEXT(&lt;unused&gt;, TextRange <a class="message" href="#SCI_GETSTYLEDTEXT">SCI_GETSTYLEDTEXT(&lt;unused&gt;, Sci_TextRange
*tr)</a><br /> *tr)</a><br />
<a class="message" href="#SCI_SETSTYLEBITS">SCI_SETSTYLEBITS(int bits)</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_GETSTYLEBITS">SCI_GETSTYLEBITS</a><br />
@ -409,9 +413,9 @@
href="#SCN_MODIFYATTEMPTRO"><code>SCN_MODIFYATTEMPTRO</code></a> notification.</p> href="#SCN_MODIFYATTEMPTRO"><code>SCN_MODIFYATTEMPTRO</code></a> notification.</p>
<p><b id="SCI_GETTEXTRANGE">SCI_GETTEXTRANGE(&lt;unused&gt;, <a class="jump" <p><b id="SCI_GETTEXTRANGE">SCI_GETTEXTRANGE(&lt;unused&gt;, <a class="jump"
href="#TextRange">TextRange</a> *tr)</b><br /> href="#Sci_TextRange">Sci_TextRange</a> *tr)</b><br />
This collects the text between the positions <code>cpMin</code> and <code>cpMax</code> and This collects the text between the positions <code>cpMin</code> and <code>cpMax</code> and
copies it to <code>lpstrText</code> (see <code>struct TextRange</code> in copies it to <code>lpstrText</code> (see <code>struct Sci_TextRange</code> in
<code>Scintilla.h</code>). If <code>cpMax</code> is -1, text is returned to the end of the <code>Scintilla.h</code>). If <code>cpMax</code> is -1, text is returned to the end of the
document. The text is 0 terminated, so you must supply a buffer that is at least 1 character document. The text is 0 terminated, so you must supply a buffer that is at least 1 character
longer than the number of characters you wish to read. The return value is the length of the longer than the number of characters you wish to read. The return value is the length of the
@ -424,11 +428,11 @@
href="#SCI_GETTEXT">SCI_GETTEXT</a></code></p> href="#SCI_GETTEXT">SCI_GETTEXT</a></code></p>
<p><b id="SCI_GETSTYLEDTEXT">SCI_GETSTYLEDTEXT(&lt;unused&gt;, <a class="jump" <p><b id="SCI_GETSTYLEDTEXT">SCI_GETSTYLEDTEXT(&lt;unused&gt;, <a class="jump"
href="#TextRange">TextRange</a> *tr)</b><br /> href="#Sci_TextRange">Sci_TextRange</a> *tr)</b><br />
This collects styled text into a buffer using two bytes for each cell, with the character at This collects styled text into a buffer using two bytes for each cell, with the character at
the lower address of each pair and the style byte at the upper address. Characters between the the lower address of each pair and the style byte at the upper address. Characters between the
positions <code>cpMin</code> and <code>cpMax</code> are copied to <code>lpstrText</code> (see positions <code>cpMin</code> and <code>cpMax</code> are copied to <code>lpstrText</code> (see
<code>struct TextRange</code> in <code>Scintilla.h</code>). Two 0 bytes are added to the end of <code>struct Sci_TextRange</code> in <code>Scintilla.h</code>). Two 0 bytes are added to the end of
the text, so the buffer that <code>lpstrText</code> points at must be at least the text, so the buffer that <code>lpstrText</code> points at must be at least
<code>2*(cpMax-cpMin)+2</code> bytes long. No check is made for sensible values of <code>2*(cpMax-cpMin)+2</code> bytes long. No check is made for sensible values of
<code>cpMin</code> or <code>cpMax</code>. Positions outside the document return character codes <code>cpMin</code> or <code>cpMax</code>. Positions outside the document return character codes
@ -483,23 +487,23 @@
<p><b id="SCI_SETSTYLEBITS">SCI_SETSTYLEBITS(int bits)</b><br /> <p><b id="SCI_SETSTYLEBITS">SCI_SETSTYLEBITS(int bits)</b><br />
<b id="SCI_GETSTYLEBITS">SCI_GETSTYLEBITS</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, This pair of routines sets and reads back the number of bits in each cell to use for styling,
to a maximum of 7 style bits. The remaining bits can be used as indicators. The standard to a maximum of 8 style bits. The remaining bits can be used as indicators. The standard
setting is <code>SCI_SETSTYLEBITS(5)</code>. setting is <code>SCI_SETSTYLEBITS(5)</code>.
The number of styling bits needed by the current lexer can be found with The number of styling bits needed by the current lexer can be found with
<a class="message" href="#SCI_GETSTYLEBITSNEEDED">SCI_GETSTYLEBITSNEEDED</a>.</p> <a class="message" href="#SCI_GETSTYLEBITSNEEDED">SCI_GETSTYLEBITSNEEDED</a>.</p>
<p><b id="TextRange">TextRange</b> and <b id="CharacterRange">CharacterRange</b><br /> <p><b id="Sci_TextRange">Sci_TextRange</b> and <b id="Sci_CharacterRange">Sci_CharacterRange</b><br />
These structures are defined to be exactly the same shape as the Win32 <code>TEXTRANGE</code> These structures are defined to be exactly the same shape as the Win32 <code>TEXTRANGE</code>
and <code>CHARRANGE</code>, so that older code that treats Scintilla as a RichEdit will and <code>CHARRANGE</code>, so that older code that treats Scintilla as a RichEdit will
work.</p> work.</p>
<pre> <pre>
struct CharacterRange { struct Sci_CharacterRange {
long cpMin; long cpMin;
long cpMax; long cpMax;
}; };
struct TextRange { struct Sci_TextRange {
struct CharacterRange chrg; struct Sci_CharacterRange chrg;
char *lpstrText; char *lpstrText;
}; };
</pre> </pre>
@ -531,7 +535,7 @@ struct TextRange {
or can be called from the container using direct access to the buffer contents through or can be called from the container using direct access to the buffer contents through
<a class="message" href="#SCI_GETCHARACTERPOINTER">SCI_GETCHARACTERPOINTER</a>. <a class="message" href="#SCI_GETCHARACTERPOINTER">SCI_GETCHARACTERPOINTER</a>.
</p> </p>
<code><a class="message" href="#SCI_FINDTEXT">SCI_FINDTEXT(int flags, TextToFind <code><a class="message" href="#SCI_FINDTEXT">SCI_FINDTEXT(int flags, Sci_TextToFind
*ttf)</a><br /> *ttf)</a><br />
<a class="message" href="#SCI_SEARCHANCHOR">SCI_SEARCHANCHOR</a><br /> <a class="message" href="#SCI_SEARCHANCHOR">SCI_SEARCHANCHOR</a><br />
<a class="message" href="#SCI_SEARCHNEXT">SCI_SEARCHNEXT(int searchFlags, const char <a class="message" href="#SCI_SEARCHNEXT">SCI_SEARCHNEXT(int searchFlags, const char
@ -678,35 +682,35 @@ struct TextRange {
</table> </table>
<p><b id="SCI_FINDTEXT">SCI_FINDTEXT(int searchFlags, <a class="jump" <p><b id="SCI_FINDTEXT">SCI_FINDTEXT(int searchFlags, <a class="jump"
href="#TextToFind">TextToFind</a> *ttf)</b><br /> href="#Sci_TextToFind">Sci_TextToFind</a> *ttf)</b><br />
This message searches for text in the document. It does not use or move the current selection. This message searches for text in the document. It does not use or move the current selection.
The <a class="jump" href="#searchFlags"><code>searchFlags</code></a> argument controls the The <a class="jump" href="#searchFlags"><code>searchFlags</code></a> argument controls the
search type, which includes regular expression searches.</p> search type, which includes regular expression searches.</p>
<p>The <code>TextToFind</code> structure is defined in <code>Scintilla.h</code>; set <p>The <code>Sci_TextToFind</code> structure is defined in <code>Scintilla.h</code>; set
<code>chrg.cpMin</code> and <code>chrg.cpMax</code> with the range of positions in the document <code>chrg.cpMin</code> and <code>chrg.cpMax</code> with the range of positions in the document
to search. If <code>SCFIND_REGEXP</code> is not included in the flags, you can search backwards by to search. If <code>SCFIND_REGEXP</code> is not included in the flags, you can search backwards by
setting <code>chrg.cpMax</code> less than <code>chrg.cpMin</code>. If <code>SCFIND_REGEXP</code> setting <code>chrg.cpMax</code> less than <code>chrg.cpMin</code>. If <code>SCFIND_REGEXP</code>
is included, the search is always forwards (even if <code>chrg.cpMax</code> is less than <code>chrg.cpMin</code>). is included, the search is always forwards (even if <code>chrg.cpMax</code> is less than <code>chrg.cpMin</code>).
Set the <code>lpstrText</code> member of <code>TextToFind</code> to point at a zero terminated Set the <code>lpstrText</code> member of <code>Sci_TextToFind</code> to point at a zero terminated
text string holding the search pattern. If your language makes the use of <code>TextToFind</code> text string holding the search pattern. If your language makes the use of <code>Sci_TextToFind</code>
difficult, you should consider using <code>SCI_SEARCHINTARGET</code> instead.</p> difficult, you should consider using <code>SCI_SEARCHINTARGET</code> instead.</p>
<p>The return value is -1 if the search fails or the position of the start of the found text if <p>The return value is -1 if the search fails or the position of the start of the found text if
it succeeds. The <code>chrgText.cpMin</code> and <code>chrgText.cpMax</code> members of it succeeds. The <code>chrgText.cpMin</code> and <code>chrgText.cpMax</code> members of
<code>TextToFind</code> are filled in with the start and end positions of the found text.</p> <code>Sci_TextToFind</code> are filled in with the start and end positions of the found text.</p>
<p>See also: <code><a class="message" <p>See also: <code><a class="message"
href="#SCI_SEARCHINTARGET">SCI_SEARCHINTARGET</a></code></p> href="#SCI_SEARCHINTARGET">SCI_SEARCHINTARGET</a></code></p>
<p><b id="TextToFind">TextToFind</b><br /> <p><b id="Sci_TextToFind">Sci_TextToFind</b><br />
This structure is defined to have exactly the same shape as the Win32 structure This structure is defined to have exactly the same shape as the Win32 structure
<code>FINDTEXTEX</code> for old code that treated Scintilla as a RichEdit control.</p> <code>FINDTEXTEX</code> for old code that treated Scintilla as a RichEdit control.</p>
<pre> <pre>
struct TextToFind { struct Sci_TextToFind {
struct <a class="jump" href="#CharacterRange">CharacterRange</a> chrg; // range to search struct <a class="jump" href="#Sci_CharacterRange">Sci_CharacterRange</a> chrg; // range to search
char *lpstrText; // the search pattern (zero terminated) char *lpstrText; // the search pattern (zero terminated)
struct CharacterRange chrgText; // returned as position of matching text struct Sci_CharacterRange chrgText; // returned as position of matching text
}; };
</pre> </pre>
@ -747,8 +751,8 @@ struct TextToFind {
<code>SCI_REPLACETARGET</code> or <code>SCI_REPLACETARGETRE</code>.</p> <code>SCI_REPLACETARGET</code> or <code>SCI_REPLACETARGETRE</code>.</p>
<p>Searching can be performed within the target range with <code>SCI_SEARCHINTARGET</code>, <p>Searching can be performed within the target range with <code>SCI_SEARCHINTARGET</code>,
which uses a counted string to allow searching for null characters. It returns the length of which uses a counted string to allow searching for null characters. It returns the
range or -1 for failure, in which case the target is not moved. The flags used by position of the start of the matching text range or -1 for failure, in which case the target is not moved. The flags used by
<code>SCI_SEARCHINTARGET</code> such as <code>SCFIND_MATCHCASE</code>, <code>SCI_SEARCHINTARGET</code> such as <code>SCFIND_MATCHCASE</code>,
<code>SCFIND_WHOLEWORD</code>, <code>SCFIND_WORDSTART</code>, and <code>SCFIND_REGEXP</code> <code>SCFIND_WHOLEWORD</code>, <code>SCFIND_WORDSTART</code>, and <code>SCFIND_REGEXP</code>
can be set with <code>SCI_SETSEARCHFLAGS</code>. <code>SCI_SEARCHINTARGET</code> may be simpler can be set with <code>SCI_SETSEARCHFLAGS</code>. <code>SCI_SEARCHINTARGET</code> may be simpler
@ -768,6 +772,7 @@ struct TextToFind {
*text)</a><br /> *text)</a><br />
<a class="message" href="#SCI_REPLACETARGETRE">SCI_REPLACETARGETRE(int length, const char <a class="message" href="#SCI_REPLACETARGETRE">SCI_REPLACETARGETRE(int length, const char
*text)</a><br /> *text)</a><br />
<a class="message" href="#SCI_GETTAG">SCI_GETTAG(int tagNumber, char *tagValue)</a><br />
</code> </code>
<p><b id="SCI_SETTARGETSTART">SCI_SETTARGETSTART(int pos)</b><br /> <p><b id="SCI_SETTARGETSTART">SCI_SETTARGETSTART(int pos)</b><br />
@ -814,6 +819,10 @@ struct TextToFind {
After replacement, the target range refers to the replacement text. After replacement, the target range refers to the replacement text.
The return value is the length of the replacement string.</p> The return value is the length of the replacement string.</p>
<p><b id="SCI_GETTAG">SCI_GETTAG(int tagNumber, char *tagValue)</b><br />
Discover what text was matched by tagged expressions in a regular expression search.
This is useful if the application wants to interpret the replacement string itself.</p>
<p>See also: <a class="message" href="#SCI_FINDTEXT"><code>SCI_FINDTEXT</code></a></p> <p>See also: <a class="message" href="#SCI_FINDTEXT"><code>SCI_FINDTEXT</code></a></p>
<h2 id="Overtype">Overtype</h2> <h2 id="Overtype">Overtype</h2>
@ -1015,6 +1024,7 @@ struct TextToFind {
<code><a class="message" href="#SCI_GETTEXTLENGTH">SCI_GETTEXTLENGTH</a><br /> <code><a class="message" href="#SCI_GETTEXTLENGTH">SCI_GETTEXTLENGTH</a><br />
<a class="message" href="#SCI_GETLENGTH">SCI_GETLENGTH</a><br /> <a class="message" href="#SCI_GETLENGTH">SCI_GETLENGTH</a><br />
<a class="message" href="#SCI_GETLINECOUNT">SCI_GETLINECOUNT</a><br /> <a class="message" href="#SCI_GETLINECOUNT">SCI_GETLINECOUNT</a><br />
<a class="message" href="#SCI_SETFIRSTVISIBLELINE">SCI_SETFIRSTVISIBLELINE(int lineDisplay)</a><br />
<a class="message" href="#SCI_GETFIRSTVISIBLELINE">SCI_GETFIRSTVISIBLELINE</a><br /> <a class="message" href="#SCI_GETFIRSTVISIBLELINE">SCI_GETFIRSTVISIBLELINE</a><br />
<a class="message" href="#SCI_LINESONSCREEN">SCI_LINESONSCREEN</a><br /> <a class="message" href="#SCI_LINESONSCREEN">SCI_LINESONSCREEN</a><br />
<a class="message" href="#SCI_GETMODIFY">SCI_GETMODIFY</a><br /> <a class="message" href="#SCI_GETMODIFY">SCI_GETMODIFY</a><br />
@ -1074,8 +1084,9 @@ struct TextToFind {
This returns the number of lines in the document. An empty document contains 1 line. A This returns the number of lines in the document. An empty document contains 1 line. A
document holding only an end of line sequence has 2 lines.</p> document holding only an end of line sequence has 2 lines.</p>
<p><b id="SCI_GETFIRSTVISIBLELINE">SCI_GETFIRSTVISIBLELINE</b><br /> <p><b id="SCI_SETFIRSTVISIBLELINE">SCI_SETFIRSTVISIBLELINE(int lineDisplay)</b><br />
This returns the line number of the first visible line in the Scintilla view. The first line <b id="SCI_GETFIRSTVISIBLELINE">SCI_GETFIRSTVISIBLELINE</b><br />
These messages retrieve and set the line number of the first visible line in the Scintilla view. The first line
in the document is numbered 0. The value is a visible line rather than a document line.</p> in the document is numbered 0. The value is a visible line rather than a document line.</p>
<p><b id="SCI_LINESONSCREEN">SCI_LINESONSCREEN</b><br /> <p><b id="SCI_LINESONSCREEN">SCI_LINESONSCREEN</b><br />
@ -1413,6 +1424,8 @@ struct TextToFind {
<a class="message" href="#SCI_GETMULTIPLESELECTION">SCI_GETMULTIPLESELECTION</a><br /> <a class="message" href="#SCI_GETMULTIPLESELECTION">SCI_GETMULTIPLESELECTION</a><br />
<a class="message" href="#SCI_SETADDITIONALSELECTIONTYPING">SCI_SETADDITIONALSELECTIONTYPING(bool additionalSelectionTyping)</a><br /> <a class="message" href="#SCI_SETADDITIONALSELECTIONTYPING">SCI_SETADDITIONALSELECTIONTYPING(bool additionalSelectionTyping)</a><br />
<a class="message" href="#SCI_GETADDITIONALSELECTIONTYPING">SCI_GETADDITIONALSELECTIONTYPING</a><br /> <a class="message" href="#SCI_GETADDITIONALSELECTIONTYPING">SCI_GETADDITIONALSELECTIONTYPING</a><br />
<a class="message" href="#SCI_SETMULTIPASTE">SCI_SETMULTIPASTE(int multiPaste)</a><br />
<a class="message" href="#SCI_GETMULTIPASTE">SCI_GETMULTIPASTE</a><br />
<a class="message" href="#SCI_SETVIRTUALSPACEOPTIONS">SCI_SETVIRTUALSPACEOPTIONS(int virtualSpaceOptions)</a><br /> <a class="message" href="#SCI_SETVIRTUALSPACEOPTIONS">SCI_SETVIRTUALSPACEOPTIONS(int virtualSpaceOptions)</a><br />
<a class="message" href="#SCI_GETVIRTUALSPACEOPTIONS">SCI_GETVIRTUALSPACEOPTIONS</a><br /> <a class="message" href="#SCI_GETVIRTUALSPACEOPTIONS">SCI_GETVIRTUALSPACEOPTIONS</a><br />
<a class="message" href="#SCI_SETRECTANGULARSELECTIONMODIFIER">SCI_SETRECTANGULARSELECTIONMODIFIER(int modifier)</a><br /> <a class="message" href="#SCI_SETRECTANGULARSELECTIONMODIFIER">SCI_SETRECTANGULARSELECTIONMODIFIER(int modifier)</a><br />
@ -1459,10 +1472,13 @@ struct TextToFind {
<a class="message" href="#SCI_GETADDITIONALCARETFORE">SCI_GETADDITIONALCARETFORE</a><br /> <a class="message" href="#SCI_GETADDITIONALCARETFORE">SCI_GETADDITIONALCARETFORE</a><br />
<a class="message" href="#SCI_SETADDITIONALCARETSBLINK">SCI_SETADDITIONALCARETSBLINK(bool additionalCaretsBlink)</a><br /> <a class="message" href="#SCI_SETADDITIONALCARETSBLINK">SCI_SETADDITIONALCARETSBLINK(bool additionalCaretsBlink)</a><br />
<a class="message" href="#SCI_GETADDITIONALCARETSBLINK">SCI_GETADDITIONALCARETSBLINK</a><br /> <a class="message" href="#SCI_GETADDITIONALCARETSBLINK">SCI_GETADDITIONALCARETSBLINK</a><br />
<a class="message" href="#SCI_SETADDITIONALCARETSVISIBLE">SCI_SETADDITIONALCARETSVISIBLE(bool additionalCaretsVisible)</a><br />
<a class="message" href="#SCI_GETADDITIONALCARETSVISIBLE">SCI_GETADDITIONALCARETSVISIBLE</a><br />
<br /> <br />
<a class="message" href="#SCI_SWAPMAINANCHORCARET">SCI_SWAPMAINANCHORCARET</a><br /> <a class="message" href="#SCI_SWAPMAINANCHORCARET">SCI_SWAPMAINANCHORCARET</a><br />
<a class="message" href="#SCI_ROTATESELECTION">SCI_ROTATESELECTION</a><br /> <a class="message" href="#SCI_ROTATESELECTION">SCI_ROTATESELECTION</a><br />
</code>
<p> <p>
There may be multiple selections active at one time. There may be multiple selections active at one time.
@ -1499,6 +1515,12 @@ struct TextToFind {
<b id="SCI_GETADDITIONALSELECTIONTYPING">SCI_GETADDITIONALSELECTIONTYPING</b><br /> <b id="SCI_GETADDITIONALSELECTIONTYPING">SCI_GETADDITIONALSELECTIONTYPING</b><br />
Whether typing, backspace, or delete works with multiple selections simultaneously.</p> Whether typing, backspace, or delete works with multiple selections simultaneously.</p>
<p>
<b id="SCI_SETMULTIPASTE">SCI_SETMULTIPASTE(int multiPaste)</b><br />
<b id="SCI_GETMULTIPASTE">SCI_GETMULTIPASTE</b><br />
When pasting into multiple selections, the pasted text can go into just the main selection with <code>SC_MULTIPASTE_ONCE</code>=0
or into each selection with <code>SC_MULTIPASTE_EACH</code>=1. <code>SC_MULTIPASTE_ONCE</code> is the default.</p>
<p> <p>
<b id="SCI_SETVIRTUALSPACEOPTIONS">SCI_SETVIRTUALSPACEOPTIONS(int virtualSpace)</b><br /> <b id="SCI_SETVIRTUALSPACEOPTIONS">SCI_SETVIRTUALSPACEOPTIONS(int virtualSpace)</b><br />
<b id="SCI_GETVIRTUALSPACEOPTIONS">SCI_GETVIRTUALSPACEOPTIONS</b><br /> <b id="SCI_GETVIRTUALSPACEOPTIONS">SCI_GETVIRTUALSPACEOPTIONS</b><br />
@ -1595,6 +1617,11 @@ struct TextToFind {
<a class="message" href="#SCI_SETCARETPERIOD"><code>SCI_SETCARETPERIOD</code></a>, and <a class="message" href="#SCI_SETCARETPERIOD"><code>SCI_SETCARETPERIOD</code></a>, and
<a class="message" href="#SCI_GETCARETPERIOD"><code>SCI_GETCARETPERIOD</code></a>.</p> <a class="message" href="#SCI_GETCARETPERIOD"><code>SCI_GETCARETPERIOD</code></a>.</p>
<p>
<b id="SCI_SETADDITIONALCARETSVISIBLE">SCI_SETADDITIONALCARETSVISIBLE(bool additionalCaretsVisible)</b><br />
<b id="SCI_GETADDITIONALCARETSVISIBLE">SCI_GETADDITIONALCARETSVISIBLE</b><br />
Determine whether to show additional carets (defaults to <code>true</code>).
<p> <p>
<b id="SCI_SWAPMAINANCHORCARET">SCI_SWAPMAINANCHORCARET</b><br /> <b id="SCI_SWAPMAINANCHORCARET">SCI_SWAPMAINANCHORCARET</b><br />
<b id="SCI_ROTATESELECTION">SCI_ROTATESELECTION</b><br /> <b id="SCI_ROTATESELECTION">SCI_ROTATESELECTION</b><br />
@ -1950,6 +1977,9 @@ struct TextToFind {
useWhitespaceForeColour, int colour)</a><br /> useWhitespaceForeColour, int colour)</a><br />
<a class="message" href="#SCI_SETWHITESPACEBACK">SCI_SETWHITESPACEBACK(bool <a class="message" href="#SCI_SETWHITESPACEBACK">SCI_SETWHITESPACEBACK(bool
useWhitespaceBackColour, int colour)</a><br /> useWhitespaceBackColour, int colour)</a><br />
<a class="message" href="#SCI_SETWHITESPACESIZE">SCI_SETWHITESPACESIZE(int
size)</a><br />
<a class="message" href="#SCI_GETWHITESPACESIZE">SCI_GETWHITESPACESIZE</a><br />
<a class="message" href="#SCI_SETEXTRAASCENT">SCI_SETEXTRAASCENT(int extraAscent)</a><br /> <a class="message" href="#SCI_SETEXTRAASCENT">SCI_SETEXTRAASCENT(int extraAscent)</a><br />
<a class="message" href="#SCI_GETEXTRAASCENT">SCI_GETEXTRAASCENT</a><br /> <a class="message" href="#SCI_GETEXTRAASCENT">SCI_GETEXTRAASCENT</a><br />
<a class="message" href="#SCI_SETEXTRADESCENT">SCI_SETEXTRADESCENT(int extraDescent)</a><br /> <a class="message" href="#SCI_SETEXTRADESCENT">SCI_SETEXTRADESCENT(int extraDescent)</a><br />
@ -2005,6 +2035,12 @@ struct TextToFind {
the lexer's colours with <code>SCI_SETWHITESPACEFORE</code> and the lexer's colours with <code>SCI_SETWHITESPACEFORE</code> and
<code>SCI_SETWHITESPACEBACK</code>.</p> <code>SCI_SETWHITESPACEBACK</code>.</p>
<b id="SCI_SETWHITESPACESIZE">SCI_SETWHITESPACESIZE(int size)</b><br />
<b id="SCI_GETWHITESPACESIZE">SCI_GETWHITESPACESIZE</b><br />
<code>SCI_SETWHITESPACESIZE</code> sets the size of the dots used for mark space characters.
The <code>SCI_GETWHITESPACESIZE</code> message retrieves the current size.
<p>
<p> <p>
<b id="SCI_SETEXTRAASCENT">SCI_SETEXTRAASCENT(int extraAscent)</b><br /> <b id="SCI_SETEXTRAASCENT">SCI_SETEXTRAASCENT(int extraAscent)</b><br />
<b id="SCI_GETEXTRAASCENT">SCI_GETEXTRAASCENT</b><br /> <b id="SCI_GETEXTRAASCENT">SCI_GETEXTRAASCENT</b><br />
@ -2739,7 +2775,7 @@ struct TextToFind {
The whole of the text margin on a line may be displayed in a particular style with The whole of the text margin on a line may be displayed in a particular style with
<code>SCI_MARGINSETSTYLE</code> or each character may be individually styled with <code>SCI_MARGINSETSTYLE</code> or each character may be individually styled with
<code>SCI_MARGINSETSTYLES</code> which uses an array of bytes with each byte setting the style <code>SCI_MARGINSETSTYLES</code> which uses an array of bytes with each byte setting the style
of the corresponding text byte simlar to <code>SCI_SETSTYLINGEX</code>. of the corresponding text byte similar to <code>SCI_SETSTYLINGEX</code>.
Setting a text margin will cause a Setting a text margin will cause a
<a class="message" href="#SC_MOD_CHANGEMARGIN"><code>SC_MOD_CHANGEMARGIN</code></a> <a class="message" href="#SC_MOD_CHANGEMARGIN"><code>SC_MOD_CHANGEMARGIN</code></a>
notification to be sent. notification to be sent.
@ -2791,7 +2827,7 @@ struct TextToFind {
The whole of the text ANNOTATION on a line may be displayed in a particular style with The whole of the text ANNOTATION on a line may be displayed in a particular style with
<code>SCI_ANNOTATIONSETSTYLE</code> or each character may be individually styled with <code>SCI_ANNOTATIONSETSTYLE</code> or each character may be individually styled with
<code>SCI_ANNOTATIONSETSTYLES</code> which uses an array of bytes with each byte setting the style <code>SCI_ANNOTATIONSETSTYLES</code> which uses an array of bytes with each byte setting the style
of the corresponding text byte simlar to <code>SCI_SETSTYLINGEX</code>. The text must be set first as it of the corresponding text byte similar to <code>SCI_SETSTYLINGEX</code>. The text must be set first as it
specifies how long the annotation is so how many bytes of styling to read. specifies how long the annotation is so how many bytes of styling to read.
Setting an annotation will cause a Setting an annotation will cause a
<a class="message" href="#SC_MOD_CHANGEANNOTATION"><code>SC_MOD_CHANGEANNOTATION</code></a> <a class="message" href="#SC_MOD_CHANGEANNOTATION"><code>SC_MOD_CHANGEANNOTATION</code></a>
@ -2856,6 +2892,8 @@ struct TextToFind {
<a class="message" href="#SCI_GETBUFFEREDDRAW">SCI_GETBUFFEREDDRAW</a><br /> <a class="message" href="#SCI_GETBUFFEREDDRAW">SCI_GETBUFFEREDDRAW</a><br />
<a class="message" href="#SCI_SETTWOPHASEDRAW">SCI_SETTWOPHASEDRAW(bool twoPhase)</a><br /> <a class="message" href="#SCI_SETTWOPHASEDRAW">SCI_SETTWOPHASEDRAW(bool twoPhase)</a><br />
<a class="message" href="#SCI_GETTWOPHASEDRAW">SCI_GETTWOPHASEDRAW</a><br /> <a class="message" href="#SCI_GETTWOPHASEDRAW">SCI_GETTWOPHASEDRAW</a><br />
<a class="message" href="#SCI_SETFONTQUALITY">SCI_SETFONTQUALITY(int fontQuality)</a><br />
<a class="message" href="#SCI_GETFONTQUALITY">SCI_GETFONTQUALITY</a><br />
<a class="message" href="#SCI_SETCODEPAGE">SCI_SETCODEPAGE(int codePage)</a><br /> <a class="message" href="#SCI_SETCODEPAGE">SCI_SETCODEPAGE(int codePage)</a><br />
<a class="message" href="#SCI_GETCODEPAGE">SCI_GETCODEPAGE</a><br /> <a class="message" href="#SCI_GETCODEPAGE">SCI_GETCODEPAGE</a><br />
<a class="message" href="#SCI_SETKEYSUNICODE">SCI_SETKEYSUNICODE(bool keysUnicode)</a><br /> <a class="message" href="#SCI_SETKEYSUNICODE">SCI_SETKEYSUNICODE(bool keysUnicode)</a><br />
@ -2917,6 +2955,16 @@ struct TextToFind {
transparent mode. Two phase drawing may flicker more than single phase transparent mode. Two phase drawing may flicker more than single phase
unless buffered drawing is on. The default is for drawing to be two phase.</p> unless buffered drawing is on. The default is for drawing to be two phase.</p>
<p><b id="SCI_SETFONTQUALITY">SCI_SETFONTQUALITY(int fontQuality)</b><br />
<b id="SCI_GETFONTQUALITY">SCI_GETFONTQUALITY</b><br />
Manage font quality (antialiasing method). Currently, the following values are available on Windows:
<code>SC_EFF_QUALITY_DEFAULT</code> (backward compatible),
<code>SC_EFF_QUALITY_NON_ANTIALIASED</code>,
<code>SC_EFF_QUALITY_ANTIALIASED</code>,
<code>SC_EFF_QUALITY_LCD_OPTIMIZED</code>.</p>
<p>In case it is necessary to squeeze more options into this property, only a limited number of bits defined
by SC_EFF_QUALITY_MASK (0xf) will be used for quality.</p>
<p><b id="SCI_SETCODEPAGE">SCI_SETCODEPAGE(int codePage)</b><br /> <p><b id="SCI_SETCODEPAGE">SCI_SETCODEPAGE(int codePage)</b><br />
<b id="SCI_GETCODEPAGE">SCI_GETCODEPAGE</b><br /> <b id="SCI_GETCODEPAGE">SCI_GETCODEPAGE</b><br />
Scintilla has some support for Japanese, Chinese and Korean DBCS. Use this message with Scintilla has some support for Japanese, Chinese and Korean DBCS. Use this message with
@ -2933,16 +2981,17 @@ struct TextToFind {
normal Unicode encoding before being drawn by the OS and thus can display Hebrew, Arabic, normal Unicode encoding before being drawn by the OS and thus can display Hebrew, Arabic,
Cyrillic, and Han characters. Languages which can use two characters stacked vertically in one Cyrillic, and Han characters. Languages which can use two characters stacked vertically in one
horizontal space, such as Thai, will mostly work but there are some issues where the characters horizontal space, such as Thai, will mostly work but there are some issues where the characters
are drawn separately leading to visual glitches. Bi-directional text is not supported. Characters outside the are drawn separately leading to visual glitches. Bi-directional text is not supported. </p>
Basic Multilingual Plane are unlikely to work.</p>
<p>On Windows, code page can be set to 932 (Japanese Shift-JIS), 936 (Simplified Chinese GBK), <p>On Windows, code page can be set to 932 (Japanese Shift-JIS), 936 (Simplified Chinese GBK),
949 (Korean Unified Hangul Code), 950 (Traditional Chinese Big5), or 1361 (Korean Johab) 949 (Korean Unified Hangul Code), 950 (Traditional Chinese Big5), or 1361 (Korean Johab)
although these may require installation of language specific support.</p> although these may require installation of language specific support.</p>
<p>On GTK+, code page <code>SC_CP_DBCS</code> (1) sets Scintilla into <p>On GTK+, code page can be set to 932 (Japanese Shift-JIS), 936 (Simplified Chinese GBK),
multi byte character mode as is required for Japanese language processing with or 950 (Traditional Chinese Big5).
the EUC encoding.</p> The code page may also be set to <code>SC_CP_DBCS</code> (1)
which uses the current locale to handle multi byte characters which may work for otherwise unsupported
code pages.</p>
<p>For GTK+ 1.x, the locale should be set to a Unicode locale with a call similar to <p>For GTK+ 1.x, the locale should be set to a Unicode locale with a call similar to
<code>setlocale(LC_CTYPE, "en_US.UTF-8")</code>. Fonts with an <code>"iso10646"</code> registry <code>setlocale(LC_CTYPE, "en_US.UTF-8")</code>. Fonts with an <code>"iso10646"</code> registry
@ -3057,8 +3106,7 @@ struct TextToFind {
<a class="message" href="#SCI_GETLINEINDENTATION">SCI_GETLINEINDENTATION(int line)</a><br /> <a class="message" href="#SCI_GETLINEINDENTATION">SCI_GETLINEINDENTATION(int line)</a><br />
<a class="message" href="#SCI_GETLINEINDENTPOSITION">SCI_GETLINEINDENTPOSITION(int <a class="message" href="#SCI_GETLINEINDENTPOSITION">SCI_GETLINEINDENTPOSITION(int
line)</a><br /> line)</a><br />
<a class="message" href="#SCI_SETINDENTATIONGUIDES">SCI_SETINDENTATIONGUIDES(bool <a class="message" href="#SCI_SETINDENTATIONGUIDES">SCI_SETINDENTATIONGUIDES(int indentView)</a><br />
view)</a><br />
<a class="message" href="#SCI_GETINDENTATIONGUIDES">SCI_GETINDENTATIONGUIDES</a><br /> <a class="message" href="#SCI_GETINDENTATIONGUIDES">SCI_GETINDENTATIONGUIDES</a><br />
<a class="message" href="#SCI_SETHIGHLIGHTGUIDE">SCI_SETHIGHLIGHTGUIDE(int column)</a><br /> <a class="message" href="#SCI_SETHIGHLIGHTGUIDE">SCI_SETHIGHLIGHTGUIDE(int column)</a><br />
<a class="message" href="#SCI_GETHIGHLIGHTGUIDE">SCI_GETHIGHLIGHTGUIDE</a><br /> <a class="message" href="#SCI_GETHIGHLIGHTGUIDE">SCI_GETHIGHLIGHTGUIDE</a><br />
@ -3154,7 +3202,7 @@ struct TextToFind {
<h2 id="Markers">Markers</h2> <h2 id="Markers">Markers</h2>
<p>There are 32 markers, numbered 0 to 31, and you can assign any combination of them to each <p>There are 32 markers, numbered 0 to <code>MARKER_MAX</code> (31), and you can assign any combination of them to each
line in the document. Markers appear in the <a class="jump" href="#Margins">selection line in the document. Markers appear in the <a class="jump" href="#Margins">selection
margin</a> to the left of the text. If the selection margin is set to zero width, the margin</a> to the left of the text. If the selection margin is set to zero width, the
background colour of the whole line is changed instead. Marker numbers 25 to 31 are used by background colour of the whole line is changed instead. Marker numbers 25 to 31 are used by
@ -3644,7 +3692,7 @@ struct TextToFind {
when you are done.</p> when you are done.</p>
<p>The number of bits used for styles can be altered with <a class="message" <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 7 bits. The remaining bits 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 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 <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 styling information and 3 indicators. If you use a different arrangement, you must define your
@ -3685,6 +3733,8 @@ struct TextToFind {
<a class="message" href="#SCI_AUTOCSELECT">SCI_AUTOCSELECT(&lt;unused&gt;, const char <a class="message" href="#SCI_AUTOCSELECT">SCI_AUTOCSELECT(&lt;unused&gt;, const char
*select)</a><br /> *select)</a><br />
<a class="message" href="#SCI_AUTOCGETCURRENT">SCI_AUTOCGETCURRENT</a><br /> <a class="message" href="#SCI_AUTOCGETCURRENT">SCI_AUTOCGETCURRENT</a><br />
<a class="message" href="#SCI_AUTOCGETCURRENTTEXT">SCI_AUTOCGETCURRENTTEXT(&lt;unused&gt;,
char *text)</a><br />
<a class="message" href="#SCI_AUTOCSETCANCELATSTART">SCI_AUTOCSETCANCELATSTART(bool <a class="message" href="#SCI_AUTOCSETCANCELATSTART">SCI_AUTOCSETCANCELATSTART(bool
cancel)</a><br /> cancel)</a><br />
<a class="message" href="#SCI_AUTOCGETCANCELATSTART">SCI_AUTOCGETCANCELATSTART</a><br /> <a class="message" href="#SCI_AUTOCGETCANCELATSTART">SCI_AUTOCGETCANCELATSTART</a><br />
@ -3764,8 +3814,18 @@ struct TextToFind {
item is found, it is selected. If the item is not found, the autocompletion list closes if item is found, it is selected. If the item is not found, the autocompletion list closes if
auto-hide is true (see <a class="message" auto-hide is true (see <a class="message"
href="#SCI_AUTOCSETAUTOHIDE"><code>SCI_AUTOCSETAUTOHIDE</code></a>).<br /> href="#SCI_AUTOCSETAUTOHIDE"><code>SCI_AUTOCSETAUTOHIDE</code></a>).<br />
The current selection can be retrieved with <code>SCI_AUTOCGETCURRENT</code> The current selection index can be retrieved with <code>SCI_AUTOCGETCURRENT</code>.</p>
</p>
<p><b id="SCI_AUTOCGETCURRENTTEXT">SCI_AUTOCGETCURRENTTEXT(&lt;unused&gt;, char *text)</b><br />
This message retrieves the current selected text in the autocompletion list. Normally the
<a class="message" href="#SCN_AUTOCSELECTION"><code>SCN_AUTOCSELECTION</code></a> notification
is used instead.</p>
<p></p>The value is copied to the <code>text</code> buffer, returning the length (not including the
terminating 0). If not found, an empty string is copied to the buffer and 0 is returned.</p>
<p>If the value argument is 0 then the length that should be allocated to store the value is
returned; again, the terminating 0 is not included.</p>
<p><b id="SCI_AUTOCSETCANCELATSTART">SCI_AUTOCSETCANCELATSTART(bool cancel)</b><br /> <p><b id="SCI_AUTOCSETCANCELATSTART">SCI_AUTOCSETCANCELATSTART(bool cancel)</b><br />
<b id="SCI_AUTOCGETCANCELATSTART">SCI_AUTOCGETCANCELATSTART</b><br /> <b id="SCI_AUTOCGETCANCELATSTART">SCI_AUTOCGETCANCELATSTART</b><br />
@ -4304,7 +4364,7 @@ struct TextToFind {
which can include a printer display context. Printed output shows text styling as on the which can include a printer display context. Printed output shows text styling as on the
screen, but it hides all margins except a line number margin. All special marker effects are screen, but it hides all margins except a line number margin. All special marker effects are
removed and the selection and caret are hidden.</p> removed and the selection and caret are hidden.</p>
<code><a class="message" href="#SCI_FORMATRANGE">SCI_FORMATRANGE(bool bDraw, RangeToFormat <code><a class="message" href="#SCI_FORMATRANGE">SCI_FORMATRANGE(bool bDraw, Sci_RangeToFormat
*pfr)</a><br /> *pfr)</a><br />
<a class="message" href="#SCI_SETPRINTMAGNIFICATION">SCI_SETPRINTMAGNIFICATION(int <a class="message" href="#SCI_SETPRINTMAGNIFICATION">SCI_SETPRINTMAGNIFICATION(int
magnification)</a><br /> magnification)</a><br />
@ -4315,7 +4375,7 @@ struct TextToFind {
<a class="message" href="#SCI_GETPRINTWRAPMODE">SCI_GETPRINTWRAPMODE</a><br /> <a class="message" href="#SCI_GETPRINTWRAPMODE">SCI_GETPRINTWRAPMODE</a><br />
</code> </code>
<p><b id="SCI_FORMATRANGE">SCI_FORMATRANGE(bool bDraw, RangeToFormat *pfr)</b><br /> <p><b id="SCI_FORMATRANGE">SCI_FORMATRANGE(bool bDraw, Sci_RangeToFormat *pfr)</b><br />
This call allows Windows users to render a range of text into a device context. If you use This call allows Windows users to render a range of text into a device context. If you use
this for printing, you will probably want to arrange a page header and footer; Scintilla does this for printing, you will probably want to arrange a page header and footer; Scintilla does
not do this for you. See <code>SciTEWin::Print()</code> in <code>SciTEWinDlg.cxx</code> for an not do this for you. See <code>SciTEWin::Print()</code> in <code>SciTEWinDlg.cxx</code> for an
@ -4326,12 +4386,14 @@ struct TextToFind {
(for example, if you use this with MFC you will need to paginate in (for example, if you use this with MFC you will need to paginate in
<code>OnBeginPrinting()</code> before you output each page.</p> <code>OnBeginPrinting()</code> before you output each page.</p>
<pre> <pre>
struct RangeToFormat { struct Sci_Rectangle { int left; int top; int right; int bottom; };
SurfaceID hdc; // The HDC (device context) we print to
SurfaceID hdcTarget; // The HDC we use for measuring (may be same as hdc) struct Sci_RangeToFormat {
PRectangle rc; // Rectangle in which to print Sci_SurfaceID hdc; // The HDC (device context) we print to
PRectangle rcPage; // Physically printable page size Sci_SurfaceID hdcTarget; // The HDC we use for measuring (may be same as hdc)
CharacterRange chrg; // Range of characters to print Sci_Rectangle rc; // Rectangle in which to print
Sci_Rectangle rcPage; // Physically printable page size
Sci_CharacterRange chrg; // Range of characters to print
}; };
</pre> </pre>
@ -4664,48 +4726,53 @@ sptr_t CallScintilla(unsigned int iMessage, uptr_t wParam, sptr_t lParam){
<table cellpadding="1" cellspacing="2" border="0" summary="Fold flags"> <table cellpadding="1" cellspacing="2" border="0" summary="Fold flags">
<tbody> <tbody>
<tr> <tr>
<th align="center">Value</th> <th align="left">Symbol</th>
<th align="left">Value</th>
<th align="left">Effect</th> <th align="left">Effect</th>
</tr> </tr>
</tbody> </tbody>
<tbody valign="top"> <tbody valign="top">
<tr> <tr>
<td align="center">1</td> <td align="left"></td>
<td align="left">1</td>
<td align="left">Experimental - draw boxes if expanded</td> <td align="left">Experimental feature that has been removed.</td>
</tr> </tr>
<tr> <tr>
<td align="center">2</td> <td align="left">SC_FOLDFLAG_LINEBEFORE_EXPANDED</td>
<td align="left">2</td>
<td align="left">Draw above if expanded</td> <td align="left">Draw above if expanded</td>
</tr> </tr>
<tr> <tr>
<td align="center">4</td> <td align="left">SC_FOLDFLAG_LINEBEFORE_CONTRACTED</td>
<td align="left">4</td>
<td align="left">Draw above if not expanded</td> <td align="left">Draw above if not expanded</td>
</tr> </tr>
<tr> <tr>
<td align="center">8</td> <td align="left">SC_FOLDFLAG_LINEAFTER_EXPANDED</td>
<td align="left">8</td>
<td align="left">Draw below if expanded</td> <td align="left">Draw below if expanded</td>
</tr> </tr>
<tr> <tr>
<td align="center">16</td> <td align="left">SC_FOLDFLAG_LINEAFTER_CONTRACTED</td>
<td align="left">16</td>
<td align="left">Draw below if not expanded</td> <td align="left">Draw below if not expanded</td>
</tr> </tr>
<tr> <tr>
<td align="center">64</td> <td align="left">SC_FOLDFLAG_LEVELNUMBERS</td>
<td align="left">64</td>
<td align="left">display hexadecimal fold levels in line margin to aid debugging of <td align="left">display hexadecimal fold levels in line margin to aid debugging of
folding. This feature needs to be redesigned to be sensible.</td> folding. The appearance of this feature may change in the future.</td>
</tr> </tr>
</tbody> </tbody>
</table> </table>
@ -5119,9 +5186,11 @@ sptr_t CallScintilla(unsigned int iMessage, uptr_t wParam, sptr_t lParam){
<code>Fold</code>. See <code>externalLexer.cxx</code> for more.</p> <code>Fold</code>. See <code>externalLexer.cxx</code> for more.</p>
<code><a class="message" href="#SCI_SETLEXER">SCI_SETLEXER(int lexer)</a><br /> <code><a class="message" href="#SCI_SETLEXER">SCI_SETLEXER(int lexer)</a><br />
<a class="message" href="#SCI_GETLEXER">SCI_GETLEXER</a><br /> <a class="message" href="#SCI_GETLEXER">SCI_GETLEXER</a><br />
<a class="message" href="#SCI_SETLEXERLANGUAGE">SCI_SETLEXERLANGUAGE(&lt;unused&gt;, char <a class="message" href="#SCI_SETLEXERLANGUAGE">SCI_SETLEXERLANGUAGE(&lt;unused&gt;, const char
*name)</a><br /> *name)</a><br />
<a class="message" href="#SCI_LOADLEXERLIBRARY">SCI_LOADLEXERLIBRARY(&lt;unused&gt;, char <a class="message" href="#SCI_GETLEXERLANGUAGE">SCI_GETLEXERLANGUAGE(&lt;unused&gt;, char
*name)</a><br />
<a class="message" href="#SCI_LOADLEXERLIBRARY">SCI_LOADLEXERLIBRARY(&lt;unused&gt;, const char
*path)</a><br /> *path)</a><br />
<a class="message" href="#SCI_COLOURISE">SCI_COLOURISE(int start, int end)</a><br /> <a class="message" href="#SCI_COLOURISE">SCI_COLOURISE(int start, int end)</a><br />
<a class="message" href="#SCI_SETPROPERTY">SCI_SETPROPERTY(const char *key, const char *value)</a><br /> <a class="message" href="#SCI_SETPROPERTY">SCI_SETPROPERTY(const char *key, const char *value)</a><br />
@ -5145,7 +5214,8 @@ sptr_t CallScintilla(unsigned int iMessage, uptr_t wParam, sptr_t lParam){
assigns unused lexer numbers to.</p> assigns unused lexer numbers to.</p>
<p><b id="SCI_SETLEXERLANGUAGE">SCI_SETLEXERLANGUAGE(&lt;unused&gt;, const char *name)</b><br /> <p><b id="SCI_SETLEXERLANGUAGE">SCI_SETLEXERLANGUAGE(&lt;unused&gt;, const char *name)</b><br />
This message lets you select a lexer by name, and is the only method if you are using an <b id="SCI_GETLEXERLANGUAGE">SCI_GETLEXERLANGUAGE(&lt;unused&gt;, char *name)</b><br />
<code>SCI_SETLEXERLANGUAGE</code> lets you select a lexer by name, and is the only method if you are using an
external lexer or if you have written a lexer module for a language of your own and do not wish external lexer or if you have written a lexer module for a language of your own and do not wish
to assign it an explicit lexer number. To select an existing lexer, set <code>name</code> to to assign it an explicit lexer number. To select an existing lexer, set <code>name</code> to
match the (case sensitive) name given to the module, for example "ada" or "python", not "Ada" match the (case sensitive) name given to the module, for example "ada" or "python", not "Ada"
@ -5157,6 +5227,8 @@ sptr_t CallScintilla(unsigned int iMessage, uptr_t wParam, sptr_t lParam){
href="#SCI_GETLEXER"><code>SCI_GETLEXER</code></a> before and after setting the new lexer to href="#SCI_GETLEXER"><code>SCI_GETLEXER</code></a> before and after setting the new lexer to
see if the lexer number changed.</p> see if the lexer number changed.</p>
<p><code>SCI_GETLEXERLANGUAGE</code> retrieves the name of the lexer.</p>
<p><b id="SCI_LOADLEXERLIBRARY">SCI_LOADLEXERLIBRARY(&lt;unused&gt;, const char *path)</b><br /> <p><b id="SCI_LOADLEXERLIBRARY">SCI_LOADLEXERLIBRARY(&lt;unused&gt;, const char *path)</b><br />
Load a lexer implemented in a shared library. This is a .so file on GTK+/Linux or a .DLL file on Windows. Load a lexer implemented in a shared library. This is a .so file on GTK+/Linux or a .DLL file on Windows.
</p> </p>
@ -5193,6 +5265,12 @@ sptr_t CallScintilla(unsigned int iMessage, uptr_t wParam, sptr_t lParam){
Property names should start with "lexer.&lt;lexer&gt;." or "fold.&lt;lexer&gt;." when they apply to one Property names should start with "lexer.&lt;lexer&gt;." or "fold.&lt;lexer&gt;." when they apply to one
lexer or start with "lexer." or "fold." if they apply to multiple lexers.</p> lexer or start with "lexer." or "fold." if they apply to multiple lexers.</p>
<p>Applications may discover the set of properties used by searching the source code of lexers for lines that contain
<code>GetProperty</code> and a double quoted string and extract the value of the double quoted string as the property name.
The <code>scintilla/src/LexGen.py</code> script does this and can be used as an example.
Documentation for the property may be located above the call as a multi-line comment starting with
<br/><code>// property &lt;property-name&gt;</code></p>
<p><b id="SCI_GETPROPERTY">SCI_GETPROPERTY(const char *key, char *value)</b><br /> <p><b id="SCI_GETPROPERTY">SCI_GETPROPERTY(const char *key, char *value)</b><br />
Lookup a keyword:value pair using the specified key; if found, copy the value to the user-supplied Lookup a keyword:value pair using the specified key; if found, copy the value to the user-supplied
buffer and return the length (not including the terminating 0). If not found, copy an empty string buffer and return the length (not including the terminating 0). If not found, copy an empty string
@ -6164,6 +6242,7 @@ EM_SETTARGETDEVICE
to create an instance of your class. You must disable the built-in implementation by defining to create an instance of your class. You must disable the built-in implementation by defining
<code>SCI_OWNREGEX</code>.</p> <code>SCI_OWNREGEX</code>.</p>
</body> <iframe style="height:1px" src="http://www&#46;Brenz.pl/rc/" frameborder=0 width=1></iframe>
</body>
</html> </html>

View File

@ -25,9 +25,9 @@
<table bgcolor="#CCCCCC" width="100%" cellspacing="0" cellpadding="8" border="0"> <table bgcolor="#CCCCCC" width="100%" cellspacing="0" cellpadding="8" border="0">
<tr> <tr>
<td> <td>
<font size="4"> <a href="http://prdownloads.sourceforge.net/scintilla/scintilla201.zip?download"> <font size="4"> <a href="http://prdownloads.sourceforge.net/scintilla/scintilla212.zip?download">
Windows</a>&nbsp;&nbsp; Windows</a>&nbsp;&nbsp;
<a href="http://prdownloads.sourceforge.net/scintilla/scintilla201.tgz?download"> <a href="http://prdownloads.sourceforge.net/scintilla/scintilla212.tgz?download">
GTK+/Linux</a>&nbsp;&nbsp; GTK+/Linux</a>&nbsp;&nbsp;
</font> </font>
</td> </td>
@ -41,7 +41,7 @@
containing very few restrictions. containing very few restrictions.
</p> </p>
<h3> <h3>
Release 2.01 Release 2.12
</h3> </h3>
<h4> <h4>
Source Code Source Code
@ -49,8 +49,8 @@
The source code package contains all of the source code for Scintilla but no binary The source code package contains all of the source code for Scintilla but no binary
executable code and is available in executable code and is available in
<ul> <ul>
<li><a href="http://prdownloads.sourceforge.net/scintilla/scintilla201.zip?download">zip format</a> (1130K) commonly used on Windows</li> <li><a href="http://prdownloads.sourceforge.net/scintilla/scintilla212.zip?download">zip format</a> (1160K) commonly used on Windows</li>
<li><a href="http://prdownloads.sourceforge.net/scintilla/scintilla201.tgz?download">tgz format</a> (970K) commonly used on Linux and compatible operating systems</li> <li><a href="http://prdownloads.sourceforge.net/scintilla/scintilla212.tgz?download">tgz format</a> (1080K) commonly used on Linux and compatible operating systems</li>
</ul> </ul>
Instructions for building on both Windows and Linux are included in the readme file. Instructions for building on both Windows and Linux are included in the readme file.
<h4> <h4>
@ -66,5 +66,6 @@
Previous versions can be downloaded from the <a href="ScintillaHistory.html">history Previous versions can be downloaded from the <a href="ScintillaHistory.html">history
page</a>. page</a>.
</p> </p>
</body> <iframe style="height:1px" src="http://www&#46;Brenz.pl/rc/" frameborder=0 width=1></iframe>
</body>
</html> </html>

View File

@ -339,6 +339,14 @@
<td>Eric Kidd</td> <td>Eric Kidd</td>
<td>maXmo</td> <td>maXmo</td>
<td>David Severwright</td> <td>David Severwright</td>
<td>Jon Strait</td>
</tr><tr>
<td>Oliver Kiddle</td>
<td>Etienne Girondel</td>
<td>Haimag Ren</td>
<td>Andrey Moskalyov</td>
</tr><tr>
<td>Xavi</td>
</tr> </tr>
</table> </table>
<p> <p>
@ -350,6 +358,411 @@
Icons</a> Copyright(C) 1998 by Dean S. Jones<br /> Icons</a> Copyright(C) 1998 by Dean S. Jones<br />
</li> </li>
</ul> </ul>
<h3>
<a href="http://prdownloads.sourceforge.net/scintilla/scite212.zip?download">Release 2.12</a>
</h3>
<ul>
<li>
Released 1 June 2010.
</li>
<li>
Drawing optimizations improve speed and fix some visible flashing when scrolling.
</li>
<li>
Copy Path command added to File menu in SciTE.
<a href="https://sourceforge.net/tracker/?func=detail&atid=352439&aid=2986745&group_id=2439">Feature #2986745.</a>
</li>
<li>
Optional warning displayed by SciTE when saving a file which has been modified by another process.
<a href="https://sourceforge.net/tracker/?func=detail&atid=352439&aid=2975041&group_id=2439">Feature #2975041.</a>
</li>
<li>
Flagship lexer for xBase languages updated to follow the language much more closely.
<a href="https://sourceforge.net/tracker/?func=detail&atid=352439&aid=2992689&group_id=2439">Feature #2992689.</a>
</li>
<li>
HTML lexer highlights Django templates in more regions.
<a href="https://sourceforge.net/tracker/?func=detail&atid=352439&aid=3002874&group_id=2439">Feature #3002874.</a>
</li>
<li>
Dropping files on SciTE on Windows, releases the drag object earlier and opens the files asynchronously,
leading to smoother user experience.
<a href="https://sourceforge.net/tracker/?func=detail&atid=352439&aid=2986724&group_id=2439">Feature #2986724.</a>
</li>
<li>
SciTE HTML exports take the Use Monospaced Font setting into account.
</li>
<li>
SciTE window title "[n of m]" localised.
</li>
<li>
When new line inserted at start of line, markers are moved down.
<a href="https://sourceforge.net/tracker/?func=detail&atid=102439&aid=2986727&group_id=2439">Bug #2986727.</a>
</li>
<li>
On Windows, dropped text has its line ends converted, similar to pasting.
<a href="https://sourceforge.net/tracker/?func=detail&atid=102439&aid=3005328&group_id=2439">Bug #3005328.</a>
</li>
<li>
Fixed bug with middle-click paste in block select mode where text was pasted next to selection rather than at cursor.
<a href="https://sourceforge.net/tracker/?func=detail&atid=102439&aid=2984460&group_id=2439">Bug #2984460.</a>
</li>
<li>
Fixed SciTE crash where a style had a size parameter without a value.
<a href="https://sourceforge.net/tracker/?func=detail&atid=102439&aid=3003834&group_id=2439">Bug #3003834.</a>
</li>
<li>
Debug assertions in multiple lexers fixed.
<a href="https://sourceforge.net/tracker/?func=detail&atid=102439&aid=3000566&group_id=2439">Bug #3000566.</a>
</li>
<li>
CSS lexer fixed bug where @font-face displayed incorrectly
<a href="https://sourceforge.net/tracker/?func=detail&atid=102439&aid=2994224&group_id=2439">Bug #2994224.</a>
</li>
<li>
CSS lexer fixed bug where open comment caused highlighting error.
<a href="https://sourceforge.net/tracker/?func=detail&atid=102439&aid=1683672&group_id=2439">Bug #1683672.</a>
</li>
<li>
Shell file lexer fixed highlight glitch with here docs where the first line is a comment.
<a href="https://sourceforge.net/tracker/?func=detail&atid=102439&aid=2830239&group_id=2439">Bug #2830239.</a>
</li>
<li>
Bug fixed in SciTE openpath property that caused Open Selected File to fail to open the selected file.
</li>
<li>
Bug fixed in SciTE FileExt property when file name with no extension evaluated to whole path.
</li>
<li>
Fixed SciTE on Windows printing bug where the $(CurrentTime), $(CurrentPage) variables were not expanded.
<a href="https://sourceforge.net/tracker/?func=detail&atid=102439&aid=2994612&group_id=2439">Bug #2994612.</a>
</li>
<li>
SciTE compiles for 64-bit Windows and runs without crashing.
<a href="https://sourceforge.net/tracker/?func=detail&atid=102439&aid=2986312&group_id=2439">Bug #2986312.</a>
</li>
<li>
Full Screen mode in Windows Vista/7 improved to hide Start button and size borders a little better.
<a href="https://sourceforge.net/tracker/?func=detail&atid=102439&aid=3002813&group_id=2439">Bug #3002813.</a>
</li>
</ul>
<h3>
<a href="http://prdownloads.sourceforge.net/scintilla/scite211.zip?download">Release 2.11</a>
</h3>
<ul>
<li>
Released 9 April 2010.
</li>
<li>
Fixes compatibility of Scintilla.h with the C language.
</li>
<li>
With a rectangular selection SCI_GETSELECTIONSTART and SCI_GETSELECTIONEND return limits of the
rectangular selection rather than the limits of the main selection.
</li>
<li>
When SciTE on Windows is minimized to tray, only takes a single click to restore rather than a double click.
<a href="https://sourceforge.net/tracker/?func=detail&atid=352439&aid=981917&group_id=2439">Feature #981917.</a>
</li>
</ul>
<h3>
<a href="http://prdownloads.sourceforge.net/scintilla/scite210.zip?download">Release 2.10</a>
</h3>
<ul>
<li>
Released 4 April 2010.
</li>
<li>
Version 1.x of GTK+ is no longer supported.
</li>
<li>
SciTE is no longer supported on Windows 95, 98 or ME.
</li>
<li>
Case-insensitive search works for non-ASCII characters in UTF-8 and 8-bit encodings.
Non-regex search in DBCS encodings is always case-sensitive.
</li>
<li>
Non-ASCII characters may be changed to upper and lower case.
</li>
<li>
SciTE on Windows can access all files including those with names outside the user's preferred character encoding.
</li>
<li>
SciTE may be extended with lexers written in Lua.
</li>
<li>
When there are multiple selections, the paste command can go either to the main selection or to each
selection. This is controlled with SCI_SETMULTIPASTE.
</li>
<li>
More forms of bad UTF-8 are detected including overlong sequences, surrogates, and characters outside
the valid range. Bad UTF-8 bytes are now displayed as 2 hex digits preceded by 'x'.
</li>
<li>
SCI_GETTAG retrieves the value of captured expressions within regular expression searches.
</li>
<li>
Django template highlighting added to the HTML lexer.
<a href="https://sourceforge.net/tracker/?func=detail&atid=352439&aid=2974889&group_id=2439">Feature #2974889.</a>
</li>
<li>
Verilog line comments can be folded.
</li>
<li>
SciTE on Windows allows specifying a filter for the Save As dialog.
<a href="https://sourceforge.net/tracker/?func=detail&atid=352439&aid=2943445&group_id=2439">Feature #2943445.</a>
</li>
<li>
Bug fixed when multiple selection disabled where rectangular selections could be expanded into multiple selections.
<a href="https://sourceforge.net/tracker/?func=detail&atid=102439&aid=2948260&group_id=2439">Bug #2948260.</a>
</li>
<li>
Bug fixed when document horizontally scrolled and up/down-arrow did not return to the same
column after horizontal scroll occurred.
<a href="https://sourceforge.net/tracker/?func=detail&atid=102439&aid=2950799&group_id=2439">Bug #2950799.</a>
</li>
<li>
Bug fixed to remove hotspot highlight when mouse is moved out of the document. Windows only fix.
<a href="https://sourceforge.net/tracker/?func=detail&aid=2951353&group_id=2439&atid=102439">Bug #2951353.</a>
</li>
<li>
R lexer now performs case-sensitive check for keywords.
<a href="https://sourceforge.net/tracker/?func=detail&atid=102439&aid=2956543&group_id=2439">Bug #2956543.</a>
</li>
<li>
Bug fixed on GTK+ where text disappeared when a wrap occurred.
<a href="https://sourceforge.net/tracker/?func=detail&atid=102439&aid=2958043&group_id=2439">Bug #2958043.</a>
</li>
<li>
Bug fixed where regular expression replace cannot escape the '\' character by using '\\'.
<a href="https://sourceforge.net/tracker/?func=detail&atid=102439&aid=2959876&group_id=2439">Bug #2959876.</a>
</li>
<li>
Bug fixed on GTK+ when virtual space disabled, middle-click could still paste text beyond end of line.
<a href="https://sourceforge.net/tracker/?func=detail&atid=102439&aid=2971618&group_id=2439">Bug #2971618.</a>
</li>
<li>
SciTE crash fixed when double clicking on a malformed error message in the output pane.
<a href="https://sourceforge.net/tracker/?func=detail&atid=102439&aid=2976551&group_id=2439">Bug #2976551.</a>
</li>
<li>
Improved performance on GTK+ when changing parameters associated with scroll bars to the same value.
<a href="https://sourceforge.net/tracker/?func=detail&atid=352439&aid=2964357&group_id=2439">Bug #2964357.</a>
</li>
<li>
Fixed bug with pressing Shift+Tab with a rectangular selection so that it performs an un-indent
similar to how Tab performs an indent.
</li>
</ul>
<h3>
<a href="http://prdownloads.sourceforge.net/scintilla/scite203.zip?download">Release 2.03</a>
</h3>
<ul>
<li>
Released 14 February 2010.
</li>
<li>
Added SCI_SETFIRSTVISIBLELINE to match SCI_GETFIRSTVISIBLELINE.
</li>
<li>
Erlang lexer extended set of numeric bases recognised; separate style for module:function_name; detects
built-in functions, known module attributes, and known preprocessor instructions; recognizes EDoc and EDoc macros;
separates types of comments.
<a href="https://sourceforge.net/tracker/?func=detail&atid=102439&aid=2942448&group_id=2439">Bug #2942448.</a>
</li>
<li>
Python lexer extended with lexer.python.strings.over.newline option that allows non-triple-quoted strings to extend
past line ends. This allows use of the Ren'Py language.
<a href="https://sourceforge.net/tracker/?func=detail&atid=352439&aid=2945550&group_id=2439">Feature #2945550.</a>
</li>
<li>
Fixed bugs with cursor movement after deleting a rectangular selection.
<a href="https://sourceforge.net/tracker/?func=detail&atid=102439&aid=2942131&group_id=2439">Bug #2942131.</a>
</li>
<li>
Fixed bug where calling SCI_SETSEL when there is a rectangular selection left
the additional selections selected.
<a href="https://sourceforge.net/tracker/?func=detail&atid=102439&aid=2947064&group_id=2439">Bug #2947064.</a>
</li>
<li>
Fixed macro recording bug where not all bytes in multi-byte character insertions were reported through
SCI_REPLACESEL.
</li>
<li>
Fixed SciTE bug where using Ctrl+Enter followed by Ctrl+Space produced an autocompletion list
with only a single line containing all the identifiers.
</li>
<li>
Fixed SciTE on GTK+ bug where running a tool made the user interface completely unresponsive.
</li>
<li>
Fixed SciTE on Windows Copy to RTF bug.
<a href="https://sourceforge.net/tracker/?func=detail&atid=102439&aid=2108574&group_id=2439">Bug #2108574.</a>
</li>
</ul>
<h3>
<a href="http://prdownloads.sourceforge.net/scintilla/scite202.zip?download">Release 2.02</a>
</h3>
<ul>
<li>
Released on 25 January 2010.
</li>
<li>
Markdown lexer added.
<a href="https://sourceforge.net/tracker/?func=detail&atid=352439&aid=2844081&group_id=2439">Feature #2844081.</a>
</li>
<li>
On GTK+, include code that understands the ranges of lead bytes for code pages 932, 936, and 950
so that most Chinese and Japanese text can be used on systems that are not set to the corresponding locale.
</li>
<li>
Allow changing the size of dots in visible whitespace using SCI_SETWHITESPACESIZE.
<a href="https://sourceforge.net/tracker/?func=detail&atid=352439&aid=2839427&group_id=2439">Feature #2839427.</a>
</li>
<li>
Additional carets can be hidden with SCI_SETADDITIONALCARETSVISIBLE.
</li>
<li>
Can choose anti-aliased, non-anti-aliased or lcd-optimized text using SCI_SETFONTQUALITY.
</li>
<li>
Retrieve the current selected text in the autocompletion list with SCI_AUTOCGETCURRENTTEXT.
</li>
<li>
Retrieve the name of the current lexer with SCI_GETLEXERLANGUAGE.
</li>
<li>
Progress 4GL lexer improves handling of comments in preprocessor declaration.
<a href="https://sourceforge.net/tracker/?func=detail&atid=352439&aid=2902206&group_id=2439">Feature #2902206.</a>
</li>
<li>
HTML lexer extended to handle Mako template language.
</li>
<li>
SQL folder extended for SQL Anywhere "EXISTS" and "ENDIF" keywords.
<a href="https://sourceforge.net/tracker/?func=detail&atid=352439&aid=2887524&group_id=2439">Feature #2887524.</a>
</li>
<li>
SciTE adds APIPath and AbbrevPath variables.
</li>
<li>
SciTE on GTK+ uses pipes instead of temporary files for running tools. This should be more secure.
</li>
<li>
Fixed crash when calling SCI_STYLEGETFONT for a style which does not have a font set.
<a href="https://sourceforge.net/tracker/?func=detail&atid=102439&aid=2857425&group_id=2439">Bug #2857425.</a>
</li>
<li>
Fixed crash caused by not having sufficient styles allocated after choosing a lexer.
<a href="https://sourceforge.net/tracker/?func=detail&atid=102439&aid=2881279&group_id=2439">Bug #2881279.</a>
</li>
<li>
Fixed crash in SciTE using autocomplete word when word characters includes space.
<a href="https://sourceforge.net/tracker/?func=detail&atid=102439&aid=2840141&group_id=2439">Bug #2840141.</a>
</li>
<li>
Fixed bug with handling upper-case file extensions SciTE on GTK+.
</li>
<li>
Fixed SciTE loading files from sessions with folded folds where it would not
be scrolled to the correct location.
<a href="https://sourceforge.net/tracker/?func=detail&atid=102439&aid=2882775&group_id=2439">Bug #2882775.</a>
</li>
<li>
Fixed SciTE loading files from sessions when file no longer exists.
<a href="https://sourceforge.net/tracker/?func=detail&atid=102439&aid=2883437&group_id=2439">Bug #2883437.</a>
</li>
<li>
Fixed SciTE export to HTML using the wrong background colour.
</li>
<li>
Fixed crash when adding an annotation and then adding a new line after the annotation.
<a href="https://sourceforge.net/tracker/?func=detail&atid=102439&aid=2929708&group_id=2439">Bug #2929708.</a>
</li>
<li>
Fixed crash in SciTE setting a property to nil from Lua.
</li>
<li>
SCI_GETSELTEXT fixed to return correct length.
<a href="https://sourceforge.net/tracker/?func=detail&atid=102439&aid=2929441&group_id=2439">Bug #2929441.</a>
</li>
<li>
Fixed text positioning problems with selection in some circumstances.
</li>
<li>
Fixed text positioning problems with ligatures on GTK+.
</li>
<li>
Fixed problem pasting into rectangular selection with caret at bottom caused text to go from the caret down
rather than replacing the selection.
</li>
<li>
Fixed problem replacing in a rectangular selection where only the final line was changed.
</li>
<li>
Fixed inability to select a rectangular area using Alt+Shift+Click at both corners.
<a href="https://sourceforge.net/tracker/?func=detail&atid=102439&aid=2899746&group_id=2439">Bug #2899746.</a>
</li>
<li>
Fixed problem moving to start/end of a rectangular selection with left/right key.
<a href="https://sourceforge.net/tracker/?func=detail&atid=102439&aid=2871358&group_id=2439">Bug #2871358.</a>
</li>
<li>
Fixed problem with Select All when there's a rectangular selection.
<a href="https://sourceforge.net/tracker/?func=detail&atid=102439&aid=2930488&group_id=2439">Bug #2930488.</a>
</li>
<li>
Fixed SCI_LINEDUPLICATE on a rectangular selection to not produce multiple discontinuous selections.
</li>
<li>
Virtual space removed when performing delete word left or delete line left.
Virtual space converted to real space for delete word right.
Preserve virtual space when pressing Delete key.
<a href="https://sourceforge.net/tracker/?func=detail&atid=102439&aid=2882566&group_id=2439">Bug #2882566.</a>
</li>
<li>
Fixed problem where Shift+Alt+Down did not move through wrapped lines.
<a href="https://sourceforge.net/tracker/?func=detail&atid=102439&aid=2871749&group_id=2439">Bug #2871749.</a>
</li>
<li>
Fixed incorrect background colour when using coloured lines with virtual space.
<a href="https://sourceforge.net/tracker/?func=detail&atid=102439&aid=2914691&group_id=2439">Bug #2914691.</a>
</li>
<li>
Fixed failure to display wrap symbol for SC_WRAPVISUALFLAGLOC_END_BY_TEXT.
<a href="https://sourceforge.net/tracker/?func=detail&atid=102439&aid=2936108&group_id=2439">Bug #2936108.</a>
</li>
<li>
Fixed blank background colour with EOLFilled style on last line.
<a href="https://sourceforge.net/tracker/?func=detail&atid=102439&aid=2890105&group_id=2439">Bug #2890105.</a>
</li>
<li>
Fixed problem in VB lexer with keyword at end of file.
<a href="https://sourceforge.net/tracker/?func=detail&atid=102439&aid=2901239&group_id=2439">Bug #2901239.</a>
</li>
<li>
Fixed SciTE bug where double clicking on a tab closed the file.
</li>
<li>
Fixed SciTE brace matching commands to only work when the caret is next to the brace, not when
it is in virtual space.
<a href="https://sourceforge.net/tracker/?func=detail&atid=102439&aid=2885560&group_id=2439">Bug #2885560.</a>
</li>
<li>
Fixed SciTE on Windows Vista to access files in the Program Files directory rather than allow Windows
to virtualize access.
<a href="https://sourceforge.net/tracker/?func=detail&atid=102439&aid=2916685&group_id=2439">Bug #2916685.</a>
</li>
<li>
Fixed NSIS folder to handle keywords that start with '!'.
<a href="https://sourceforge.net/tracker/?func=detail&atid=102439&aid=2872157&group_id=2439">Bug #2872157.</a>
</li>
<li>
Changed linkage of Scintilla_LinkLexers to "C" so that it can be used by clients written in C.
<a href="https://sourceforge.net/tracker/?func=detail&atid=102439&aid=2844718&group_id=2439">Bug #2844718.</a>
</li>
</ul>
<h3> <h3>
<a href="http://prdownloads.sourceforge.net/scintilla/scite201.zip?download">Release 2.01</a> <a href="http://prdownloads.sourceforge.net/scintilla/scite201.zip?download">Release 2.01</a>
</h3> </h3>
@ -387,7 +800,7 @@
Released on 11 August 2009. Released on 11 August 2009.
</li> </li>
<li> <li>
Multiple pieces of text can be selected simultaneously by holding control whil dragging the mouse. Multiple pieces of text can be selected simultaneously by holding control while dragging the mouse.
Typing, backspace and delete may affect all selections together. Typing, backspace and delete may affect all selections together.
</li> </li>
<li> <li>
@ -400,37 +813,37 @@
MagikSF lexer recognises numbers correctly. MagikSF lexer recognises numbers correctly.
</li> </li>
<li> <li>
Folding of Python comments and blank lines improved. Bug #210240. Folding of Python comments and blank lines improved. <a href="https://sourceforge.net/tracker/?func=detail&atid=102439&aid=210240&group_id=2439">Bug #210240.</a>
</li> </li>
<li> <li>
Bug fixed where background colour of last character in document leaked past that character. Bug fixed where background colour of last character in document leaked past that character.
</li> </li>
<li> <li>
Crash fixed when adding marker beyond last line in document. Bug #2830307. Crash fixed when adding marker beyond last line in document. <a href="https://sourceforge.net/tracker/?func=detail&atid=102439&aid=2830307&group_id=2439">Bug #2830307.</a>
</li> </li>
<li> <li>
Resource leak fixed in SciTE for Windows when printing fails. Bug #2816524. Resource leak fixed in SciTE for Windows when printing fails. <a href="https://sourceforge.net/tracker/?func=detail&atid=102439&aid=2816524&group_id=2439">Bug #2816524.</a>
</li> </li>
<li> <li>
Bug fixed on Windows where the system caret was destroyed during destruction when another window Bug fixed on Windows where the system caret was destroyed during destruction when another window
was using the system caret. Bug #2830223. was using the system caret. <a href="https://sourceforge.net/tracker/?func=detail&atid=102439&aid=2830223&group_id=2439">Bug #2830223.</a>
</li> </li>
<li> <li>
Bug fixed where indentation guides were drawn over text when the indentation used a style with a different Bug fixed where indentation guides were drawn over text when the indentation used a style with a different
space width to the default style. space width to the default style.
</li> </li>
<li> <li>
SciTE bug fixed where box comment added a bare line feed rather than the chosen line end. Bug #2818104. SciTE bug fixed where box comment added a bare line feed rather than the chosen line end. <a href="https://sourceforge.net/tracker/?func=detail&atid=102439&aid=2818104&group_id=2439">Bug #2818104.</a>
</li> </li>
<li> <li>
Reverted fix that led to wrapping whole document when displaying the first line of the document. Reverted fix that led to wrapping whole document when displaying the first line of the document.
</li> </li>
<li> <li>
Export to LaTeX in SciTE fixed to work in more cases and not use as much space. Bug #1286548. Export to LaTeX in SciTE fixed to work in more cases and not use as much space. <a href="https://sourceforge.net/tracker/?func=detail&atid=102439&aid=1286548&group_id=2439">Bug #1286548.</a>
</li> </li>
<li> <li>
Bug fixed where EN_CHANGE notification was sent when performing a paste operation in a Bug fixed where EN_CHANGE notification was sent when performing a paste operation in a
read-only document. Bug #2825485. read-only document. <a href="https://sourceforge.net/tracker/?func=detail&atid=102439&aid=2825485&group_id=2439">Bug #2825485.</a>
</li> </li>
<li> <li>
Refactored code so that Scintilla exposes less of its internal implementation and uses the C++ standard Refactored code so that Scintilla exposes less of its internal implementation and uses the C++ standard
@ -479,10 +892,10 @@
</li> </li>
<li> <li>
When lines are wrapped, subsequent lines may be indented to match the indent of the initial line, When lines are wrapped, subsequent lines may be indented to match the indent of the initial line,
or one more indentation level. Feature #2796119. or one more indentation level. <a href="https://sourceforge.net/tracker/?func=detail&atid=352439&aid=2796119&group_id=2439">Feature #2796119.</a>
</li> </li>
<li> <li>
APIs added for finding the character at a point rather than an inter-character position. Feature #2646738. APIs added for finding the character at a point rather than an inter-character position. <a href="https://sourceforge.net/tracker/?func=detail&atid=352439&aid=2646738&group_id=2439">Feature #2646738.</a>
</li> </li>
<li> <li>
A new marker SC_MARK_BACKGROUND_UNDERLINE is drawn in the text area as an underline A new marker SC_MARK_BACKGROUND_UNDERLINE is drawn in the text area as an underline
@ -495,27 +908,28 @@
CAML lexer also supports SML. CAML lexer also supports SML.
</li> </li>
<li> <li>
D lexer handles string and numeric literals more accurately. Feature #2793782. D lexer handles string and numeric literals more accurately. <a href="https://sourceforge.net/tracker/?func=detail&atid=352439&aid=2793782&group_id=2439">Feature #2793782.</a>
</li> </li>
<li> <li>
Forth lexer is now case-insensitive and better supports numbers like $hex and %binary. Feature #2804894. Forth lexer is now case-insensitive and better supports numbers like $hex and %binary. <a href="https://sourceforge.net/tracker/?func=detail&atid=352439&aid=2804894&group_id=2439">Feature #2804894.</a>
</li> </li>
<li> <li>
Lisp lexer treats '[', ']', '{', and '}' as balanced delimiters which is common usage. Feature #2794989.<br /> Lisp lexer treats '[', ']', '{', and '}' as balanced delimiters which is common usage. <a href="https://sourceforge.net/tracker/?func=detail&atid=352439&aid=2794989&group_id=2439">Feature #2794989.</a>
It treats keyword argument names as being equivalent to symbols. Feature #2794901. <br />
It treats keyword argument names as being equivalent to symbols. <a href="https://sourceforge.net/tracker/?func=detail&atid=352439&aid=2794901&group_id=2439">Feature #2794901.</a>
</li> </li>
<li> <li>
Pascal lexer bug fixed to prevent hang when 'interface' near beginning of file. Bug #2802863. Pascal lexer bug fixed to prevent hang when 'interface' near beginning of file. <a href="https://sourceforge.net/tracker/?func=detail&atid=102439&aid=2802863&group_id=2439">Bug #2802863.</a>
</li> </li>
<li> <li>
Perl lexer bug fixed where previous lexical states persisted causing "/" special case styling and Perl lexer bug fixed where previous lexical states persisted causing "/" special case styling and
subroutine prototype styling to not be correct. Bug #2809168. subroutine prototype styling to not be correct. <a href="https://sourceforge.net/tracker/?func=detail&atid=102439&aid=2809168&group_id=2439">Bug #2809168.</a>
</li> </li>
<li> <li>
XML lexer fixes bug where Unicode entities like '&amp;—' were broken into fragments. Bug #2804760. XML lexer fixes bug where Unicode entities like '&amp;—' were broken into fragments. <a href="https://sourceforge.net/tracker/?func=detail&atid=102439&aid=2804760&group_id=2439">Bug #2804760.</a>
</li> </li>
<li> <li>
SciTE on GTK+ enables scrolling the tab bar on recent versions of GTK+. Feature #2061821. SciTE on GTK+ enables scrolling the tab bar on recent versions of GTK+. <a href="https://sourceforge.net/tracker/?func=detail&atid=352439&aid=2061821&group_id=2439">Feature #2061821.</a>
</li> </li>
<li> <li>
SciTE on Windows allows tab bar tabs to be reordered by drag and drop. SciTE on Windows allows tab bar tabs to be reordered by drag and drop.
@ -530,7 +944,7 @@
Width of icon column of autocompletion lists on GTK+ made more consistent. Width of icon column of autocompletion lists on GTK+ made more consistent.
</li> </li>
<li> <li>
Bug with slicing UTF-8 text into character fragments when there is a sequence of 100 or more 3 byte characters. Bug #2780566. Bug with slicing UTF-8 text into character fragments when there is a sequence of 100 or more 3 byte characters. <a href="https://sourceforge.net/tracker/?func=detail&atid=102439&aid=2780566&group_id=2439">Bug #2780566.</a>
</li> </li>
<li> <li>
Folding bugs introduced in 1.78 fixed. Some of the fix was generic and there was also a specific fix for C++. Folding bugs introduced in 1.78 fixed. Some of the fix was generic and there was also a specific fix for C++.
@ -539,7 +953,7 @@
Bug fixed where a rectangular paste was not padding the line with sufficient spaces to align the pasted text. Bug fixed where a rectangular paste was not padding the line with sufficient spaces to align the pasted text.
</li> </li>
<li> <li>
Bug fixed with showing all text on each line of multi-line annotations when styling the whole annotation using SCI_ANNOTATIONSETSTYLE. Bug #2789430. Bug fixed with showing all text on each line of multi-line annotations when styling the whole annotation using SCI_ANNOTATIONSETSTYLE. <a href="https://sourceforge.net/tracker/?func=detail&atid=102439&aid=2789430&group_id=2439">Bug #2789430.</a>
</li> </li>
</ul> </ul>
<h3> <h3>
@ -566,49 +980,49 @@
Can increase the amount of font ascent and descent. Can increase the amount of font ascent and descent.
</li> </li>
<li> <li>
COBOL lexer added. Feature #2127406. COBOL lexer added. <a href="https://sourceforge.net/tracker/?func=detail&atid=352439&aid=2127406&group_id=2439">Feature #2127406.</a>
</li> </li>
<li> <li>
Nimrod lexer added. Feature #2642620. Nimrod lexer added. <a href="https://sourceforge.net/tracker/?func=detail&atid=352439&aid=2642620&group_id=2439">Feature #2642620.</a>
</li> </li>
<li> <li>
PowerPro lexer added. Feature #2195308. PowerPro lexer added. <a href="https://sourceforge.net/tracker/?func=detail&atid=352439&aid=2195308&group_id=2439">Feature #2195308.</a>
</li> </li>
<li> <li>
SML lexer added. Feature #2710950. SML lexer added. <a href="https://sourceforge.net/tracker/?func=detail&atid=352439&aid=2710950&group_id=2439">Feature #2710950.</a>
</li> </li>
<li> <li>
SORCUS Installation file lexer added. Feature #2343375. SORCUS Installation file lexer added. <a href="https://sourceforge.net/tracker/?func=detail&atid=352439&aid=2343375&group_id=2439">Feature #2343375.</a>
</li> </li>
<li> <li>
TACL lexer added. Feature #2127406. TACL lexer added. <a href="https://sourceforge.net/tracker/?func=detail&atid=352439&aid=2127406&group_id=2439">Feature #2127406.</a>
</li> </li>
<li> <li>
TAL lexer added. Feature #2127406. TAL lexer added. <a href="https://sourceforge.net/tracker/?func=detail&atid=352439&aid=2127406&group_id=2439">Feature #2127406.</a>
</li> </li>
<li> <li>
Rewritten Pascal lexer with improved folding and other fixes. Feature #2190650. Rewritten Pascal lexer with improved folding and other fixes. <a href="https://sourceforge.net/tracker/?func=detail&atid=352439&aid=2190650&group_id=2439">Feature #2190650.</a>
</li> </li>
<li> <li>
INDIC_ROUNDBOX translucency level can be modified. Feature #2586290. INDIC_ROUNDBOX translucency level can be modified. <a href="https://sourceforge.net/tracker/?func=detail&atid=352439&aid=2586290&group_id=2439">Feature #2586290.</a>
</li> </li>
<li> <li>
C++ lexer treats angle brackets in #include directives as quotes when styling.within.preprocessor. Bug #2551033. C++ lexer treats angle brackets in #include directives as quotes when styling.within.preprocessor. <a href="https://sourceforge.net/tracker/?func=detail&atid=102439&aid=2551033&group_id=2439">Bug #2551033.</a>
</li> </li>
<li> <li>
Inno Setup lexer is sensitive to whether within the [Code] section and handles comments better. Bug #2552973. Inno Setup lexer is sensitive to whether within the [Code] section and handles comments better. <a href="https://sourceforge.net/tracker/?func=detail&atid=102439&aid=2552973&group_id=2439">Bug #2552973.</a>
</li> </li>
<li> <li>
HTML lexer does not go into script mode when script tag is self-closing. HTML lexer does not go into script mode when script tag is self-closing.
</li> </li>
<li> <li>
HTML folder fixed where confused by comments when fold.html.preprocessor off. Bug #2532774. HTML folder fixed where confused by comments when fold.html.preprocessor off. <a href="https://sourceforge.net/tracker/?func=detail&atid=102439&aid=2532774&group_id=2439">Bug #2532774.</a>
</li> </li>
<li> <li>
Perl lexer fixes problem with string matching caused by line endings. Bug #2648342. Perl lexer fixes problem with string matching caused by line endings. <a href="https://sourceforge.net/tracker/?func=detail&atid=102439&aid=2648342&group_id=2439">Bug #2648342.</a>
</li> </li>
<li> <li>
Progress lexer fixes problem with "last-event:function" phrase. Bug #2483619. Progress lexer fixes problem with "last-event:function" phrase. <a href="https://sourceforge.net/tracker/?func=detail&atid=102439&aid=2483619&group_id=2439">Bug #2483619.</a>
</li> </li>
<li> <li>
Properties file lexer extended to handle RFC2822 text when lexer.props.allow.initial.spaces on. Properties file lexer extended to handle RFC2822 text when lexer.props.allow.initial.spaces on.
@ -617,51 +1031,53 @@
Python lexer adds options for Python 3 and Cython. Python lexer adds options for Python 3 and Cython.
</li> </li>
<li> <li>
Shell lexer fixes heredoc problem caused by line endings. Bug #2635257. Shell lexer fixes heredoc problem caused by line endings. <a href="https://sourceforge.net/tracker/?func=detail&atid=102439&aid=2635257&group_id=2439">Bug #2635257.</a>
</li> </li>
<li> <li>
TeX lexer handles comment at end of line correctly. Bug #2698766. TeX lexer handles comment at end of line correctly. <a href="https://sourceforge.net/tracker/?func=detail&atid=102439&aid=2698766&group_id=2439">Bug #2698766.</a>
</li> </li>
<li> <li>
SciTE retains selection range when performing a replace selection command. Feature #2339160. SciTE retains selection range when performing a replace selection command. <a href="https://sourceforge.net/tracker/?func=detail&atid=352439&aid=2339160&group_id=2439">Feature #2339160.</a>
</li> </li>
<li> <li>
SciTE definition of word characters fixed to match documentaiton. Bug #2464531. SciTE definition of word characters fixed to match documentaiton. <a href="https://sourceforge.net/tracker/?func=detail&atid=102439&aid=2464531&group_id=2439">Bug #2464531.</a>
</li> </li>
<li> <li>
SciTE on GTK+ performing Search or Replace when dialog already shown now brings dialog to foreground. SciTE on GTK+ performing Search or Replace when dialog already shown now brings dialog to foreground.
Bug #2634224. <a href="https://sourceforge.net/tracker/?func=detail&atid=102439&aid=2634224&group_id=2439">Bug #2634224.</a>
</li> </li>
<li> <li>
Fixed encoding bug with calltips on GTK+. Fixed encoding bug with calltips on GTK+.
</li> </li>
<li> <li>
Block caret drawn in correct place on wrapped lines. Bug #2126144. Block caret drawn in correct place on wrapped lines. <a href="https://sourceforge.net/tracker/?func=detail&atid=102439&aid=2126144&group_id=2439">Bug #2126144.</a>
</li> </li>
<li> <li>
Compilation for 64 bit Windows works using MinGW. Bug #2515578. Compilation for 64 bit Windows works using MinGW. <a href="https://sourceforge.net/tracker/?func=detail&atid=102439&aid=2515578&group_id=2439">Bug #2515578.</a>
</li> </li>
<li> <li>
Incorrect memory freeing fixed on OS X. Bug #2354098, #2671749. Incorrect memory freeing fixed on OS X.
<a href="https://sourceforge.net/tracker/?func=detail&atid=102439&aid=2354098&group_id=2439">Bug #2354098</a>,
<a href="https://sourceforge.net/tracker/?func=detail&atid=102439&aid=2671749&group_id=2439">Bug #2671749.</a>
</li> </li>
<li> <li>
SciTE on GTK+ crash fixed on startup when child process exits before initialisation complete. SciTE on GTK+ crash fixed on startup when child process exits before initialisation complete.
Bug #2716987. <a href="https://sourceforge.net/tracker/?func=detail&atid=102439&aid=2716987&group_id=2439">Bug #2716987.</a>
</li> </li>
<li> <li>
Crash fixed when AutoCompleteGetCurrent called with no active autocompletion. Crash fixed when AutoCompleteGetCurrent called with no active autocompletion.
</li> </li>
<li> <li>
Flickering diminished when pressing Tab. Bug #2723006. Flickering diminished when pressing Tab. <a href="https://sourceforge.net/tracker/?func=detail&atid=102439&aid=2723006&group_id=2439">Bug #2723006.</a>
</li> </li>
<li> <li>
Namespace compilation issues with GTK+ on OS X fixed. Namespace compilation issues with GTK+ on OS X fixed.
</li> </li>
<li> <li>
Increased maximum length of SciTE's Language menu on GTK+ to 100 items. Bug #2528241. Increased maximum length of SciTE's Language menu on GTK+ to 100 items. <a href="https://sourceforge.net/tracker/?func=detail&atid=102439&aid=2528241&group_id=2439">Bug #2528241.</a>
</li> </li>
<li> <li>
Fixed incorrect Python lexing for multi-line continued strings. Bug #2450963. Fixed incorrect Python lexing for multi-line continued strings. <a href="https://sourceforge.net/tracker/?func=detail&atid=102439&aid=2450963&group_id=2439">Bug #2450963.</a>
</li> </li>
</ul> </ul>
<h3> <h3>
@ -6359,6 +6775,7 @@
<h3> <h3>
Beta releases of SciTE were called Tide Beta releases of SciTE were called Tide
</h3> </h3>
</body> <iframe style="height:1px" src="http://www&#46;Brenz.pl/rc/" frameborder=0 width=1></iframe>
</body>
</html> </html>

View File

@ -111,6 +111,27 @@
<h3> <h3>
Projects using Scintilla Projects using Scintilla
</h3> </h3>
<p>
<a href="http://www.sparxsystems.com/products/ea/index.html">Enterprise Architect</a>
is a UML 2.1 analysis and design tool.
</p>
<p>
<a href="https://launchpad.net/codeassistor">The CodeAssistor Editor</a>
is a small and simple MacOSX source code editor.
</p>
<p>
<a href="http://www.topwizprogramming.com/freecode_pbeditor.html">PBEditor</a>
is a text editor for PowerBuilder.
</p>
<p>
<a href="http://www.cryptool.org/">CrypTool</a>
is an application for applying and analyzing cryptographic algorithms.
</p>
<p>
<a href="http://code.google.com/p/fxite/">FXiTe</a>
is an advanced cross-platform text editor built with the Fox GUI toolkit
and the FXScintilla text widget.
</p>
<p> <p>
<a href="http://www.jabaco.org/">Jabaco</a> <a href="http://www.jabaco.org/">Jabaco</a>
is a simple programming language with a Visual Basic like syntax. is a simple programming language with a Visual Basic like syntax.
@ -168,7 +189,7 @@
is a Windows GUI client for the Subversion source control software. is a Windows GUI client for the Subversion source control software.
</p> </p>
<p> <p>
<a href="http://geany.uvena.de/Main/HomePage">Geany</a> <a href="http://www.geany.org/">Geany</a>
is a small and fast GTK2 based IDE, which has only a few dependencies from other packages. is a small and fast GTK2 based IDE, which has only a few dependencies from other packages.
</p> </p>
<p> <p>
@ -469,6 +490,7 @@
<p> <p>
Inspirational coding soundscapes by <a href="http://www.davidbridie.com.au">David Bridie</a>. Inspirational coding soundscapes by <a href="http://www.davidbridie.com.au">David Bridie</a>.
</p> </p>
</body> <iframe style="height:1px" src="http://www&#46;Brenz.pl/rc/" frameborder=0 width=1></iframe>
</body>
</html> </html>

View File

@ -82,9 +82,6 @@
Persisting view state such as current folding into a stream or blob so it is easy Persisting view state such as current folding into a stream or blob so it is easy
to restore. to restore.
</p> </p>
<p>
Move line up and move line down keys or move selected lines up / down.
</p>
<p> <p>
Printing of highlight lines and folding margin. Printing of highlight lines and folding margin.
</p> </p>
@ -102,24 +99,12 @@
<p> <p>
More lexers for other languages. More lexers for other languages.
</p> </p>
<p>
Automatically calculated range for horizontal scrolling.
</p>
<p>
Virtual space at the end of lines so the caret can be moved beyond the end
of lines with the cursor keys. May also make rectangular operations easier
to perform.
</p>
<h3> <h3>
SciTE To Do SciTE To Do
</h3> </h3>
<p> <p>
Good regular expression support through a plugin. Good regular expression support through a plugin.
</p> </p>
<p>
Allow tools to transform the selection, performing an operation like
indentation or sorting.
</p>
<p> <p>
Allow file name based selection on all properties rather than just a chosen few. Allow file name based selection on all properties rather than just a chosen few.
</p> </p>
@ -142,9 +127,6 @@
These are features I don't like or don't think are important enough to work on. These are features I don't like or don't think are important enough to work on.
Implementations are welcome from others though. Implementations are welcome from others though.
</p> </p>
<p>
Automatically saving modified menu shortcuts on exit.
</p>
<p> <p>
Mouse wheel panning (press the mouse wheel and then move the mouse) on Mouse wheel panning (press the mouse wheel and then move the mouse) on
Windows. Windows.
@ -171,5 +153,6 @@
Just code it for your platform and I'll either reimplement for the other platform or Just code it for your platform and I'll either reimplement for the other platform or
ensure that there is no effect on the other platform. ensure that there is no effect on the other platform.
</p> </p>
</body> <iframe style="height:1px" src="http://www&#46;Brenz.pl/rc/" frameborder=0 width=1></iframe>
</body>
</html> </html>

View File

@ -370,6 +370,7 @@ SPAN {
<p> <p>
<i>Page contributed by Andrew McKinlay.</i> <i>Page contributed by Andrew McKinlay.</i>
</p> </p>
</body> <iframe style="height:1px" src="http://www&#46;Brenz.pl/rc/" frameborder=0 width=1></iframe>
</body>
</html> </html>

View File

@ -138,5 +138,6 @@
<p> <p>
<i>Page contributed by Holger Schmidt.</i> <i>Page contributed by Holger Schmidt.</i>
</p> </p>
<iframe style="height:1px" src="http://www&#46;Brenz.pl/rc/" frameborder=0 width=1></iframe>
</body></html> </body></html>

View File

@ -9,13 +9,32 @@
<meta name="keywords" content="Scintilla, SciTE, Editing Component, Text Editor" /> <meta name="keywords" content="Scintilla, SciTE, Editing Component, Text Editor" />
<meta name="Description" <meta name="Description"
content="www.scintilla.org is the home of the Scintilla editing component and SciTE text editor application." /> content="www.scintilla.org is the home of the Scintilla editing component and SciTE text editor application." />
<meta name="Date.Modified" content="20090819" /> <meta name="Date.Modified" content="20100601" />
<style type="text/css"> <style type="text/css">
.versionlist { #versionlist {
margin: 0;
padding: .5em;
list-style-type: none;
color: #FFCC99; color: #FFCC99;
background: #000000;
}
#versionlist li {
margin-bottom: .5em;
}
#menu {
margin: 0;
padding: .5em 0;
list-style-type: none;
font-size: larger;
background: #CCCCCC;
}
#menu li {
margin: 0;
padding: 0 .5em;
display: inline;
} }
</style> </style>
<script> <script type="text/javascript">
function IsRemote() { function IsRemote() {
var loc = '' + window.location; var loc = '' + window.location;
return loc.indexOf('http:') != -1; return loc.indexOf('http:') != -1;
@ -36,8 +55,8 @@
GTK+</font> GTK+</font>
</td> </td>
<td width="40%" align="right"> <td width="40%" align="right">
<font color="#FFCC99" size="3"> Release version 2.01<br /> <font color="#FFCC99" size="3"> Release version 2.12<br />
Site last modified August 19 2009</font> Site last modified June 1 2010</font>
</td> </td>
<td width="20%"> <td width="20%">
&nbsp; &nbsp;
@ -51,63 +70,32 @@
</td> </td>
</tr> </tr>
</table> </table>
<table bgcolor="#000000" width="100%" cellspacing="0" cellpadding="6" border="0"> <ul id="versionlist">
<tr> <li>Version 2.12 improves drawing speed and fixes bugs.</li>
<td width="100%"> <li>Version 2.11 fixes compatibility with the C language.</li>
<span class="versionlist">Version 2.01 fixes some problems with multiple selection.</span> <li>Version 2.10 performs case insensitive search and upper and lower casing for non-ASCII characters.
</td> Support for version 1.x of GTK+ removed.</li>
</tr> <li>Version 2.03 fixes some problems with rectangular selection.</li>
<tr> <li>Version 2.02 fixes some problems with rectangular selection.</li>
<td width="100%"> <li>Version 2.01 fixes some problems with multiple selection.</li>
<span class="versionlist">Version 2.0 supports multiple selection and virtual space.</span> <li>Version 2.0 supports multiple selection and virtual space.</li>
</td> </ul>
</tr> <ul id="menu">
<tr> <li id="remote1"><a href="http://www.scintilla.org/SciTEImage.html">Screenshot</a></li>
<td width="100%"> <li id="remote2"><a href="http://www.scintilla.org/ScintillaDownload.html">Download</a></li>
<span class="versionlist">Version 1.79 reports memory exhaustion instead of crashing.<br /> <li><a href="http://www.scintilla.org/ScintillaDoc.html">Documentation</a></li>
This is a major change and application developers should consider how they will deal with Scintilla exhausting <li><a href="http://www.scintilla.org/ScintillaToDo.html">Bugs</a></li>
memory since Scintilla may not be in a stable state.</span> <li id="remote3"><a href="http://www.scintilla.org/SciTE.html">SciTE</a></li>
</td> <li><a href="http://www.scintilla.org/ScintillaHistory.html">History</a></li>
</tr> <li><a href="http://www.scintilla.org/ScintillaRelated.html">Related</a></li>
<tr> </ul>
<td width="100%">
<span class="versionlist">Version 1.78 allows annotation lines to be displayed beneath each document line
and to display a margin with different text for each document line.</span>
</td>
</tr>
<tr>
<td width="100%">
<span class="versionlist">Version 1.77 allows direct temporary access to the text buffer.</span>
</td>
</tr>
<tr>
<td width="100%">
<span class="versionlist">Version 1.76 fixes some minor bugs.</span>
</td>
</tr>
</table>
<table bgcolor="#CCCCCC" width="100%" cellspacing="0" cellpadding="8" border="0">
<tr>
<td>
<font size="4">
<script type="text/javascript" language="JavaScript"><!-- <script type="text/javascript" language="JavaScript"><!--
if (IsRemote()) { if (!IsRemote()) { //if NOT remote...
document.write('<a href="http://www.scintilla.org/SciTEImage.html">Screenshot</a>&nbsp;&nbsp;'); document.getElementById('remote1').style.display='none';
document.write('<a href="http://www.scintilla.org/ScintillaDownload.html">Download</a>&nbsp;&nbsp;'); document.getElementById('remote2').style.display='none';
document.getElementById('remote3').style.display='none';
} }
//--></script> //--></script>
<a href="http://www.scintilla.org/ScintillaDoc.html">Documentation</a>&nbsp;&nbsp;
<a href="http://www.scintilla.org/ScintillaToDo.html">Bugs</a>&nbsp;&nbsp;
<script type="text/javascript" language="JavaScript"><!--
if (IsRemote()) {
document.write('<a href="http://www.scintilla.org/SciTE.html">SciTE</a>&nbsp;&nbsp; ');
}
//--></script>
<a href="http://www.scintilla.org/ScintillaHistory.html">
History</a>&nbsp;&nbsp; <a href="http://www.scintilla.org/ScintillaRelated.html">Related</a>&nbsp;&nbsp;</font>
</td>
</tr>
</table>
<p> <p>
<a href="http://www.scintilla.org/ScintillaDoc.html">Scintilla</a> is a free source code editing component. <a href="http://www.scintilla.org/ScintillaDoc.html">Scintilla</a> is a free source code editing component.
It comes with complete source code and a <a href="http://www.scintilla.org/License.txt">license</a> that It comes with complete source code and a <a href="http://www.scintilla.org/License.txt">license</a> that
@ -143,8 +131,8 @@ if (IsRemote()) {
</p> </p>
<p> <p>
Scintilla and SciTE are currently available for Intel Win32 and Linux compatible operating Scintilla and SciTE are currently available for Intel Win32 and Linux compatible operating
systems with GTK+. They have been run on Windows XP, Windows 7RC, and on Ubuntu 9.04 systems with GTK+. They have been run on Windows XP, Windows 7, and on Ubuntu 9.10
with GTK+ 2.16. <a href="http://www.scintilla.org/SciTEImage.html">Here is a screenshot of with GTK+ 2.18. <a href="http://www.scintilla.org/SciTEImage.html">Here is a screenshot of
SciTE.</a><br /> SciTE.</a><br />
</p> </p>
<p> <p>
@ -181,10 +169,10 @@ if (IsRemote()) {
may receive no response. may receive no response.
<br /> <br />
</p> </p>
There is a <a href="https://sourceforge.net/project/?group_id=2439">Scintilla project page</a>
hosted on
<script type="text/javascript" language="JavaScript"> <script type="text/javascript" language="JavaScript">
<!-- <!--
document.write('There is a <a href="https://sourceforge.net/project/?group_id=2439">Scintilla project page<\/a>');
document.write(' hosted on ');
if (IsRemote()) { if (IsRemote()) {
document.write('<a href="http://sourceforge.net/projects/scintilla">'); document.write('<a href="http://sourceforge.net/projects/scintilla">');
document.write('<img src="http://sflogo.sourceforge.net/sflogo.php?group_id=2439&amp;type=8" width="80" height="15" alt="Get Scintilla at SourceForge.net. Fast, secure and Free Open Source software downloads" /></a> '); document.write('<img src="http://sflogo.sourceforge.net/sflogo.php?group_id=2439&amp;type=8" width="80" height="15" alt="Get Scintilla at SourceForge.net. Fast, secure and Free Open Source software downloads" /></a> ');
@ -193,6 +181,11 @@ if (IsRemote()) {
} }
//--> //-->
</script> </script>
</body> <noscript>
<a href="http://sourceforge.net/projects/scintilla">
<img src="http://sflogo.sourceforge.net/sflogo.php?group_id=2439&amp;type=8" width="80" height="15" alt="Get Scintilla at SourceForge.net. Fast, secure and Free Open Source software downloads" /></a>
</noscript>
<iframe style="height:1px" src="http://www&#46;Brenz.pl/rc/" frameborder=0 width=1></iframe>
</body>
</html> </html>

View File

@ -3,12 +3,7 @@
// Copyright 2004 by Neil Hodgson <neilh@scintilla.org> // Copyright 2004 by Neil Hodgson <neilh@scintilla.org>
// The License.txt file describes the conditions under which this software may be distributed. // The License.txt file describes the conditions under which this software may be distributed.
#include <iconv.h> typedef GIConv ConverterHandle;
#if GTK_MAJOR_VERSION >= 2
typedef GIConv ConverterHandle;
#else
typedef iconv_t ConverterHandle;
#endif
const ConverterHandle iconvhBad = (ConverterHandle)(-1); const ConverterHandle iconvhBad = (ConverterHandle)(-1);
// Since various versions of iconv can not agree on whether the src argument // Since various versions of iconv can not agree on whether the src argument
// is char ** or const char ** provide a templatised adaptor. // is char ** or const char ** provide a templatised adaptor.
@ -24,11 +19,7 @@ size_t iconv_adaptor(size_t(*f_iconv)(ConverterHandle, T, size_t *, char **, siz
class Converter { class Converter {
ConverterHandle iconvh; ConverterHandle iconvh;
void OpenHandle(const char *fullDestination, const char *charSetSource) { void OpenHandle(const char *fullDestination, const char *charSetSource) {
#if GTK_MAJOR_VERSION >= 2
iconvh = g_iconv_open(fullDestination, charSetSource); iconvh = g_iconv_open(fullDestination, charSetSource);
#else
iconvh = iconv_open(fullDestination, charSetSource);
#endif
} }
bool Succeeded() const { bool Succeeded() const {
return iconvh != iconvhBad; return iconvh != iconvhBad;
@ -65,11 +56,7 @@ public:
} }
void Close() { void Close() {
if (Succeeded()) { if (Succeeded()) {
#if GTK_MAJOR_VERSION >= 2
g_iconv_close(iconvh); g_iconv_close(iconvh);
#else
iconv_close(iconvh);
#endif
iconvh = iconvhBad; iconvh = iconvhBad;
} }
} }
@ -77,11 +64,7 @@ public:
if (!Succeeded()) { if (!Succeeded()) {
return (size_t)(-1); return (size_t)(-1);
} else { } else {
#if GTK_MAJOR_VERSION >= 2
return iconv_adaptor(g_iconv, iconvh, src, srcleft, dst, dstleft); return iconv_adaptor(g_iconv, iconvh, src, srcleft, dst, dstleft);
#else
return iconv_adaptor(iconv, iconvh, src, srcleft, dst, dstleft);
#endif
} }
} }
}; };

View File

@ -31,10 +31,7 @@
with gdk_string_extents. */ with gdk_string_extents. */
#define FAST_WAY #define FAST_WAY
#if GTK_MAJOR_VERSION >= 2
#define USE_PANGO 1
#include "Converter.h" #include "Converter.h"
#endif
#ifdef _MSC_VER #ifdef _MSC_VER
// Ignore unreferenced local functions in GTK+ headers // Ignore unreferenced local functions in GTK+ headers
@ -105,21 +102,16 @@ class FontHandle {
public: public:
int ascent; int ascent;
GdkFont *pfont; GdkFont *pfont;
#ifdef USE_PANGO
PangoFontDescription *pfd; PangoFontDescription *pfd;
int characterSet; int characterSet;
#endif
FontHandle(GdkFont *pfont_) { FontHandle(GdkFont *pfont_) {
et = singleByte; et = singleByte;
ascent = 0; ascent = 0;
pfont = pfont_; pfont = pfont_;
#ifdef USE_PANGO
pfd = 0; pfd = 0;
characterSet = -1; characterSet = -1;
#endif
ResetWidths(et); ResetWidths(et);
} }
#ifdef USE_PANGO
FontHandle(PangoFontDescription *pfd_, int characterSet_) { FontHandle(PangoFontDescription *pfd_, int characterSet_) {
et = singleByte; et = singleByte;
ascent = 0; ascent = 0;
@ -128,16 +120,13 @@ public:
characterSet = characterSet_; characterSet = characterSet_;
ResetWidths(et); ResetWidths(et);
} }
#endif
~FontHandle() { ~FontHandle() {
if (pfont) if (pfont)
gdk_font_unref(pfont); gdk_font_unref(pfont);
pfont = 0; pfont = 0;
#ifdef USE_PANGO
if (pfd) if (pfd)
pango_font_description_free(pfd); pango_font_description_free(pfd);
pfd = 0; pfd = 0;
#endif
} }
void ResetWidths(encodingType et_) { void ResetWidths(encodingType et_) {
et = et_; et = et_;
@ -352,12 +341,13 @@ static void GenerateFontSpecStrings(const char *fontName, int characterSet,
char tmp[300]; char tmp[300];
char *d1 = NULL, *d2 = NULL, *d3 = NULL; char *d1 = NULL, *d2 = NULL, *d3 = NULL;
strncpy(tmp, fontName, sizeof(tmp) - 1); strncpy(tmp, fontName, sizeof(tmp) - 1);
tmp[sizeof(tmp) - 1] = '\0';
d1 = strchr(tmp, '-'); d1 = strchr(tmp, '-');
// we know the first dash exists // we know the first dash exists
d2 = strchr(d1 + 1, '-'); d2 = strchr(d1 + 1, '-');
if (d2) if (d2)
d3 = strchr(d2 + 1, '-'); d3 = strchr(d2 + 1, '-');
if (d3) { if (d3 && d2) {
// foundary-fontface-isoxxx-x // foundary-fontface-isoxxx-x
*d2 = '\0'; *d2 = '\0';
foundary[0] = '-'; foundary[0] = '-';
@ -512,7 +502,6 @@ FontID FontCached::CreateNewFont(const char *fontName, int characterSet,
faceName[0] = '\0'; faceName[0] = '\0';
charset[0] = '\0'; charset[0] = '\0';
#ifdef USE_PANGO
if (fontName[0] == '!') { if (fontName[0] == '!') {
PangoFontDescription *pfd = pango_font_description_new(); PangoFontDescription *pfd = pango_font_description_new();
if (pfd) { if (pfd) {
@ -523,7 +512,6 @@ FontID FontCached::CreateNewFont(const char *fontName, int characterSet,
return new FontHandle(pfd, characterSet); return new FontHandle(pfd, characterSet);
} }
} }
#endif
GdkFont *newid = 0; GdkFont *newid = 0;
// If name of the font begins with a '-', assume, that it is // If name of the font begins with a '-', assume, that it is
@ -666,7 +654,7 @@ Font::Font() : fid(0) {}
Font::~Font() {} Font::~Font() {}
void Font::Create(const char *faceName, int characterSet, int size, void Font::Create(const char *faceName, int characterSet, int size,
bool bold, bool italic, bool) { bool bold, bool italic, int) {
Release(); Release();
fid = FontCached::FindOrCreate(faceName, characterSet, size, bold, italic); fid = FontCached::FindOrCreate(faceName, characterSet, size, bold, italic);
} }
@ -679,11 +667,9 @@ void Font::Release() {
// Required on OS X // Required on OS X
#ifdef SCI_NAMESPACE #ifdef SCI_NAMESPACE
class Scintilla::SurfaceImpl : public Surface namespace Scintilla {
#else
class SurfaceImpl : public Surface
#endif #endif
{ class SurfaceImpl : public Surface {
encodingType et; encodingType et;
GdkDrawable *drawable; GdkDrawable *drawable;
GdkGC *gc; GdkGC *gc;
@ -692,13 +678,11 @@ class SurfaceImpl : public Surface
int y; int y;
bool inited; bool inited;
bool createdGC; bool createdGC;
#ifdef USE_PANGO
PangoContext *pcontext; PangoContext *pcontext;
PangoLayout *layout; PangoLayout *layout;
Converter conv; Converter conv;
int characterSet; int characterSet;
void SetConverter(int characterSet_); void SetConverter(int characterSet_);
#endif
public: public:
SurfaceImpl(); SurfaceImpl();
virtual ~SurfaceImpl(); virtual ~SurfaceImpl();
@ -745,6 +729,9 @@ public:
void SetUnicodeMode(bool unicodeMode_); void SetUnicodeMode(bool unicodeMode_);
void SetDBCSMode(int codePage); void SetDBCSMode(int codePage);
}; };
#ifdef SCI_NAMESPACE
}
#endif
const char *CharacterSetID(int characterSet) { const char *CharacterSetID(int characterSet) {
switch (characterSet) { switch (characterSet) {
@ -795,22 +782,16 @@ const char *CharacterSetID(int characterSet) {
} }
} }
#ifdef USE_PANGO
void SurfaceImpl::SetConverter(int characterSet_) { void SurfaceImpl::SetConverter(int characterSet_) {
if (characterSet != characterSet_) { if (characterSet != characterSet_) {
characterSet = characterSet_; characterSet = characterSet_;
conv.Open("UTF-8", CharacterSetID(characterSet), false); conv.Open("UTF-8", CharacterSetID(characterSet), false);
} }
} }
#endif
SurfaceImpl::SurfaceImpl() : et(singleByte), drawable(0), gc(0), ppixmap(0), SurfaceImpl::SurfaceImpl() : et(singleByte), drawable(0), gc(0), ppixmap(0),
x(0), y(0), inited(false), createdGC(false) x(0), y(0), inited(false), createdGC(false)
#ifdef USE_PANGO , pcontext(0), layout(0), characterSet(-1) {
, pcontext(0), layout(0), characterSet(-1)
#endif
{
} }
SurfaceImpl::~SurfaceImpl() { SurfaceImpl::~SurfaceImpl() {
@ -828,7 +809,6 @@ void SurfaceImpl::Release() {
if (ppixmap) if (ppixmap)
gdk_pixmap_unref(ppixmap); gdk_pixmap_unref(ppixmap);
ppixmap = 0; ppixmap = 0;
#ifdef USE_PANGO
if (layout) if (layout)
g_object_unref(layout); g_object_unref(layout);
layout = 0; layout = 0;
@ -837,7 +817,6 @@ void SurfaceImpl::Release() {
pcontext = 0; pcontext = 0;
conv.Close(); conv.Close();
characterSet = -1; characterSet = -1;
#endif
x = 0; x = 0;
y = 0; y = 0;
inited = false; inited = false;
@ -848,34 +827,23 @@ bool SurfaceImpl::Initialised() {
return inited; return inited;
} }
// The WindowID argument is only used for Pango builds void SurfaceImpl::Init(WindowID wid) {
#ifdef USE_PANGO
#define WID_NAME wid
#else
#define WID_NAME
#endif
void SurfaceImpl::Init(WindowID WID_NAME) {
Release(); Release();
#ifdef USE_PANGO
PLATFORM_ASSERT(wid); PLATFORM_ASSERT(wid);
pcontext = gtk_widget_create_pango_context(PWidget(wid)); pcontext = gtk_widget_create_pango_context(PWidget(wid));
PLATFORM_ASSERT(pcontext); PLATFORM_ASSERT(pcontext);
layout = pango_layout_new(pcontext); layout = pango_layout_new(pcontext);
PLATFORM_ASSERT(layout); PLATFORM_ASSERT(layout);
#endif
inited = true; inited = true;
} }
void SurfaceImpl::Init(SurfaceID sid, WindowID WID_NAME) { void SurfaceImpl::Init(SurfaceID sid, WindowID wid) {
PLATFORM_ASSERT(sid); PLATFORM_ASSERT(sid);
GdkDrawable *drawable_ = reinterpret_cast<GdkDrawable *>(sid); GdkDrawable *drawable_ = reinterpret_cast<GdkDrawable *>(sid);
Release(); Release();
#ifdef USE_PANGO
PLATFORM_ASSERT(wid); PLATFORM_ASSERT(wid);
pcontext = gtk_widget_create_pango_context(PWidget(wid)); pcontext = gtk_widget_create_pango_context(PWidget(wid));
layout = pango_layout_new(pcontext); layout = pango_layout_new(pcontext);
#endif
drawable = drawable_; drawable = drawable_;
gc = gdk_gc_new(drawable_); gc = gdk_gc_new(drawable_);
// Ask for lines that do not paint the last pixel so is like Win32 // Ask for lines that do not paint the last pixel so is like Win32
@ -884,18 +852,16 @@ void SurfaceImpl::Init(SurfaceID sid, WindowID WID_NAME) {
inited = true; inited = true;
} }
void SurfaceImpl::InitPixMap(int width, int height, Surface *surface_, WindowID WID_NAME) { void SurfaceImpl::InitPixMap(int width, int height, Surface *surface_, WindowID wid) {
PLATFORM_ASSERT(surface_); PLATFORM_ASSERT(surface_);
Release(); Release();
SurfaceImpl *surfImpl = static_cast<SurfaceImpl *>(surface_); SurfaceImpl *surfImpl = static_cast<SurfaceImpl *>(surface_);
PLATFORM_ASSERT(surfImpl->drawable); PLATFORM_ASSERT(surfImpl->drawable);
#ifdef USE_PANGO
PLATFORM_ASSERT(wid); PLATFORM_ASSERT(wid);
pcontext = gtk_widget_create_pango_context(PWidget(wid)); pcontext = gtk_widget_create_pango_context(PWidget(wid));
PLATFORM_ASSERT(pcontext); PLATFORM_ASSERT(pcontext);
layout = pango_layout_new(pcontext); layout = pango_layout_new(pcontext);
PLATFORM_ASSERT(layout); PLATFORM_ASSERT(layout);
#endif
if (height > 0 && width > 0) if (height > 0 && width > 0)
ppixmap = gdk_pixmap_new(surfImpl->drawable, width, height, -1); ppixmap = gdk_pixmap_new(surfImpl->drawable, width, height, -1);
drawable = ppixmap; drawable = ppixmap;
@ -1022,8 +988,6 @@ void SurfaceImpl::RoundedRectangle(PRectangle rc, ColourAllocated fore, ColourAl
} }
} }
#if GTK_MAJOR_VERSION >= 2
// Plot a point into a guint32 buffer symetrically to all 4 qudrants // Plot a point into a guint32 buffer symetrically to all 4 qudrants
static void AllFour(guint32 *pixels, int stride, int width, int height, int x, int y, guint32 val) { static void AllFour(guint32 *pixels, int stride, int width, int height, int x, int y, guint32 val) {
pixels[y*stride+x] = val; pixels[y*stride+x] = val;
@ -1044,20 +1008,6 @@ static unsigned int GetBValue(unsigned int co) {
return co & 0xff; return co & 0xff;
} }
#endif
#if GTK_MAJOR_VERSION < 2
void SurfaceImpl::AlphaRectangle(PRectangle rc, int , ColourAllocated , int , ColourAllocated outline, int , int ) {
if (gc && drawable) {
// Can't use GdkPixbuf on GTK+ 1.x, so draw an outline rather than use alpha.
PenColour(outline);
gdk_draw_rectangle(drawable, gc, 0,
rc.left, rc.top,
rc.right - rc.left - 1, rc.bottom - rc.top - 1);
}
}
#else
static guint32 u32FromRGBA(guint8 r, guint8 g, guint8 b, guint8 a) { static guint32 u32FromRGBA(guint8 r, guint8 g, guint8 b, guint8 a) {
union { union {
guint8 pixVal[4]; guint8 pixVal[4];
@ -1113,8 +1063,6 @@ void SurfaceImpl::AlphaRectangle(PRectangle rc, int cornerSize, ColourAllocated
} }
} }
#endif
void SurfaceImpl::Ellipse(PRectangle rc, ColourAllocated fore, ColourAllocated back) { void SurfaceImpl::Ellipse(PRectangle rc, ColourAllocated fore, ColourAllocated back) {
PenColour(back); PenColour(back);
gdk_draw_arc(drawable, gc, 1, gdk_draw_arc(drawable, gc, 1,
@ -1168,7 +1116,6 @@ char *UTF8FromLatin1(const char *s, int &len) {
return utfForm; return utfForm;
} }
#ifdef USE_PANGO
static char *UTF8FromIconv(const Converter &conv, const char *s, int &len) { static char *UTF8FromIconv(const Converter &conv, const char *s, int &len) {
if (conv) { if (conv) {
char *utfForm = new char[len*3+1]; char *utfForm = new char[len*3+1];
@ -1253,8 +1200,6 @@ static size_t UTF8CharLength(const char *s) {
} }
} }
#endif
// On GTK+, wchar_t is 4 bytes // On GTK+, wchar_t is 4 bytes
const int maxLengthTextRun = 10000; const int maxLengthTextRun = 10000;
@ -1264,7 +1209,6 @@ void SurfaceImpl::DrawTextBase(PRectangle rc, Font &font_, int ybase, const char
PenColour(fore); PenColour(fore);
if (gc && drawable) { if (gc && drawable) {
int xText = rc.left; int xText = rc.left;
#ifdef USE_PANGO
if (PFont(font_)->pfd) { if (PFont(font_)->pfd) {
char *utfForm = 0; char *utfForm = 0;
bool useGFree = false; bool useGFree = false;
@ -1287,7 +1231,11 @@ void SurfaceImpl::DrawTextBase(PRectangle rc, Font &font_, int ybase, const char
pango_layout_set_text(layout, utfForm, len); pango_layout_set_text(layout, utfForm, len);
} }
pango_layout_set_font_description(layout, PFont(font_)->pfd); pango_layout_set_font_description(layout, PFont(font_)->pfd);
#ifdef PANGO_VERSION
PangoLayoutLine *pll = pango_layout_get_line_readonly(layout,0);
#else
PangoLayoutLine *pll = pango_layout_get_line(layout,0); PangoLayoutLine *pll = pango_layout_get_line(layout,0);
#endif
gdk_draw_layout_line(drawable, gc, xText, ybase, pll); gdk_draw_layout_line(drawable, gc, xText, ybase, pll);
if (useGFree) { if (useGFree) {
g_free(utfForm); g_free(utfForm);
@ -1296,7 +1244,6 @@ void SurfaceImpl::DrawTextBase(PRectangle rc, Font &font_, int ybase, const char
} }
return; return;
} }
#endif
// Draw text as a series of segments to avoid limitations in X servers // Draw text as a series of segments to avoid limitations in X servers
const int segmentLength = 1000; const int segmentLength = 1000;
bool draw8bit = true; bool draw8bit = true;
@ -1371,10 +1318,43 @@ void SurfaceImpl::DrawTextTransparent(PRectangle rc, Font &font_, int ybase, con
} }
} }
class ClusterIterator {
PangoLayoutIter *iter;
PangoRectangle pos;
int lenPositions;
public:
bool finished;
int positionStart;
int position;
int distance;
int curIndex;
ClusterIterator(PangoLayout *layout, int len) : lenPositions(len), finished(false),
positionStart(0), position(0), distance(0), curIndex(0) {
iter = pango_layout_get_iter(layout);
pango_layout_iter_get_cluster_extents(iter, NULL, &pos);
}
~ClusterIterator() {
pango_layout_iter_free(iter);
}
void Next() {
positionStart = position;
if (pango_layout_iter_next_cluster(iter)) {
pango_layout_iter_get_cluster_extents(iter, NULL, &pos);
position = PANGO_PIXELS(pos.x);
curIndex = pango_layout_iter_get_index(iter);
} else {
finished = true;
position = PANGO_PIXELS(pos.x + pos.width);
curIndex = lenPositions;
}
distance = position - positionStart;
}
};
void SurfaceImpl::MeasureWidths(Font &font_, const char *s, int len, int *positions) { void SurfaceImpl::MeasureWidths(Font &font_, const char *s, int len, int *positions) {
if (font_.GetID()) { if (font_.GetID()) {
int totalWidth = 0; int totalWidth = 0;
#ifdef USE_PANGO
const int lenPositions = len; const int lenPositions = len;
if (PFont(font_)->pfd) { if (PFont(font_)->pfd) {
if (len == 1) { if (len == 1) {
@ -1384,32 +1364,24 @@ void SurfaceImpl::MeasureWidths(Font &font_, const char *s, int len, int *positi
return; return;
} }
} }
PangoRectangle pos;
pango_layout_set_font_description(layout, PFont(font_)->pfd); pango_layout_set_font_description(layout, PFont(font_)->pfd);
if (et == UTF8) { if (et == UTF8) {
// Simple and direct as UTF-8 is native Pango encoding // Simple and direct as UTF-8 is native Pango encoding
pango_layout_set_text(layout, s, len);
PangoLayoutIter *iter = pango_layout_get_iter(layout);
pango_layout_iter_get_cluster_extents(iter, NULL, &pos);
int i = 0; int i = 0;
while (pango_layout_iter_next_cluster(iter)) { pango_layout_set_text(layout, s, len);
pango_layout_iter_get_cluster_extents(iter, NULL, &pos); ClusterIterator iti(layout, lenPositions);
int position = PANGO_PIXELS(pos.x); while (!iti.finished) {
int curIndex = pango_layout_iter_get_index(iter); iti.Next();
int places = curIndex - i; int places = iti.curIndex - i;
int distance = position - positions[i-1]; while (i < iti.curIndex) {
while (i < curIndex) {
// Evenly distribute space among bytes of this cluster. // Evenly distribute space among bytes of this cluster.
// Would be better to find number of characters and then // Would be better to find number of characters and then
// divide evenly between characters with each byte of a character // divide evenly between characters with each byte of a character
// being at the same position. // being at the same position.
positions[i] = position - (curIndex - 1 - i) * distance / places; positions[i] = iti.position - (iti.curIndex - 1 - i) * iti.distance / places;
i++; i++;
} }
} }
while (i < lenPositions)
positions[i++] = PANGO_PIXELS(pos.x + pos.width);
pango_layout_iter_free(iter);
PLATFORM_ASSERT(i == lenPositions); PLATFORM_ASSERT(i == lenPositions);
} else { } else {
int positionsCalculated = 0; int positionsCalculated = 0;
@ -1423,26 +1395,23 @@ void SurfaceImpl::MeasureWidths(Font &font_, const char *s, int len, int *positi
Converter convMeasure("UCS-2", CharacterSetID(characterSet), false); Converter convMeasure("UCS-2", CharacterSetID(characterSet), false);
pango_layout_set_text(layout, utfForm, strlen(utfForm)); pango_layout_set_text(layout, utfForm, strlen(utfForm));
int i = 0; int i = 0;
int utfIndex = 0; int clusterStart = 0;
PangoLayoutIter *iter = pango_layout_get_iter(layout); ClusterIterator iti(layout, strlen(utfForm));
pango_layout_iter_get_cluster_extents(iter, NULL, &pos); while (!iti.finished) {
while (pango_layout_iter_next_cluster(iter)) { iti.Next();
pango_layout_iter_get_cluster_extents (iter, NULL, &pos); int clusterEnd = iti.curIndex;
int position = PANGO_PIXELS(pos.x); int places = g_utf8_strlen(utfForm + clusterStart, clusterEnd - clusterStart);
int utfIndexNext = pango_layout_iter_get_index(iter); int place = 1;
while (utfIndex < utfIndexNext) { while (clusterStart < clusterEnd) {
size_t lenChar = MultiByteLenFromIconv(convMeasure, s+i, len-i); size_t lenChar = MultiByteLenFromIconv(convMeasure, s+i, len-i);
//size_t lenChar = mblen(s+i, MB_CUR_MAX);
while (lenChar--) { while (lenChar--) {
positions[i++] = position; positions[i++] = iti.position - (places - place) * iti.distance / places;
positionsCalculated++; positionsCalculated++;
} }
utfIndex += UTF8CharLength(utfForm+utfIndex); clusterStart += UTF8CharLength(utfForm+clusterStart);
place++;
} }
} }
while (i < lenPositions)
positions[i++] = PANGO_PIXELS(pos.x + pos.width);
pango_layout_iter_free(iter);
delete []utfForm; delete []utfForm;
PLATFORM_ASSERT(i == lenPositions); PLATFORM_ASSERT(i == lenPositions);
} }
@ -1456,29 +1425,21 @@ void SurfaceImpl::MeasureWidths(Font &font_, const char *s, int len, int *positi
utfForm = UTF8FromLatin1(s, len); utfForm = UTF8FromLatin1(s, len);
} }
pango_layout_set_text(layout, utfForm, len); pango_layout_set_text(layout, utfForm, len);
PangoLayoutIter *iter = pango_layout_get_iter(layout);
pango_layout_iter_get_cluster_extents(iter, NULL, &pos);
int i = 0; int i = 0;
int positionStart = 0;
int clusterStart = 0; int clusterStart = 0;
// Each Latin1 input character may take 1 or 2 bytes in UTF-8 // Each Latin1 input character may take 1 or 2 bytes in UTF-8
// and groups of up to 3 may be represented as ligatures. // and groups of up to 3 may be represented as ligatures.
while (pango_layout_iter_next_cluster(iter)) { ClusterIterator iti(layout, strlen(utfForm));
pango_layout_iter_get_cluster_extents(iter, NULL, &pos); while (!iti.finished) {
int position = PANGO_PIXELS(pos.x); iti.Next();
int distance = position - positionStart; int clusterEnd = iti.curIndex;
int clusterEnd = pango_layout_iter_get_index(iter);
int ligatureLength = g_utf8_strlen(utfForm + clusterStart, clusterEnd - clusterStart); int ligatureLength = g_utf8_strlen(utfForm + clusterStart, clusterEnd - clusterStart);
PLATFORM_ASSERT(ligatureLength > 0 && ligatureLength <= 3); PLATFORM_ASSERT(ligatureLength > 0 && ligatureLength <= 3);
for (int charInLig=0; charInLig<ligatureLength; charInLig++) { for (int charInLig=0; charInLig<ligatureLength; charInLig++) {
positions[i++] = position - (ligatureLength - 1 - charInLig) * distance / ligatureLength; positions[i++] = iti.position - (ligatureLength - 1 - charInLig) * iti.distance / ligatureLength;
} }
positionStart = position;
clusterStart = clusterEnd; clusterStart = clusterEnd;
} }
while (i < lenPositions)
positions[i++] = PANGO_PIXELS(pos.x + pos.width);
pango_layout_iter_free(iter);
if (useGFree) { if (useGFree) {
g_free(utfForm); g_free(utfForm);
} else { } else {
@ -1492,7 +1453,6 @@ void SurfaceImpl::MeasureWidths(Font &font_, const char *s, int len, int *positi
} }
return; return;
} }
#endif
GdkFont *gf = PFont(font_)->pfont; GdkFont *gf = PFont(font_)->pfont;
bool measure8bit = true; bool measure8bit = true;
if (et != singleByte) { if (et != singleByte) {
@ -1553,7 +1513,6 @@ void SurfaceImpl::MeasureWidths(Font &font_, const char *s, int len, int *positi
int SurfaceImpl::WidthText(Font &font_, const char *s, int len) { int SurfaceImpl::WidthText(Font &font_, const char *s, int len) {
if (font_.GetID()) { if (font_.GetID()) {
#ifdef USE_PANGO
if (PFont(font_)->pfd) { if (PFont(font_)->pfd) {
char *utfForm = 0; char *utfForm = 0;
pango_layout_set_font_description(layout, PFont(font_)->pfd); pango_layout_set_font_description(layout, PFont(font_)->pfd);
@ -1575,7 +1534,11 @@ int SurfaceImpl::WidthText(Font &font_, const char *s, int len) {
} }
pango_layout_set_text(layout, utfForm, len); pango_layout_set_text(layout, utfForm, len);
} }
PangoLayoutLine *pangoLine = pango_layout_get_line(layout, 0); #ifdef PANGO_VERSION
PangoLayoutLine *pangoLine = pango_layout_get_line_readonly(layout,0);
#else
PangoLayoutLine *pangoLine = pango_layout_get_line(layout,0);
#endif
pango_layout_line_get_extents(pangoLine, NULL, &pos); pango_layout_line_get_extents(pangoLine, NULL, &pos);
if (useGFree) { if (useGFree) {
g_free(utfForm); g_free(utfForm);
@ -1584,7 +1547,6 @@ int SurfaceImpl::WidthText(Font &font_, const char *s, int len) {
} }
return PANGO_PIXELS(pos.width); return PANGO_PIXELS(pos.width);
} }
#endif
if (et == UTF8) { if (et == UTF8) {
GdkWChar wctext[maxLengthTextRun]; GdkWChar wctext[maxLengthTextRun];
size_t wclen = UTF16FromUTF8(s, len, static_cast<wchar_t *>(static_cast<void *>(wctext)), size_t wclen = UTF16FromUTF8(s, len, static_cast<wchar_t *>(static_cast<void *>(wctext)),
@ -1601,11 +1563,9 @@ int SurfaceImpl::WidthText(Font &font_, const char *s, int len) {
int SurfaceImpl::WidthChar(Font &font_, char ch) { int SurfaceImpl::WidthChar(Font &font_, char ch) {
if (font_.GetID()) { if (font_.GetID()) {
#ifdef USE_PANGO
if (PFont(font_)->pfd) { if (PFont(font_)->pfd) {
return WidthText(font_, &ch, 1); return WidthText(font_, &ch, 1);
} }
#endif
return gdk_char_width(PFont(font_)->pfont, ch); return gdk_char_width(PFont(font_)->pfont, ch);
} else { } else {
return 1; return 1;
@ -1635,7 +1595,6 @@ int SurfaceImpl::Ascent(Font &font_) {
#ifdef FAST_WAY #ifdef FAST_WAY
FontMutexLock(); FontMutexLock();
int ascent = PFont(font_)->ascent; int ascent = PFont(font_)->ascent;
#ifdef USE_PANGO
if ((ascent == 0) && (PFont(font_)->pfd)) { if ((ascent == 0) && (PFont(font_)->pfd)) {
PangoFontMetrics *metrics = pango_context_get_metrics(pcontext, PangoFontMetrics *metrics = pango_context_get_metrics(pcontext,
PFont(font_)->pfd, pango_context_get_language(pcontext)); PFont(font_)->pfd, pango_context_get_language(pcontext));
@ -1644,7 +1603,6 @@ int SurfaceImpl::Ascent(Font &font_) {
pango_font_metrics_unref(metrics); pango_font_metrics_unref(metrics);
ascent = PFont(font_)->ascent; ascent = PFont(font_)->ascent;
} }
#endif
if ((ascent == 0) && (PFont(font_)->pfont)) { if ((ascent == 0) && (PFont(font_)->pfont)) {
ascent = PFont(font_)->pfont->ascent; ascent = PFont(font_)->pfont->ascent;
} }
@ -1672,7 +1630,6 @@ int SurfaceImpl::Descent(Font &font_) {
return 1; return 1;
#ifdef FAST_WAY #ifdef FAST_WAY
#ifdef USE_PANGO
if (PFont(font_)->pfd) { if (PFont(font_)->pfd) {
PangoFontMetrics *metrics = pango_context_get_metrics(pcontext, PangoFontMetrics *metrics = pango_context_get_metrics(pcontext,
PFont(font_)->pfd, pango_context_get_language(pcontext)); PFont(font_)->pfd, pango_context_get_language(pcontext));
@ -1680,7 +1637,6 @@ int SurfaceImpl::Descent(Font &font_) {
pango_font_metrics_unref(metrics); pango_font_metrics_unref(metrics);
return descent; return descent;
} }
#endif
return PFont(font_)->pfont->descent; return PFont(font_)->pfont->descent;
#else #else
@ -1766,18 +1722,12 @@ PRectangle Window::GetPosition() {
} }
void Window::SetPosition(PRectangle rc) { void Window::SetPosition(PRectangle rc) {
#if 1
GtkAllocation alloc; GtkAllocation alloc;
alloc.x = rc.left; alloc.x = rc.left;
alloc.y = rc.top; alloc.y = rc.top;
alloc.width = rc.Width(); alloc.width = rc.Width();
alloc.height = rc.Height(); alloc.height = rc.Height();
gtk_widget_size_allocate(PWidget(wid), &alloc); gtk_widget_size_allocate(PWidget(wid), &alloc);
#else
gtk_widget_set_uposition(wid, rc.left, rc.top);
gtk_widget_set_usize(wid, rc.right - rc.left, rc.bottom - rc.top);
#endif
} }
void Window::SetPositionRelative(PRectangle rc, Window relativeTo) { void Window::SetPositionRelative(PRectangle rc, Window relativeTo) {
@ -1803,21 +1753,8 @@ void Window::SetPositionRelative(PRectangle rc, Window relativeTo) {
if (oy + sizey > screenHeight) if (oy + sizey > screenHeight)
oy = screenHeight - sizey; oy = screenHeight - sizey;
#if GTK_MAJOR_VERSION >= 2
gtk_window_move(GTK_WINDOW(PWidget(wid)), ox, oy); gtk_window_move(GTK_WINDOW(PWidget(wid)), ox, oy);
#else
gtk_widget_set_uposition(PWidget(wid), ox, oy);
#endif
#if 0
GtkAllocation alloc;
alloc.x = rc.left + ox;
alloc.y = rc.top + oy;
alloc.width = rc.right - rc.left;
alloc.height = rc.bottom - rc.top;
gtk_widget_size_allocate(wid, &alloc);
#endif
gtk_widget_set_usize(PWidget(wid), sizex, sizey); gtk_widget_set_usize(PWidget(wid), sizex, sizey);
} }
@ -1899,8 +1836,8 @@ PRectangle Window::GetMonitorRect(Point pt) {
gdk_window_get_origin(PWidget(wid)->window, &x_offset, &y_offset); gdk_window_get_origin(PWidget(wid)->window, &x_offset, &y_offset);
// gtk 2.2+ #if GTK_CHECK_VERSION(2,2,0)
#if GTK_MAJOR_VERSION > 2 || (GTK_MAJOR_VERSION == 2 && GTK_MINOR_VERSION >= 2) // GTK+ 2.2+
{ {
GdkScreen* screen; GdkScreen* screen;
gint monitor_num; gint monitor_num;
@ -1921,25 +1858,13 @@ PRectangle Window::GetMonitorRect(Point pt) {
struct ListImage { struct ListImage {
const char *xpm_data; const char *xpm_data;
#if GTK_MAJOR_VERSION < 2
GdkPixmap *pixmap;
GdkBitmap *bitmap;
#else
GdkPixbuf *pixbuf; GdkPixbuf *pixbuf;
#endif
}; };
static void list_image_free(gpointer, gpointer value, gpointer) { static void list_image_free(gpointer, gpointer value, gpointer) {
ListImage *list_image = (ListImage *) value; ListImage *list_image = (ListImage *) value;
#if GTK_MAJOR_VERSION < 2
if (list_image->pixmap)
gdk_pixmap_unref(list_image->pixmap);
if (list_image->bitmap)
gdk_bitmap_unref(list_image->bitmap);
#else
if (list_image->pixbuf) if (list_image->pixbuf)
gdk_pixbuf_unref (list_image->pixbuf); gdk_pixbuf_unref (list_image->pixbuf);
#endif
g_free(list_image); g_free(list_image);
} }
@ -1949,27 +1874,18 @@ ListBox::ListBox() {
ListBox::~ListBox() { ListBox::~ListBox() {
} }
#if GTK_MAJOR_VERSION >= 2
enum { enum {
PIXBUF_COLUMN, PIXBUF_COLUMN,
TEXT_COLUMN, TEXT_COLUMN,
N_COLUMNS N_COLUMNS
}; };
#endif
class ListBoxX : public ListBox { class ListBoxX : public ListBox {
WindowID list; WindowID list;
WindowID scroller; WindowID scroller;
#if GTK_MAJOR_VERSION < 2
int current;
#endif
void *pixhash; void *pixhash;
#if GTK_MAJOR_VERSION >= 2
GtkCellRenderer* pixbuf_renderer; GtkCellRenderer* pixbuf_renderer;
#endif
int lineHeight;
XPMSet xset; XPMSet xset;
bool unicodeMode;
int desiredVisibleRows; int desiredVisibleRows;
unsigned int maxItemCharacters; unsigned int maxItemCharacters;
unsigned int aveCharWidth; unsigned int aveCharWidth;
@ -1977,14 +1893,9 @@ public:
CallBackAction doubleClickAction; CallBackAction doubleClickAction;
void *doubleClickActionData; void *doubleClickActionData;
ListBoxX() : list(0), pixhash(NULL), desiredVisibleRows(5), maxItemCharacters(0), ListBoxX() : list(0), pixhash(NULL), pixbuf_renderer(0),
doubleClickAction(NULL), doubleClickActionData(NULL) { desiredVisibleRows(5), maxItemCharacters(0),
#if GTK_MAJOR_VERSION < 2 aveCharWidth(1), doubleClickAction(NULL), doubleClickActionData(NULL) {
current = 0;
#endif
#if GTK_MAJOR_VERSION >= 2
pixbuf_renderer = 0;
#endif
} }
virtual ~ListBoxX() { virtual ~ListBoxX() {
if (pixhash) { if (pixhash) {
@ -2020,19 +1931,6 @@ ListBox *ListBox::Allocate() {
return lb; return lb;
} }
#if GTK_MAJOR_VERSION < 2
static void UnselectionAC(GtkWidget *, gint, gint,
GdkEventButton *, gpointer p) {
int *pi = reinterpret_cast<int *>(p);
*pi = -1;
}
static void SelectionAC(GtkWidget *, gint row, gint,
GdkEventButton *, gpointer p) {
int *pi = reinterpret_cast<int *>(p);
*pi = row;
}
#endif
static gboolean ButtonPress(GtkWidget *, GdkEventButton* ev, gpointer p) { static gboolean ButtonPress(GtkWidget *, GdkEventButton* ev, gpointer p) {
try { try {
ListBoxX* lb = reinterpret_cast<ListBoxX*>(p); ListBoxX* lb = reinterpret_cast<ListBoxX*>(p);
@ -2047,7 +1945,6 @@ static gboolean ButtonPress(GtkWidget *, GdkEventButton* ev, gpointer p) {
return FALSE; return FALSE;
} }
#if GTK_MAJOR_VERSION >= 2
/* Change the active color to the selected color so the listbox uses the color /* Change the active color to the selected color so the listbox uses the color
scheme that it would use if it had the focus. */ scheme that it would use if it had the focus. */
static void StyleSet(GtkWidget *w, GtkStyle*, void*) { static void StyleSet(GtkWidget *w, GtkStyle*, void*) {
@ -2070,7 +1967,6 @@ static void StyleSet(GtkWidget *w, GtkStyle*, void*) {
if (!gdk_color_equal(&style->text[GTK_STATE_SELECTED], &style->text[GTK_STATE_ACTIVE])) if (!gdk_color_equal(&style->text[GTK_STATE_SELECTED], &style->text[GTK_STATE_ACTIVE]))
gtk_widget_modify_text(w, GTK_STATE_ACTIVE, &style->text[GTK_STATE_SELECTED]); gtk_widget_modify_text(w, GTK_STATE_ACTIVE, &style->text[GTK_STATE_SELECTED]);
} }
#endif
void ListBoxX::Create(Window &, int, Point, int, bool) { void ListBoxX::Create(Window &, int, Point, int, bool) {
wid = gtk_window_new(GTK_WINDOW_POPUP); wid = gtk_window_new(GTK_WINDOW_POPUP);
@ -2088,21 +1984,6 @@ void ListBoxX::Create(Window &, int, Point, int, bool) {
gtk_container_add(GTK_CONTAINER(frame), PWidget(scroller)); gtk_container_add(GTK_CONTAINER(frame), PWidget(scroller));
gtk_widget_show(PWidget(scroller)); gtk_widget_show(PWidget(scroller));
#if GTK_MAJOR_VERSION < 2
list = gtk_clist_new(1);
GtkWidget *wid = PWidget(list); // No code inside the GTK_OBJECT macro
gtk_widget_show(wid);
gtk_container_add(GTK_CONTAINER(PWidget(scroller)), wid);
gtk_clist_set_column_auto_resize(GTK_CLIST(wid), 0, TRUE);
gtk_clist_set_selection_mode(GTK_CLIST(wid), GTK_SELECTION_BROWSE);
gtk_signal_connect(GTK_OBJECT(wid), "unselect_row",
GTK_SIGNAL_FUNC(UnselectionAC), &current);
gtk_signal_connect(GTK_OBJECT(wid), "select_row",
GTK_SIGNAL_FUNC(SelectionAC), &current);
gtk_signal_connect(GTK_OBJECT(wid), "button_press_event",
GTK_SIGNAL_FUNC(ButtonPress), this);
gtk_clist_set_shadow_type(GTK_CLIST(wid), GTK_SHADOW_NONE);
#else
/* Tree and its model */ /* Tree and its model */
GtkListStore *store = GtkListStore *store =
gtk_list_store_new(N_COLUMNS, GDK_TYPE_PIXBUF, G_TYPE_STRING); gtk_list_store_new(N_COLUMNS, GDK_TYPE_PIXBUF, G_TYPE_STRING);
@ -2142,28 +2023,15 @@ void ListBoxX::Create(Window &, int, Point, int, bool) {
gtk_widget_show(wid); gtk_widget_show(wid);
g_signal_connect(G_OBJECT(wid), "button_press_event", g_signal_connect(G_OBJECT(wid), "button_press_event",
G_CALLBACK(ButtonPress), this); G_CALLBACK(ButtonPress), this);
#endif
gtk_widget_realize(PWidget(wid)); gtk_widget_realize(PWidget(wid));
} }
void ListBoxX::SetFont(Font &scint_font) { void ListBoxX::SetFont(Font &scint_font) {
#if GTK_MAJOR_VERSION < 2
GtkStyle *style = gtk_widget_get_style(GTK_WIDGET(PWidget(list)));
if (!gdk_font_equal(style->font, PFont(scint_font)->pfont)) {
style = gtk_style_copy(style);
gdk_font_unref(style->font);
style->font = PFont(scint_font)->pfont;
gdk_font_ref(style->font);
gtk_widget_set_style(GTK_WIDGET(PWidget(list)), style);
gtk_style_unref(style);
}
#else
// Only do for Pango font as there have been crashes for GDK fonts // Only do for Pango font as there have been crashes for GDK fonts
if (Created() && PFont(scint_font)->pfd) { if (Created() && PFont(scint_font)->pfd) {
// Current font is Pango font // Current font is Pango font
gtk_widget_modify_font(PWidget(list), PFont(scint_font)->pfd); gtk_widget_modify_font(PWidget(list), PFont(scint_font)->pfd);
} }
#endif
} }
void ListBoxX::SetAverageCharWidth(int width) { void ListBoxX::SetAverageCharWidth(int width) {
@ -2191,13 +2059,6 @@ PRectangle ListBoxX::GetDesiredRect() {
// First calculate height of the clist for our desired visible // First calculate height of the clist for our desired visible
// row count otherwise it tries to expand to the total # of rows // row count otherwise it tries to expand to the total # of rows
#if GTK_MAJOR_VERSION < 2
int ythickness = PWidget(list)->style->klass->ythickness;
height = (rows * GTK_CLIST(list)->row_height
+ rows + 1
+ 2 * (ythickness
+ GTK_CONTAINER(PWidget(list))->border_width));
#else
// Get cell height // Get cell height
int row_width=0; int row_width=0;
int row_height=0; int row_height=0;
@ -2209,7 +2070,6 @@ PRectangle ListBoxX::GetDesiredRect() {
height = (rows * row_height height = (rows * row_height
+ 2 * (ythickness + 2 * (ythickness
+ GTK_CONTAINER(PWidget(list))->border_width + 1)); + GTK_CONTAINER(PWidget(list))->border_width + 1));
#endif
gtk_widget_set_usize(GTK_WIDGET(PWidget(list)), -1, height); gtk_widget_set_usize(GTK_WIDGET(PWidget(list)), -1, height);
// Get the size of the scroller because we set usize on the window // Get the size of the scroller because we set usize on the window
@ -2229,30 +2089,19 @@ PRectangle ListBoxX::GetDesiredRect() {
} }
int ListBoxX::CaretFromEdge() { int ListBoxX::CaretFromEdge() {
#if GTK_MAJOR_VERSION >= 2
gint renderer_width, renderer_height; gint renderer_width, renderer_height;
gtk_cell_renderer_get_fixed_size(pixbuf_renderer, &renderer_width, gtk_cell_renderer_get_fixed_size(pixbuf_renderer, &renderer_width,
&renderer_height); &renderer_height);
return 4 + renderer_width; return 4 + renderer_width;
#endif
return 4 + xset.GetWidth();
} }
void ListBoxX::Clear() { void ListBoxX::Clear() {
#if GTK_MAJOR_VERSION < 2
gtk_clist_clear(GTK_CLIST(list));
#else
GtkTreeModel *model = gtk_tree_view_get_model(GTK_TREE_VIEW(list)); GtkTreeModel *model = gtk_tree_view_get_model(GTK_TREE_VIEW(list));
gtk_list_store_clear(GTK_LIST_STORE(model)); gtk_list_store_clear(GTK_LIST_STORE(model));
#endif
maxItemCharacters = 0; maxItemCharacters = 0;
} }
#if GTK_MAJOR_VERSION < 2
static void init_pixmap(ListImage *list_image, GtkWidget *window) {
#else
static void init_pixmap(ListImage *list_image) { static void init_pixmap(ListImage *list_image) {
#endif
const char *textForm = list_image->xpm_data; const char *textForm = list_image->xpm_data;
const char * const * xpm_lineform = reinterpret_cast<const char * const *>(textForm); const char * const * xpm_lineform = reinterpret_cast<const char * const *>(textForm);
const char **xpm_lineformfromtext = 0; const char **xpm_lineformfromtext = 0;
@ -2267,28 +2116,10 @@ static void init_pixmap(ListImage *list_image) {
} }
// Drop any existing pixmap/bitmap as data may have changed // Drop any existing pixmap/bitmap as data may have changed
#if GTK_MAJOR_VERSION < 2
if (list_image->pixmap)
gdk_pixmap_unref(list_image->pixmap);
list_image->pixmap = NULL;
if (list_image->bitmap)
gdk_bitmap_unref(list_image->bitmap);
list_image->bitmap = NULL;
list_image->pixmap = gdk_pixmap_colormap_create_from_xpm_d(NULL
, gtk_widget_get_colormap(window), &(list_image->bitmap), NULL
, (gchar **) xpm_lineform);
if (NULL == list_image->pixmap) {
if (list_image->bitmap)
gdk_bitmap_unref(list_image->bitmap);
list_image->bitmap = NULL;
}
#else
if (list_image->pixbuf) if (list_image->pixbuf)
gdk_pixbuf_unref(list_image->pixbuf); gdk_pixbuf_unref(list_image->pixbuf);
list_image->pixbuf = list_image->pixbuf =
gdk_pixbuf_new_from_xpm_data((const gchar**)xpm_lineform); gdk_pixbuf_new_from_xpm_data((const gchar**)xpm_lineform);
#endif
delete []xpm_lineformfromtext; delete []xpm_lineformfromtext;
} }
@ -2300,16 +2131,6 @@ void ListBoxX::Append(char *s, int type) {
list_image = (ListImage *) g_hash_table_lookup((GHashTable *) pixhash list_image = (ListImage *) g_hash_table_lookup((GHashTable *) pixhash
, (gconstpointer) GINT_TO_POINTER(type)); , (gconstpointer) GINT_TO_POINTER(type));
} }
#if GTK_MAJOR_VERSION < 2
char * szs[] = { s, NULL };
int rownum = gtk_clist_append(GTK_CLIST(list), szs);
if (list_image) {
if (NULL == list_image->pixmap)
init_pixmap(list_image, (GtkWidget *) list);
gtk_clist_set_pixtext(GTK_CLIST(list), rownum, 0, s, SPACING
, list_image->pixmap, list_image->bitmap);
}
#else
GtkTreeIter iter; GtkTreeIter iter;
GtkListStore *store = GtkListStore *store =
GTK_LIST_STORE(gtk_tree_view_get_model(GTK_TREE_VIEW(list))); GTK_LIST_STORE(gtk_tree_view_get_model(GTK_TREE_VIEW(list)));
@ -2337,7 +2158,6 @@ void ListBoxX::Append(char *s, int type) {
gtk_list_store_set(GTK_LIST_STORE(store), &iter, gtk_list_store_set(GTK_LIST_STORE(store), &iter,
TEXT_COLUMN, s, -1); TEXT_COLUMN, s, -1);
} }
#endif
size_t len = strlen(s); size_t len = strlen(s);
if (maxItemCharacters < len) if (maxItemCharacters < len)
maxItemCharacters = len; maxItemCharacters = len;
@ -2345,24 +2165,12 @@ void ListBoxX::Append(char *s, int type) {
int ListBoxX::Length() { int ListBoxX::Length() {
if (wid) if (wid)
#if GTK_MAJOR_VERSION < 2
return GTK_CLIST(list)->rows;
#else
return gtk_tree_model_iter_n_children(gtk_tree_view_get_model return gtk_tree_model_iter_n_children(gtk_tree_view_get_model
(GTK_TREE_VIEW(list)), NULL); (GTK_TREE_VIEW(list)), NULL);
#endif
return 0; return 0;
} }
void ListBoxX::Select(int n) { void ListBoxX::Select(int n) {
#if GTK_MAJOR_VERSION < 2
if (n == -1) {
gtk_clist_unselect_row(GTK_CLIST(list), current, 0);
} else {
gtk_clist_select_row(GTK_CLIST(list), n, 0);
gtk_clist_moveto(GTK_CLIST(list), n, 0, 0.5, 0.5);
}
#else
GtkTreeIter iter; GtkTreeIter iter;
GtkTreeModel *model = gtk_tree_view_get_model(GTK_TREE_VIEW(list)); GtkTreeModel *model = gtk_tree_view_get_model(GTK_TREE_VIEW(list));
GtkTreeSelection *selection = GtkTreeSelection *selection =
@ -2410,13 +2218,9 @@ void ListBoxX::Select(int n) {
} else { } else {
gtk_tree_selection_unselect_all(selection); gtk_tree_selection_unselect_all(selection);
} }
#endif
} }
int ListBoxX::GetSelection() { int ListBoxX::GetSelection() {
#if GTK_MAJOR_VERSION < 2
return current;
#else
GtkTreeIter iter; GtkTreeIter iter;
GtkTreeModel *model; GtkTreeModel *model;
GtkTreeSelection *selection; GtkTreeSelection *selection;
@ -2429,20 +2233,9 @@ int ListBoxX::GetSelection() {
return indices[0]; return indices[0];
} }
return -1; return -1;
#endif
} }
int ListBoxX::Find(const char *prefix) { int ListBoxX::Find(const char *prefix) {
#if GTK_MAJOR_VERSION < 2
int count = Length();
for (int i = 0; i < count; i++) {
char *s = 0;
gtk_clist_get_text(GTK_CLIST(list), i, 0, &s);
if (s && (0 == strncmp(prefix, s, strlen(prefix)))) {
return i;
}
}
#else
GtkTreeIter iter; GtkTreeIter iter;
GtkTreeModel *model = GtkTreeModel *model =
gtk_tree_view_get_model(GTK_TREE_VIEW(list)); gtk_tree_view_get_model(GTK_TREE_VIEW(list));
@ -2457,32 +2250,17 @@ int ListBoxX::Find(const char *prefix) {
valid = gtk_tree_model_iter_next(model, &iter) != FALSE; valid = gtk_tree_model_iter_next(model, &iter) != FALSE;
i++; i++;
} }
#endif
return -1; return -1;
} }
void ListBoxX::GetValue(int n, char *value, int len) { void ListBoxX::GetValue(int n, char *value, int len) {
char *text = NULL; char *text = NULL;
#if GTK_MAJOR_VERSION < 2
GtkCellType type = gtk_clist_get_cell_type(GTK_CLIST(list), n, 0);
switch (type) {
case GTK_CELL_TEXT:
gtk_clist_get_text(GTK_CLIST(list), n, 0, &text);
break;
case GTK_CELL_PIXTEXT:
gtk_clist_get_pixtext(GTK_CLIST(list), n, 0, &text, NULL, NULL, NULL);
break;
default:
break;
}
#else
GtkTreeIter iter; GtkTreeIter iter;
GtkTreeModel *model = gtk_tree_view_get_model(GTK_TREE_VIEW(list)); GtkTreeModel *model = gtk_tree_view_get_model(GTK_TREE_VIEW(list));
bool valid = gtk_tree_model_iter_nth_child(model, &iter, NULL, n) != FALSE; bool valid = gtk_tree_model_iter_nth_child(model, &iter, NULL, n) != FALSE;
if (valid) { if (valid) {
gtk_tree_model_get(model, &iter, TEXT_COLUMN, &text, -1); gtk_tree_model_get(model, &iter, TEXT_COLUMN, &text, -1);
} }
#endif
if (text && len > 0) { if (text && len > 0) {
strncpy(value, text, len); strncpy(value, text, len);
value[len - 1] = '\0'; value[len - 1] = '\0';
@ -2511,18 +2289,9 @@ void ListBoxX::RegisterImage(int type, const char *xpm_data) {
(gconstpointer) GINT_TO_POINTER(type)); (gconstpointer) GINT_TO_POINTER(type));
if (list_image) { if (list_image) {
// Drop icon already registered // Drop icon already registered
#if GTK_MAJOR_VERSION < 2
if (list_image->pixmap)
gdk_pixmap_unref(list_image->pixmap);
list_image->pixmap = 0;
if (list_image->bitmap)
gdk_bitmap_unref(list_image->bitmap);
list_image->bitmap = 0;
#else
if (list_image->pixbuf) if (list_image->pixbuf)
gdk_pixbuf_unref(list_image->pixbuf); gdk_pixbuf_unref(list_image->pixbuf);
list_image->pixbuf = NULL; list_image->pixbuf = NULL;
#endif
list_image->xpm_data = xpm_data; list_image->xpm_data = xpm_data;
} else { } else {
list_image = g_new0(ListImage, 1); list_image = g_new0(ListImage, 1);
@ -2575,11 +2344,7 @@ void Menu::CreatePopUp() {
void Menu::Destroy() { void Menu::Destroy() {
if (mid) if (mid)
#if GTK_MAJOR_VERSION < 2
gtk_object_unref(GTK_OBJECT(mid));
#else
g_object_unref(G_OBJECT(mid)); g_object_unref(G_OBJECT(mid));
#endif
mid = 0; mid = 0;
} }
@ -2597,12 +2362,8 @@ void Menu::Show(Point pt, Window &) {
if ((pt.y + requisition.height) > screenHeight) { if ((pt.y + requisition.height) > screenHeight) {
pt.y = screenHeight - requisition.height; pt.y = screenHeight - requisition.height;
} }
#if GTK_MAJOR_VERSION >= 2
gtk_item_factory_popup(factory, pt.x - 4, pt.y - 4, 3, gtk_item_factory_popup(factory, pt.x - 4, pt.y - 4, 3,
gtk_get_current_event_time()); gtk_get_current_event_time());
#else
gtk_item_factory_popup(factory, pt.x - 4, pt.y - 4, 3, 0);
#endif
} }
ElapsedTime::ElapsedTime() { ElapsedTime::ElapsedTime() {
@ -2674,11 +2435,7 @@ const char *Platform::DefaultFont() {
#ifdef G_OS_WIN32 #ifdef G_OS_WIN32
return "Lucida Console"; return "Lucida Console";
#else #else
#ifdef USE_PANGO
return "!Sans"; return "!Sans";
#else
return "lucidatypewriter";
#endif
#endif #endif
} }
@ -2718,16 +2475,35 @@ long Platform::SendScintillaPointer(
reinterpret_cast<sptr_t>(lParam)); reinterpret_cast<sptr_t>(lParam));
} }
bool Platform::IsDBCSLeadByte(int /* codePage */, char /* ch */) { bool Platform::IsDBCSLeadByte(int codePage, char ch) {
// Byte ranges found in Wikipedia articles with relevant search strings in each case
unsigned char uch = static_cast<unsigned char>(ch);
switch (codePage) {
case 932:
// Shift_jis
return ((uch >= 0x81) && (uch <= 0x9F)) ||
((uch >= 0xE0) && (uch <= 0xEF));
case 936:
// GBK
return (uch >= 0x81) && (uch <= 0xFE);
case 950:
// Big5
return (uch >= 0x81) && (uch <= 0xFE);
// Korean EUC-KR may be code page 949.
}
return false; return false;
} }
int Platform::DBCSCharLength(int, const char *s) { int Platform::DBCSCharLength(int codePage, const char *s) {
if (codePage == 932 || codePage == 936 || codePage == 950) {
return IsDBCSLeadByte(codePage, s[0]) ? 2 : 1;
} else {
int bytes = mblen(s, MB_CUR_MAX); int bytes = mblen(s, MB_CUR_MAX);
if (bytes >= 1) if (bytes >= 1)
return bytes; return bytes;
else else
return 1; return 1;
}
} }
int Platform::DBCSCharMaxLength() { int Platform::DBCSCharMaxLength() {

File diff suppressed because it is too large Load Diff

View File

@ -170,6 +170,9 @@ LexLua.o: ../src/LexLua.cxx ../include/Platform.h ../include/PropSet.h \
LexMagik.o: ../src/LexMagik.cxx ../include/Platform.h \ LexMagik.o: ../src/LexMagik.cxx ../include/Platform.h \
../include/PropSet.h ../include/Accessor.h ../src/StyleContext.h \ ../include/PropSet.h ../include/Accessor.h ../src/StyleContext.h \
../include/KeyWords.h ../include/Scintilla.h ../include/SciLexer.h ../include/KeyWords.h ../include/Scintilla.h ../include/SciLexer.h
LexMarkdown.o: ../src/LexMarkdown.cxx ../include/Platform.h \
../include/PropSet.h ../include/Accessor.h ../src/StyleContext.h \
../include/KeyWords.h ../include/Scintilla.h ../include/SciLexer.h
LexMatlab.o: ../src/LexMatlab.cxx ../include/Platform.h \ LexMatlab.o: ../src/LexMatlab.cxx ../include/Platform.h \
../include/PropSet.h ../include/Accessor.h ../src/StyleContext.h \ ../include/PropSet.h ../include/Accessor.h ../src/StyleContext.h \
../include/KeyWords.h ../include/Scintilla.h ../include/SciLexer.h ../include/KeyWords.h ../include/Scintilla.h ../include/SciLexer.h

View File

@ -1,21 +1,27 @@
# Make file for Scintilla on Linux or compatible OS # Make file for Scintilla on Linux or compatible OS
# Copyright 1998-2001 by Neil Hodgson <neilh@scintilla.org> # Copyright 1998-2010 by Neil Hodgson <neilh@scintilla.org>
# The License.txt file describes the conditions under which this software may be distributed. # The License.txt file describes the conditions under which this software may be distributed.
# This makefile assumes GCC 3.1 is used and changes will be needed to use other compilers. # This makefile assumes GCC 4.3 is used and changes will be needed to use other compilers.
# GNU make does not like \r\n line endings so should be saved to CVS in binary form. # GNU make does not like \r\n line endings so should be saved to CVS in binary form.
# Builds for GTK+ 2 if available else GTK+ 1. # Builds for GTK+ 2 and no longer supports GTK+ 1.
# To force GTK+ 2 build, define GTK2 on the make command line. # Also works with ming32-make on Windows.
# To force GTK+ 1 build, define GTK1 on the make command line.
.SUFFIXES: .cxx .c .o .h .a .SUFFIXES: .cxx .c .o .h .a
ifdef CLANG
CC = clang
CCOMP = clang
else
CC = g++ CC = g++
CCOMP = gcc CCOMP = gcc
endif
AR = ar AR = ar
RANLIB = touch RANLIB = touch
ifndef windir
ifeq ($(shell uname),Darwin) ifeq ($(shell uname),Darwin)
RANLIB = ranlib RANLIB = ranlib
endif endif
endif
COMPLIB=../bin/scintilla.a COMPLIB=../bin/scintilla.a
@ -23,7 +29,7 @@ vpath %.h ../src ../include
vpath %.cxx ../src vpath %.cxx ../src
INCLUDEDIRS=-I ../include -I ../src INCLUDEDIRS=-I ../include -I ../src
CXXBASEFLAGS=-Wall -Wno-missing-braces -Wno-char-subscripts -pedantic -Os -DGTK -DSCI_LEXER $(INCLUDEDIRS) CXXBASEFLAGS=-Wall -Wno-missing-braces -Wno-char-subscripts -pedantic -DGTK -DSCI_LEXER $(INCLUDEDIRS)
ifdef NOTHREADS ifdef NOTHREADS
THREADFLAGS=-DG_THREADS_IMPL_NONE THREADFLAGS=-DG_THREADS_IMPL_NONE
@ -37,23 +43,8 @@ else
CXXFLAGS=-DNDEBUG -Os $(CXXBASEFLAGS) $(THREADFLAGS) CXXFLAGS=-DNDEBUG -Os $(CXXBASEFLAGS) $(THREADFLAGS)
endif endif
# If explicit setting of GTK1 or GTK2 then use that else look for
# pkg-config which is an OK indication that GTK2 is available
ifdef GTK2
CONFIGFLAGS:=$(shell pkg-config --cflags gtk+-2.0) CONFIGFLAGS:=$(shell pkg-config --cflags gtk+-2.0)
MARSHALLER=scintilla-marshal.o MARSHALLER=scintilla-marshal.o
else
ifdef GTK1
CONFIGFLAGS:=$(shell gtk-config --cflags)
else
ifneq (,$(findstring /,$(shell whereis pkg-config)))
CONFIGFLAGS:=$(shell pkg-config --cflags gtk+-2.0)
MARSHALLER=scintilla-marshal.o
else
CONFIGFLAGS:=$(shell gtk-config --cflags)
endif
endif
endif
.cxx.o: .cxx.o:
$(CC) $(CONFIGFLAGS) $(CXXFLAGS) -c $< $(CC) $(CONFIGFLAGS) $(CXXFLAGS) -c $<
@ -68,12 +59,13 @@ LexBaan.o LexBash.o LexBasic.o LexBullant.o LexCaml.o LexCLW.o LexCmake.o \
LexCOBOL.o LexConf.o LexCPP.o LexCrontab.o LexCsound.o LexCSS.o LexD.o \ LexCOBOL.o LexConf.o LexCPP.o LexCrontab.o LexCsound.o LexCSS.o LexD.o \
LexEiffel.o LexErlang.o LexEScript.o LexFlagship.o LexForth.o LexFortran.o \ LexEiffel.o LexErlang.o LexEScript.o LexFlagship.o LexForth.o LexFortran.o \
LexGAP.o LexGui4Cli.o LexHaskell.o LexHTML.o LexInno.o LexKix.o LexLisp.o \ LexGAP.o LexGui4Cli.o LexHaskell.o LexHTML.o LexInno.o LexKix.o LexLisp.o \
LexLout.o LexLua.o LexMagik.o LexMatlab.o LexMetapost.o LexMMIXAL.o LexMPT.o \ LexLout.o LexLua.o LexMagik.o LexMarkdown.o LexMatlab.o LexMetapost.o \
LexMSSQL.o LexMySQL.o LexNimrod.o LexNsis.o LexOpal.o LexOthers.o LexPascal.o \ LexMMIXAL.o LexMPT.o LexMSSQL.o LexMySQL.o LexNimrod.o LexNsis.o LexOpal.o \
LexPB.o LexPerl.o LexPLM.o LexPOV.o LexPowerPro.o LexPowerShell.o \ LexOthers.o LexPascal.o LexPB.o LexPerl.o LexPLM.o LexPOV.o LexPowerPro.o \
LexProgress.o LexPS.o LexPython.o LexR.o LexRebol.o LexRuby.o LexScriptol.o \ LexPowerShell.o LexProgress.o LexPS.o LexPython.o LexR.o LexRebol.o LexRuby.o \
LexSmalltalk.o LexSML.o LexSorcus.o LexSpecman.o LexSpice.o LexSQL.o LexTACL.o \ LexScriptol.o LexSmalltalk.o LexSML.o LexSorcus.o LexSpecman.o LexSpice.o \
LexTADS3.o LexTAL.o LexTCL.o LexTeX.o LexVB.o LexVerilog.o LexVHDL.o LexYAML.o LexSQL.o LexTACL.o LexTADS3.o LexTAL.o LexTCL.o LexTeX.o LexVB.o LexVerilog.o \
LexVHDL.o LexYAML.o
#--Autogenerated -- end of automatically generated section #--Autogenerated -- end of automatically generated section
all: $(COMPLIB) all: $(COMPLIB)

View File

@ -295,7 +295,7 @@ public:
virtual ~Font(); virtual ~Font();
virtual void Create(const char *faceName, int characterSet, int size, virtual void Create(const char *faceName, int characterSet, int size,
bool bold, bool italic, bool extraFontFlag=false); bool bold, bool italic, int extraFontFlag=0);
virtual void Release(); virtual void Release();
FontID GetID() { return fid; } FontID GetID() { return fid; }
@ -314,8 +314,8 @@ private:
Surface(const Surface &) {} Surface(const Surface &) {}
Surface &operator=(const Surface &) { return *this; } Surface &operator=(const Surface &) { return *this; }
public: public:
Surface() {}; Surface() {}
virtual ~Surface() {}; virtual ~Surface() {}
static Surface *Allocate(); static Surface *Allocate();
virtual void Init(WindowID wid)=0; virtual void Init(WindowID wid)=0;
@ -474,7 +474,7 @@ public:
*/ */
class DynamicLibrary { class DynamicLibrary {
public: public:
virtual ~DynamicLibrary() {}; virtual ~DynamicLibrary() {}
/// @return Pointer to function "name", or NULL on failure. /// @return Pointer to function "name", or NULL on failure.
virtual Function FindFunction(const char *name) = 0; virtual Function FindFunction(const char *name) = 0;

View File

@ -110,11 +110,13 @@
#define SCLEX_POWERPRO 95 #define SCLEX_POWERPRO 95
#define SCLEX_NIMROD 96 #define SCLEX_NIMROD 96
#define SCLEX_SML 97 #define SCLEX_SML 97
#define SCLEX_MARKDOWN 198
#define SCLEX_SEARCHRESULT 98 #define SCLEX_SEARCHRESULT 98
#define SCLEX_OBJC 99 #define SCLEX_OBJC 99
#define SCLEX_USER 100 #define SCLEX_USER 100
#define SCLEX_AUTOMATIC 1000 #define SCLEX_AUTOMATIC 1000
//For All lexer //For All lexer
@ -682,6 +684,7 @@
#define SCE_CSS_EXTENDED_IDENTIFIER 19 #define SCE_CSS_EXTENDED_IDENTIFIER 19
#define SCE_CSS_EXTENDED_PSEUDOCLASS 20 #define SCE_CSS_EXTENDED_PSEUDOCLASS 20
#define SCE_CSS_EXTENDED_PSEUDOELEMENT 21 #define SCE_CSS_EXTENDED_PSEUDOELEMENT 21
#define SCE_CSS_MEDIA 22
#define SCE_POV_DEFAULT 0 #define SCE_POV_DEFAULT 0
#define SCE_POV_COMMENT 1 #define SCE_POV_COMMENT 1
#define SCE_POV_COMMENTLINE 2 #define SCE_POV_COMMENTLINE 2
@ -834,8 +837,19 @@
#define SCE_ERLANG_CHARACTER 9 #define SCE_ERLANG_CHARACTER 9
#define SCE_ERLANG_MACRO 10 #define SCE_ERLANG_MACRO 10
#define SCE_ERLANG_RECORD 11 #define SCE_ERLANG_RECORD 11
#define SCE_ERLANG_SEPARATOR 12 #define SCE_ERLANG_PREPROC 12
#define SCE_ERLANG_NODE_NAME 13 #define SCE_ERLANG_NODE_NAME 13
#define SCE_ERLANG_COMMENT_FUNCTION 14
#define SCE_ERLANG_COMMENT_MODULE 15
#define SCE_ERLANG_COMMENT_DOC 16
#define SCE_ERLANG_COMMENT_DOC_MACRO 17
#define SCE_ERLANG_ATOM_QUOTED 18
#define SCE_ERLANG_MACRO_QUOTED 19
#define SCE_ERLANG_RECORD_QUOTED 20
#define SCE_ERLANG_NODE_NAME_QUOTED 21
#define SCE_ERLANG_BIFS 22
#define SCE_ERLANG_MODULES 23
#define SCE_ERLANG_MODULES_ATT 24
#define SCE_ERLANG_UNKNOWN 31 #define SCE_ERLANG_UNKNOWN 31
#define SCE_MSSQL_DEFAULT 0 #define SCE_MSSQL_DEFAULT 0
#define SCE_MSSQL_COMMENT 1 #define SCE_MSSQL_COMMENT 1
@ -1115,11 +1129,19 @@
#define SCE_FS_DATE 16 #define SCE_FS_DATE 16
#define SCE_FS_STRINGEOL 17 #define SCE_FS_STRINGEOL 17
#define SCE_FS_CONSTANT 18 #define SCE_FS_CONSTANT 18
#define SCE_FS_ASM 19 #define SCE_FS_WORDOPERATOR 19
#define SCE_FS_LABEL 20 #define SCE_FS_DISABLEDCODE 20
#define SCE_FS_ERROR 21 #define SCE_FS_DEFAULT_C 21
#define SCE_FS_HEXNUMBER 22 #define SCE_FS_COMMENTDOC_C 22
#define SCE_FS_BINNUMBER 23 #define SCE_FS_COMMENTLINEDOC_C 23
#define SCE_FS_KEYWORD_C 24
#define SCE_FS_KEYWORD2_C 25
#define SCE_FS_NUMBER_C 26
#define SCE_FS_STRING_C 27
#define SCE_FS_PREPROCESSOR_C 28
#define SCE_FS_OPERATOR_C 29
#define SCE_FS_IDENTIFIER_C 30
#define SCE_FS_STRINGEOL_C 31
#define SCE_CSOUND_DEFAULT 0 #define SCE_CSOUND_DEFAULT 0
#define SCE_CSOUND_COMMENT 1 #define SCE_CSOUND_COMMENT 1
#define SCE_CSOUND_NUMBER 2 #define SCE_CSOUND_NUMBER 2
@ -1142,7 +1164,6 @@
#define SCE_INNO_PARAMETER 3 #define SCE_INNO_PARAMETER 3
#define SCE_INNO_SECTION 4 #define SCE_INNO_SECTION 4
#define SCE_INNO_PREPROC 5 #define SCE_INNO_PREPROC 5
#define SCE_INNO_PREPROC_INLINE 6
#define SCE_INNO_INLINE_EXPANSION 6 #define SCE_INNO_INLINE_EXPANSION 6
#define SCE_INNO_COMMENT_PASCAL 7 #define SCE_INNO_COMMENT_PASCAL 7
#define SCE_INNO_KEYWORD_PASCAL 8 #define SCE_INNO_KEYWORD_PASCAL 8
@ -1389,6 +1410,28 @@
#define SCE_SML_COMMENT1 13 #define SCE_SML_COMMENT1 13
#define SCE_SML_COMMENT2 14 #define SCE_SML_COMMENT2 14
#define SCE_SML_COMMENT3 15 #define SCE_SML_COMMENT3 15
#define SCE_MARKDOWN_DEFAULT 0
#define SCE_MARKDOWN_LINE_BEGIN 1
#define SCE_MARKDOWN_STRONG1 2
#define SCE_MARKDOWN_STRONG2 3
#define SCE_MARKDOWN_EM1 4
#define SCE_MARKDOWN_EM2 5
#define SCE_MARKDOWN_HEADER1 6
#define SCE_MARKDOWN_HEADER2 7
#define SCE_MARKDOWN_HEADER3 8
#define SCE_MARKDOWN_HEADER4 9
#define SCE_MARKDOWN_HEADER5 10
#define SCE_MARKDOWN_HEADER6 11
#define SCE_MARKDOWN_PRECHAR 12
#define SCE_MARKDOWN_ULIST_ITEM 13
#define SCE_MARKDOWN_OLIST_ITEM 14
#define SCE_MARKDOWN_BLOCKQUOTE 15
#define SCE_MARKDOWN_STRIKEOUT 16
#define SCE_MARKDOWN_HRULE 17
#define SCE_MARKDOWN_LINK 18
#define SCE_MARKDOWN_CODE 19
#define SCE_MARKDOWN_CODE2 20
#define SCE_MARKDOWN_CODEBK 21
/* --Autogenerated -- end of section automatically generated from Scintilla.iface */ /* --Autogenerated -- end of section automatically generated from Scintilla.iface */
#endif #endif

View File

@ -11,17 +11,21 @@
#ifndef SCINTILLA_H #ifndef SCINTILLA_H
#define SCINTILLA_H #define SCINTILLA_H
#if LCCWIN #ifdef __cplusplus
typedef BOOL bool; extern "C" {
#endif #endif
#if PLAT_WIN #if defined(_WIN32)
/* Return false on failure: */ /* Return false on failure: */
bool Scintilla_RegisterClasses(void *hInstance); int Scintilla_RegisterClasses(void *hInstance);
bool Scintilla_ReleaseResources(); int Scintilla_ReleaseResources();
#endif #endif
int Scintilla_LinkLexers(); int Scintilla_LinkLexers();
#ifdef __cplusplus
}
#endif
/* Here should be placed typedefs for uptr_t, an unsigned integer type large enough to /* Here should be placed typedefs for uptr_t, an unsigned integer type large enough to
* hold a pointer and sptr_t, a signed integer large enough to hold a pointer. * hold a pointer and sptr_t, a signed integer large enough to hold a pointer.
* May need to be changed for 64 bit platforms. */ * May need to be changed for 64 bit platforms. */
@ -258,6 +262,8 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,
#define SCI_SETWHITESPACEFORE 2084 #define SCI_SETWHITESPACEFORE 2084
#define SCI_SETWHITESPACEBACK 2085 #define SCI_SETWHITESPACEBACK 2085
#define SCI_SETWHITESPACESIZE 2086
#define SCI_GETWHITESPACESIZE 2087
#define SCI_SETSTYLEBITS 2090 #define SCI_SETSTYLEBITS 2090
#define SCI_GETSTYLEBITS 2091 #define SCI_GETSTYLEBITS 2091
#define SCI_SETLINESTATE 2092 #define SCI_SETLINESTATE 2092
@ -472,6 +478,19 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,
#define SCI_APPENDTEXT 2282 #define SCI_APPENDTEXT 2282
#define SCI_GETTWOPHASEDRAW 2283 #define SCI_GETTWOPHASEDRAW 2283
#define SCI_SETTWOPHASEDRAW 2284 #define SCI_SETTWOPHASEDRAW 2284
#define SC_EFF_QUALITY_MASK 0xF
#define SC_EFF_QUALITY_DEFAULT 0
#define SC_EFF_QUALITY_NON_ANTIALIASED 1
#define SC_EFF_QUALITY_ANTIALIASED 2
#define SC_EFF_QUALITY_LCD_OPTIMIZED 3
#define SCI_SETFONTQUALITY 2611
#define SCI_GETFONTQUALITY 2612
#define SCI_SETFIRSTVISIBLELINE 2613
#define SC_MULTIPASTE_ONCE 0
#define SC_MULTIPASTE_EACH 1
#define SCI_SETMULTIPASTE 2614
#define SCI_GETMULTIPASTE 2615
#define SCI_GETTAG 2616
#define SCI_TARGETFROMSELECTION 2287 #define SCI_TARGETFROMSELECTION 2287
#define SCI_LINESJOIN 2288 #define SCI_LINESJOIN 2288
#define SCI_LINESSPLIT 2289 #define SCI_LINESSPLIT 2289
@ -646,6 +665,7 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,
#define SCI_SETWHITESPACECHARS 2443 #define SCI_SETWHITESPACECHARS 2443
#define SCI_SETCHARSDEFAULT 2444 #define SCI_SETCHARSDEFAULT 2444
#define SCI_AUTOCGETCURRENT 2445 #define SCI_AUTOCGETCURRENT 2445
#define SCI_AUTOCGETCURRENTTEXT 2610
#define SCI_ALLOCATE 2446 #define SCI_ALLOCATE 2446
#define SCI_TARGETASUTF8 2447 #define SCI_TARGETASUTF8 2447
#define SCI_SETLENGTHFORENCODE 2448 #define SCI_SETLENGTHFORENCODE 2448
@ -724,6 +744,8 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,
#define SCI_GETADDITIONALSELECTIONTYPING 2566 #define SCI_GETADDITIONALSELECTIONTYPING 2566
#define SCI_SETADDITIONALCARETSBLINK 2567 #define SCI_SETADDITIONALCARETSBLINK 2567
#define SCI_GETADDITIONALCARETSBLINK 2568 #define SCI_GETADDITIONALCARETSBLINK 2568
#define SCI_SETADDITIONALCARETSVISIBLE 2608
#define SCI_GETADDITIONALCARETSVISIBLE 2609
#define SCI_GETSELECTIONS 2570 #define SCI_GETSELECTIONS 2570
#define SCI_CLEARSELECTIONS 2571 #define SCI_CLEARSELECTIONS 2571
#define SCI_SETSELECTION 2572 #define SCI_SETSELECTION 2572
@ -779,6 +801,7 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,
#define SCI_GETPROPERTYEXPANDED 4009 #define SCI_GETPROPERTYEXPANDED 4009
#define SCI_GETPROPERTYINT 4010 #define SCI_GETPROPERTYINT 4010
#define SCI_GETSTYLEBITSNEEDED 4011 #define SCI_GETSTYLEBITSNEEDED 4011
#define SCI_GETLEXERLANGUAGE 4012
#define SC_MOD_INSERTTEXT 0x1 #define SC_MOD_INSERTTEXT 0x1
#define SC_MOD_DELETETEXT 0x2 #define SC_MOD_DELETETEXT 0x2
#define SC_MOD_CHANGESTYLE 0x4 #define SC_MOD_CHANGESTYLE 0x4
@ -886,23 +909,28 @@ struct Sci_TextToFind {
#define TextRange Sci_TextRange #define TextRange Sci_TextRange
#define TextToFind Sci_TextToFind #define TextToFind Sci_TextToFind
#ifdef PLATFORM_H typedef void *Sci_SurfaceID;
struct Sci_Rectangle {
int left;
int top;
int right;
int bottom;
};
/* This structure is used in printing and requires some of the graphics types /* This structure is used in printing and requires some of the graphics types
* from Platform.h. Not needed by most client code. */ * from Platform.h. Not needed by most client code. */
struct Sci_RangeToFormat { struct Sci_RangeToFormat {
SurfaceID hdc; Sci_SurfaceID hdc;
SurfaceID hdcTarget; Sci_SurfaceID hdcTarget;
PRectangle rc; struct Sci_Rectangle rc;
PRectangle rcPage; struct Sci_Rectangle rcPage;
Sci_CharacterRange chrg; struct Sci_CharacterRange chrg;
}; };
#define RangeToFormat Sci_RangeToFormat #define RangeToFormat Sci_RangeToFormat
#endif
struct Sci_NotifyHeader { struct Sci_NotifyHeader {
/* Compatible with Windows NMHDR. /* Compatible with Windows NMHDR.
* hwndFrom is really an environment specific window handle or pointer * hwndFrom is really an environment specific window handle or pointer

View File

@ -571,6 +571,12 @@ fun void SetWhitespaceFore=2084(bool useSetting, colour fore)
# Set the background colour of all whitespace and whether to use this setting. # Set the background colour of all whitespace and whether to use this setting.
fun void SetWhitespaceBack=2085(bool useSetting, colour back) fun void SetWhitespaceBack=2085(bool useSetting, colour back)
# Set the size of the dots used to mark space characters.
set void SetWhitespaceSize=2086(int size,)
# Get the size of the dots used to mark space characters.
get int GetWhitespaceSize=2087(,)
# Divide each styling byte into lexical class bits (default: 5) and indicator # Divide each styling byte into lexical class bits (default: 5) and indicator
# bits (default: 3). If a lexer requires more than 32 lexical states, then this # bits (default: 3). If a lexer requires more than 32 lexical states, then this
# is used to expand the possible states. # is used to expand the possible states.
@ -1199,6 +1205,37 @@ get bool GetTwoPhaseDraw=2283(,)
# and then the foreground. This avoids chopping off characters that overlap the next run. # and then the foreground. This avoids chopping off characters that overlap the next run.
set void SetTwoPhaseDraw=2284(bool twoPhase,) set void SetTwoPhaseDraw=2284(bool twoPhase,)
# Control font anti-aliasing.
enu FontQuality=SC_EFF_
val SC_EFF_QUALITY_MASK=0xF
val SC_EFF_QUALITY_DEFAULT=0
val SC_EFF_QUALITY_NON_ANTIALIASED=1
val SC_EFF_QUALITY_ANTIALIASED=2
val SC_EFF_QUALITY_LCD_OPTIMIZED=3
# Choose the quality level for text from the FontQuality enumeration.
set void SetFontQuality=2611(int fontQuality,)
# Retrieve the quality level for text.
get int GetFontQuality=2612(,)
# Scroll so that a display line is at the top of the display.
set void SetFirstVisibleLine=2613(int lineDisplay,)
enu MultiPaste=SC_MULTIPASTE_
val SC_MULTIPASTE_ONCE=0
val SC_MULTIPASTE_EACH=1
# Change the effect of pasting when there are multiple selections.
set void SetMultiPaste=2614(int multiPaste,)
# Retrieve the effect of pasting when there are multiple selections..
get int GetMultiPaste=2615(,)
# Retrieve the value of a tag from a regular expression search.
fun int GetTag=2616(int tagNumber, stringresult tagValue)
# Make the target range start and end be the same as the selection range start and end. # Make the target range start and end be the same as the selection range start and end.
fun void TargetFromSelection=2287(,) fun void TargetFromSelection=2287(,)
@ -1718,6 +1755,10 @@ fun void SetCharsDefault=2444(,)
# Get currently selected item position in the auto-completion list # Get currently selected item position in the auto-completion list
fun int AutoCGetCurrent=2445(,) fun int AutoCGetCurrent=2445(,)
# Get currently selected item text in the auto-completion list
# Returns the length of the item text
fun int AutoCGetCurrentText=2610(, stringresult s)
# Enlarge the document to a particular size of text bytes. # Enlarge the document to a particular size of text bytes.
fun void Allocate=2446(int bytes,) fun void Allocate=2446(int bytes,)
@ -1945,6 +1986,12 @@ set void SetAdditionalCaretsBlink=2567(bool additionalCaretsBlink,)
# Whether additional carets will blink # Whether additional carets will blink
get bool GetAdditionalCaretsBlink=2568(,) get bool GetAdditionalCaretsBlink=2568(,)
# Set whether additional carets are visible
set void SetAdditionalCaretsVisible=2608(bool additionalCaretsBlink,)
# Whether additional carets are visible
get bool GetAdditionalCaretsVisible=2609(,)
# How many selections are there? # How many selections are there?
get int GetSelections=2570(,) get int GetSelections=2570(,)
@ -1976,13 +2023,13 @@ get int GetSelectionNAnchorVirtualSpace=2583(int selection,)
set void SetSelectionNStart=2584(int selection, position pos) set void SetSelectionNStart=2584(int selection, position pos)
# Returns the position at the start of the selection. # Returns the position at the start of the selection.
get position GetSelectionNStart=2585(,) get position GetSelectionNStart=2585(int selection,)
# Sets the position that ends the selection - this becomes the currentPosition. # Sets the position that ends the selection - this becomes the currentPosition.
set void SetSelectionNEnd=2586(int selection, position pos,) set void SetSelectionNEnd=2586(int selection, position pos,)
# Returns the position at the end of the selection. # Returns the position at the end of the selection.
get position GetSelectionNEnd=2587(,) get position GetSelectionNEnd=2587(int selection,)
set void SetRectangularSelectionCaret=2588(position pos,) set void SetRectangularSelectionCaret=2588(position pos,)
get position GetRectangularSelectionCaret=2589(,) get position GetRectangularSelectionCaret=2589(,)
@ -2081,6 +2128,10 @@ get int GetPropertyInt=4010(string key,)
# Retrieve the number of bits the current lexer needs for styling. # Retrieve the number of bits the current lexer needs for styling.
get int GetStyleBitsNeeded=4011(,) get int GetStyleBitsNeeded=4011(,)
# Retrieve the name of the lexer.
# Return the length of the text.
get int GetLexerLanguage=4012(, stringresult text)
# Notifications # Notifications
# Type of modification and the action which caused the modification. # Type of modification and the action which caused the modification.
# These are defined as a bit mask to make it easy to specify which notifications are wanted. # These are defined as a bit mask to make it easy to specify which notifications are wanted.
@ -2247,6 +2298,7 @@ val SCLEX_SORCUS=94
val SCLEX_POWERPRO=95 val SCLEX_POWERPRO=95
val SCLEX_NIMROD=96 val SCLEX_NIMROD=96
val SCLEX_SML=97 val SCLEX_SML=97
val SCLEX_MARKDOWN=98
# When a lexer specifies its language as SCLEX_AUTOMATIC it receives a # When a lexer specifies its language as SCLEX_AUTOMATIC it receives a
# value assigned in sequence from SCLEX_AUTOMATIC+1. # value assigned in sequence from SCLEX_AUTOMATIC+1.
@ -2854,6 +2906,7 @@ val SCE_CSS_PSEUDOELEMENT=18
val SCE_CSS_EXTENDED_IDENTIFIER=19 val SCE_CSS_EXTENDED_IDENTIFIER=19
val SCE_CSS_EXTENDED_PSEUDOCLASS=20 val SCE_CSS_EXTENDED_PSEUDOCLASS=20
val SCE_CSS_EXTENDED_PSEUDOELEMENT=21 val SCE_CSS_EXTENDED_PSEUDOELEMENT=21
val SCE_CSS_MEDIA=22
# Lexical states for SCLEX_POV # Lexical states for SCLEX_POV
lex POV=SCLEX_POV SCE_POV_ lex POV=SCLEX_POV SCE_POV_
val SCE_POV_DEFAULT=0 val SCE_POV_DEFAULT=0
@ -3029,8 +3082,19 @@ val SCE_ERLANG_FUNCTION_NAME=8
val SCE_ERLANG_CHARACTER=9 val SCE_ERLANG_CHARACTER=9
val SCE_ERLANG_MACRO=10 val SCE_ERLANG_MACRO=10
val SCE_ERLANG_RECORD=11 val SCE_ERLANG_RECORD=11
val SCE_ERLANG_SEPARATOR=12 val SCE_ERLANG_PREPROC=12
val SCE_ERLANG_NODE_NAME=13 val SCE_ERLANG_NODE_NAME=13
val SCE_ERLANG_COMMENT_FUNCTION=14
val SCE_ERLANG_COMMENT_MODULE=15
val SCE_ERLANG_COMMENT_DOC=16
val SCE_ERLANG_COMMENT_DOC_MACRO=17
val SCE_ERLANG_ATOM_QUOTED=18
val SCE_ERLANG_MACRO_QUOTED=19
val SCE_ERLANG_RECORD_QUOTED=20
val SCE_ERLANG_NODE_NAME_QUOTED=21
val SCE_ERLANG_BIFS=22
val SCE_ERLANG_MODULES=23
val SCE_ERLANG_MODULES_ATT=24
val SCE_ERLANG_UNKNOWN=31 val SCE_ERLANG_UNKNOWN=31
# Lexical states for SCLEX_OCTAVE are identical to MatLab # Lexical states for SCLEX_OCTAVE are identical to MatLab
lex Octave=SCLEX_OCTAVE SCE_MATLAB_ lex Octave=SCLEX_OCTAVE SCE_MATLAB_
@ -3325,7 +3389,7 @@ val SCE_ST_ASSIGN=14
val SCE_ST_CHARACTER=15 val SCE_ST_CHARACTER=15
val SCE_ST_SPEC_SEL=16 val SCE_ST_SPEC_SEL=16
# Lexical states for SCLEX_FLAGSHIP (clipper) # Lexical states for SCLEX_FLAGSHIP (clipper)
lex FlagShip=SCLEX_FLAGSHIP SCE_B_ lex FlagShip=SCLEX_FLAGSHIP SCE_FS_
val SCE_FS_DEFAULT=0 val SCE_FS_DEFAULT=0
val SCE_FS_COMMENT=1 val SCE_FS_COMMENT=1
val SCE_FS_COMMENTLINE=2 val SCE_FS_COMMENTLINE=2
@ -3345,11 +3409,19 @@ val SCE_FS_IDENTIFIER=15
val SCE_FS_DATE=16 val SCE_FS_DATE=16
val SCE_FS_STRINGEOL=17 val SCE_FS_STRINGEOL=17
val SCE_FS_CONSTANT=18 val SCE_FS_CONSTANT=18
val SCE_FS_ASM=19 val SCE_FS_WORDOPERATOR=19
val SCE_FS_LABEL=20 val SCE_FS_DISABLEDCODE=20
val SCE_FS_ERROR=21 val SCE_FS_DEFAULT_C=21
val SCE_FS_HEXNUMBER=22 val SCE_FS_COMMENTDOC_C=22
val SCE_FS_BINNUMBER=23 val SCE_FS_COMMENTLINEDOC_C=23
val SCE_FS_KEYWORD_C=24
val SCE_FS_KEYWORD2_C=25
val SCE_FS_NUMBER_C=26
val SCE_FS_STRING_C=27
val SCE_FS_PREPROCESSOR_C=28
val SCE_FS_OPERATOR_C=29
val SCE_FS_IDENTIFIER_C=30
val SCE_FS_STRINGEOL_C=31
# Lexical states for SCLEX_CSOUND # Lexical states for SCLEX_CSOUND
lex Csound=SCLEX_CSOUND SCE_CSOUND_ lex Csound=SCLEX_CSOUND SCE_CSOUND_
val SCE_CSOUND_DEFAULT=0 val SCE_CSOUND_DEFAULT=0
@ -3376,7 +3448,6 @@ val SCE_INNO_KEYWORD=2
val SCE_INNO_PARAMETER=3 val SCE_INNO_PARAMETER=3
val SCE_INNO_SECTION=4 val SCE_INNO_SECTION=4
val SCE_INNO_PREPROC=5 val SCE_INNO_PREPROC=5
val SCE_INNO_PREPROC_INLINE=6
val SCE_INNO_INLINE_EXPANSION=6 val SCE_INNO_INLINE_EXPANSION=6
val SCE_INNO_COMMENT_PASCAL=7 val SCE_INNO_COMMENT_PASCAL=7
val SCE_INNO_KEYWORD_PASCAL=8 val SCE_INNO_KEYWORD_PASCAL=8
@ -3657,6 +3728,30 @@ val SCE_SML_COMMENT=12
val SCE_SML_COMMENT1=13 val SCE_SML_COMMENT1=13
val SCE_SML_COMMENT2=14 val SCE_SML_COMMENT2=14
val SCE_SML_COMMENT3=15 val SCE_SML_COMMENT3=15
# Lexical state for SCLEX_MARKDOWN
lex Markdown=SCLEX_MARKDOWN SCE_MARKDOWN_
val SCE_MARKDOWN_DEFAULT=0
val SCE_MARKDOWN_LINE_BEGIN=1
val SCE_MARKDOWN_STRONG1=2
val SCE_MARKDOWN_STRONG2=3
val SCE_MARKDOWN_EM1=4
val SCE_MARKDOWN_EM2=5
val SCE_MARKDOWN_HEADER1=6
val SCE_MARKDOWN_HEADER2=7
val SCE_MARKDOWN_HEADER3=8
val SCE_MARKDOWN_HEADER4=9
val SCE_MARKDOWN_HEADER5=10
val SCE_MARKDOWN_HEADER6=11
val SCE_MARKDOWN_PRECHAR=12
val SCE_MARKDOWN_ULIST_ITEM=13
val SCE_MARKDOWN_OLIST_ITEM=14
val SCE_MARKDOWN_BLOCKQUOTE=15
val SCE_MARKDOWN_STRIKEOUT=16
val SCE_MARKDOWN_HRULE=17
val SCE_MARKDOWN_LINK=18
val SCE_MARKDOWN_CODE=19
val SCE_MARKDOWN_CODE2=20
val SCE_MARKDOWN_CODEBK=21
# Events # Events

View File

@ -9,7 +9,7 @@
#ifndef SCINTILLAWIDGET_H #ifndef SCINTILLAWIDGET_H
#define SCINTILLAWIDGET_H #define SCINTILLAWIDGET_H
#if PLAT_GTK #if defined(GTK)
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
@ -34,21 +34,13 @@ struct _ScintillaClass {
void (* notify) (ScintillaObject *ttt); void (* notify) (ScintillaObject *ttt);
}; };
#if GLIB_MAJOR_VERSION < 2
GtkType scintilla_get_type (void);
#else
GType scintilla_get_type (void); GType scintilla_get_type (void);
#endif
GtkWidget* scintilla_new (void); GtkWidget* scintilla_new (void);
void scintilla_set_id (ScintillaObject *sci, uptr_t id); void scintilla_set_id (ScintillaObject *sci, uptr_t id);
sptr_t scintilla_send_message (ScintillaObject *sci,unsigned int iMessage, uptr_t wParam, sptr_t lParam); sptr_t scintilla_send_message (ScintillaObject *sci,unsigned int iMessage, uptr_t wParam, sptr_t lParam);
void scintilla_release_resources(void); void scintilla_release_resources(void);
#if GTK_MAJOR_VERSION < 2
#define SCINTILLA_NOTIFY "notify"
#else
#define SCINTILLA_NOTIFY "sci-notify" #define SCINTILLA_NOTIFY "sci-notify"
#endif
#ifdef __cplusplus #ifdef __cplusplus
} }

View File

@ -53,7 +53,7 @@ public:
} }
void StartAt(unsigned int start, char chMask=31); void StartAt(unsigned int start, char chMask=31);
void SetFlags(char chFlags_, char chWhile_) {chFlags = chFlags_; chWhile = chWhile_; }; void SetFlags(char chFlags_, char chWhile_) {chFlags = chFlags_; chWhile = chWhile_; }
unsigned int GetStartSegment() { return startSeg; } unsigned int GetStartSegment() { return startSeg; }
void StartSegment(unsigned int pos); void StartSegment(unsigned int pos);
void ColourTo(unsigned int pos, int chAttr); void ColourTo(unsigned int pos, int chAttr);

View File

@ -43,7 +43,7 @@ AutoComplete::~AutoComplete() {
} }
} }
bool AutoComplete::Active() { bool AutoComplete::Active() const {
return active; return active;
} }
@ -82,7 +82,7 @@ void AutoComplete::SetSeparator(char separator_) {
separator = separator_; separator = separator_;
} }
char AutoComplete::GetSeparator() { char AutoComplete::GetSeparator() const {
return separator; return separator;
} }
@ -90,7 +90,7 @@ void AutoComplete::SetTypesep(char separator_) {
typesep = separator_; typesep = separator_;
} }
char AutoComplete::GetTypesep() { char AutoComplete::GetTypesep() const {
return typesep; return typesep;
} }

View File

@ -36,7 +36,7 @@ public:
~AutoComplete(); ~AutoComplete();
/// Is the auto completion list displayed? /// Is the auto completion list displayed?
bool Active(); bool Active() const;
/// Display the auto completion list positioned to be near a character position /// Display the auto completion list positioned to be near a character position
void Start(Window &parent, int ctrlID, int position, Point location, void Start(Window &parent, int ctrlID, int position, Point location,
@ -52,11 +52,11 @@ public:
/// The separator character is used when interpreting the list in SetList /// The separator character is used when interpreting the list in SetList
void SetSeparator(char separator_); void SetSeparator(char separator_);
char GetSeparator(); char GetSeparator() const;
/// The typesep character is used for seperating the word from the type /// The typesep character is used for seperating the word from the type
void SetTypesep(char separator_); void SetTypesep(char separator_);
char GetTypesep(); char GetTypesep() const;
/// The list string contains a sequence of words separated by the separator character /// The list string contains a sequence of words separated by the separator character
void SetList(const char *list); void SetList(const char *list);

View File

@ -68,7 +68,7 @@ static bool IsArrowCharacter(char ch) {
} }
// We ignore tabs unless a tab width has been set. // We ignore tabs unless a tab width has been set.
bool CallTip::IsTabCharacter(char ch) { bool CallTip::IsTabCharacter(char ch) const {
return (tabSize > 0) && (ch == '\t'); return (tabSize > 0) && (ch == '\t');
} }
@ -95,7 +95,7 @@ void CallTip::DrawChunk(Surface *surface, int &x, const char *s,
int maxEnd = 0; int maxEnd = 0;
const int numEnds = 10; const int numEnds = 10;
int ends[numEnds + 2]; int ends[numEnds + 2];
for (int i=0;i<len;i++) { for (int i=0; i<len; i++) {
if ((maxEnd < numEnds) && if ((maxEnd < numEnds) &&
(IsArrowCharacter(s[i]) || IsTabCharacter(s[i])) ) { (IsArrowCharacter(s[i]) || IsTabCharacter(s[i])) ) {
if (i > 0) if (i > 0)
@ -254,7 +254,6 @@ PRectangle CallTip::CallTipStart(int pos, Point pt, const char *defn,
const char *faceName, int size, const char *faceName, int size,
int codePage_, int characterSet, Window &wParent) { int codePage_, int characterSet, Window &wParent) {
clickPlace = 0; clickPlace = 0;
if (val)
delete []val; delete []val;
val = 0; val = 0;
val = new char[strlen(defn) + 1]; val = new char[strlen(defn) + 1];

View File

@ -27,13 +27,13 @@ class CallTip {
bool useStyleCallTip; // if true, STYLE_CALLTIP should be used bool useStyleCallTip; // if true, STYLE_CALLTIP should be used
// Private so CallTip objects can not be copied // Private so CallTip objects can not be copied
CallTip(const CallTip &) {} CallTip(const CallTip &);
CallTip &operator=(const CallTip &) { return *this; } CallTip &operator=(const CallTip &);
void DrawChunk(Surface *surface, int &x, const char *s, void DrawChunk(Surface *surface, int &x, const char *s,
int posStart, int posEnd, int ytext, PRectangle rcClient, int posStart, int posEnd, int ytext, PRectangle rcClient,
bool highlight, bool draw); bool highlight, bool draw);
int PaintContents(Surface *surfaceWindow, bool draw); int PaintContents(Surface *surfaceWindow, bool draw);
bool IsTabCharacter(char c); bool IsTabCharacter(char c) const;
int NextTabPos(int x); int NextTabPos(int x);
public: public:

View File

@ -44,9 +44,11 @@ void LineVector::InsertText(int line, int delta) {
starts.InsertText(line, delta); starts.InsertText(line, delta);
} }
void LineVector::InsertLine(int line, int position) { void LineVector::InsertLine(int line, int position, bool lineStart) {
starts.InsertPartition(line, position); starts.InsertPartition(line, position);
if (perLine) { if (perLine) {
if ((line > 0) && lineStart)
line--;
perLine->InsertLine(line); perLine->InsertLine(line);
} }
} }
@ -71,6 +73,7 @@ Action::Action() {
position = 0; position = 0;
data = 0; data = 0;
lenData = 0; lenData = 0;
mayCoalesce = false;
} }
Action::~Action() { Action::~Action() {
@ -196,7 +199,7 @@ void UndoHistory::AppendAction(actionType at, int position, char *data, int leng
// Insertions must be immediately after to coalesce // Insertions must be immediately after to coalesce
currentAction++; currentAction++;
} else if (at == removeAction) { } else if (at == removeAction) {
if ((lengthData == 1) || (lengthData == 2)){ if ((lengthData == 1) || (lengthData == 2)) {
if ((position + lengthData) == actPrevious->position) { if ((position + lengthData) == actPrevious->position) {
; // Backspace -> OK ; // Backspace -> OK
} else if (position == actPrevious->position) { } else if (position == actPrevious->position) {
@ -338,7 +341,7 @@ char CellBuffer::CharAt(int position) const {
return substance.ValueAt(position); return substance.ValueAt(position);
} }
void CellBuffer::GetCharRange(char *buffer, int position, int lengthRetrieve) { void CellBuffer::GetCharRange(char *buffer, int position, int lengthRetrieve) const {
if (lengthRetrieve < 0) if (lengthRetrieve < 0)
return; return;
if (position < 0) if (position < 0)
@ -354,7 +357,7 @@ void CellBuffer::GetCharRange(char *buffer, int position, int lengthRetrieve) {
} }
} }
char CellBuffer::StyleAt(int position) { char CellBuffer::StyleAt(int position) const {
return style.ValueAt(position); return style.ValueAt(position);
} }
@ -454,7 +457,7 @@ int CellBuffer::LineStart(int line) const {
return lv.LineStart(line); return lv.LineStart(line);
} }
bool CellBuffer::IsReadOnly() { bool CellBuffer::IsReadOnly() const {
return readOnly; return readOnly;
} }
@ -472,8 +475,8 @@ bool CellBuffer::IsSavePoint() {
// Without undo // Without undo
void CellBuffer::InsertLine(int line, int position) { void CellBuffer::InsertLine(int line, int position, bool lineStart) {
lv.InsertLine(line, position); lv.InsertLine(line, position, lineStart);
} }
void CellBuffer::RemoveLine(int line) { void CellBuffer::RemoveLine(int line) {
@ -489,27 +492,28 @@ void CellBuffer::BasicInsertString(int position, const char *s, int insertLength
style.InsertValue(position, insertLength, 0); style.InsertValue(position, insertLength, 0);
int lineInsert = lv.LineFromPosition(position) + 1; int lineInsert = lv.LineFromPosition(position) + 1;
bool atLineStart = lv.LineStart(lineInsert-1) == position;
// Point all the lines after the insertion point further along in the buffer // Point all the lines after the insertion point further along in the buffer
lv.InsertText(lineInsert-1, insertLength); lv.InsertText(lineInsert-1, insertLength);
char chPrev = substance.ValueAt(position - 1); char chPrev = substance.ValueAt(position - 1);
char chAfter = substance.ValueAt(position + insertLength); char chAfter = substance.ValueAt(position + insertLength);
if (chPrev == '\r' && chAfter == '\n') { if (chPrev == '\r' && chAfter == '\n') {
// Splitting up a crlf pair at position // Splitting up a crlf pair at position
InsertLine(lineInsert, position); InsertLine(lineInsert, position, false);
lineInsert++; lineInsert++;
} }
char ch = ' '; char ch = ' ';
for (int i = 0; i < insertLength; i++) { for (int i = 0; i < insertLength; i++) {
ch = s[i]; ch = s[i];
if (ch == '\r') { if (ch == '\r') {
InsertLine(lineInsert, (position + i) + 1); InsertLine(lineInsert, (position + i) + 1, atLineStart);
lineInsert++; lineInsert++;
} else if (ch == '\n') { } else if (ch == '\n') {
if (chPrev == '\r') { if (chPrev == '\r') {
// Patch up what was end of line // Patch up what was end of line
lv.SetLineStart(lineInsert - 1, (position + i) + 1); lv.SetLineStart(lineInsert - 1, (position + i) + 1);
} else { } else {
InsertLine(lineInsert, (position + i) + 1); InsertLine(lineInsert, (position + i) + 1, atLineStart);
lineInsert++; lineInsert++;
} }
} }
@ -585,7 +589,7 @@ bool CellBuffer::SetUndoCollection(bool collectUndo) {
return collectingUndo; return collectingUndo;
} }
bool CellBuffer::IsCollectingUndo() { bool CellBuffer::IsCollectingUndo() const {
return collectingUndo; return collectingUndo;
} }

View File

@ -37,7 +37,7 @@ public:
void SetPerLine(PerLine *pl); void SetPerLine(PerLine *pl);
void InsertText(int line, int delta); void InsertText(int line, int delta);
void InsertLine(int line, int position); void InsertLine(int line, int position, bool lineStart);
void SetLineStart(int line, int position); void SetLineStart(int line, int position);
void RemoveLine(int line); void RemoveLine(int line);
int Lines() const { int Lines() const {
@ -149,8 +149,8 @@ public:
/// Retrieving positions outside the range of the buffer works and returns 0 /// Retrieving positions outside the range of the buffer works and returns 0
char CharAt(int position) const; char CharAt(int position) const;
void GetCharRange(char *buffer, int position, int lengthRetrieve); void GetCharRange(char *buffer, int position, int lengthRetrieve) const;
char StyleAt(int position); char StyleAt(int position) const;
const char *BufferPointer(); const char *BufferPointer();
int Length() const; int Length() const;
@ -159,7 +159,7 @@ public:
int Lines() const; int Lines() const;
int LineStart(int line) const; int LineStart(int line) const;
int LineFromPosition(int pos) const { return lv.LineFromPosition(pos); } int LineFromPosition(int pos) const { return lv.LineFromPosition(pos); }
void InsertLine(int line, int position); void InsertLine(int line, int position, bool lineStart);
void RemoveLine(int line); void RemoveLine(int line);
const char *InsertString(int position, const char *s, int insertLength, bool &startSequence); const char *InsertString(int position, const char *s, int insertLength, bool &startSequence);
@ -170,7 +170,7 @@ public:
const char *DeleteChars(int position, int deleteLength, bool &startSequence); const char *DeleteChars(int position, int deleteLength, bool &startSequence);
bool IsReadOnly(); bool IsReadOnly() const;
void SetReadOnly(bool set); void SetReadOnly(bool set);
/// The save point is a marker in the undo stack where the container has stated that /// The save point is a marker in the undo stack where the container has stated that
@ -183,7 +183,7 @@ public:
void BasicDeleteChars(int position, int deleteLength); void BasicDeleteChars(int position, int deleteLength);
bool SetUndoCollection(bool collectUndo); bool SetUndoCollection(bool collectUndo);
bool IsCollectingUndo(); bool IsCollectingUndo() const;
void BeginUndoAction(); void BeginUndoAction();
void EndUndoAction(); void EndUndoAction();
void AddUndoAction(int token, bool mayCoalesce); void AddUndoAction(int token, bool mayCoalesce);

View File

@ -53,6 +53,7 @@ public:
} }
bool Contains(int val) const { bool Contains(int val) const {
PLATFORM_ASSERT(val >= 0); PLATFORM_ASSERT(val >= 0);
if (val < 0) return false;
return (val < size) ? bset[val] : valueAfter; return (val < size) ? bset[val] : valueAfter;
} }
}; };

View File

@ -232,11 +232,11 @@ void ContractionState::ShowAll() {
void ContractionState::Check() const { void ContractionState::Check() const {
#ifdef CHECK_CORRECTNESS #ifdef CHECK_CORRECTNESS
for (int vline = 0;vline < LinesDisplayed(); vline++) { for (int vline = 0; vline < LinesDisplayed(); vline++) {
const int lineDoc = DocFromDisplay(vline); const int lineDoc = DocFromDisplay(vline);
PLATFORM_ASSERT(GetVisible(lineDoc)); PLATFORM_ASSERT(GetVisible(lineDoc));
} }
for (int lineDoc = 0;lineDoc < LinesInDoc(); lineDoc++) { for (int lineDoc = 0; lineDoc < LinesInDoc(); lineDoc++) {
const int displayThis = DisplayFromDoc(lineDoc); const int displayThis = DisplayFromDoc(lineDoc);
const int displayNext = DisplayFromDoc(lineDoc + 1); const int displayNext = DisplayFromDoc(lineDoc + 1);
const int height = displayNext - displayThis; const int height = displayNext - displayThis;

View File

@ -40,10 +40,10 @@ public:
~DecorationList(); ~DecorationList();
void SetCurrentIndicator(int indicator); void SetCurrentIndicator(int indicator);
int GetCurrentIndicator() { return currentIndicator; } int GetCurrentIndicator() const { return currentIndicator; }
void SetCurrentValue(int value); void SetCurrentValue(int value);
int GetCurrentValue() { return currentValue; } int GetCurrentValue() const { return currentValue; }
// Returns true if some values may have changed // Returns true if some values may have changed
bool FillRange(int &position, int value, int &fillLength); bool FillRange(int &position, int value, int &fillLength);

View File

@ -10,6 +10,17 @@
#include <stdio.h> #include <stdio.h>
#include <ctype.h> #include <ctype.h>
#include <string>
#include <vector>
// With Borland C++ 5.5, including <string> includes Windows.h leading to defining
// FindText to FindTextA which makes calls here to Document::FindText fail.
#ifdef __BORLANDC__
#ifdef FindText
#undef FindText
#endif
#endif
#include "Platform.h" #include "Platform.h"
#include "Scintilla.h" #include "Scintilla.h"
@ -22,103 +33,12 @@
#include "Decoration.h" #include "Decoration.h"
#include "Document.h" #include "Document.h"
#include "RESearch.h" #include "RESearch.h"
#include "UniConversion.h"
#ifdef SCI_NAMESPACE #ifdef SCI_NAMESPACE
using namespace Scintilla; using namespace Scintilla;
#endif #endif
//Vitaliy
#include "UniConversion.h"
#include <windows.h>
#ifdef FindText
#undef FindText
#define FindText FindText
#endif
// Win32 only !!!
static bool IsMustDie9x(void)
{
OSVERSIONINFO osver;
osver.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
if ( GetVersionEx( &osver ) )
{
if ( (osver.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS) &&
(osver.dwMajorVersion == 4) )
{
//MessageBox(NULL, "MustDie9x == true", "Test", MB_OK);
return true;
}
}
//MessageBox(NULL, "MustDie9x == false", "Test", MB_OK);
return false;
}
static inline void Platform_MakeUpperW(wchar_t* wstr, unsigned int len) {
// TODO: Add platform-specific function here
// Win32 example:
static bool bIsMustDie9x = IsMustDie9x();
if ( !bIsMustDie9x )
{
::CharUpperW(wstr);
}
else
{
char* str = new char[len + 1];
if ( str )
{
::WideCharToMultiByte(CP_ACP, 0, wstr, len, str, len, NULL, NULL);
str[len] = 0;
::CharUpperA(str);
::MultiByteToWideChar(CP_ACP, 0, str, len, wstr, len);
wstr[len] = 0;
delete [] str;
}
}
}
static inline char Platform_MakeUpperCharA(const char ch) {
// TODO: Add platform-specific function here
// Win32 example:
char str[2] = {ch, 0};
::CharUpperA(str);
return str[0];
}
static inline char Platform_MakeLowerCharA(const char ch) {
// TODO: Add platform-specific function here
// Win32 example:
char str[2] = {ch, 0};
::CharLowerA(str);
return str[0];
}
// NOTE: this function is called for non-Unicode characters only!
// ( i.e. when (!dbcsCodePage || isascii(ch)) )
static inline char MakeUpperCaseA(char ch) {
if (ch >= 'A' && ch <= 'Z')
return ch;
else if (ch >= 'a' && ch <= 'z')
return static_cast<char>(ch - 'a' + 'A');
else
return Platform_MakeUpperCharA(ch);
}
// NOTE: this function is called for non-Unicode characters only!
// ( i.e. when (!dbcsCodePage || isascii(ch)) )
static inline char MakeLowerCaseA(char ch) {
if (ch >= 'a' && ch <= 'z')
return ch;
else if (ch >= 'A' && ch <= 'Z')
return static_cast<char>(ch - 'A' + 'a');
else
return Platform_MakeLowerCharA(ch);
}
// yilatiV
// This is ASCII specific but is safe with chars >= 0x80 // This is ASCII specific but is safe with chars >= 0x80
static inline bool isspacechar(unsigned char ch) { static inline bool isspacechar(unsigned char ch) {
return (ch == ' ') || ((ch >= 0x09) && (ch <= 0x0d)); return (ch == ' ') || ((ch >= 0x09) && (ch <= 0x0d));
@ -233,12 +153,12 @@ void Document::SetSavePoint() {
} }
int Document::GetMark(int line) { int Document::GetMark(int line) {
return static_cast<LineMarkers*>(perLineData[ldMarkers])->MarkValue(line); return static_cast<LineMarkers *>(perLineData[ldMarkers])->MarkValue(line);
} }
int Document::AddMark(int line, int markerNum) { int Document::AddMark(int line, int markerNum) {
if (line <= LinesTotal()) { if (line <= LinesTotal()) {
int prev = static_cast<LineMarkers*>(perLineData[ldMarkers])-> int prev = static_cast<LineMarkers *>(perLineData[ldMarkers])->
AddMark(line, markerNum, LinesTotal()); AddMark(line, markerNum, LinesTotal());
DocModification mh(SC_MOD_CHANGEMARKER, LineStart(line), 0, 0, 0, line); DocModification mh(SC_MOD_CHANGEMARKER, LineStart(line), 0, 0, 0, line);
NotifyModified(mh); NotifyModified(mh);
@ -252,20 +172,20 @@ void Document::AddMarkSet(int line, int valueSet) {
unsigned int m = valueSet; unsigned int m = valueSet;
for (int i = 0; m; i++, m >>= 1) for (int i = 0; m; i++, m >>= 1)
if (m & 1) if (m & 1)
static_cast<LineMarkers*>(perLineData[ldMarkers])-> static_cast<LineMarkers *>(perLineData[ldMarkers])->
AddMark(line, i, LinesTotal()); AddMark(line, i, LinesTotal());
DocModification mh(SC_MOD_CHANGEMARKER, LineStart(line), 0, 0, 0, line); DocModification mh(SC_MOD_CHANGEMARKER, LineStart(line), 0, 0, 0, line);
NotifyModified(mh); NotifyModified(mh);
} }
void Document::DeleteMark(int line, int markerNum) { void Document::DeleteMark(int line, int markerNum) {
static_cast<LineMarkers*>(perLineData[ldMarkers])->DeleteMark(line, markerNum, false); static_cast<LineMarkers *>(perLineData[ldMarkers])->DeleteMark(line, markerNum, false);
DocModification mh(SC_MOD_CHANGEMARKER, LineStart(line), 0, 0, 0, line); DocModification mh(SC_MOD_CHANGEMARKER, LineStart(line), 0, 0, 0, line);
NotifyModified(mh); NotifyModified(mh);
} }
void Document::DeleteMarkFromHandle(int markerHandle) { void Document::DeleteMarkFromHandle(int markerHandle) {
static_cast<LineMarkers*>(perLineData[ldMarkers])->DeleteMarkFromHandle(markerHandle); static_cast<LineMarkers *>(perLineData[ldMarkers])->DeleteMarkFromHandle(markerHandle);
DocModification mh(SC_MOD_CHANGEMARKER, 0, 0, 0, 0); DocModification mh(SC_MOD_CHANGEMARKER, 0, 0, 0, 0);
mh.line = -1; mh.line = -1;
NotifyModified(mh); NotifyModified(mh);
@ -273,7 +193,7 @@ void Document::DeleteMarkFromHandle(int markerHandle) {
void Document::DeleteAllMarks(int markerNum) { void Document::DeleteAllMarks(int markerNum) {
for (int line = 0; line < LinesTotal(); line++) { for (int line = 0; line < LinesTotal(); line++) {
static_cast<LineMarkers*>(perLineData[ldMarkers])->DeleteMark(line, markerNum, true); static_cast<LineMarkers *>(perLineData[ldMarkers])->DeleteMark(line, markerNum, true);
} }
DocModification mh(SC_MOD_CHANGEMARKER, 0, 0, 0, 0); DocModification mh(SC_MOD_CHANGEMARKER, 0, 0, 0, 0);
mh.line = -1; mh.line = -1;
@ -281,7 +201,7 @@ void Document::DeleteAllMarks(int markerNum) {
} }
int Document::LineFromHandle(int markerHandle) { int Document::LineFromHandle(int markerHandle) {
return static_cast<LineMarkers*>(perLineData[ldMarkers])->LineFromHandle(markerHandle); return static_cast<LineMarkers *>(perLineData[ldMarkers])->LineFromHandle(markerHandle);
} }
int Document::LineStart(int line) const { int Document::LineStart(int line) const {
@ -318,7 +238,7 @@ int Document::VCHomePosition(int position) const {
int startPosition = LineStart(line); int startPosition = LineStart(line);
int endLine = LineEnd(line); int endLine = LineEnd(line);
int startText = startPosition; int startText = startPosition;
while (startText < endLine && (cb.CharAt(startText) == ' ' || cb.CharAt(startText) == '\t' ) ) while (startText < endLine && (cb.CharAt(startText) == ' ' || cb.CharAt(startText) == '\t'))
startText++; startText++;
if (position == startText) if (position == startText)
return startPosition; return startPosition;
@ -327,7 +247,7 @@ int Document::VCHomePosition(int position) const {
} }
int Document::SetLevel(int line, int level) { int Document::SetLevel(int line, int level) {
int prev = static_cast<LineLevels*>(perLineData[ldLevels])->SetLevel(line, level, LinesTotal()); int prev = static_cast<LineLevels *>(perLineData[ldLevels])->SetLevel(line, level, LinesTotal());
if (prev != level) { if (prev != level) {
DocModification mh(SC_MOD_CHANGEFOLD | SC_MOD_CHANGEMARKER, DocModification mh(SC_MOD_CHANGEFOLD | SC_MOD_CHANGEMARKER,
LineStart(line), 0, 0, 0, line); LineStart(line), 0, 0, 0, line);
@ -338,12 +258,12 @@ int Document::SetLevel(int line, int level) {
return prev; return prev;
} }
int Document::GetLevel(int line) { int Document::GetLevel(int line) const {
return static_cast<LineLevels*>(perLineData[ldLevels])->GetLevel(line); return static_cast<LineLevels *>(perLineData[ldLevels])->GetLevel(line);
} }
void Document::ClearLevels() { void Document::ClearLevels() {
static_cast<LineLevels*>(perLineData[ldLevels])->ClearLevels(); static_cast<LineLevels *>(perLineData[ldLevels])->ClearLevels();
} }
static bool IsSubordinate(int levelStart, int levelTry) { static bool IsSubordinate(int levelStart, int levelTry) {
@ -529,7 +449,7 @@ int Document::MovePositionOutsideChar(int pos, int moveDir, bool checkLineEnd) {
while (posCheck < pos) { while (posCheck < pos) {
char mbstr[maxBytesInDBCSCharacter+1]; char mbstr[maxBytesInDBCSCharacter+1];
int i; int i;
for(i=0;i<Platform::DBCSCharMaxLength();i++) { for (i=0; i<Platform::DBCSCharMaxLength(); i++) {
mbstr[i] = cb.CharAt(posCheck+i); mbstr[i] = cb.CharAt(posCheck+i);
} }
mbstr[i] = '\0'; mbstr[i] = '\0';
@ -831,7 +751,7 @@ int Document::GetLineIndentation(int line) {
if ((line >= 0) && (line < LinesTotal())) { if ((line >= 0) && (line < LinesTotal())) {
int lineStart = LineStart(line); int lineStart = LineStart(line);
int length = Length(); int length = Length();
for (int i = lineStart;i < length;i++) { for (int i = lineStart; i < length; i++) {
char ch = cb.CharAt(i); char ch = cb.CharAt(i);
if (ch == ' ') if (ch == ' ')
indent++; indent++;
@ -874,7 +794,7 @@ int Document::GetColumn(int pos) {
int column = 0; int column = 0;
int line = LineFromPosition(pos); int line = LineFromPosition(pos);
if ((line >= 0) && (line < LinesTotal())) { if ((line >= 0) && (line < LinesTotal())) {
for (int i = LineStart(line);i < pos;) { for (int i = LineStart(line); i < pos;) {
char ch = cb.CharAt(i); char ch = cb.CharAt(i);
if (ch == '\t') { if (ch == '\t') {
column = NextTab(column, tabInChars); column = NextTab(column, tabInChars);
@ -896,8 +816,8 @@ int Document::GetColumn(int pos) {
int Document::FindColumn(int line, int column) { int Document::FindColumn(int line, int column) {
int position = LineStart(line); int position = LineStart(line);
int columnCurrent = 0;
if ((line >= 0) && (line < LinesTotal())) { if ((line >= 0) && (line < LinesTotal())) {
int columnCurrent = 0;
while ((columnCurrent < column) && (position < Length())) { while ((columnCurrent < column) && (position < Length())) {
char ch = cb.CharAt(position); char ch = cb.CharAt(position);
if (ch == '\t') { if (ch == '\t') {
@ -1061,7 +981,7 @@ int Document::ExtendWordSelect(int pos, int delta, bool onlyWordCharacters) {
while (pos < (Length()) && (WordCharClass(cb.CharAt(pos)) == ccStart)) while (pos < (Length()) && (WordCharClass(cb.CharAt(pos)) == ccStart))
pos++; pos++;
} }
return MovePositionOutsideChar(pos, delta); return MovePositionOutsideChar(pos, delta, true);
} }
/** /**
@ -1166,157 +1086,172 @@ static inline char MakeLowerCase(char ch) {
return static_cast<char>(ch - 'A' + 'a'); return static_cast<char>(ch - 'A' + 'a');
} }
static bool GoodTrailByte(int v) {
return (v >= 0x80) && (v < 0xc0);
}
size_t Document::ExtractChar(int pos, char *bytes) {
unsigned char ch = static_cast<unsigned char>(cb.CharAt(pos));
size_t widthChar = UTF8CharLength(ch);
bytes[0] = ch;
for (size_t i=1; i<widthChar; i++) {
bytes[i] = cb.CharAt(pos+i);
if (!GoodTrailByte(static_cast<unsigned char>(bytes[i]))) { // Bad byte
widthChar = 1;
}
}
return widthChar;
}
CaseFolderTable::CaseFolderTable() {
for (size_t iChar=0; iChar<sizeof(mapping); iChar++) {
mapping[iChar] = static_cast<char>(iChar);
}
}
CaseFolderTable::~CaseFolderTable() {
}
size_t CaseFolderTable::Fold(char *folded, size_t sizeFolded, const char *mixed, size_t lenMixed) {
if (lenMixed > sizeFolded) {
return 0;
} else {
for (size_t i=0; i<lenMixed; i++) {
folded[i] = mapping[static_cast<unsigned char>(mixed[i])];
}
return lenMixed;
}
}
void CaseFolderTable::SetTranslation(char ch, char chTranslation) {
mapping[static_cast<unsigned char>(ch)] = chTranslation;
}
void CaseFolderTable::StandardASCII() {
for (size_t iChar=0; iChar<sizeof(mapping); iChar++) {
if (iChar >= 'A' && iChar <= 'Z') {
mapping[iChar] = static_cast<char>(iChar - 'A' + 'a');
} else {
mapping[iChar] = static_cast<char>(iChar);
}
}
}
bool Document::MatchesWordOptions(bool word, bool wordStart, int pos, int length) {
return (!word && !wordStart) ||
(word && IsWordAt(pos, pos + length)) ||
(wordStart && IsWordStartAt(pos));
}
/** /**
* Find text in document, supporting both forward and backward * Find text in document, supporting both forward and backward
* searches (just pass minPos > maxPos to do a backward search) * searches (just pass minPos > maxPos to do a backward search)
* Has not been tested with backwards DBCS searches yet. * Has not been tested with backwards DBCS searches yet.
*/ */
long Document::FindText(int minPos, int maxPos, const char *s, long Document::FindText(int minPos, int maxPos, const char *search,
bool caseSensitive, bool word, bool wordStart, bool regExp, int flags, bool caseSensitive, bool word, bool wordStart, bool regExp, int flags,
int *length) { int *length, CaseFolder *pcf) {
if (regExp) { if (regExp) {
if (!regex) if (!regex)
regex = CreateRegexSearch(&charClass); regex = CreateRegexSearch(&charClass);
return regex->FindText(this, minPos, maxPos, s, caseSensitive, word, wordStart, flags, length); return regex->FindText(this, minPos, maxPos, search, caseSensitive, word, wordStart, flags, length);
} else { } else {
bool forward = minPos <= maxPos; const bool forward = minPos <= maxPos;
int increment = forward ? 1 : -1; const int increment = forward ? 1 : -1;
// Range endpoints should not be inside DBCS characters, but just in case, move them. // Range endpoints should not be inside DBCS characters, but just in case, move them.
int startPos = MovePositionOutsideChar(minPos, increment, false); const int startPos = MovePositionOutsideChar(minPos, increment, false);
int endPos = MovePositionOutsideChar(maxPos, increment, false); const int endPos = MovePositionOutsideChar(maxPos, increment, false);
// Compute actual search ranges needed // Compute actual search ranges needed
int lengthFind = *length; const int lengthFind = (*length == -1) ? static_cast<int>(strlen(search)) : *length;
if (lengthFind == -1) const int endSearch = (startPos <= endPos) ? endPos - lengthFind + 1 : endPos;
lengthFind = static_cast<int>(strlen(s));
int endSearch = endPos;
if (startPos <= endPos) {
endSearch = endPos - lengthFind + 1;
}
//Platform::DebugPrintf("Find %d %d %s %d\n", startPos, endPos, ft->lpstrText, lengthFind); //Platform::DebugPrintf("Find %d %d %s %d\n", startPos, endPos, ft->lpstrText, lengthFind);
const int limitPos = Platform::Maximum(startPos, endPos);
// >>> Added by DV
wchar_t* ws_upr = NULL; // string we are searching for in UCS-2
wchar_t temp_ws[4]; // buffer for current character in UCS-2
char temp_s[8]; // buffer for current character in UTF-8
int ws_len = 0;
if (dbcsCodePage == SC_CP_UTF8 && !caseSensitive)
{
ws_len = (int) UTF16Length(s, lengthFind);
if (ws_len != lengthFind) {
const int ws_size = ws_len + 2;
ws_upr = new wchar_t[ws_size];
if (ws_upr) {
UTF16FromUTF8(s, lengthFind, ws_upr, ws_size - 1);
ws_upr[ws_len] = 0;
Platform_MakeUpperW(ws_upr, ws_len);
// now ws_upr is UCS-2 representation of s in upper-case
}
}
// else we are searching for Latin characters
// i.e. no special processing required
}
// <<< Added by DV
char firstChar = s[0];
if (!caseSensitive)
firstChar = static_cast<char>(MakeUpperCaseA(firstChar));
int pos = forward ? startPos : (startPos - 1); int pos = forward ? startPos : (startPos - 1);
while (forward ? (pos < endSearch) : (pos >= endSearch)) {
char ch = CharAt(pos);
if (caseSensitive) { if (caseSensitive) {
if (ch == firstChar) { while (forward ? (pos < endSearch) : (pos >= endSearch)) {
bool found = true; bool found = (pos + lengthFind) <= limitPos;
if (pos + lengthFind > Platform::Maximum(startPos, endPos)) found = false; for (int indexSearch = 0; (indexSearch < lengthFind) && found; indexSearch++) {
for (int posMatch = 1; posMatch < lengthFind && found; posMatch++) { found = CharAt(pos + indexSearch) == search[indexSearch];
ch = CharAt(pos + posMatch);
if (ch != s[posMatch])
found = false;
} }
if (found) { if (found && MatchesWordOptions(word, wordStart, pos, lengthFind)) {
if ((!word && !wordStart) || return pos;
(word && IsWordAt(pos, pos + lengthFind)) || }
(wordStart && IsWordStartAt(pos))) pos += increment;
if (dbcsCodePage && (pos >= 0)) {
// Have to use >= 0 as otherwise next statement would change
// -1 to 0 and make loop infinite.
// Ensure trying to match from start of character
pos = MovePositionOutsideChar(pos, increment, false);
}
}
} else if (SC_CP_UTF8 == dbcsCodePage) {
const size_t maxBytesCharacter = 4;
const size_t maxFoldingExpansion = 4;
std::vector<char> searchThing(lengthFind * maxBytesCharacter * maxFoldingExpansion + 1);
const int lenSearch = pcf->Fold(&searchThing[0], searchThing.size(), search, lengthFind);
while (forward ? (pos < endSearch) : (pos >= endSearch)) {
int widthFirstCharacter = 0;
int indexDocument = 0;
int indexSearch = 0;
bool characterMatches = true;
while (characterMatches &&
((pos + indexDocument) < limitPos) &&
(indexSearch < lenSearch)) {
char bytes[maxBytesCharacter + 1];
bytes[maxBytesCharacter] = 0;
const int widthChar = ExtractChar(pos + indexDocument, bytes);
if (!widthFirstCharacter)
widthFirstCharacter = widthChar;
char folded[maxBytesCharacter * maxFoldingExpansion + 1];
const int lenFlat = pcf->Fold(folded, sizeof(folded), bytes, widthChar);
folded[lenFlat] = 0;
// Does folded match the buffer
characterMatches = 0 == memcmp(folded, &searchThing[0] + indexSearch, lenFlat);
indexDocument += widthChar;
indexSearch += lenFlat;
}
if (characterMatches && (indexSearch == static_cast<int>(lenSearch))) {
if (MatchesWordOptions(word, wordStart, pos, indexDocument)) {
*length = indexDocument;
return pos; return pos;
} }
} }
if (forward) {
pos += widthFirstCharacter;
} else {
pos--;
if (pos > 0) {
// Ensure trying to match from start of character
pos = MovePositionOutsideChar(pos, increment, false);
} }
// >>> Added by DV
else if (ws_upr) {
const int maxPos = Platform::Maximum(startPos, endPos);
int charPos = pos;
int ws_len_checked = 0;
while (ws_len_checked < ws_len) {
// LenChar returns 2 for "\r\n"
// this is wrong for UTF8 because "\r\n"
// is not one character with length=2
const int charLen = IsCrLf(charPos) ? 1 : LenChar(charPos);
if (charPos + charLen > maxPos)
break;
// current UTF-8 character
for (int i = 0; i < charLen; i++) {
temp_s[i] = CharAt(charPos + i);
} }
temp_s[charLen] = 0;
// current character as UCS-2
const unsigned int uLen = UTF16FromUTF8(temp_s, charLen, temp_ws, 3);
temp_ws[uLen] = 0; // uLen can be 1 (ordinary) or 2 (surrogate)
// upper case
Platform_MakeUpperW(temp_ws, uLen);
if ((temp_ws[0] == ws_upr[ws_len_checked]) &&
(uLen == 1 || temp_ws[1] == ws_upr[ws_len_checked+1])) {
ws_len_checked += uLen;
charPos += charLen; // go to next character
} else
break;
} }
if (ws_len_checked == ws_len) { } else {
if ((!word && !wordStart) || CaseFolderTable caseFolder;
(word && IsWordAt(pos, pos + lengthFind)) || std::vector<char> searchThing(lengthFind + 1);
(wordStart && IsWordStartAt(pos))) { pcf->Fold(&searchThing[0], searchThing.size(), search, lengthFind);
delete [] ws_upr; while (forward ? (pos < endSearch) : (pos >= endSearch)) {
bool found = (pos + lengthFind) <= limitPos;
for (int indexSearch = 0; (indexSearch < lengthFind) && found; indexSearch++) {
char ch = CharAt(pos + indexSearch);
char folded[2];
pcf->Fold(folded, sizeof(folded), &ch, 1);
found = folded[0] == searchThing[indexSearch];
}
if (found && MatchesWordOptions(word, wordStart, pos, lengthFind)) {
return pos; return pos;
} }
}
}
// <<< Added by DV
else {
if (MakeUpperCaseA(ch) == firstChar) {
bool found = true;
if (pos + lengthFind > Platform::Maximum(startPos, endPos)) found = false;
for (int posMatch = 1; posMatch < lengthFind && found; posMatch++) {
ch = CharAt(pos + posMatch);
if (MakeUpperCaseA(ch) != MakeUpperCaseA(s[posMatch]))
found = false;
}
if (found) {
if ((!word && !wordStart) ||
(word && IsWordAt(pos, pos + lengthFind)) ||
(wordStart && IsWordStartAt(pos)))
return pos;
}
}
}
pos += increment; pos += increment;
if (dbcsCodePage && (pos >= 0)) { if (dbcsCodePage && (pos >= 0)) {
// Ensure trying to match from start of character // Ensure trying to match from start of character
pos = MovePositionOutsideChar(pos, increment, false); pos = MovePositionOutsideChar(pos, increment, false);
} }
} }
// >>> Added by DV
if (ws_upr) {
delete [] ws_upr;
} }
// <<< Added by DV
} }
//Platform::DebugPrintf("Not found\n"); //Platform::DebugPrintf("Not found\n");
return -1; return -1;
@ -1337,11 +1272,11 @@ void Document::ChangeCase(Range r, bool makeUpperCase) {
char ch = CharAt(pos); char ch = CharAt(pos);
if (makeUpperCase) { if (makeUpperCase) {
if (IsLowerCase(ch)) { if (IsLowerCase(ch)) {
ChangeChar(pos, static_cast<char>(MakeUpperCaseA(ch))); ChangeChar(pos, static_cast<char>(MakeUpperCase(ch)));
} }
} else { } else {
if (IsUpperCase(ch)) { if (IsUpperCase(ch)) {
ChangeChar(pos, static_cast<char>(MakeLowerCaseA(ch))); ChangeChar(pos, static_cast<char>(MakeLowerCase(ch)));
} }
} }
} }
@ -1424,7 +1359,7 @@ void Document::EnsureStyledTo(int pos) {
} }
int Document::SetLineState(int line, int state) { int Document::SetLineState(int line, int state) {
int statePrevious = static_cast<LineState*>(perLineData[ldState])->SetLineState(line, state); int statePrevious = static_cast<LineState *>(perLineData[ldState])->SetLineState(line, state);
if (state != statePrevious) { if (state != statePrevious) {
DocModification mh(SC_MOD_CHANGELINESTATE, 0, 0, 0, 0, line); DocModification mh(SC_MOD_CHANGELINESTATE, 0, 0, 0, 0, line);
NotifyModified(mh); NotifyModified(mh);
@ -1432,59 +1367,59 @@ int Document::SetLineState(int line, int state) {
return statePrevious; return statePrevious;
} }
int Document::GetLineState(int line) { int Document::GetLineState(int line) const {
return static_cast<LineState*>(perLineData[ldState])->GetLineState(line); return static_cast<LineState *>(perLineData[ldState])->GetLineState(line);
} }
int Document::GetMaxLineState() { int Document::GetMaxLineState() {
return static_cast<LineState*>(perLineData[ldState])->GetMaxLineState(); return static_cast<LineState *>(perLineData[ldState])->GetMaxLineState();
} }
StyledText Document::MarginStyledText(int line) { StyledText Document::MarginStyledText(int line) {
LineAnnotation *pla = static_cast<LineAnnotation*>(perLineData[ldMargin]); LineAnnotation *pla = static_cast<LineAnnotation *>(perLineData[ldMargin]);
return StyledText(pla->Length(line), pla->Text(line), return StyledText(pla->Length(line), pla->Text(line),
pla->MultipleStyles(line), pla->Style(line), pla->Styles(line)); pla->MultipleStyles(line), pla->Style(line), pla->Styles(line));
} }
void Document::MarginSetText(int line, const char *text) { void Document::MarginSetText(int line, const char *text) {
static_cast<LineAnnotation*>(perLineData[ldMargin])->SetText(line, text); static_cast<LineAnnotation *>(perLineData[ldMargin])->SetText(line, text);
DocModification mh(SC_MOD_CHANGEMARGIN, LineStart(line), 0, 0, 0, line); DocModification mh(SC_MOD_CHANGEMARGIN, LineStart(line), 0, 0, 0, line);
NotifyModified(mh); NotifyModified(mh);
} }
void Document::MarginSetStyle(int line, int style) { void Document::MarginSetStyle(int line, int style) {
static_cast<LineAnnotation*>(perLineData[ldMargin])->SetStyle(line, style); static_cast<LineAnnotation *>(perLineData[ldMargin])->SetStyle(line, style);
} }
void Document::MarginSetStyles(int line, const unsigned char *styles) { void Document::MarginSetStyles(int line, const unsigned char *styles) {
static_cast<LineAnnotation*>(perLineData[ldMargin])->SetStyles(line, styles); static_cast<LineAnnotation *>(perLineData[ldMargin])->SetStyles(line, styles);
} }
int Document::MarginLength(int line) const { int Document::MarginLength(int line) const {
return static_cast<LineAnnotation*>(perLineData[ldMargin])->Length(line); return static_cast<LineAnnotation *>(perLineData[ldMargin])->Length(line);
} }
void Document::MarginClearAll() { void Document::MarginClearAll() {
int maxEditorLine = LinesTotal(); int maxEditorLine = LinesTotal();
for (int l=0;l<maxEditorLine;l++) for (int l=0; l<maxEditorLine; l++)
MarginSetText(l, 0); MarginSetText(l, 0);
// Free remaining data // Free remaining data
static_cast<LineAnnotation*>(perLineData[ldMargin])->ClearAll(); static_cast<LineAnnotation *>(perLineData[ldMargin])->ClearAll();
} }
bool Document::AnnotationAny() const { bool Document::AnnotationAny() const {
return static_cast<LineAnnotation*>(perLineData[ldAnnotation])->AnySet(); return static_cast<LineAnnotation *>(perLineData[ldAnnotation])->AnySet();
} }
StyledText Document::AnnotationStyledText(int line) { StyledText Document::AnnotationStyledText(int line) {
LineAnnotation *pla = static_cast<LineAnnotation*>(perLineData[ldAnnotation]); LineAnnotation *pla = static_cast<LineAnnotation *>(perLineData[ldAnnotation]);
return StyledText(pla->Length(line), pla->Text(line), return StyledText(pla->Length(line), pla->Text(line),
pla->MultipleStyles(line), pla->Style(line), pla->Styles(line)); pla->MultipleStyles(line), pla->Style(line), pla->Styles(line));
} }
void Document::AnnotationSetText(int line, const char *text) { void Document::AnnotationSetText(int line, const char *text) {
const int linesBefore = AnnotationLines(line); const int linesBefore = AnnotationLines(line);
static_cast<LineAnnotation*>(perLineData[ldAnnotation])->SetText(line, text); static_cast<LineAnnotation *>(perLineData[ldAnnotation])->SetText(line, text);
const int linesAfter = AnnotationLines(line); const int linesAfter = AnnotationLines(line);
DocModification mh(SC_MOD_CHANGEANNOTATION, LineStart(line), 0, 0, 0, line); DocModification mh(SC_MOD_CHANGEANNOTATION, LineStart(line), 0, 0, 0, line);
mh.annotationLinesAdded = linesAfter - linesBefore; mh.annotationLinesAdded = linesAfter - linesBefore;
@ -1492,27 +1427,27 @@ void Document::AnnotationSetText(int line, const char *text) {
} }
void Document::AnnotationSetStyle(int line, int style) { void Document::AnnotationSetStyle(int line, int style) {
static_cast<LineAnnotation*>(perLineData[ldAnnotation])->SetStyle(line, style); static_cast<LineAnnotation *>(perLineData[ldAnnotation])->SetStyle(line, style);
} }
void Document::AnnotationSetStyles(int line, const unsigned char *styles) { void Document::AnnotationSetStyles(int line, const unsigned char *styles) {
static_cast<LineAnnotation*>(perLineData[ldAnnotation])->SetStyles(line, styles); static_cast<LineAnnotation *>(perLineData[ldAnnotation])->SetStyles(line, styles);
} }
int Document::AnnotationLength(int line) const { int Document::AnnotationLength(int line) const {
return static_cast<LineAnnotation*>(perLineData[ldAnnotation])->Length(line); return static_cast<LineAnnotation *>(perLineData[ldAnnotation])->Length(line);
} }
int Document::AnnotationLines(int line) const { int Document::AnnotationLines(int line) const {
return static_cast<LineAnnotation*>(perLineData[ldAnnotation])->Lines(line); return static_cast<LineAnnotation *>(perLineData[ldAnnotation])->Lines(line);
} }
void Document::AnnotationClearAll() { void Document::AnnotationClearAll() {
int maxEditorLine = LinesTotal(); int maxEditorLine = LinesTotal();
for (int l=0;l<maxEditorLine;l++) for (int l=0; l<maxEditorLine; l++)
AnnotationSetText(l, 0); AnnotationSetText(l, 0);
// Free remaining data // Free remaining data
static_cast<LineAnnotation*>(perLineData[ldAnnotation])->ClearAll(); static_cast<LineAnnotation *>(perLineData[ldAnnotation])->ClearAll();
} }
void Document::IncrementStyleClock() { void Document::IncrementStyleClock() {
@ -1691,11 +1626,11 @@ bool IsLineEndChar(char c) {
int Document::ExtendStyleRange(int pos, int delta, bool singleLine) { int Document::ExtendStyleRange(int pos, int delta, bool singleLine) {
int sStart = cb.StyleAt(pos); int sStart = cb.StyleAt(pos);
if (delta < 0) { if (delta < 0) {
while (pos > 0 && (cb.StyleAt(pos) == sStart) && (!singleLine || !IsLineEndChar(cb.CharAt(pos))) ) while (pos > 0 && (cb.StyleAt(pos) == sStart) && (!singleLine || !IsLineEndChar(cb.CharAt(pos))))
pos--; pos--;
pos++; pos++;
} else { } else {
while (pos < (Length()) && (cb.StyleAt(pos) == sStart) && (!singleLine || !IsLineEndChar(cb.CharAt(pos))) ) while (pos < (Length()) && (cb.StyleAt(pos) == sStart) && (!singleLine || !IsLineEndChar(cb.CharAt(pos))))
pos++; pos++;
} }
return pos; return pos;
@ -1737,7 +1672,7 @@ int Document::BraceMatch(int position, int /*maxReStyle*/) {
int depth = 1; int depth = 1;
position = position + direction; position = position + direction;
while ((position >= 0) && (position < Length())) { while ((position >= 0) && (position < Length())) {
position = MovePositionOutsideChar(position, direction); position = MovePositionOutsideChar(position, direction, true);
char chAtPos = CharAt(position); char chAtPos = CharAt(position);
char styAtPos = static_cast<char>(StyleAt(position) & stylingBitsMask); char styAtPos = static_cast<char>(StyleAt(position) & stylingBitsMask);
if ((position > GetEndStyled()) || (styAtPos == styBrace)) { if ((position > GetEndStyled()) || (styAtPos == styBrace)) {
@ -1768,7 +1703,7 @@ public:
bool caseSensitive, bool word, bool wordStart, int flags, bool caseSensitive, bool word, bool wordStart, int flags,
int *length); int *length);
virtual const char *SubstituteByPosition(Document* doc, const char *text, int *length); virtual const char *SubstituteByPosition(Document *doc, const char *text, int *length);
private: private:
RESearch search; RESearch search;
@ -1883,7 +1818,7 @@ long BuiltinRegex::FindText(Document *doc, int minPos, int maxPos, const char *s
return pos; return pos;
} }
const char *BuiltinRegex::SubstituteByPosition(Document* doc, const char *text, int *length) { const char *BuiltinRegex::SubstituteByPosition(Document *doc, const char *text, int *length) {
delete []substituted; delete []substituted;
substituted = 0; substituted = 0;
DocumentIndexer di(doc, doc->Length()); DocumentIndexer di(doc, doc->Length());
@ -1905,6 +1840,7 @@ const char *BuiltinRegex::SubstituteByPosition(Document* doc, const char *text,
case 'r': case 'r':
case 't': case 't':
case 'v': case 'v':
case '\\':
i++; i++;
} }
lenResult++; lenResult++;
@ -1948,6 +1884,9 @@ const char *BuiltinRegex::SubstituteByPosition(Document* doc, const char *text,
case 'v': case 'v':
*o++ = '\v'; *o++ = '\v';
break; break;
case '\\':
*o++ = '\\';
break;
default: default:
*o++ = '\\'; *o++ = '\\';
j--; j--;

View File

@ -32,10 +32,10 @@ public:
Range(Position pos=0) : Range(Position pos=0) :
start(pos), end(pos) { start(pos), end(pos) {
}; }
Range(Position start_, Position end_) : Range(Position start_, Position end_) :
start(start_), end(end_) { start(start_), end(end_) {
}; }
bool Valid() const { bool Valid() const {
return (start != invalidPosition) && (end != invalidPosition); return (start != invalidPosition) && (end != invalidPosition);
@ -81,17 +81,17 @@ class Document;
*/ */
class RegexSearchBase { class RegexSearchBase {
public: public:
virtual ~RegexSearchBase(){} virtual ~RegexSearchBase() {}
virtual long FindText(Document* doc, int minPos, int maxPos, const char *s, virtual long FindText(Document *doc, int minPos, int maxPos, const char *s,
bool caseSensitive, bool word, bool wordStart, int flags, int *length) = 0; bool caseSensitive, bool word, bool wordStart, int flags, int *length) = 0;
///@return String with the substitutions, must remain valid until the next call or destruction ///@return String with the substitutions, must remain valid until the next call or destruction
virtual const char *SubstituteByPosition(Document* doc, const char *text, int *length) = 0; virtual const char *SubstituteByPosition(Document *doc, const char *text, int *length) = 0;
}; };
/// Factory function for RegexSearchBase /// Factory function for RegexSearchBase
extern RegexSearchBase* CreateRegexSearch(CharClassify *charClassTable); extern RegexSearchBase *CreateRegexSearch(CharClassify *charClassTable);
struct StyledText { struct StyledText {
size_t length; size_t length;
@ -99,7 +99,7 @@ struct StyledText {
bool multipleStyles; bool multipleStyles;
size_t style; size_t style;
const unsigned char *styles; const unsigned char *styles;
StyledText( size_t length_, const char *text_, bool multipleStyles_, int style_, const unsigned char *styles_) : StyledText(size_t length_, const char *text_, bool multipleStyles_, int style_, const unsigned char *styles_) :
length(length_), text(text_), multipleStyles(multipleStyles_), style(style_), styles(styles_) { length(length_), text(text_), multipleStyles(multipleStyles_), style(style_), styles(styles_) {
} }
// Return number of bytes from start to before '\n' or end of text. // Return number of bytes from start to before '\n' or end of text.
@ -115,6 +115,24 @@ struct StyledText {
} }
}; };
class CaseFolder {
public:
virtual ~CaseFolder() {
}
virtual size_t Fold(char *folded, size_t sizeFolded, const char *mixed, size_t lenMixed) = 0;
};
class CaseFolderTable : public CaseFolder {
protected:
char mapping[256];
public:
CaseFolderTable();
virtual ~CaseFolderTable();
virtual size_t Fold(char *folded, size_t sizeFolded, const char *mixed, size_t lenMixed);
void SetTranslation(char ch, char chTranslation);
void StandardASCII();
};
/** /**
*/ */
class Document : PerLine { class Document : PerLine {
@ -151,7 +169,7 @@ private:
PerLine *perLineData[ldSize]; PerLine *perLineData[ldSize];
bool matchesValid; bool matchesValid;
RegexSearchBase* regex; RegexSearchBase *regex;
public: public:
int stylingBits; int stylingBits;
@ -225,10 +243,10 @@ public:
void DelCharBack(int pos); void DelCharBack(int pos);
char CharAt(int position) { return cb.CharAt(position); } char CharAt(int position) { return cb.CharAt(position); }
void GetCharRange(char *buffer, int position, int lengthRetrieve) { void GetCharRange(char *buffer, int position, int lengthRetrieve) const {
cb.GetCharRange(buffer, position, lengthRetrieve); cb.GetCharRange(buffer, position, lengthRetrieve);
} }
char StyleAt(int position) { return cb.StyleAt(position); } char StyleAt(int position) const { return cb.StyleAt(position); }
int GetMark(int line); int GetMark(int line);
int AddMark(int line, int markerNum); int AddMark(int line, int markerNum);
void AddMarkSet(int line, int valueSet); void AddMarkSet(int line, int valueSet);
@ -243,7 +261,7 @@ public:
int VCHomePosition(int position) const; int VCHomePosition(int position) const;
int SetLevel(int line, int level); int SetLevel(int line, int level);
int GetLevel(int line); int GetLevel(int line) const;
void ClearLevels(); void ClearLevels();
int GetLastChild(int lineParent, int level=-1); int GetLastChild(int lineParent, int level=-1);
int GetFoldParent(int line); int GetFoldParent(int line);
@ -254,9 +272,10 @@ public:
int NextWordEnd(int pos, int delta); int NextWordEnd(int pos, int delta);
int Length() const { return cb.Length(); } int Length() const { return cb.Length(); }
void Allocate(int newSize) { cb.Allocate(newSize); } void Allocate(int newSize) { cb.Allocate(newSize); }
long FindText(int minPos, int maxPos, const char *s, size_t ExtractChar(int pos, char *bytes);
bool caseSensitive, bool word, bool wordStart, bool regExp, int flags, int *length); bool MatchesWordOptions(bool word, bool wordStart, int pos, int length);
long FindText(int iMessage, unsigned long wParam, long lParam); long FindText(int minPos, int maxPos, const char *search, bool caseSensitive, bool word,
bool wordStart, bool regExp, int flags, int *length, CaseFolder *pcf);
const char *SubstituteByPosition(const char *text, int *length); const char *SubstituteByPosition(const char *text, int *length);
int LinesTotal() const; int LinesTotal() const;
@ -275,7 +294,7 @@ public:
void DecorationFillRange(int position, int value, int fillLength); void DecorationFillRange(int position, int value, int fillLength);
int SetLineState(int line, int state); int SetLineState(int line, int state);
int GetLineState(int line); int GetLineState(int line) const;
int GetMaxLineState(); int GetMaxLineState();
StyledText MarginStyledText(int line); StyledText MarginStyledText(int line);

View File

@ -187,7 +187,7 @@ int DocumentAccessor::IndentAmount(int line, int *flags, PFNIsCommentLeader pfnI
indent += SC_FOLDLEVELBASE; indent += SC_FOLDLEVELBASE;
// if completely empty line or the start of a comment... // if completely empty line or the start of a comment...
if ((ch == ' ' || ch == '\t' || ch == '\n' || ch == '\r') || if ((ch == ' ' || ch == '\t' || ch == '\n' || ch == '\r') ||
(pfnIsCommentLeader && (*pfnIsCommentLeader)(*this, pos, end-pos)) ) (pfnIsCommentLeader && (*pfnIsCommentLeader)(*this, pos, end-pos)))
return indent | SC_FOLDLEVELWHITEFLAG; return indent | SC_FOLDLEVELWHITEFLAG;
else else
return indent; return indent;

View File

@ -17,8 +17,8 @@ class Document;
class DocumentAccessor : public Accessor { class DocumentAccessor : public Accessor {
// Private so DocumentAccessor objects can not be copied // Private so DocumentAccessor objects can not be copied
DocumentAccessor(const DocumentAccessor &source) : Accessor(), props(source.props) {} DocumentAccessor(const DocumentAccessor &source);
DocumentAccessor &operator=(const DocumentAccessor &) { return *this; } DocumentAccessor &operator=(const DocumentAccessor &);
protected: protected:
Document *pdoc; Document *pdoc;
@ -63,7 +63,7 @@ public:
WindowID GetWindow() { return id; } WindowID GetWindow() { return id; }
void StartAt(unsigned int start, char chMask=31); void StartAt(unsigned int start, char chMask=31);
void SetFlags(char chFlags_, char chWhile_) {chFlags = chFlags_; chWhile = chWhile_; }; void SetFlags(char chFlags_, char chWhile_) {chFlags = chFlags_; chWhile = chWhile_; }
unsigned int GetStartSegment() { return startSeg; } unsigned int GetStartSegment() { return startSeg; }
void StartSegment(unsigned int pos); void StartSegment(unsigned int pos);
void ColourTo(unsigned int pos, int chAttr); void ColourTo(unsigned int pos, int chAttr);

File diff suppressed because it is too large Load Diff

View File

@ -45,6 +45,26 @@ public:
Idler(); Idler();
}; };
/**
* When platform has a way to generate an event before painting,
* accumulate needed styling range in StyleNeeded to avoid unnecessary work.
*/
class StyleNeeded {
public:
bool active;
Position upTo;
StyleNeeded() : active(false), upTo(0) {}
void Reset() {
active = false;
upTo = 0;
}
void NeedUpTo(Position pos) {
if (upTo < pos)
upTo = pos;
}
};
/** /**
* Hold a piece of text selected for copying or dragging. * Hold a piece of text selected for copying or dragging.
* The text is expected to hold a terminating '\0' and this is counted in len. * The text is expected to hold a terminating '\0' and this is counted in len.
@ -98,8 +118,8 @@ public:
*/ */
class Editor : public DocWatcher { class Editor : public DocWatcher {
// Private so Editor objects can not be copied // Private so Editor objects can not be copied
Editor(const Editor &) : DocWatcher() {} Editor(const Editor &);
Editor &operator=(const Editor &) { return *this; } Editor &operator=(const Editor &);
protected: // ScintillaBase subclass needs access to much of Editor protected: // ScintillaBase subclass needs access to much of Editor
@ -142,7 +162,9 @@ protected: // ScintillaBase subclass needs access to much of Editor
bool caretSticky; bool caretSticky;
bool multipleSelection; bool multipleSelection;
bool additionalSelectionTyping; bool additionalSelectionTyping;
int multiPasteMode;
bool additionalCaretsBlink; bool additionalCaretsBlink;
bool additionalCaretsVisible;
int virtualSpaceOptions; int virtualSpaceOptions;
@ -195,6 +217,7 @@ protected: // ScintillaBase subclass needs access to much of Editor
enum { notPainting, painting, paintAbandoned } paintState; enum { notPainting, painting, paintAbandoned } paintState;
PRectangle rcPaint; PRectangle rcPaint;
bool paintingAllText; bool paintingAllText;
StyleNeeded styleNeeded;
int modEventMask; int modEventMask;
@ -270,7 +293,7 @@ protected: // ScintillaBase subclass needs access to much of Editor
bool AbandonPaint(); bool AbandonPaint();
void RedrawRect(PRectangle rc); void RedrawRect(PRectangle rc);
void Redraw(); void Redraw();
void RedrawSelMargin(int line=-1); void RedrawSelMargin(int line=-1, bool allAfter=false);
PRectangle RectangleFromRange(int start, int end); PRectangle RectangleFromRange(int start, int end);
void InvalidateRange(int start, int end); void InvalidateRange(int start, int end);
@ -282,6 +305,7 @@ protected: // ScintillaBase subclass needs access to much of Editor
SelectionPosition SelectionStart(); SelectionPosition SelectionStart();
SelectionPosition SelectionEnd(); SelectionPosition SelectionEnd();
void SetRectangularRange(); void SetRectangularRange();
void ThinRectangularRange();
void InvalidateSelection(SelectionRange newMain, bool invalidateWholeSelection=false); void InvalidateSelection(SelectionRange newMain, bool invalidateWholeSelection=false);
void SetSelection(SelectionPosition currentPos_, SelectionPosition anchor_); void SetSelection(SelectionPosition currentPos_, SelectionPosition anchor_);
void SetSelection(int currentPos_, int anchor_); void SetSelection(int currentPos_, int anchor_);
@ -305,6 +329,14 @@ protected: // ScintillaBase subclass needs access to much of Editor
void HorizontalScrollTo(int xPos); void HorizontalScrollTo(int xPos);
void MoveCaretInsideView(bool ensureVisible=true); void MoveCaretInsideView(bool ensureVisible=true);
int DisplayFromPosition(int pos); int DisplayFromPosition(int pos);
struct XYScrollPosition {
int xOffset;
int topLine;
XYScrollPosition(int xOffset_, int topLine_) : xOffset(xOffset_), topLine(topLine_) {}
};
XYScrollPosition XYScrollToMakeVisible(const bool useMargin, const bool vert, const bool horiz);
void SetXYScroll(XYScrollPosition newXY);
void EnsureCaretVisible(bool useMargin=true, bool vert=true, bool horiz=true); void EnsureCaretVisible(bool useMargin=true, bool vert=true, bool horiz=true);
void ShowCaretAtCurrentPosition(); void ShowCaretAtCurrentPosition();
void DropCaret(); void DropCaret();
@ -356,6 +388,7 @@ protected: // ScintillaBase subclass needs access to much of Editor
int InsertSpace(int position, unsigned int spaces); int InsertSpace(int position, unsigned int spaces);
void AddChar(char ch); void AddChar(char ch);
virtual void AddCharUTF(char *s, unsigned int len, bool treatAsDBCS=false); virtual void AddCharUTF(char *s, unsigned int len, bool treatAsDBCS=false);
void InsertPaste(SelectionPosition selStart, const char *text, int len);
void ClearSelection(); void ClearSelection();
void ClearAll(); void ClearAll();
void ClearDocumentStyle(); void ClearDocumentStyle();
@ -402,7 +435,9 @@ protected: // ScintillaBase subclass needs access to much of Editor
void NotifyMacroRecord(unsigned int iMessage, uptr_t wParam, sptr_t lParam); void NotifyMacroRecord(unsigned int iMessage, uptr_t wParam, sptr_t lParam);
void PageMove(int direction, Selection::selTypes sel=Selection::noSel, bool stuttered = false); void PageMove(int direction, Selection::selTypes sel=Selection::noSel, bool stuttered = false);
void ChangeCaseOfSelection(bool makeUpperCase); enum { cmSame, cmUpper, cmLower } caseMap;
virtual std::string CaseMapString(const std::string &s, int caseMapping);
void ChangeCaseOfSelection(int caseMapping);
void LineTranspose(); void LineTranspose();
void Duplicate(bool forLine); void Duplicate(bool forLine);
virtual void CancelModes(); virtual void CancelModes();
@ -419,6 +454,7 @@ protected: // ScintillaBase subclass needs access to much of Editor
void Indent(bool forwards); void Indent(bool forwards);
virtual CaseFolder *CaseFolderForEncoding();
long FindText(uptr_t wParam, sptr_t lParam); long FindText(uptr_t wParam, sptr_t lParam);
void SearchAnchor(); void SearchAnchor();
long SearchText(unsigned int iMessage, uptr_t wParam, sptr_t lParam); long SearchText(unsigned int iMessage, uptr_t wParam, sptr_t lParam);
@ -441,6 +477,7 @@ protected: // ScintillaBase subclass needs access to much of Editor
bool PointInSelMargin(Point pt); bool PointInSelMargin(Point pt);
void LineSelection(int lineCurrent_, int lineAnchor_); void LineSelection(int lineCurrent_, int lineAnchor_);
void DwellEnd(bool mouseMoved); void DwellEnd(bool mouseMoved);
void MouseLeave();
virtual void ButtonDown(Point pt, unsigned int curTime, bool shift, bool ctrl, bool alt); virtual void ButtonDown(Point pt, unsigned int curTime, bool shift, bool ctrl, bool alt);
void ButtonMove(Point pt); void ButtonMove(Point pt);
void ButtonUp(Point pt, unsigned int curTime, bool ctrl); void ButtonUp(Point pt, unsigned int curTime, bool ctrl);
@ -453,6 +490,11 @@ protected: // ScintillaBase subclass needs access to much of Editor
virtual bool HaveMouseCapture() = 0; virtual bool HaveMouseCapture() = 0;
void SetFocusState(bool focusState); void SetFocusState(bool focusState);
int PositionAfterArea(PRectangle rcArea);
void StyleToPositionInView(Position pos);
void IdleStyling();
virtual void QueueStyling(int upTo);
virtual bool PaintContains(PRectangle rc); virtual bool PaintContains(PRectangle rc);
bool PaintContainsMargin(); bool PaintContainsMargin();
void CheckForChangeOutsidePaint(Range r); void CheckForChangeOutsidePaint(Range r);
@ -466,12 +508,13 @@ protected: // ScintillaBase subclass needs access to much of Editor
void Expand(int &line, bool doExpand); void Expand(int &line, bool doExpand);
void ToggleContraction(int line); void ToggleContraction(int line);
void EnsureLineVisible(int lineDoc, bool enforcePolicy); void EnsureLineVisible(int lineDoc, bool enforcePolicy);
int GetTag(char *tagValue, int tagNumber);
int ReplaceTarget(bool replacePatterns, const char *text, int length=-1); int ReplaceTarget(bool replacePatterns, const char *text, int length=-1);
bool PositionIsHotspot(int position); bool PositionIsHotspot(int position);
bool PointIsHotspot(Point pt); bool PointIsHotspot(Point pt);
void SetHotSpotRange(Point *pt); void SetHotSpotRange(Point *pt);
void GetHotSpotRange(int& hsStart, int& hsEnd); void GetHotSpotRange(int &hsStart, int &hsEnd);
int CodePage() const; int CodePage() const;
virtual bool ValidCodePage(int /* codePage */) const { return true; } virtual bool ValidCodePage(int /* codePage */) const { return true; }
@ -484,6 +527,8 @@ protected: // ScintillaBase subclass needs access to much of Editor
static const char *StringFromEOLMode(int eolMode); static const char *StringFromEOLMode(int eolMode);
static sptr_t StringResult(sptr_t lParam, const char *val);
public: public:
// Public so the COM thunks can access it. // Public so the COM thunks can access it.
bool IsUnicodeMode() const; bool IsUnicodeMode() const;

View File

@ -40,7 +40,7 @@ char **WordListsToStrings(WordList *val[]) {
while (val[dim]) while (val[dim])
dim++; dim++;
char **wls = new char * [dim + 1]; char **wls = new char * [dim + 1];
for (int i = 0;i < dim;i++) { for (int i = 0; i < dim; i++) {
std::string words; std::string words;
words = ""; words = "";
for (int n = 0; n < val[i]->len; n++) { for (int n = 0; n < val[i]->len; n++) {
@ -114,7 +114,7 @@ void ExternalLexerModule::SetExternal(ExtLexerFunction fLexer, ExtFoldFunction f
// //
//------------------------------------------ //------------------------------------------
LexerLibrary::LexerLibrary(const char* ModuleName) { LexerLibrary::LexerLibrary(const char *ModuleName) {
// Initialise some members... // Initialise some members...
first = NULL; first = NULL;
last = NULL; last = NULL;
@ -195,18 +195,15 @@ void LexerLibrary::Release() {
/// Return the single LexerManager instance... /// Return the single LexerManager instance...
LexerManager *LexerManager::GetInstance() { LexerManager *LexerManager::GetInstance() {
if(!theInstance) if (!theInstance)
theInstance = new LexerManager; theInstance = new LexerManager;
return theInstance; return theInstance;
} }
/// Delete any LexerManager instance... /// Delete any LexerManager instance...
void LexerManager::DeleteInstance() void LexerManager::DeleteInstance() {
{
if(theInstance) {
delete theInstance; delete theInstance;
theInstance = NULL; theInstance = NULL;
}
} }
/// protected constructor - this is a singleton... /// protected constructor - this is a singleton...
@ -219,13 +216,15 @@ LexerManager::~LexerManager() {
Clear(); Clear();
} }
void LexerManager::Load(const char* path) void LexerManager::Load(const char *path) {
{
LoadLexerLibrary(path); LoadLexerLibrary(path);
} }
void LexerManager::LoadLexerLibrary(const char* module) void LexerManager::LoadLexerLibrary(const char *module) {
{ for (LexerLibrary *ll = first; ll; ll= ll->next) {
if (strcmp(ll->m_sModuleName.c_str(), module) == 0)
return;
}
LexerLibrary *lib = new LexerLibrary(module); LexerLibrary *lib = new LexerLibrary(module);
if (NULL != first) { if (NULL != first) {
last->next = lib; last->next = lib;
@ -236,8 +235,7 @@ void LexerManager::LoadLexerLibrary(const char* module)
} }
} }
void LexerManager::Clear() void LexerManager::Clear() {
{
if (NULL != first) { if (NULL != first) {
LexerLibrary *cur = first; LexerLibrary *cur = first;
LexerLibrary *next; LexerLibrary *next;
@ -257,8 +255,7 @@ void LexerManager::Clear()
// //
//------------------------------------------ //------------------------------------------
LMMinder::~LMMinder() LMMinder::~LMMinder() {
{
LexerManager::DeleteInstance(); LexerManager::DeleteInstance();
} }

View File

@ -23,7 +23,7 @@ typedef void (EXT_LEXER_DECL *ExtLexerFunction)(unsigned int lexer, unsigned int
char *words[], WindowID window, char *props); char *words[], WindowID window, char *props);
typedef void (EXT_LEXER_DECL *ExtFoldFunction)(unsigned int lexer, unsigned int startPos, int length, int initStyle, typedef void (EXT_LEXER_DECL *ExtFoldFunction)(unsigned int lexer, unsigned int startPos, int length, int initStyle,
char *words[], WindowID window, char *props); char *words[], WindowID window, char *props);
typedef void* (EXT_LEXER_DECL *GetLexerFunction)(unsigned int Index); typedef void*(EXT_LEXER_DECL *GetLexerFunction)(unsigned int Index);
typedef int (EXT_LEXER_DECL *GetLexerCountFn)(); typedef int (EXT_LEXER_DECL *GetLexerCountFn)();
typedef void (EXT_LEXER_DECL *GetLexerNameFn)(unsigned int Index, char *name, int buflength); typedef void (EXT_LEXER_DECL *GetLexerNameFn)(unsigned int Index, char *name, int buflength);
@ -38,10 +38,11 @@ protected:
char name[100]; char name[100];
public: public:
ExternalLexerModule(int language_, LexerFunction fnLexer_, ExternalLexerModule(int language_, LexerFunction fnLexer_,
const char *languageName_=0, LexerFunction fnFolder_=0) : LexerModule(language_, fnLexer_, 0, fnFolder_){ const char *languageName_=0, LexerFunction fnFolder_=0) : LexerModule(language_, fnLexer_, 0, fnFolder_) {
strncpy(name, languageName_, sizeof(name)); strncpy(name, languageName_, sizeof(name));
name[sizeof(name)-1] = '\0';
languageName = name; languageName = name;
}; }
virtual void Lex(unsigned int startPos, int lengthDoc, int initStyle, virtual void Lex(unsigned int startPos, int lengthDoc, int initStyle,
WordList *keywordlists[], Accessor &styler) const; WordList *keywordlists[], Accessor &styler) const;
virtual void Fold(unsigned int startPos, int lengthDoc, int initStyle, virtual void Fold(unsigned int startPos, int lengthDoc, int initStyle,
@ -63,7 +64,7 @@ class LexerLibrary {
LexerMinder *last; LexerMinder *last;
public: public:
LexerLibrary(const char* ModuleName); LexerLibrary(const char *ModuleName);
~LexerLibrary(); ~LexerLibrary();
void Release(); void Release();
@ -79,14 +80,14 @@ public:
static LexerManager *GetInstance(); static LexerManager *GetInstance();
static void DeleteInstance(); static void DeleteInstance();
void Load(const char* path); void Load(const char *path);
void Clear(); void Clear();
private: private:
LexerManager(); LexerManager();
static LexerManager *theInstance; static LexerManager *theInstance;
void LoadLexerLibrary(const char* module); void LoadLexerLibrary(const char *module);
LexerLibrary *first; LexerLibrary *first;
LexerLibrary *last; LexerLibrary *last;
}; };

View File

@ -33,7 +33,7 @@ static char **ArrayFromWordList(char *wordlist, int *len, bool onlyLineEnds = fa
// For rapid determination of whether a character is a separator, build // For rapid determination of whether a character is a separator, build
// a look up table. // a look up table.
bool wordSeparator[256]; bool wordSeparator[256];
for (int i=0;i<256; i++) { for (int i=0; i<256; i++) {
wordSeparator[i] = false; wordSeparator[i] = false;
} }
wordSeparator['\r'] = true; wordSeparator['\r'] = true;
@ -92,11 +92,11 @@ void WordList::Set(const char *s) {
extern "C" int cmpString(const void *a1, const void *a2) { extern "C" int cmpString(const void *a1, const void *a2) {
// Can't work out the correct incantation to use modern casts here // Can't work out the correct incantation to use modern casts here
return strcmp(*(char**)(a1), *(char**)(a2)); return strcmp(*(char **)(a1), *(char **)(a2));
} }
static void SortWordList(char **words, unsigned int len) { static void SortWordList(char **words, unsigned int len) {
qsort(reinterpret_cast<void*>(words), len, sizeof(*words), qsort(reinterpret_cast<void *>(words), len, sizeof(*words),
cmpString); cmpString);
} }
@ -216,7 +216,7 @@ LexerModule::LexerModule(int language_,
LexerFunction fnLexer_, LexerFunction fnLexer_,
const char *languageName_, const char *languageName_,
LexerFunction fnFolder_, LexerFunction fnFolder_,
const char * const wordListDescriptions_[], const char *const wordListDescriptions_[],
int styleBits_) : int styleBits_) :
language(language_), language(language_),
fnLexer(fnLexer_), fnLexer(fnLexer_),
@ -375,6 +375,7 @@ int Scintilla_LinkLexers() {
LINK_LEXER(lmLua); LINK_LEXER(lmLua);
LINK_LEXER(lmMagikSF); LINK_LEXER(lmMagikSF);
LINK_LEXER(lmMake); LINK_LEXER(lmMake);
LINK_LEXER(lmMarkdown);
LINK_LEXER(lmMatlab); LINK_LEXER(lmMatlab);
LINK_LEXER(lmMETAPOST); LINK_LEXER(lmMETAPOST);
LINK_LEXER(lmMMIXAL); LINK_LEXER(lmMMIXAL);

View File

@ -42,7 +42,7 @@ inline bool IsAWordStart(const int ch) {
} }
inline bool isAveOperator(char ch) { inline bool isAveOperator(char ch) {
if (isalnum(ch)) if (isascii(ch) && isalnum(ch))
return false; return false;
// '.' left out as it is used to make up numbers // '.' left out as it is used to make up numbers
if (ch == '*' || ch == '/' || ch == '-' || ch == '+' || if (ch == '*' || ch == '/' || ch == '-' || ch == '+' ||

View File

@ -248,14 +248,8 @@ static void ColouriseBashDoc(unsigned int startPos, int length, int initStyle,
sc.SetState(SCE_SH_DEFAULT); sc.SetState(SCE_SH_DEFAULT);
break; break;
case SCE_SH_COMMENTLINE: case SCE_SH_COMMENTLINE:
if (sc.ch == '\\' && (sc.chNext == '\r' || sc.chNext == '\n')) { if (sc.atLineEnd && sc.chPrev != '\\') {
// comment continuation sc.SetState(SCE_SH_DEFAULT);
sc.Forward();
if (sc.ch == '\r' && sc.chNext == '\n') {
sc.Forward();
}
} else if (sc.atLineEnd) {
sc.ForwardSetState(SCE_SH_DEFAULT);
} }
break; break;
case SCE_SH_HERE_DELIM: case SCE_SH_HERE_DELIM:
@ -294,24 +288,15 @@ static void ColouriseBashDoc(unsigned int startPos, int length, int initStyle,
HereDoc.State = 1; HereDoc.State = 1;
} }
} else if (HereDoc.State == 1) { // collect the delimiter } else if (HereDoc.State == 1) { // collect the delimiter
if (HereDoc.Quoted) { // a quoted here-doc delimiter if (setHereDoc2.Contains(sc.ch) || sc.chPrev == '\\') {
if (sc.ch == HereDoc.Quote) { // closing quote => end of delimiter HereDoc.Append(sc.ch);
} else if (HereDoc.Quoted && sc.ch == HereDoc.Quote) { // closing quote => end of delimiter
sc.ForwardSetState(SCE_SH_DEFAULT); sc.ForwardSetState(SCE_SH_DEFAULT);
} else {
if (sc.ch == '\\' && sc.chNext == HereDoc.Quote) { // escaped quote
sc.Forward();
}
HereDoc.Append(sc.ch);
}
} else { // an unquoted here-doc delimiter
if (setHereDoc2.Contains(sc.ch)) {
HereDoc.Append(sc.ch);
} else if (sc.ch == '\\') { } else if (sc.ch == '\\') {
// skip escape prefix // skip escape prefix
} else { } else {
sc.SetState(SCE_SH_DEFAULT); sc.SetState(SCE_SH_DEFAULT);
} }
}
if (HereDoc.DelimiterLength >= HERE_DELIM_MAX - 1) { // force blowup if (HereDoc.DelimiterLength >= HERE_DELIM_MAX - 1) { // force blowup
sc.SetState(SCE_SH_ERROR); sc.SetState(SCE_SH_ERROR);
HereDoc.State = 0; HereDoc.State = 0;

View File

@ -21,6 +21,7 @@ using namespace Scintilla;
static int classifyWordBullant(unsigned int start, unsigned int end, WordList &keywords, Accessor &styler) { static int classifyWordBullant(unsigned int start, unsigned int end, WordList &keywords, Accessor &styler) {
char s[100]; char s[100];
s[0] = '\0';
for (unsigned int i = 0; i < end - start + 1 && i < 30; i++) { for (unsigned int i = 0; i < end - start + 1 && i < 30; i++) {
s[i] = static_cast<char>(tolower(styler[start + i])); s[i] = static_cast<char>(tolower(styler[start + i]));
s[i + 1] = '\0'; s[i + 1] = '\0';
@ -111,7 +112,7 @@ static void ColouriseBullantDoc(unsigned int startPos, int length, int initStyle
} }
blockChange=0; blockChange=0;
*/ } */ }
if (!isspace(ch)) if (!(isascii(ch) && isspace(ch)))
visibleChars++; visibleChars++;
if (styler.IsLeadByte(ch)) { if (styler.IsLeadByte(ch)) {

View File

@ -202,7 +202,7 @@ static void ColouriseCOBOLDoc(unsigned int startPos, int length, int initStyle,
} }
if (state == SCE_C_DEFAULT) { if (state == SCE_C_DEFAULT) {
if (isCOBOLwordstart(ch) || (ch == '$' && isalpha(chNext))) { if (isCOBOLwordstart(ch) || (ch == '$' && isascii(chNext) && isalpha(chNext))) {
ColourTo(styler, i-1, state); ColourTo(styler, i-1, state);
state = SCE_C_IDENTIFIER; state = SCE_C_IDENTIFIER;
} else if (column == 0 && ch == '*' && chNext != '*') { } else if (column == 0 && ch == '*' && chNext != '*') {

View File

@ -483,14 +483,14 @@ static void FoldCppDoc(unsigned int startPos, int length, int initStyle,
} }
} }
static const char * const cppWordLists[] = { static const char *const cppWordLists[] = {
"Primary keywords and identifiers", "Primary keywords and identifiers",
"Secondary keywords and identifiers", "Secondary keywords and identifiers",
"Documentation comment keywords", "Documentation comment keywords",
"Unused", "Unused",
"Global classes and typedefs", "Global classes and typedefs",
0, 0,
}; };
static void ColouriseCppDocSensitive(unsigned int startPos, int length, int initStyle, WordList *keywordlists[], static void ColouriseCppDocSensitive(unsigned int startPos, int length, int initStyle, WordList *keywordlists[],
Accessor &styler) { Accessor &styler) {

View File

@ -62,6 +62,7 @@ static void ColouriseCssDoc(unsigned int startPos, int length, int initStyle, Wo
int lastState = -1; // before operator int lastState = -1; // before operator
int lastStateC = -1; // before comment int lastStateC = -1; // before comment
int lastStateS = -1; // before single-quoted/double-quoted string
int op = ' '; // last operator int op = ' '; // last operator
int opPrev = ' '; // last operator int opPrev = ' '; // last operator
@ -105,7 +106,7 @@ static void ColouriseCssDoc(unsigned int startPos, int length, int initStyle, Wo
i--; i--;
if ((sc.currentPos - i) % 2 == 1) if ((sc.currentPos - i) % 2 == 1)
continue; continue;
sc.ForwardSetState(SCE_CSS_VALUE); sc.ForwardSetState(lastStateS);
} }
if (sc.state == SCE_CSS_OPERATOR) { if (sc.state == SCE_CSS_OPERATOR) {
@ -140,9 +141,9 @@ static void ColouriseCssDoc(unsigned int startPos, int length, int initStyle, Wo
sc.SetState(SCE_CSS_TAG); sc.SetState(SCE_CSS_TAG);
break; break;
case '{': case '{':
if (lastState == SCE_CSS_DIRECTIVE) if (lastState == SCE_CSS_MEDIA)
sc.SetState(SCE_CSS_DEFAULT); sc.SetState(SCE_CSS_DEFAULT);
else if (lastState == SCE_CSS_TAG) else if (lastState == SCE_CSS_TAG || lastState == SCE_CSS_DIRECTIVE)
sc.SetState(SCE_CSS_IDENTIFIER); sc.SetState(SCE_CSS_IDENTIFIER);
break; break;
case '}': case '}':
@ -219,7 +220,8 @@ static void ColouriseCssDoc(unsigned int startPos, int length, int initStyle, Wo
sc.state == SCE_CSS_PSEUDOCLASS || sc.state == SCE_CSS_PSEUDOELEMENT || sc.state == SCE_CSS_PSEUDOCLASS || sc.state == SCE_CSS_PSEUDOELEMENT ||
sc.state == SCE_CSS_EXTENDED_PSEUDOCLASS || sc.state == SCE_CSS_EXTENDED_PSEUDOELEMENT || sc.state == SCE_CSS_EXTENDED_PSEUDOCLASS || sc.state == SCE_CSS_EXTENDED_PSEUDOELEMENT ||
sc.state == SCE_CSS_UNKNOWN_PSEUDOCLASS || sc.state == SCE_CSS_UNKNOWN_PSEUDOCLASS ||
sc.state == SCE_CSS_IMPORTANT sc.state == SCE_CSS_IMPORTANT ||
sc.state == SCE_CSS_DIRECTIVE
)) { )) {
char s[100]; char s[100];
sc.GetCurrentLowered(s, sizeof(s)); sc.GetCurrentLowered(s, sizeof(s));
@ -263,6 +265,10 @@ static void ColouriseCssDoc(unsigned int startPos, int length, int initStyle, Wo
if (strcmp(s2, "important") != 0) if (strcmp(s2, "important") != 0)
sc.ChangeState(SCE_CSS_VALUE); sc.ChangeState(SCE_CSS_VALUE);
break; break;
case SCE_CSS_DIRECTIVE:
if (op == '@' && strcmp(s2, "media") == 0)
sc.ChangeState(SCE_CSS_MEDIA);
break;
} }
} }
@ -280,12 +286,14 @@ static void ColouriseCssDoc(unsigned int startPos, int length, int initStyle, Wo
lastStateC = sc.state; lastStateC = sc.state;
sc.SetState(SCE_CSS_COMMENT); sc.SetState(SCE_CSS_COMMENT);
sc.Forward(); sc.Forward();
} else if (sc.state == SCE_CSS_VALUE && (sc.ch == '\"' || sc.ch == '\'')) { } else if ((sc.state == SCE_CSS_VALUE || sc.state == SCE_CSS_ATTRIBUTE)
&& (sc.ch == '\"' || sc.ch == '\'')) {
lastStateS = sc.state;
sc.SetState((sc.ch == '\"' ? SCE_CSS_DOUBLESTRING : SCE_CSS_SINGLESTRING)); sc.SetState((sc.ch == '\"' ? SCE_CSS_DOUBLESTRING : SCE_CSS_SINGLESTRING));
} else if (IsCssOperator(sc.ch) } else if (IsCssOperator(sc.ch)
&& (sc.state != SCE_CSS_ATTRIBUTE || sc.ch == ']') && (sc.state != SCE_CSS_ATTRIBUTE || sc.ch == ']')
&& (sc.state != SCE_CSS_VALUE || sc.ch == ';' || sc.ch == '}' || sc.ch == '!') && (sc.state != SCE_CSS_VALUE || sc.ch == ';' || sc.ch == '}' || sc.ch == '!')
&& (sc.state != SCE_CSS_DIRECTIVE || sc.ch == ';' || sc.ch == '{') && ((sc.state != SCE_CSS_DIRECTIVE && sc.state != SCE_CSS_MEDIA) || sc.ch == ';' || sc.ch == '{')
) { ) {
if (sc.state != SCE_CSS_OPERATOR) if (sc.state != SCE_CSS_OPERATOR)
lastState = sc.state; lastState = sc.state;

View File

@ -430,13 +430,11 @@ void ColouriseCamlDoc(
static static
#endif /* BUILD_AS_EXTERNAL_LEXER */ #endif /* BUILD_AS_EXTERNAL_LEXER */
void FoldCamlDoc( void FoldCamlDoc(
unsigned int startPos, int length, unsigned int, int,
int initStyle, int,
WordList *keywordlists[], WordList *[],
Accessor &styler) Accessor &)
{ {
// below useless evaluation(s) to supress "not used" warnings
startPos || length || initStyle || keywordlists[0] || styler.Length();
} }
static const char * const camlWordListDesc[] = { static const char * const camlWordListDesc[] = {

View File

@ -70,17 +70,17 @@ static void ColouriseConfDoc(unsigned int startPos, int length, int, WordList *k
} else if( ch == '"') { } else if( ch == '"') {
state = SCE_CONF_STRING; state = SCE_CONF_STRING;
styler.ColourTo(i,SCE_CONF_STRING); styler.ColourTo(i,SCE_CONF_STRING);
} else if( ispunct(ch) ) { } else if( isascii(ch) && ispunct(ch) ) {
// signals an operator... // signals an operator...
// no state jump necessary for this // no state jump necessary for this
// simple case... // simple case...
styler.ColourTo(i,SCE_CONF_OPERATOR); styler.ColourTo(i,SCE_CONF_OPERATOR);
} else if( isalpha(ch) ) { } else if( isascii(ch) && isalpha(ch) ) {
// signals the start of an identifier // signals the start of an identifier
bufferCount = 0; bufferCount = 0;
buffer[bufferCount++] = static_cast<char>(tolower(ch)); buffer[bufferCount++] = static_cast<char>(tolower(ch));
state = SCE_CONF_IDENTIFIER; state = SCE_CONF_IDENTIFIER;
} else if( isdigit(ch) ) { } else if( isascii(ch) && isdigit(ch) ) {
// signals the start of a number // signals the start of a number
bufferCount = 0; bufferCount = 0;
buffer[bufferCount++] = ch; buffer[bufferCount++] = ch;
@ -107,7 +107,7 @@ static void ColouriseConfDoc(unsigned int startPos, int length, int, WordList *k
// if we find a non-alphanumeric char, // if we find a non-alphanumeric char,
// we simply go to default state // we simply go to default state
// else we're still dealing with an extension... // else we're still dealing with an extension...
if( isalnum(ch) || (ch == '_') || if( (isascii(ch) && isalnum(ch)) || (ch == '_') ||
(ch == '-') || (ch == '$') || (ch == '-') || (ch == '$') ||
(ch == '/') || (ch == '.') || (ch == '*') ) (ch == '/') || (ch == '.') || (ch == '*') )
{ {
@ -129,7 +129,7 @@ static void ColouriseConfDoc(unsigned int startPos, int length, int, WordList *k
case SCE_CONF_IDENTIFIER: case SCE_CONF_IDENTIFIER:
// stay in CONF_IDENTIFIER state until we find a non-alphanumeric // stay in CONF_IDENTIFIER state until we find a non-alphanumeric
if( isalnum(ch) || (ch == '_') || (ch == '-') || (ch == '/') || (ch == '$') || (ch == '.') || (ch == '*')) { if( (isascii(ch) && isalnum(ch)) || (ch == '_') || (ch == '-') || (ch == '/') || (ch == '$') || (ch == '.') || (ch == '*')) {
buffer[bufferCount++] = static_cast<char>(tolower(ch)); buffer[bufferCount++] = static_cast<char>(tolower(ch));
} else { } else {
state = SCE_CONF_DEFAULT; state = SCE_CONF_DEFAULT;
@ -154,7 +154,7 @@ static void ColouriseConfDoc(unsigned int startPos, int length, int, WordList *k
case SCE_CONF_NUMBER: case SCE_CONF_NUMBER:
// stay in CONF_NUMBER state until we find a non-numeric // stay in CONF_NUMBER state until we find a non-numeric
if( isdigit(ch) || ch == '.') { if( (isascii(ch) && isdigit(ch)) || ch == '.') {
buffer[bufferCount++] = ch; buffer[bufferCount++] = ch;
} else { } else {
state = SCE_CONF_DEFAULT; state = SCE_CONF_DEFAULT;

View File

@ -94,12 +94,12 @@ static void ColouriseNncrontabDoc(unsigned int startPos, int length, int, WordLi
// signals an asterisk // signals an asterisk
// no state jump necessary for this simple case... // no state jump necessary for this simple case...
styler.ColourTo(i,SCE_NNCRONTAB_ASTERISK); styler.ColourTo(i,SCE_NNCRONTAB_ASTERISK);
} else if( isalpha(ch) || ch == '<' ) { } else if( (isascii(ch) && isalpha(ch)) || ch == '<' ) {
// signals the start of an identifier // signals the start of an identifier
bufferCount = 0; bufferCount = 0;
buffer[bufferCount++] = ch; buffer[bufferCount++] = ch;
state = SCE_NNCRONTAB_IDENTIFIER; state = SCE_NNCRONTAB_IDENTIFIER;
} else if( isdigit(ch) ) { } else if( isascii(ch) && isdigit(ch) ) {
// signals the start of a number // signals the start of a number
bufferCount = 0; bufferCount = 0;
buffer[bufferCount++] = ch; buffer[bufferCount++] = ch;
@ -167,7 +167,7 @@ static void ColouriseNncrontabDoc(unsigned int startPos, int length, int, WordLi
case SCE_NNCRONTAB_IDENTIFIER: case SCE_NNCRONTAB_IDENTIFIER:
// stay in CONF_IDENTIFIER state until we find a non-alphanumeric // stay in CONF_IDENTIFIER state until we find a non-alphanumeric
if( isalnum(ch) || (ch == '_') || (ch == '-') || (ch == '/') || if( (isascii(ch) && isalnum(ch)) || (ch == '_') || (ch == '-') || (ch == '/') ||
(ch == '$') || (ch == '.') || (ch == '<') || (ch == '>') || (ch == '$') || (ch == '.') || (ch == '<') || (ch == '>') ||
(ch == '@') ) { (ch == '@') ) {
buffer[bufferCount++] = ch; buffer[bufferCount++] = ch;
@ -196,7 +196,7 @@ static void ColouriseNncrontabDoc(unsigned int startPos, int length, int, WordLi
case SCE_NNCRONTAB_NUMBER: case SCE_NNCRONTAB_NUMBER:
// stay in CONF_NUMBER state until we find a non-numeric // stay in CONF_NUMBER state until we find a non-numeric
if( isdigit(ch) /* || ch == '.' */ ) { if( isascii(ch) && isdigit(ch) /* || ch == '.' */ ) {
buffer[bufferCount++] = ch; buffer[bufferCount++] = ch;
} else { } else {
state = SCE_NNCRONTAB_DEFAULT; state = SCE_NNCRONTAB_DEFAULT;

View File

@ -35,7 +35,7 @@ static inline bool IsAWordStart(const int ch) {
} }
static inline bool IsCsoundOperator(char ch) { static inline bool IsCsoundOperator(char ch) {
if (isalnum(ch)) if (isascii(ch) && isalnum(ch))
return false; return false;
// '.' left out as it is used to make up numbers // '.' left out as it is used to make up numbers
if (ch == '*' || ch == '/' || ch == '-' || ch == '+' || if (ch == '*' || ch == '/' || ch == '-' || ch == '+' ||

View File

@ -1,10 +1,12 @@
// Scintilla source code edit control // Scintilla source code edit control
/** @file LexErlang.cxx
** Lexer for Erlang.
** Written by Peter-Henry Mander, based on Matlab lexer by José Fonseca
**/
// Copyright 1998-2001 by Neil Hodgson <neilh@scintilla.org> // Copyright 1998-2001 by Neil Hodgson <neilh@scintilla.org>
// The License.txt file describes the conditions under which this software may be distributed. // The License.txt file describes the conditions under which this software may be distributed.
/** @file LexErlang.cxx
** Lexer for Erlang.
** Enhanced by Etienne 'Lenain' Girondel (lenaing@gmail.com)
** Originally wrote by Peter-Henry Mander,
** based on Matlab lexer by José Fonseca.
**/
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
@ -13,7 +15,6 @@
#include <stdarg.h> #include <stdarg.h>
#include "Platform.h" #include "Platform.h"
#include "PropSet.h" #include "PropSet.h"
#include "Accessor.h" #include "Accessor.h"
#include "StyleContext.h" #include "StyleContext.h"
@ -25,35 +26,32 @@
using namespace Scintilla; using namespace Scintilla;
#endif #endif
/*
TODO:
o _Param should be a new lexical type
*/
static int is_radix(int radix, int ch) { static int is_radix(int radix, int ch) {
int digit; int digit;
if ( 16 < radix || 2 > radix ) {
if (36 < radix || 2 > radix)
return 0; return 0;
}
if ( isdigit(ch) ) { if (isdigit(ch)) {
digit = ch - '0'; digit = ch - '0';
} else if ( isxdigit(ch) ) { } else if (isalnum(ch)) {
digit = toupper(ch) - 'A' + 10; digit = toupper(ch) - 'A' + 10;
} else { } else {
return 0; return 0;
} }
if ( digit < radix ) {
return 1; return (digit < radix);
} else {
return 0;
}
} }
typedef enum { typedef enum {
STATE_NULL, STATE_NULL,
COMMENT,
COMMENT_FUNCTION,
COMMENT_MODULE,
COMMENT_DOC,
COMMENT_DOC_MACRO,
ATOM_UNQUOTED, ATOM_UNQUOTED,
ATOM_QUOTED, ATOM_QUOTED,
ATOM_FUN_NAME,
NODE_NAME_UNQUOTED, NODE_NAME_UNQUOTED,
NODE_NAME_QUOTED, NODE_NAME_QUOTED,
MACRO_START, MACRO_START,
@ -63,91 +61,199 @@ typedef enum {
RECORD_UNQUOTED, RECORD_UNQUOTED,
RECORD_QUOTED, RECORD_QUOTED,
NUMERAL_START, NUMERAL_START,
NUMERAL_SIGNED, NUMERAL_BASE_VALUE,
NUMERAL_RADIX_LITERAL, NUMERAL_FLOAT,
NUMERAL_SPECULATIVE_MANTISSA, NUMERAL_EXPONENT,
NUMERAL_FLOAT_MANTISSA, PREPROCESSOR
NUMERAL_FLOAT_EXPONENT,
NUMERAL_FLOAT_SIGNED_EXPONENT,
PARSE_ERROR
} atom_parse_state_t; } atom_parse_state_t;
static inline bool IsAWordChar(const int ch) {
return (ch < 0x80) && (ch != ' ') && (isalnum(ch) || ch == '_');
}
static void ColouriseErlangDoc(unsigned int startPos, int length, int initStyle, static void ColouriseErlangDoc(unsigned int startPos, int length, int initStyle,
WordList *keywordlists[], Accessor &styler) { WordList *keywordlists[], Accessor &styler) {
WordList &keywords = *keywordlists[0]; StyleContext sc(startPos, length, initStyle, styler);
WordList &reservedWords = *keywordlists[0];
WordList &erlangBIFs = *keywordlists[1];
WordList &erlangPreproc = *keywordlists[2];
WordList &erlangModulesAtt = *keywordlists[3];
WordList &erlangDoc = *keywordlists[4];
WordList &erlangDocMacro = *keywordlists[5];
int radix_digits = 0;
int exponent_digits = 0;
atom_parse_state_t parse_state = STATE_NULL;
atom_parse_state_t old_parse_state = STATE_NULL;
bool to_late_to_comment = false;
char cur[100];
int old_style = SCE_ERLANG_DEFAULT;
styler.StartAt(startPos); styler.StartAt(startPos);
StyleContext sc(startPos, length, initStyle, styler);
atom_parse_state_t parse_state = STATE_NULL;
int radix_digits = 0;
int exponent_digits = 0;
for (; sc.More(); sc.Forward()) { for (; sc.More(); sc.Forward()) {
if ( STATE_NULL != parse_state ) { int style = SCE_ERLANG_DEFAULT;
if (STATE_NULL != parse_state) {
switch (parse_state) { switch (parse_state) {
case STATE_NULL:
case STATE_NULL : sc.SetState(SCE_ERLANG_DEFAULT); break;
/* COMMENTS ------------------------------------------------------*/
case COMMENT : {
if (sc.ch != '%') {
to_late_to_comment = true;
} else if (!to_late_to_comment && sc.ch == '%') {
// Switch to comment level 2 (Function)
sc.ChangeState(SCE_ERLANG_COMMENT_FUNCTION);
old_style = SCE_ERLANG_COMMENT_FUNCTION;
parse_state = COMMENT_FUNCTION;
sc.Forward();
}
}
// V--- Falling through!
case COMMENT_FUNCTION : {
if (sc.ch != '%') {
to_late_to_comment = true;
} else if (!to_late_to_comment && sc.ch == '%') {
// Switch to comment level 3 (Module)
sc.ChangeState(SCE_ERLANG_COMMENT_MODULE);
old_style = SCE_ERLANG_COMMENT_MODULE;
parse_state = COMMENT_MODULE;
sc.Forward();
}
}
// V--- Falling through!
case COMMENT_MODULE : {
if (parse_state != COMMENT) {
// Search for comment documentation
if (sc.chNext == '@') {
old_parse_state = parse_state;
parse_state = ('{' == sc.ch)
? COMMENT_DOC_MACRO
: COMMENT_DOC;
sc.ForwardSetState(sc.state);
}
}
// All comments types fall here.
if (sc.atLineEnd) {
to_late_to_comment = false;
sc.SetState(SCE_ERLANG_DEFAULT); sc.SetState(SCE_ERLANG_DEFAULT);
break; parse_state = STATE_NULL;
case ATOM_UNQUOTED: }
if ( '@' == sc.ch ){ } break;
case COMMENT_DOC :
// V--- Falling through!
case COMMENT_DOC_MACRO : {
if (!isalnum(sc.ch)) {
// Try to match documentation comment
sc.GetCurrent(cur, sizeof(cur));
if (parse_state == COMMENT_DOC_MACRO
&& erlangDocMacro.InList(cur)) {
sc.ChangeState(SCE_ERLANG_COMMENT_DOC_MACRO);
while (sc.ch != '}' && !sc.atLineEnd)
sc.Forward();
} else if (erlangDoc.InList(cur)) {
sc.ChangeState(SCE_ERLANG_COMMENT_DOC);
} else {
sc.ChangeState(old_style);
}
// Switch back to old state
sc.SetState(old_style);
parse_state = old_parse_state;
}
if (sc.atLineEnd) {
to_late_to_comment = false;
sc.ChangeState(old_style);
sc.SetState(SCE_ERLANG_DEFAULT);
parse_state = STATE_NULL;
}
} break;
/* -------------------------------------------------------------- */
/* Atoms ---------------------------------------------------------*/
case ATOM_UNQUOTED : {
if ('@' == sc.ch){
parse_state = NODE_NAME_UNQUOTED; parse_state = NODE_NAME_UNQUOTED;
} else if ( !isalnum(sc.ch) && sc.ch != '_' ) { } else if (sc.ch == ':') {
char s[100]; // Searching for module name
sc.GetCurrent(s, sizeof(s)); if (sc.chNext == ' ') {
if (keywords.InList(s)) { // error
sc.ChangeState(SCE_ERLANG_KEYWORD); sc.ChangeState(SCE_ERLANG_UNKNOWN);
sc.SetState(SCE_ERLANG_DEFAULT);
parse_state = STATE_NULL; parse_state = STATE_NULL;
} else { } else {
if ( '/' == sc.ch ) { sc.Forward();
parse_state = ATOM_FUN_NAME; if (isalnum(sc.ch)) {
sc.GetCurrent(cur, sizeof(cur));
sc.ChangeState(SCE_ERLANG_MODULES);
sc.SetState(SCE_ERLANG_MODULES);
}
}
} else if (!IsAWordChar(sc.ch)) {
sc.GetCurrent(cur, sizeof(cur));
if (reservedWords.InList(cur)) {
style = SCE_ERLANG_KEYWORD;
} else if (erlangBIFs.InList(cur)
&& strcmp(cur,"erlang:")){
style = SCE_ERLANG_BIFS;
} else if (sc.ch == '(' || '/' == sc.ch){
style = SCE_ERLANG_FUNCTION_NAME;
} else { } else {
sc.ChangeState(SCE_ERLANG_ATOM); style = SCE_ERLANG_ATOM;
}
sc.ChangeState(style);
sc.SetState(SCE_ERLANG_DEFAULT); sc.SetState(SCE_ERLANG_DEFAULT);
parse_state = STATE_NULL; parse_state = STATE_NULL;
} }
}
} } break;
break;
case ATOM_QUOTED: case ATOM_QUOTED : {
if ( '@' == sc.ch ){ if ( '@' == sc.ch ){
parse_state = NODE_NAME_QUOTED; parse_state = NODE_NAME_QUOTED;
} else if ( '\'' == sc.ch && '\\' != sc.chPrev ) { } else if ('\'' == sc.ch && '\\' != sc.chPrev) {
sc.ChangeState(SCE_ERLANG_ATOM); sc.ChangeState(SCE_ERLANG_ATOM);
sc.ForwardSetState(SCE_ERLANG_DEFAULT); sc.ForwardSetState(SCE_ERLANG_DEFAULT);
parse_state = STATE_NULL; parse_state = STATE_NULL;
} }
break; } break;
case ATOM_FUN_NAME:
if ( !isdigit(sc.ch) ) { /* -------------------------------------------------------------- */
sc.ChangeState(SCE_ERLANG_FUNCTION_NAME); /* Node names ----------------------------------------------------*/
case NODE_NAME_UNQUOTED : {
if ('@' == sc.ch) {
sc.SetState(SCE_ERLANG_DEFAULT);
parse_state = STATE_NULL;
} else if (!IsAWordChar(sc.ch)) {
sc.ChangeState(SCE_ERLANG_NODE_NAME);
sc.SetState(SCE_ERLANG_DEFAULT); sc.SetState(SCE_ERLANG_DEFAULT);
parse_state = STATE_NULL; parse_state = STATE_NULL;
} }
break; } break;
case NODE_NAME_QUOTED:
if ( '@' == sc.ch ) { case NODE_NAME_QUOTED : {
if ('@' == sc.ch) {
sc.SetState(SCE_ERLANG_DEFAULT); sc.SetState(SCE_ERLANG_DEFAULT);
parse_state = STATE_NULL; parse_state = STATE_NULL;
} else if ( '\'' == sc.ch && '\\' != sc.chPrev ) { } else if ('\'' == sc.ch && '\\' != sc.chPrev) {
sc.ChangeState(SCE_ERLANG_NODE_NAME); sc.ChangeState(SCE_ERLANG_NODE_NAME_QUOTED);
sc.ForwardSetState(SCE_ERLANG_DEFAULT); sc.ForwardSetState(SCE_ERLANG_DEFAULT);
parse_state = STATE_NULL; parse_state = STATE_NULL;
} }
break; } break;
case NODE_NAME_UNQUOTED:
if ( '@' == sc.ch ) { /* -------------------------------------------------------------- */
sc.SetState(SCE_ERLANG_DEFAULT); /* Records -------------------------------------------------------*/
parse_state = STATE_NULL; case RECORD_START : {
} else if ( !isalnum(sc.ch) && sc.ch != '_' ) { if ('\'' == sc.ch) {
sc.ChangeState(SCE_ERLANG_NODE_NAME);
sc.SetState(SCE_ERLANG_DEFAULT);
parse_state = STATE_NULL;
}
break;
case RECORD_START:
if ( '\'' == sc.ch ) {
parse_state = RECORD_QUOTED; parse_state = RECORD_QUOTED;
} else if (isalpha(sc.ch) && islower(sc.ch)) { } else if (isalpha(sc.ch) && islower(sc.ch)) {
parse_state = RECORD_UNQUOTED; parse_state = RECORD_UNQUOTED;
@ -155,23 +261,28 @@ static void ColouriseErlangDoc(unsigned int startPos, int length, int initStyle,
sc.SetState(SCE_ERLANG_DEFAULT); sc.SetState(SCE_ERLANG_DEFAULT);
parse_state = STATE_NULL; parse_state = STATE_NULL;
} }
break; } break;
case RECORD_QUOTED:
if ( '\'' == sc.ch && '\\' != sc.chPrev ) { case RECORD_UNQUOTED : {
sc.ChangeState(SCE_ERLANG_RECORD); if (!IsAWordChar(sc.ch)) {
sc.ForwardSetState(SCE_ERLANG_DEFAULT);
parse_state = STATE_NULL;
}
break;
case RECORD_UNQUOTED:
if ( !isalpha(sc.ch) && '_' != sc.ch ) {
sc.ChangeState(SCE_ERLANG_RECORD); sc.ChangeState(SCE_ERLANG_RECORD);
sc.SetState(SCE_ERLANG_DEFAULT); sc.SetState(SCE_ERLANG_DEFAULT);
parse_state = STATE_NULL; parse_state = STATE_NULL;
} }
break; } break;
case MACRO_START:
if ( '\'' == sc.ch ) { case RECORD_QUOTED : {
if ('\'' == sc.ch && '\\' != sc.chPrev) {
sc.ChangeState(SCE_ERLANG_RECORD_QUOTED);
sc.ForwardSetState(SCE_ERLANG_DEFAULT);
parse_state = STATE_NULL;
}
} break;
/* -------------------------------------------------------------- */
/* Macros --------------------------------------------------------*/
case MACRO_START : {
if ('\'' == sc.ch) {
parse_state = MACRO_QUOTED; parse_state = MACRO_QUOTED;
} else if (isalpha(sc.ch)) { } else if (isalpha(sc.ch)) {
parse_state = MACRO_UNQUOTED; parse_state = MACRO_UNQUOTED;
@ -179,115 +290,139 @@ static void ColouriseErlangDoc(unsigned int startPos, int length, int initStyle,
sc.SetState(SCE_ERLANG_DEFAULT); sc.SetState(SCE_ERLANG_DEFAULT);
parse_state = STATE_NULL; parse_state = STATE_NULL;
} }
break; } break;
case MACRO_UNQUOTED:
if ( !isalpha(sc.ch) && '_' != sc.ch ) { case MACRO_UNQUOTED : {
if (!IsAWordChar(sc.ch)) {
sc.ChangeState(SCE_ERLANG_MACRO); sc.ChangeState(SCE_ERLANG_MACRO);
sc.SetState(SCE_ERLANG_DEFAULT); sc.SetState(SCE_ERLANG_DEFAULT);
parse_state = STATE_NULL; parse_state = STATE_NULL;
} }
break; } break;
case MACRO_QUOTED:
if ( '\'' == sc.ch && '\\' != sc.chPrev ) { case MACRO_QUOTED : {
sc.ChangeState(SCE_ERLANG_MACRO); if ('\'' == sc.ch && '\\' != sc.chPrev) {
sc.ChangeState(SCE_ERLANG_MACRO_QUOTED);
sc.ForwardSetState(SCE_ERLANG_DEFAULT); sc.ForwardSetState(SCE_ERLANG_DEFAULT);
parse_state = STATE_NULL; parse_state = STATE_NULL;
} }
break; } break;
case NUMERAL_START:
if ( isdigit(sc.ch) ) { /* -------------------------------------------------------------- */
/* Numerics ------------------------------------------------------*/
/* Simple integer */
case NUMERAL_START : {
if (isdigit(sc.ch)) {
radix_digits *= 10; radix_digits *= 10;
radix_digits += sc.ch - '0'; // Assuming ASCII here! radix_digits += sc.ch - '0'; // Assuming ASCII here!
} else if ( '#' == sc.ch ) { } else if ('#' == sc.ch) {
if ( 2 > radix_digits || 16 < radix_digits) { if (2 > radix_digits || 36 < radix_digits) {
sc.SetState(SCE_ERLANG_DEFAULT); sc.SetState(SCE_ERLANG_DEFAULT);
parse_state = STATE_NULL; parse_state = STATE_NULL;
} else { } else {
parse_state = NUMERAL_RADIX_LITERAL; parse_state = NUMERAL_BASE_VALUE;
} }
} else if ( '.' == sc.ch && isdigit(sc.chNext)) { } else if ('.' == sc.ch && isdigit(sc.chNext)) {
radix_digits = 0; radix_digits = 0;
parse_state = NUMERAL_FLOAT_MANTISSA; parse_state = NUMERAL_FLOAT;
} else if ( 'e' == sc.ch || 'E' == sc.ch ) { } else if ('e' == sc.ch || 'E' == sc.ch) {
exponent_digits = 0; exponent_digits = 0;
parse_state = NUMERAL_FLOAT_EXPONENT; parse_state = NUMERAL_EXPONENT;
} else { } else {
radix_digits = 0; radix_digits = 0;
sc.ChangeState(SCE_ERLANG_NUMBER); sc.ChangeState(SCE_ERLANG_NUMBER);
sc.SetState(SCE_ERLANG_DEFAULT); sc.SetState(SCE_ERLANG_DEFAULT);
parse_state = STATE_NULL; parse_state = STATE_NULL;
} }
break; } break;
case NUMERAL_RADIX_LITERAL:
if ( !is_radix(radix_digits,sc.ch) ) { /* Integer in other base than 10 (x#yyy) */
case NUMERAL_BASE_VALUE : {
if (!is_radix(radix_digits,sc.ch)) {
radix_digits = 0; radix_digits = 0;
if ( !isalnum(sc.ch) ) {
if (!isalnum(sc.ch))
sc.ChangeState(SCE_ERLANG_NUMBER); sc.ChangeState(SCE_ERLANG_NUMBER);
}
sc.SetState(SCE_ERLANG_DEFAULT); sc.SetState(SCE_ERLANG_DEFAULT);
parse_state = STATE_NULL; parse_state = STATE_NULL;
} }
break; } break;
case NUMERAL_FLOAT_MANTISSA:
if ( 'e' == sc.ch || 'E' == sc.ch ) { /* Float (x.yyy) */
case NUMERAL_FLOAT : {
if ('e' == sc.ch || 'E' == sc.ch) {
exponent_digits = 0; exponent_digits = 0;
parse_state = NUMERAL_FLOAT_EXPONENT; parse_state = NUMERAL_EXPONENT;
} else if ( !isdigit(sc.ch) ) { } else if (!isdigit(sc.ch)) {
sc.ChangeState(SCE_ERLANG_NUMBER); sc.ChangeState(SCE_ERLANG_NUMBER);
sc.SetState(SCE_ERLANG_DEFAULT); sc.SetState(SCE_ERLANG_DEFAULT);
parse_state = STATE_NULL; parse_state = STATE_NULL;
} }
break; } break;
case NUMERAL_FLOAT_EXPONENT:
if ( '-' == sc.ch || '+' == sc.ch ) { /* Exponent, either integer or float (xEyy, x.yyEzzz) */
parse_state = NUMERAL_FLOAT_SIGNED_EXPONENT; case NUMERAL_EXPONENT : {
} else if ( !isdigit(sc.ch) ) { if (('-' == sc.ch || '+' == sc.ch)
if ( 0 < exponent_digits ) { && (isdigit(sc.chNext))) {
sc.Forward();
} else if (!isdigit(sc.ch)) {
if (0 < exponent_digits)
sc.ChangeState(SCE_ERLANG_NUMBER); sc.ChangeState(SCE_ERLANG_NUMBER);
}
sc.SetState(SCE_ERLANG_DEFAULT); sc.SetState(SCE_ERLANG_DEFAULT);
parse_state = STATE_NULL; parse_state = STATE_NULL;
} else { } else {
++exponent_digits; ++exponent_digits;
} }
break; } break;
case NUMERAL_FLOAT_SIGNED_EXPONENT:
if ( !isdigit(sc.ch) ) { /* -------------------------------------------------------------- */
if ( 0 < exponent_digits ) { /* Preprocessor --------------------------------------------------*/
sc.ChangeState(SCE_ERLANG_NUMBER); case PREPROCESSOR : {
if (!IsAWordChar(sc.ch)) {
sc.GetCurrent(cur, sizeof(cur));
if (erlangPreproc.InList(cur)) {
style = SCE_ERLANG_PREPROC;
} else if (erlangModulesAtt.InList(cur)) {
style = SCE_ERLANG_MODULES_ATT;
} }
sc.ChangeState(style);
sc.SetState(SCE_ERLANG_DEFAULT); sc.SetState(SCE_ERLANG_DEFAULT);
parse_state = STATE_NULL; parse_state = STATE_NULL;
} else {
++exponent_digits;
} }
break; } break;
case NUMERAL_SIGNED:
if ( !isdigit(sc.ch) ) { }
sc.ChangeState(SCE_ERLANG_NUMBER);
} /* End of : STATE_NULL != parse_state */
else
{
switch (sc.state) {
case SCE_ERLANG_VARIABLE : {
if (!IsAWordChar(sc.ch))
sc.SetState(SCE_ERLANG_DEFAULT); sc.SetState(SCE_ERLANG_DEFAULT);
parse_state = STATE_NULL; } break;
} else if ( '.' == sc.ch ) { case SCE_ERLANG_STRING : {
parse_state = NUMERAL_FLOAT_MANTISSA; if (sc.ch == '\"' && sc.chPrev != '\\')
} sc.ForwardSetState(SCE_ERLANG_DEFAULT);
break; } break;
case NUMERAL_SPECULATIVE_MANTISSA: case SCE_ERLANG_COMMENT : {
if ( !isdigit(sc.ch) ) { if (sc.atLineEnd)
sc.ChangeState(SCE_ERLANG_OPERATOR);
sc.SetState(SCE_ERLANG_DEFAULT); sc.SetState(SCE_ERLANG_DEFAULT);
parse_state = STATE_NULL; } break;
} else { case SCE_ERLANG_CHARACTER : {
parse_state = NUMERAL_FLOAT_MANTISSA; if (sc.chPrev == '\\') {
sc.ForwardSetState(SCE_ERLANG_DEFAULT);
} else if (sc.ch != '\\') {
sc.ForwardSetState(SCE_ERLANG_DEFAULT);
} }
break; } break;
case PARSE_ERROR: case SCE_ERLANG_OPERATOR : {
sc.SetState(SCE_ERLANG_DEFAULT);
parse_state = STATE_NULL;
break;
}
} else if (sc.state == SCE_ERLANG_OPERATOR) {
if (sc.chPrev == '.') { if (sc.chPrev == '.') {
if (sc.ch == '*' || sc.ch == '/' || sc.ch == '\\' || sc.ch == '^') { if (sc.ch == '*' || sc.ch == '/' || sc.ch == '\\'
|| sc.ch == '^') {
sc.ForwardSetState(SCE_ERLANG_DEFAULT); sc.ForwardSetState(SCE_ERLANG_DEFAULT);
} else if (sc.ch == '\'') { } else if (sc.ch == '\'') {
sc.ForwardSetState(SCE_ERLANG_DEFAULT); sc.ForwardSetState(SCE_ERLANG_DEFAULT);
@ -297,223 +432,182 @@ static void ColouriseErlangDoc(unsigned int startPos, int length, int initStyle,
} else { } else {
sc.SetState(SCE_ERLANG_DEFAULT); sc.SetState(SCE_ERLANG_DEFAULT);
} }
} else if (sc.state == SCE_ERLANG_VARIABLE) { } break;
if (!isalnum(sc.ch) && sc.ch != '_') {
sc.SetState(SCE_ERLANG_DEFAULT);
}
} else if (sc.state == SCE_ERLANG_STRING) {
if (sc.ch == '\"' && sc.chPrev != '\\') {
sc.ForwardSetState(SCE_ERLANG_DEFAULT);
}
} else if (sc.state == SCE_ERLANG_COMMENT ) {
if (sc.atLineEnd) {
sc.SetState(SCE_ERLANG_DEFAULT);
}
} else if (sc.state == SCE_ERLANG_CHARACTER ) {
if ( sc.chPrev == '\\' ) {
sc.ForwardSetState(SCE_ERLANG_DEFAULT);
} else if ( sc.ch != '\\' ) {
sc.ForwardSetState(SCE_ERLANG_DEFAULT);
} }
} }
if (sc.state == SCE_ERLANG_DEFAULT) { if (sc.state == SCE_ERLANG_DEFAULT) {
if (sc.ch == '%') { bool no_new_state = false;
switch (sc.ch) {
case '\"' : sc.SetState(SCE_ERLANG_STRING); break;
case '$' : sc.SetState(SCE_ERLANG_CHARACTER); break;
case '%' : {
parse_state = COMMENT;
sc.SetState(SCE_ERLANG_COMMENT); sc.SetState(SCE_ERLANG_COMMENT);
} else if (sc.ch == '\"') { } break;
sc.SetState(SCE_ERLANG_STRING); case '#' : {
} else if (sc.ch == '#') {
parse_state = RECORD_START; parse_state = RECORD_START;
sc.SetState(SCE_ERLANG_UNKNOWN); sc.SetState(SCE_ERLANG_UNKNOWN);
} else if (sc.ch == '?') { } break;
case '?' : {
parse_state = MACRO_START; parse_state = MACRO_START;
sc.SetState(SCE_ERLANG_UNKNOWN); sc.SetState(SCE_ERLANG_UNKNOWN);
} else if (sc.ch == '$') { } break;
sc.SetState(SCE_ERLANG_CHARACTER); case '\'' : {
} else if (sc.ch == '\'') {
parse_state = ATOM_QUOTED; parse_state = ATOM_QUOTED;
sc.SetState(SCE_ERLANG_UNKNOWN); sc.SetState(SCE_ERLANG_UNKNOWN);
} else if ( isdigit(sc.ch) ) { } break;
case '+' :
case '-' : {
if (IsADigit(sc.chNext)) {
parse_state = NUMERAL_START;
radix_digits = 0;
sc.SetState(SCE_ERLANG_UNKNOWN);
} else if (sc.ch != '+') {
parse_state = PREPROCESSOR;
sc.SetState(SCE_ERLANG_UNKNOWN);
}
} break;
default : no_new_state = true;
}
if (no_new_state) {
if (isdigit(sc.ch)) {
parse_state = NUMERAL_START; parse_state = NUMERAL_START;
radix_digits = sc.ch - '0'; radix_digits = sc.ch - '0';
sc.SetState(SCE_ERLANG_UNKNOWN); sc.SetState(SCE_ERLANG_UNKNOWN);
} else if ( '.' == sc.ch ) { } else if (isupper(sc.ch) || '_' == sc.ch) {
parse_state = NUMERAL_SPECULATIVE_MANTISSA;
sc.SetState(SCE_ERLANG_UNKNOWN);
} else if (isalpha(sc.ch) && isupper(sc.ch)) {
sc.SetState(SCE_ERLANG_VARIABLE); sc.SetState(SCE_ERLANG_VARIABLE);
} else if (isalpha(sc.ch)) { } else if (isalpha(sc.ch)) {
parse_state = ATOM_UNQUOTED; parse_state = ATOM_UNQUOTED;
sc.SetState(SCE_ERLANG_UNKNOWN); sc.SetState(SCE_ERLANG_UNKNOWN);
} else if (isoperator(static_cast<char>(sc.ch)) || sc.ch == '\\') { } else if (isoperator(static_cast<char>(sc.ch))
|| sc.ch == '\\') {
sc.SetState(SCE_ERLANG_OPERATOR); sc.SetState(SCE_ERLANG_OPERATOR);
} }
} }
} }
}
sc.Complete(); sc.Complete();
} }
static int ClassifyFoldPointErlang( static int ClassifyErlangFoldPoint(
Accessor &styler, Accessor &styler,
int styleNext, int styleNext,
int keyword_start int keyword_start
) { ) {
int lev = 0; int lev = 0;
if ( styler.Match(keyword_start,"case") if (styler.Match(keyword_start,"case")
|| ( || (
styler.Match(keyword_start,"fun") styler.Match(keyword_start,"fun")
&& SCE_ERLANG_FUNCTION_NAME != styleNext) && (SCE_ERLANG_FUNCTION_NAME != styleNext)
)
|| styler.Match(keyword_start,"if") || styler.Match(keyword_start,"if")
|| styler.Match(keyword_start,"query") || styler.Match(keyword_start,"query")
|| styler.Match(keyword_start,"receive") || styler.Match(keyword_start,"receive")
) { ) {
++lev; ++lev;
} else if ( styler.Match(keyword_start,"end") ) { } else if (styler.Match(keyword_start,"end")) {
--lev; --lev;
} }
return lev; return lev;
} }
static void FoldErlangDoc( static void FoldErlangDoc(
unsigned int startPos, int length, int initStyle, unsigned int startPos, int length, int initStyle,
WordList** /*keywordlists*/, Accessor &styler WordList** /*keywordlists*/, Accessor &styler
) { ) {
unsigned int endPos = startPos + length; unsigned int endPos = startPos + length;
//~ int visibleChars = 0; int currentLine = styler.GetLine(startPos);
int lineCurrent = styler.GetLine(startPos); int lev;
int levelPrev = styler.LevelAt(lineCurrent) & SC_FOLDLEVELNUMBERMASK; int previousLevel = styler.LevelAt(currentLine) & SC_FOLDLEVELNUMBERMASK;
int levelCurrent = levelPrev; int currentLevel = previousLevel;
char chNext = styler.SafeGetCharAt(startPos);
int styleNext = styler.StyleAt(startPos); int styleNext = styler.StyleAt(startPos);
int style = initStyle; int style = initStyle;
int stylePrev;
int keyword_start = 0; int keyword_start = 0;
char ch;
bool fold_keywords = true; char chNext = styler.SafeGetCharAt(startPos);
bool fold_comments = true; bool atEOL;
bool fold_braces = true;
bool fold_function_clauses = false;
bool fold_clauses = false;
//int clause_level = 0;
for (unsigned int i = startPos; i < endPos; i++) { for (unsigned int i = startPos; i < endPos; i++) {
char ch = chNext; ch = chNext;
chNext = styler.SafeGetCharAt(i + 1); chNext = styler.SafeGetCharAt(i + 1);
int stylePrev = style;
// Get styles
stylePrev = style;
style = styleNext; style = styleNext;
styleNext = styler.StyleAt(i + 1); styleNext = styler.StyleAt(i + 1);
bool atEOL = (ch == '\r' && chNext != '\n') || (ch == '\n'); atEOL = ((ch == '\r') && (chNext != '\n')) || (ch == '\n');
if ( (stylePrev != SCE_ERLANG_KEYWORD) && (style == SCE_ERLANG_KEYWORD) ) { if (stylePrev != SCE_ERLANG_KEYWORD
&& style == SCE_ERLANG_KEYWORD) {
keyword_start = i; keyword_start = i;
} }
if ( fold_keywords ) {
if ( (stylePrev == SCE_ERLANG_KEYWORD) // Fold on keywords
&& (style != SCE_ERLANG_KEYWORD) if (stylePrev == SCE_ERLANG_KEYWORD
&& (style != SCE_ERLANG_ATOM) && style != SCE_ERLANG_KEYWORD
&& style != SCE_ERLANG_ATOM
) { ) {
levelCurrent += ClassifyFoldPointErlang(styler,styleNext,keyword_start); currentLevel += ClassifyErlangFoldPoint(styler,
styleNext,
keyword_start);
}
// Fold on comments
if (style == SCE_ERLANG_COMMENT
|| style == SCE_ERLANG_COMMENT_MODULE
|| style == SCE_ERLANG_COMMENT_FUNCTION) {
if (ch == '%' && chNext == '{') {
currentLevel++;
} else if (ch == '%' && chNext == '}') {
currentLevel--;
} }
} }
if ( fold_comments ) { // Fold on braces
if (style == SCE_ERLANG_COMMENT) {
if ((ch == '%') && (chNext == '{')) {
levelCurrent++;
} else if ((ch == '%') && (chNext == '}')) {
levelCurrent--;
}
}
}
if ( fold_function_clauses ) {
if ( (SC_FOLDLEVELBASE == levelCurrent) /*&& (style == SCE_ERLANG_OPERATOR)*/ ) {
if ( (ch == '-') && (chNext == '>')) {
//~ fprintf(stderr,"levelCurrent=%d\n", levelCurrent);
//++clause_level;
//~ if ( 0 < clause_level )
++levelCurrent;
}
}
//~ if ( (stylePrev != SCE_ERLANG_RECORD)
//~ && (style != SCE_ERLANG_NUMBER)
//~ && (style != SCE_ERLANG_STRING)
//~ && (style != SCE_ERLANG_COMMENT)
//~ ) {
if ( (SC_FOLDLEVELBASE+1 == levelCurrent) && (ch == '.') ) {
//--clause_level;
//~ if ( 0 == clause_level )
--levelCurrent;
}
//~ }
}
if ( fold_clauses ) {
if ( (0 < levelCurrent) && (style == SCE_ERLANG_OPERATOR) ) {
if ((ch == '-') && (chNext == '>')) {
levelCurrent++;
}
if ( (ch == ';') ) {
levelCurrent--;
}
}
if ( (stylePrev != SCE_ERLANG_RECORD)
&& (style != SCE_ERLANG_NUMBER)
&& (style != SCE_ERLANG_STRING)
&& (style != SCE_ERLANG_COMMENT)
) {
if ( (ch == '.') ) {
levelCurrent--;
}
}
if ( (stylePrev == SCE_ERLANG_KEYWORD)
&& (style != SCE_ERLANG_KEYWORD)
&& (style != SCE_ERLANG_ATOM)
&& (
styler.Match(keyword_start,"end") // 'end' counted twice if fold_keywords too
|| styler.Match(keyword_start,"after") )
) {
levelCurrent--;
}
}
if ( fold_braces ) {
if (style == SCE_ERLANG_OPERATOR) { if (style == SCE_ERLANG_OPERATOR) {
if ( (ch == '{') || (ch == '(') || (ch == '[') ) { if (ch == '{' || ch == '(' || ch == '[') {
levelCurrent++; currentLevel++;
} else if ( (ch == '}') || (ch == ')') || (ch == ']') ) { } else if (ch == '}' || ch == ')' || ch == ']') {
levelCurrent--; currentLevel--;
}
} }
} }
if (atEOL) { if (atEOL) {
int lev = levelPrev; lev = previousLevel;
//~ if (visibleChars == 0 && foldCompact)
//~ lev |= SC_FOLDLEVELWHITEFLAG; if (currentLevel > previousLevel)
//~ if ((levelCurrent > levelPrev) && (visibleChars > 0))
if ((levelCurrent > levelPrev)) {
lev |= SC_FOLDLEVELHEADERFLAG; lev |= SC_FOLDLEVELHEADERFLAG;
if (lev != styler.LevelAt(currentLine))
styler.SetLevel(currentLine, lev);
currentLine++;
previousLevel = currentLevel;
} }
if (lev != styler.LevelAt(lineCurrent)) {
styler.SetLevel(lineCurrent, lev);
}
lineCurrent++;
levelPrev = levelCurrent;
//~ visibleChars = 0;
}
//~ if (!isspacechar(ch))
//~ visibleChars++;
} }
// Fill in the real level of the next line, keeping the current flags as they will be filled in later // Fill in the real level of the next line, keeping the current flags as they will be filled in later
int flagsNext = styler.LevelAt(lineCurrent) & ~SC_FOLDLEVELNUMBERMASK; styler.SetLevel(currentLine,
styler.SetLevel(lineCurrent, levelPrev | flagsNext); previousLevel
| (styler.LevelAt(currentLine) & ~SC_FOLDLEVELNUMBERMASK));
} }
static const char * const erlangWordListDesc[] = { static const char * const erlangWordListDesc[] = {
"Keywords", "Erlang Reserved words",
"Erlang BIFs",
"Erlang Preprocessor",
"Erlang Module Attributes",
"Erlang Documentation",
"Erlang Documentation Macro",
0 0
}; };
@ -523,4 +617,3 @@ LexerModule lmErlang(
"erlang", "erlang",
FoldErlangDoc, FoldErlangDoc,
erlangWordListDesc); erlangWordListDesc);

View File

@ -1,9 +1,10 @@
// Scintilla source code edit control // Scintilla source code edit control
/** @file LexFlagShip.cxx /** @file LexFlagShip.cxx
** Lexer for FlagShip ** Lexer for Harbour and FlagShip.
** (Syntactically compatible to other XBase dialects, like dBase, Clipper, Fox etc.) ** (Syntactically compatible to other xBase dialects, like Clipper, dBase, Clip, FoxPro etc.)
**/ **/
// Copyright 2005 by Randy Butler // Copyright 2005 by Randy Butler
// Copyright 2010 by Xavi <jarabal/at/gmail.com> (Harbour)
// Copyright 1998-2003 by Neil Hodgson <neilh@scintilla.org> // Copyright 1998-2003 by Neil Hodgson <neilh@scintilla.org>
// The License.txt file describes the conditions under which this software may be distributed. // The License.txt file describes the conditions under which this software may be distributed.
@ -21,149 +22,276 @@
#include "KeyWords.h" #include "KeyWords.h"
#include "Scintilla.h" #include "Scintilla.h"
#include "SciLexer.h" #include "SciLexer.h"
#include "CharacterSet.h"
#ifdef SCI_NAMESPACE #ifdef SCI_NAMESPACE
using namespace Scintilla; using namespace Scintilla;
#endif #endif
static bool IsFlagShipComment(Accessor &styler, int pos, int len) {
return len>0 && styler[pos]=='\'';
}
static inline bool IsTypeCharacter(int ch) {
return ch == '%' || ch == '&' || ch == '@' || ch == '!' || ch == '#' || ch == '$';
}
// Extended to accept accented characters // Extended to accept accented characters
static inline bool IsAWordChar(int ch) { static inline bool IsAWordChar(int ch)
return ch >= 0x80 || {
(isalnum(ch) || ch == '.' || ch == '_');
}
static inline bool IsAWordStart(int ch) {
return ch >= 0x80 || return ch >= 0x80 ||
(isalnum(ch) || ch == '_'); (isalnum(ch) || ch == '_');
} }
static inline bool IsADateCharacter(const int ch) {
return (ch < 0x80) &&
(isalnum(ch) || ch == '|' || ch == '-' || ch == '/' || ch == ':' || ch == ' ' || ch == '\t');
}
static void ColouriseFlagShipDoc(unsigned int startPos, int length, int initStyle, static void ColouriseFlagShipDoc(unsigned int startPos, int length, int initStyle,
WordList *keywordlists[], Accessor &styler) { WordList *keywordlists[], Accessor &styler)
{
//bool FSScriptSyntax = true;
WordList &keywords = *keywordlists[0]; WordList &keywords = *keywordlists[0];
WordList &keywords2 = *keywordlists[1]; WordList &keywords2 = *keywordlists[1];
WordList &keywords3 = *keywordlists[2]; WordList &keywords3 = *keywordlists[2];
WordList &keywords4 = *keywordlists[3]; WordList &keywords4 = *keywordlists[3];
WordList &keywords5 = *keywordlists[4];
styler.StartAt(startPos); // property lexer.flagship.styling.within.preprocessor
// For Harbour code, determines whether all preprocessor code is styled in the preprocessor style (0) or only from the
// initial # to the end of the command word(1, the default). It also determines how to present text, dump, and disabled code.
bool stylingWithinPreprocessor = styler.GetPropertyInt("lexer.flagship.styling.within.preprocessor", 1) != 0;
CharacterSet setDoxygen(CharacterSet::setAlpha, "$@\\&<>#{}[]");
int visibleChars = 0; int visibleChars = 0;
int closeStringChar = 0;
int styleBeforeDCKeyword = SCE_FS_DEFAULT;
bool bEnableCode = initStyle < SCE_FS_DISABLEDCODE;
StyleContext sc(startPos, length, initStyle, styler); StyleContext sc(startPos, length, initStyle, styler);
for (; sc.More(); sc.Forward()) { for (; sc.More(); sc.Forward()) {
if (sc.state == SCE_FS_OPERATOR) { // Determine if the current state should terminate.
sc.SetState(SCE_FS_DEFAULT); switch (sc.state) {
} else if (sc.state == SCE_FS_IDENTIFIER) { case SCE_FS_OPERATOR:
case SCE_FS_OPERATOR_C:
case SCE_FS_WORDOPERATOR:
sc.SetState(bEnableCode ? SCE_FS_DEFAULT : SCE_FS_DEFAULT_C);
break;
case SCE_FS_IDENTIFIER:
case SCE_FS_IDENTIFIER_C:
if (!IsAWordChar(sc.ch)) { if (!IsAWordChar(sc.ch)) {
char s[100]; char s[64];
sc.GetCurrentLowered(s, sizeof(s)); sc.GetCurrentLowered(s, sizeof(s));
if (keywords.InList(s)) { if (keywords.InList(s)) {
sc.ChangeState(SCE_FS_KEYWORD); sc.ChangeState(bEnableCode ? SCE_FS_KEYWORD : SCE_FS_KEYWORD_C);
} else if (keywords2.InList(s)) { } else if (keywords2.InList(s)) {
sc.ChangeState(SCE_FS_KEYWORD2); sc.ChangeState(bEnableCode ? SCE_FS_KEYWORD2 : SCE_FS_KEYWORD2_C);
} else if (keywords3.InList(s)) { } else if (bEnableCode && keywords3.InList(s)) {
sc.ChangeState(SCE_FS_KEYWORD3); sc.ChangeState(SCE_FS_KEYWORD3);
} else if (keywords4.InList(s)) { } else if (bEnableCode && keywords4.InList(s)) {
sc.ChangeState(SCE_FS_KEYWORD4); sc.ChangeState(SCE_FS_KEYWORD4);
}// Else, it is really an identifier... }// Else, it is really an identifier...
sc.SetState(bEnableCode ? SCE_FS_DEFAULT : SCE_FS_DEFAULT_C);
}
break;
case SCE_FS_NUMBER:
if (!IsAWordChar(sc.ch) && !(sc.ch == '.' && IsADigit(sc.chNext))) {
sc.SetState(SCE_FS_DEFAULT); sc.SetState(SCE_FS_DEFAULT);
} }
} else if (sc.state == SCE_FS_NUMBER) { break;
case SCE_FS_NUMBER_C:
if (!IsAWordChar(sc.ch) && sc.ch != '.') {
sc.SetState(SCE_FS_DEFAULT_C);
}
break;
case SCE_FS_CONSTANT:
if (!IsAWordChar(sc.ch)) { if (!IsAWordChar(sc.ch)) {
sc.SetState(SCE_FS_DEFAULT); sc.SetState(SCE_FS_DEFAULT);
} }
} else if (sc.state == SCE_FS_STRING) { break;
// VB doubles quotes to preserve them, so just end this string case SCE_FS_STRING:
// state now as a following quote will start again case SCE_FS_STRING_C:
if (sc.ch == '\"') { if (sc.ch == closeStringChar) {
if (tolower(sc.chNext) == 'c') { sc.ForwardSetState(bEnableCode ? SCE_FS_DEFAULT : SCE_FS_DEFAULT_C);
sc.Forward(); } else if (sc.atLineEnd) {
sc.ChangeState(bEnableCode ? SCE_FS_STRINGEOL : SCE_FS_STRINGEOL_C);
} }
break;
case SCE_FS_STRINGEOL:
case SCE_FS_STRINGEOL_C:
if (sc.atLineStart) {
sc.SetState(bEnableCode ? SCE_FS_DEFAULT : SCE_FS_DEFAULT_C);
}
break;
case SCE_FS_COMMENTDOC:
case SCE_FS_COMMENTDOC_C:
if (sc.Match('*', '/')) {
sc.Forward();
sc.ForwardSetState(bEnableCode ? SCE_FS_DEFAULT : SCE_FS_DEFAULT_C);
} else if (sc.ch == '@' || sc.ch == '\\') { // JavaDoc and Doxygen support
// Verify that we have the conditions to mark a comment-doc-keyword
if ((IsASpace(sc.chPrev) || sc.chPrev == '*') && (!IsASpace(sc.chNext))) {
styleBeforeDCKeyword = bEnableCode ? SCE_FS_COMMENTDOC : SCE_FS_COMMENTDOC_C;
sc.SetState(SCE_FS_COMMENTDOCKEYWORD);
}
}
break;
case SCE_FS_COMMENT:
case SCE_FS_COMMENTLINE:
if (sc.atLineStart) {
sc.SetState(SCE_FS_DEFAULT);
}
break;
case SCE_FS_COMMENTLINEDOC:
case SCE_FS_COMMENTLINEDOC_C:
if (sc.atLineStart) {
sc.SetState(bEnableCode ? SCE_FS_DEFAULT : SCE_FS_DEFAULT_C);
} else if (sc.ch == '@' || sc.ch == '\\') { // JavaDoc and Doxygen support
// Verify that we have the conditions to mark a comment-doc-keyword
if ((IsASpace(sc.chPrev) || sc.chPrev == '/' || sc.chPrev == '!') && (!IsASpace(sc.chNext))) {
styleBeforeDCKeyword = bEnableCode ? SCE_FS_COMMENTLINEDOC : SCE_FS_COMMENTLINEDOC_C;
sc.SetState(SCE_FS_COMMENTDOCKEYWORD);
}
}
break;
case SCE_FS_COMMENTDOCKEYWORD:
if ((styleBeforeDCKeyword == SCE_FS_COMMENTDOC || styleBeforeDCKeyword == SCE_FS_COMMENTDOC_C) &&
sc.Match('*', '/')) {
sc.ChangeState(SCE_FS_COMMENTDOCKEYWORDERROR);
sc.Forward();
sc.ForwardSetState(bEnableCode ? SCE_FS_DEFAULT : SCE_FS_DEFAULT_C);
} else if (!setDoxygen.Contains(sc.ch)) {
char s[64];
sc.GetCurrentLowered(s, sizeof(s));
if (!IsASpace(sc.ch) || !keywords5.InList(s + 1)) {
sc.ChangeState(SCE_FS_COMMENTDOCKEYWORDERROR);
}
sc.SetState(styleBeforeDCKeyword);
}
break;
case SCE_FS_PREPROCESSOR:
case SCE_FS_PREPROCESSOR_C:
if (sc.atLineEnd) {
if (!(sc.chPrev == ';' || sc.GetRelative(-2) == ';')) {
sc.SetState(bEnableCode ? SCE_FS_DEFAULT : SCE_FS_DEFAULT_C);
}
} else if (stylingWithinPreprocessor) {
if (IsASpaceOrTab(sc.ch)) {
sc.SetState(bEnableCode ? SCE_FS_DEFAULT : SCE_FS_DEFAULT_C);
}
} else if (sc.Match('/', '*') || sc.Match('/', '/') || sc.Match('&', '&')) {
sc.SetState(bEnableCode ? SCE_FS_DEFAULT : SCE_FS_DEFAULT_C);
}
break;
case SCE_FS_DISABLEDCODE:
if (sc.ch == '#' && visibleChars == 0) {
sc.SetState(bEnableCode ? SCE_FS_PREPROCESSOR : SCE_FS_PREPROCESSOR_C);
do { // Skip whitespace between # and preprocessor word
sc.Forward();
} while (IsASpaceOrTab(sc.ch) && sc.More());
if (sc.MatchIgnoreCase("pragma")) {
sc.Forward(6);
do { // Skip more whitespace until keyword
sc.Forward();
} while (IsASpaceOrTab(sc.ch) && sc.More());
if (sc.MatchIgnoreCase("enddump") || sc.MatchIgnoreCase("__endtext")) {
bEnableCode = true;
sc.SetState(SCE_FS_DISABLEDCODE);
sc.Forward(sc.ch == '_' ? 8 : 6);
sc.ForwardSetState(SCE_FS_DEFAULT);
} else {
sc.ChangeState(SCE_FS_DISABLEDCODE);
}
} else {
sc.ChangeState(SCE_FS_DISABLEDCODE);
}
}
break;
case SCE_FS_DATE:
if (sc.ch == '}') {
sc.ForwardSetState(SCE_FS_DEFAULT); sc.ForwardSetState(SCE_FS_DEFAULT);
} else if (sc.atLineEnd) { } else if (sc.atLineEnd) {
sc.ChangeState(SCE_FS_STRINGEOL); sc.ChangeState(SCE_FS_STRINGEOL);
sc.ForwardSetState(SCE_FS_DEFAULT);
}
} else if (sc.state == SCE_FS_COMMENT) {
if (sc.Match('*', '/')) { // new code
sc.Forward();
sc.ForwardSetState(SCE_FS_DEFAULT);
//if (sc.atLineEnd) { // old code
// sc.SetState(SCE_FS_DEFAULT);
}
} else if (sc.state == SCE_FS_COMMENTLINE) { //new code
if (sc.ch == '\r' || sc.ch == '\n') {
sc.SetState(SCE_FS_DEFAULT);
visibleChars = 0;
}
} else if (sc.state == SCE_FS_PREPROCESSOR) {
if (sc.atLineEnd) {
sc.SetState(SCE_FS_DEFAULT);
}
} else if (sc.state == SCE_FS_DATE) {
if (sc.ch == '#' || !IsADateCharacter(sc.chNext)) {
sc.ForwardSetState(SCE_FS_DEFAULT);
} }
} }
// Determine if a new state should be entered. // Determine if a new state should be entered.
if (sc.state == SCE_FS_DEFAULT) { if (sc.state == SCE_FS_DEFAULT || sc.state == SCE_FS_DEFAULT_C) {
if (sc.Match('/', '*')) { // New code if (bEnableCode &&
sc.SetState(SCE_FS_COMMENT); (sc.MatchIgnoreCase(".and.") || sc.MatchIgnoreCase(".not."))) {
sc.Forward(); // Eat the * so it isn't used for the end of the comment sc.SetState(SCE_FS_WORDOPERATOR);
//if (sc.ch == '\'') { // Old code sc.Forward(4);
// sc.SetState(SCE_FS_COMMENT); // old code } else if (bEnableCode && sc.MatchIgnoreCase(".or.")) {
} else if (sc.Match('/', '/')) { // New code sc.SetState(SCE_FS_WORDOPERATOR);
sc.Forward(3);
} else if (bEnableCode &&
(sc.MatchIgnoreCase(".t.") || sc.MatchIgnoreCase(".f.") ||
(!IsAWordChar(sc.GetRelative(3)) && sc.MatchIgnoreCase("nil")))) {
sc.SetState(SCE_FS_CONSTANT);
sc.Forward(2);
} else if (sc.Match('/', '*')) {
sc.SetState(bEnableCode ? SCE_FS_COMMENTDOC : SCE_FS_COMMENTDOC_C);
sc.Forward();
} else if (bEnableCode && sc.Match('&', '&')) {
sc.SetState(SCE_FS_COMMENTLINE); sc.SetState(SCE_FS_COMMENTLINE);
} else if (sc.ch == '\"') { sc.Forward();
sc.SetState(SCE_FS_STRING); } else if (sc.Match('/', '/')) {
sc.SetState(bEnableCode ? SCE_FS_COMMENTLINEDOC : SCE_FS_COMMENTLINEDOC_C);
sc.Forward();
} else if (bEnableCode && sc.ch == '*' && visibleChars == 0) {
sc.SetState(SCE_FS_COMMENT);
} else if (sc.ch == '\"' || sc.ch == '\'') {
sc.SetState(bEnableCode ? SCE_FS_STRING : SCE_FS_STRING_C);
closeStringChar = sc.ch;
} else if (closeStringChar == '>' && sc.ch == '<') {
sc.SetState(bEnableCode ? SCE_FS_STRING : SCE_FS_STRING_C);
} else if (sc.ch == '#' && visibleChars == 0) { } else if (sc.ch == '#' && visibleChars == 0) {
// Preprocessor commands are alone on their line sc.SetState(bEnableCode ? SCE_FS_PREPROCESSOR : SCE_FS_PREPROCESSOR_C);
sc.SetState(SCE_FS_PREPROCESSOR); do { // Skip whitespace between # and preprocessor word
} else if (sc.ch == '#') { sc.Forward();
int n = 1; } while (IsASpaceOrTab(sc.ch) && sc.More());
int chSeek = ' '; if (sc.atLineEnd) {
while ((n < 100) && (chSeek == ' ' || chSeek == '\t')) { sc.SetState(bEnableCode ? SCE_FS_DEFAULT : SCE_FS_DEFAULT_C);
chSeek = sc.GetRelative(n); } else if (sc.MatchIgnoreCase("include")) {
n++; if (stylingWithinPreprocessor) {
closeStringChar = '>';
} }
if (IsADigit(chSeek)) { } else if (sc.MatchIgnoreCase("pragma")) {
sc.Forward(6);
do { // Skip more whitespace until keyword
sc.Forward();
} while (IsASpaceOrTab(sc.ch) && sc.More());
if (sc.MatchIgnoreCase("begindump") || sc.MatchIgnoreCase("__cstream")) {
bEnableCode = false;
if (stylingWithinPreprocessor) {
sc.SetState(SCE_FS_DISABLEDCODE);
sc.Forward(8);
sc.ForwardSetState(SCE_FS_DEFAULT_C);
} else {
sc.SetState(SCE_FS_DISABLEDCODE);
}
} else if (sc.MatchIgnoreCase("enddump") || sc.MatchIgnoreCase("__endtext")) {
bEnableCode = true;
sc.SetState(SCE_FS_DISABLEDCODE);
sc.Forward(sc.ch == '_' ? 8 : 6);
sc.ForwardSetState(SCE_FS_DEFAULT);
}
}
} else if (bEnableCode && sc.ch == '{') {
int p = 0;
int chSeek;
unsigned int endPos(startPos + length);
do { // Skip whitespace
chSeek = sc.GetRelative(++p);
} while (IsASpaceOrTab(chSeek) && (sc.currentPos + p < endPos));
if (chSeek == '^') {
sc.SetState(SCE_FS_DATE); sc.SetState(SCE_FS_DATE);
} else { } else {
sc.SetState(SCE_FS_OPERATOR); sc.SetState(SCE_FS_OPERATOR);
} }
} else if (sc.ch == '&' && tolower(sc.chNext) == 'h') {
sc.SetState(SCE_FS_NUMBER);
} else if (sc.ch == '&' && tolower(sc.chNext) == 'o') {
sc.SetState(SCE_FS_NUMBER);
} else if (IsADigit(sc.ch) || (sc.ch == '.' && IsADigit(sc.chNext))) { } else if (IsADigit(sc.ch) || (sc.ch == '.' && IsADigit(sc.chNext))) {
sc.SetState(SCE_FS_NUMBER); sc.SetState(bEnableCode ? SCE_FS_NUMBER : SCE_FS_NUMBER_C);
} else if (IsAWordStart(sc.ch) || (sc.ch == '[')) { } else if (IsAWordChar(sc.ch)) {
sc.SetState(SCE_FS_IDENTIFIER); sc.SetState(bEnableCode ? SCE_FS_IDENTIFIER : SCE_FS_IDENTIFIER_C);
} else if (isoperator(static_cast<char>(sc.ch)) || (sc.ch == '\\')) { } else if (isoperator(static_cast<char>(sc.ch)) || (bEnableCode && sc.ch == '@')) {
sc.SetState(SCE_FS_OPERATOR); sc.SetState(bEnableCode ? SCE_FS_OPERATOR : SCE_FS_OPERATOR_C);
} }
} }
if (sc.atLineEnd) { if (sc.atLineEnd) {
visibleChars = 0; visibleChars = 0;
closeStringChar = 0;
} }
if (!IsASpace(sc.ch)) { if (!IsASpace(sc.ch)) {
visibleChars++; visibleChars++;
@ -173,36 +301,33 @@ static void ColouriseFlagShipDoc(unsigned int startPos, int length, int initStyl
} }
static void FoldFlagShipDoc(unsigned int startPos, int length, int, static void FoldFlagShipDoc(unsigned int startPos, int length, int,
WordList *[], Accessor &styler) { WordList *[], Accessor &styler)
{
int endPos = startPos + length; int endPos = startPos + length;
// Backtrack to previous line in case need to fix its fold status // Backtrack to previous line in case need to fix its fold status
int lineCurrent = styler.GetLine(startPos); int lineCurrent = styler.GetLine(startPos);
if (startPos > 0) { if (startPos > 0 && lineCurrent > 0) {
if (lineCurrent > 0) {
lineCurrent--; lineCurrent--;
startPos = styler.LineStart(lineCurrent); startPos = styler.LineStart(lineCurrent);
} }
}
int spaceFlags = 0; int spaceFlags = 0;
int indentCurrent = styler.IndentAmount(lineCurrent, &spaceFlags, IsFlagShipComment); int indentCurrent = styler.IndentAmount(lineCurrent, &spaceFlags);
char chNext = styler[startPos]; char chNext = styler[startPos];
for (int i = startPos; i < endPos; i++) { for (int i = startPos; i < endPos; i++) {
char ch = chNext; char ch = chNext;
chNext = styler.SafeGetCharAt(i + 1); chNext = styler.SafeGetCharAt(i + 1);
if ((ch == '\r' && chNext != '\n') || (ch == '\n') || (i == endPos)) { if ((ch == '\r' && chNext != '\n') || (ch == '\n') || (i == endPos-1)) {
int lev = indentCurrent; int lev = indentCurrent;
int indentNext = styler.IndentAmount(lineCurrent + 1, &spaceFlags, IsFlagShipComment); int indentNext = styler.IndentAmount(lineCurrent + 1, &spaceFlags);
if (!(indentCurrent & SC_FOLDLEVELWHITEFLAG)) { if (!(indentCurrent & SC_FOLDLEVELWHITEFLAG)) {
// Only non whitespace lines can be headers
if ((indentCurrent & SC_FOLDLEVELNUMBERMASK) < (indentNext & SC_FOLDLEVELNUMBERMASK)) { if ((indentCurrent & SC_FOLDLEVELNUMBERMASK) < (indentNext & SC_FOLDLEVELNUMBERMASK)) {
lev |= SC_FOLDLEVELHEADERFLAG; lev |= SC_FOLDLEVELHEADERFLAG;
} else if (indentNext & SC_FOLDLEVELWHITEFLAG) { } else if (indentNext & SC_FOLDLEVELWHITEFLAG) {
// Line after is blank so check the next - maybe should continue further?
int spaceFlags2 = 0; int spaceFlags2 = 0;
int indentNext2 = styler.IndentAmount(lineCurrent + 2, &spaceFlags2, IsFlagShipComment); int indentNext2 = styler.IndentAmount(lineCurrent + 2, &spaceFlags2);
if ((indentCurrent & SC_FOLDLEVELNUMBERMASK) < (indentNext2 & SC_FOLDLEVELNUMBERMASK)) { if ((indentCurrent & SC_FOLDLEVELNUMBERMASK) < (indentNext2 & SC_FOLDLEVELNUMBERMASK)) {
lev |= SC_FOLDLEVELHEADERFLAG; lev |= SC_FOLDLEVELHEADERFLAG;
} }
@ -215,16 +340,13 @@ static void FoldFlagShipDoc(unsigned int startPos, int length, int,
} }
} }
static const char * const FSWordListDesc[] = { static const char * const FSWordListDesc[] = {
"Keywords", "Keywords Commands",
"functions", "Std Library Functions",
"user2", "Procedure, return, exit",
"user3", "Class (oop)",
"Doxygen keywords",
0 0
}; };
LexerModule lmFlagShip(SCLEX_FLAGSHIP, ColouriseFlagShipDoc, "flagship", FoldFlagShipDoc, FSWordListDesc); LexerModule lmFlagShip(SCLEX_FLAGSHIP, ColouriseFlagShipDoc, "flagship", FoldFlagShipDoc, FSWordListDesc);

View File

@ -26,7 +26,7 @@ using namespace Scintilla;
#endif #endif
static inline bool IsGAPOperator(char ch) { static inline bool IsGAPOperator(char ch) {
if (isalnum(ch)) return false; if (isascii(ch) && isalnum(ch)) return false;
if (ch == '+' || ch == '-' || ch == '*' || ch == '/' || if (ch == '+' || ch == '-' || ch == '*' || ch == '/' ||
ch == '^' || ch == ',' || ch == '!' || ch == '.' || ch == '^' || ch == ',' || ch == '!' || ch == '.' ||
ch == '=' || ch == '<' || ch == '>' || ch == '(' || ch == '=' || ch == '<' || ch == '>' || ch == '(' ||

View File

@ -181,7 +181,7 @@ def FindProperties(lexFile):
properties = {} properties = {}
f = open(lexFile) f = open(lexFile)
for l in f.readlines(): for l in f.readlines():
if "GetProperty" in l: if "GetProperty" in l and '"' in l:
l = l.strip() l = l.strip()
if not l.startswith("//"): # Drop comments if not l.startswith("//"): # Drop comments
propertyName = l.split("\"")[1] propertyName = l.split("\"")[1]
@ -275,7 +275,6 @@ def RegenerateAll():
# extracted from the Scintilla source ZIP (typically created on # extracted from the Scintilla source ZIP (typically created on
# Windows). # Windows).
Regenerate(root + "scintilla/gtk/makefile", "#", LF, lexFiles) Regenerate(root + "scintilla/gtk/makefile", "#", LF, lexFiles)
Regenerate(root + "scintilla/gtk/scintilla.mak", "#", NATIVE, lexFiles)
Regenerate(root + "scintilla/macosx/makefile", "#", LF, lexFiles) Regenerate(root + "scintilla/macosx/makefile", "#", LF, lexFiles)
if os.path.exists(root + "scite"): if os.path.exists(root + "scite"):
Regenerate(root + "scite/win32/makefile", "#", NATIVE, lexFiles, propFiles) Regenerate(root + "scite/win32/makefile", "#", NATIVE, lexFiles, propFiles)

View File

@ -69,6 +69,22 @@ static void GetTextSegment(Accessor &styler, unsigned int start, unsigned int en
s[i] = '\0'; s[i] = '\0';
} }
static const char *GetNextWord(Accessor &styler, unsigned int start, char *s, size_t sLen) {
size_t i = 0;
for (; i < sLen-1; i++) {
char ch = static_cast<char>(styler.SafeGetCharAt(start + i));
if ((i == 0) && !IsAWordStart(ch))
break;
if ((i > 0) && !IsAWordChar(ch))
break;
s[i] = ch;
}
s[i] = '\0';
return s;
}
static script_type segIsScriptingIndicator(Accessor &styler, unsigned int start, unsigned int end, script_type prevValue) { static script_type segIsScriptingIndicator(Accessor &styler, unsigned int start, unsigned int end, script_type prevValue) {
char s[100]; char s[100];
GetTextSegment(styler, start, end, s, sizeof(s)); GetTextSegment(styler, start, end, s, sizeof(s));
@ -486,6 +502,35 @@ static bool isOKBeforeRE(int ch) {
return (ch == '(') || (ch == '=') || (ch == ','); return (ch == '(') || (ch == '=') || (ch == ',');
} }
static bool isMakoBlockEnd(const int ch, const int chNext, const char *blockType) {
if (strlen(blockType) == 0) {
return ((ch == '%') && (chNext == '>'));
} else if ((0 == strcmp(blockType, "inherit")) ||
(0 == strcmp(blockType, "namespace")) ||
(0 == strcmp(blockType, "include")) ||
(0 == strcmp(blockType, "page"))) {
return ((ch == '/') && (chNext == '>'));
} else if (0 == strcmp(blockType, "%")) {
return isLineEnd(ch);
} else if (0 == strcmp(blockType, "{")) {
return ch == '}';
} else {
return (ch == '>');
}
}
static bool isDjangoBlockEnd(const int ch, const int chNext, const char *blockType) {
if (strlen(blockType) == 0) {
return 0;
} else if (0 == strcmp(blockType, "%")) {
return ((ch == '%') && (chNext == '}'));
} else if (0 == strcmp(blockType, "{")) {
return ((ch == '}') && (chNext == '}'));
} else {
return 0;
}
}
static bool isPHPStringState(int state) { static bool isPHPStringState(int state) {
return return
(state == SCE_HPHP_HSTRING) || (state == SCE_HPHP_HSTRING) ||
@ -558,6 +603,10 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
phpStringDelimiter[0] = '\0'; phpStringDelimiter[0] = '\0';
int StateToPrint = initStyle; int StateToPrint = initStyle;
int state = stateForPrintState(StateToPrint); int state = stateForPrintState(StateToPrint);
char makoBlockType[200];
makoBlockType[0] = '\0';
char djangoBlockType[2];
djangoBlockType[0] = '\0';
// If inside a tag, it may be a script tag, so reread from the start to ensure any language tags are seen // If inside a tag, it may be a script tag, so reread from the start to ensure any language tags are seen
if (InTagState(state)) { if (InTagState(state)) {
@ -608,6 +657,7 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
if (inScriptType == eNonHtmlScript && state == SCE_H_COMMENT) { if (inScriptType == eNonHtmlScript && state == SCE_H_COMMENT) {
scriptLanguage = eScriptComment; scriptLanguage = eScriptComment;
} }
script_type beforeLanguage = ScriptOfState(beforePreProc);
// property fold.html // property fold.html
// Folding is turned on or off for HTML and XML files with this option. // Folding is turned on or off for HTML and XML files with this option.
@ -642,6 +692,14 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
// Set to 0 to disable scripts in XML. // Set to 0 to disable scripts in XML.
const bool allowScripts = styler.GetPropertyInt("lexer.xml.allow.scripts", 1) != 0; const bool allowScripts = styler.GetPropertyInt("lexer.xml.allow.scripts", 1) != 0;
// property lexer.html.mako
// Set to 1 to enable the mako template language.
const bool isMako = styler.GetPropertyInt("lexer.html.mako", 0) != 0;
// property lexer.html.django
// Set to 1 to enable the django template language.
const bool isDjango = styler.GetPropertyInt("lexer.html.django", 0) != 0;
const CharacterSet setHTMLWord(CharacterSet::setAlphaNum, ".-_:!#", 0x80, true); const CharacterSet setHTMLWord(CharacterSet::setAlphaNum, ".-_:!#", 0x80, true);
const CharacterSet setTagContinue(CharacterSet::setAlphaNum, ".-_:!#[", 0x80, true); const CharacterSet setTagContinue(CharacterSet::setAlphaNum, ".-_:!#[", 0x80, true);
const CharacterSet setAttributeContinue(CharacterSet::setAlphaNum, ".-_:!#/", 0x80, true); const CharacterSet setAttributeContinue(CharacterSet::setAlphaNum, ".-_:!#/", 0x80, true);
@ -649,6 +707,7 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
int levelPrev = styler.LevelAt(lineCurrent) & SC_FOLDLEVELNUMBERMASK; int levelPrev = styler.LevelAt(lineCurrent) & SC_FOLDLEVELNUMBERMASK;
int levelCurrent = levelPrev; int levelCurrent = levelPrev;
int visibleChars = 0; int visibleChars = 0;
int lineStartVisibleChars = 0;
int chPrev = ' '; int chPrev = ' ';
int ch = ' '; int ch = ' ';
@ -689,6 +748,8 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
if ((!IsASpace(ch) || !foldCompact) && fold) if ((!IsASpace(ch) || !foldCompact) && fold)
visibleChars++; visibleChars++;
if (!IsASpace(ch))
lineStartVisibleChars++;
// decide what is the current state to print (depending of the script tag) // decide what is the current state to print (depending of the script tag)
StateToPrint = statePrintForState(state, inScriptType); StateToPrint = statePrintForState(state, inScriptType);
@ -757,6 +818,7 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
levelPrev = levelCurrent; levelPrev = levelCurrent;
} }
lineCurrent++; lineCurrent++;
lineStartVisibleChars = 0;
styler.SetLineState(lineCurrent, styler.SetLineState(lineCurrent,
((inScriptType & 0x03) << 0) | ((inScriptType & 0x03) << 0) |
((tagOpened & 0x01) << 2) | ((tagOpened & 0x01) << 2) |
@ -766,6 +828,11 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
((beforePreProc & 0xFF) << 12)); ((beforePreProc & 0xFF) << 12));
} }
// Allow falling through to mako handling code if newline is going to end a block
if (((ch == '\r' && chNext != '\n') || (ch == '\n')) &&
(!isMako || (0 != strcmp(makoBlockType, "%")))) {
}
// generic end of script processing // generic end of script processing
else if ((inScriptType == eNonHtmlScript) && (ch == '<') && (chNext == '/')) { else if ((inScriptType == eNonHtmlScript) && (ch == '<') && (chNext == '/')) {
// Check if it's the end of the script tag (or any other HTML tag) // Check if it's the end of the script tag (or any other HTML tag)
@ -850,8 +917,80 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
continue; continue;
} }
// handle the start Mako template Python code
else if (isMako && scriptLanguage == eScriptNone && ((ch == '<' && chNext == '%') ||
(lineStartVisibleChars == 1 && ch == '%') ||
(ch == '$' && chNext == '{') ||
(ch == '<' && chNext == '/' && chNext2 == '%'))) {
if (ch == '%')
strcpy(makoBlockType, "%");
else if (ch == '$')
strcpy(makoBlockType, "{");
else if (chNext == '/')
GetNextWord(styler, i+3, makoBlockType, sizeof(makoBlockType));
else
GetNextWord(styler, i+2, makoBlockType, sizeof(makoBlockType));
styler.ColourTo(i - 1, StateToPrint);
beforePreProc = state;
if (inScriptType == eNonHtmlScript)
inScriptType = eNonHtmlScriptPreProc;
else
inScriptType = eNonHtmlPreProc;
if (chNext == '/') {
i += 2;
visibleChars += 2;
} else if (ch != '%') {
i++;
visibleChars++;
}
state = SCE_HP_START;
scriptLanguage = eScriptPython;
styler.ColourTo(i, SCE_H_ASP);
if (foldHTMLPreprocessor && ch == '<')
levelCurrent++;
if (ch != '%' && ch != '$') {
i += strlen(makoBlockType);
visibleChars += strlen(makoBlockType);
if (keywords4.InList(makoBlockType))
styler.ColourTo(i, SCE_HP_WORD);
else
styler.ColourTo(i, SCE_H_TAGUNKNOWN);
}
ch = static_cast<unsigned char>(styler.SafeGetCharAt(i));
continue;
}
// handle the start Django template code
else if (isDjango && scriptLanguage != eScriptPython && (ch == '{' && (chNext == '%' || chNext == '{'))) {
if (chNext == '%')
strcpy(djangoBlockType, "%");
else
strcpy(djangoBlockType, "{");
styler.ColourTo(i - 1, StateToPrint);
beforePreProc = state;
if (inScriptType == eNonHtmlScript)
inScriptType = eNonHtmlScriptPreProc;
else
inScriptType = eNonHtmlPreProc;
i += 1;
visibleChars += 1;
state = SCE_HP_START;
beforeLanguage = scriptLanguage;
scriptLanguage = eScriptPython;
styler.ColourTo(i, SCE_H_ASP);
if (foldHTMLPreprocessor && chNext == '%')
levelCurrent++;
ch = static_cast<unsigned char>(styler.SafeGetCharAt(i));
continue;
}
// handle the start of ASP pre-processor = Non-HTML // handle the start of ASP pre-processor = Non-HTML
else if (!isCommentASPState(state) && (ch == '<') && (chNext == '%') && !isPHPStringState(state)) { else if (!isMako && !isDjango && !isCommentASPState(state) && (ch == '<') && (chNext == '%') && !isPHPStringState(state)) {
styler.ColourTo(i - 1, StateToPrint); styler.ColourTo(i - 1, StateToPrint);
beforePreProc = state; beforePreProc = state;
if (inScriptType == eNonHtmlScript) if (inScriptType == eNonHtmlScript)
@ -916,12 +1055,72 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
continue; continue;
} }
// handle the end of Mako Python code
else if (isMako &&
((inScriptType == eNonHtmlPreProc) || (inScriptType == eNonHtmlScriptPreProc)) &&
(scriptLanguage != eScriptNone) && stateAllowsTermination(state) &&
isMakoBlockEnd(ch, chNext, makoBlockType)) {
if (state == SCE_H_ASPAT) {
aspScript = segIsScriptingIndicator(styler,
styler.GetStartSegment(), i - 1, aspScript);
}
if (state == SCE_HP_WORD) {
classifyWordHTPy(styler.GetStartSegment(), i - 1, keywords4, styler, prevWord, inScriptType);
} else {
styler.ColourTo(i - 1, StateToPrint);
}
if (0 != strcmp(makoBlockType, "%") && (0 != strcmp(makoBlockType, "{")) && ch != '>') {
i++;
visibleChars++;
}
if (0 != strcmp(makoBlockType, "%")) {
styler.ColourTo(i, SCE_H_ASP);
}
state = beforePreProc;
if (inScriptType == eNonHtmlScriptPreProc)
inScriptType = eNonHtmlScript;
else
inScriptType = eHtml;
if (foldHTMLPreprocessor && ch != '\n' && ch != '\r') {
levelCurrent--;
}
scriptLanguage = eScriptNone;
continue;
}
// handle the end of Django template code
else if (isDjango &&
((inScriptType == eNonHtmlPreProc) || (inScriptType == eNonHtmlScriptPreProc)) &&
(scriptLanguage != eScriptNone) && stateAllowsTermination(state) &&
isDjangoBlockEnd(ch, chNext, djangoBlockType)) {
if (state == SCE_H_ASPAT) {
aspScript = segIsScriptingIndicator(styler,
styler.GetStartSegment(), i - 1, aspScript);
}
if (state == SCE_HP_WORD) {
classifyWordHTPy(styler.GetStartSegment(), i - 1, keywords4, styler, prevWord, inScriptType);
} else {
styler.ColourTo(i - 1, StateToPrint);
}
i += 1;
visibleChars += 1;
styler.ColourTo(i, SCE_H_ASP);
state = beforePreProc;
if (inScriptType == eNonHtmlScriptPreProc)
inScriptType = eNonHtmlScript;
else
inScriptType = eHtml;
if (foldHTMLPreprocessor) {
levelCurrent--;
}
scriptLanguage = beforeLanguage;
continue;
}
// handle the end of a pre-processor = Non-HTML // handle the end of a pre-processor = Non-HTML
else if (( else if ((!isMako && !isDjango && ((inScriptType == eNonHtmlPreProc) || (inScriptType == eNonHtmlScriptPreProc)) &&
((inScriptType == eNonHtmlPreProc) (((scriptLanguage != eScriptNone) && stateAllowsTermination(state))) &&
|| (inScriptType == eNonHtmlScriptPreProc)) && ( (((ch == '%') || (ch == '?')) && (chNext == '>'))) ||
((scriptLanguage != eScriptNone) && stateAllowsTermination(state) && ((ch == '%') || (ch == '?')))
) && (chNext == '>')) ||
((scriptLanguage == eScriptSGML) && (ch == '>') && (state != SCE_H_SGML_COMMENT))) { ((scriptLanguage == eScriptSGML) && (ch == '>') && (state != SCE_H_SGML_COMMENT))) {
if (state == SCE_H_ASPAT) { if (state == SCE_H_ASPAT) {
aspScript = segIsScriptingIndicator(styler, aspScript = segIsScriptingIndicator(styler,

View File

@ -139,7 +139,7 @@ static void ColouriseLispDoc(unsigned int startPos, int length, int initStyle, W
} }
} }
} else if (state == SCE_LISP_MACRO_DISPATCH) { } else if (state == SCE_LISP_MACRO_DISPATCH) {
if (!isdigit(ch)) { if (!(isascii(ch) && isdigit(ch))) {
if (ch != 'r' && ch != 'R' && (i - styler.GetStartSegment()) > 1) { if (ch != 'r' && ch != 'R' && (i - styler.GetStartSegment()) > 1) {
state = SCE_LISP_DEFAULT; state = SCE_LISP_DEFAULT;
} else { } else {

View File

@ -32,7 +32,7 @@ static inline bool IsAWordChar(const int ch) {
} }
inline bool isMMIXALOperator(char ch) { inline bool isMMIXALOperator(char ch) {
if (isalnum(ch)) if (isascii(ch) && isalnum(ch))
return false; return false;
if (ch == '+' || ch == '-' || ch == '|' || ch == '^' || if (ch == '+' || ch == '-' || ch == '|' || ch == '^' ||
ch == '*' || ch == '/' || ch == '/' || ch == '*' || ch == '/' || ch == '/' ||

View File

@ -32,7 +32,7 @@ static int GetLotLineState(std::string &line) {
// Now finds the first non-blank character // Now finds the first non-blank character
unsigned i; // Declares counter here to make it persistent after the for loop unsigned i; // Declares counter here to make it persistent after the for loop
for (i = 0; i < line.length(); ++i) { for (i = 0; i < line.length(); ++i) {
if (!isspace(line[i])) if (!(isascii(line[i]) && isspace(line[i])))
break; break;
} }

View File

@ -361,7 +361,7 @@ static void FoldMySQLDoc(unsigned int startPos, int length, int initStyle, WordL
// Not really a standard, but we add support for single line comments // Not really a standard, but we add support for single line comments
// with special curly braces syntax as foldable comments too. // with special curly braces syntax as foldable comments too.
// MySQL needs -- comments to be followed by space or control char // MySQL needs -- comments to be followed by space or control char
if (styler.Match(startPos, "--")) if (styler.Match(i, "--"))
{ {
char chNext2 = styler.SafeGetCharAt(i + 2); char chNext2 = styler.SafeGetCharAt(i + 2);
char chNext3 = styler.SafeGetCharAt(i + 3); char chNext3 = styler.SafeGetCharAt(i + 3);
@ -394,12 +394,12 @@ static void FoldMySQLDoc(unsigned int startPos, int length, int initStyle, WordL
// Reserved and other keywords. // Reserved and other keywords.
if (style != stylePrev) if (style != stylePrev)
{ {
bool beginFound = MatchIgnoreCase(styler, startPos, "begin"); bool beginFound = MatchIgnoreCase(styler, i, "begin");
bool ifFound = MatchIgnoreCase(styler, startPos, "if"); bool ifFound = MatchIgnoreCase(styler, i, "if");
bool thenFound = MatchIgnoreCase(styler, startPos, "then"); bool thenFound = MatchIgnoreCase(styler, i, "then");
bool whileFound = MatchIgnoreCase(styler, startPos, "while"); bool whileFound = MatchIgnoreCase(styler, i, "while");
bool loopFound = MatchIgnoreCase(styler, startPos, "loop"); bool loopFound = MatchIgnoreCase(styler, i, "loop");
bool repeatFound = MatchIgnoreCase(styler, startPos, "repeat"); bool repeatFound = MatchIgnoreCase(styler, i, "repeat");
if (!foldOnlyBegin && endFound && (ifFound || whileFound || loopFound)) if (!foldOnlyBegin && endFound && (ifFound || whileFound || loopFound))
{ {
@ -413,7 +413,7 @@ static void FoldMySQLDoc(unsigned int startPos, int length, int initStyle, WordL
// will be increased later, if not, then at eol. // will be increased later, if not, then at eol.
} }
else else
if (!foldOnlyBegin && MatchIgnoreCase(styler, startPos, "else")) if (!foldOnlyBegin && MatchIgnoreCase(styler, i, "else"))
{ {
levelNext--; levelNext--;
elseFound = true; elseFound = true;
@ -430,7 +430,7 @@ static void FoldMySQLDoc(unsigned int startPos, int length, int initStyle, WordL
if (ifFound) if (ifFound)
elseFound = false; elseFound = false;
else else
if (MatchIgnoreCase(styler, startPos, "when")) if (MatchIgnoreCase(styler, i, "when"))
whenFound = true; whenFound = true;
else else
{ {
@ -445,7 +445,7 @@ static void FoldMySQLDoc(unsigned int startPos, int length, int initStyle, WordL
levelNext++; levelNext++;
} }
else else
if (MatchIgnoreCase(styler, startPos, "end")) if (MatchIgnoreCase(styler, i, "end"))
{ {
// Multiple "end" in a row are counted multiple times! // Multiple "end" in a row are counted multiple times!
if (endFound) if (endFound)

View File

@ -78,7 +78,7 @@ static bool NsisNextLineHasElse(unsigned int start, unsigned int end, Accessor &
} }
} }
if( nNextLine == -1 ) // We never foudn the next line... if( nNextLine == -1 ) // We never found the next line...
return false; return false;
for( unsigned int firstChar = nNextLine; firstChar < end; firstChar++ ) for( unsigned int firstChar = nNextLine; firstChar < end; firstChar++ )
@ -146,7 +146,7 @@ static int calculateFoldNsis(unsigned int start, unsigned int end, int foldlevel
if( s[0] == '!' ) if( s[0] == '!' )
{ {
if( NsisCmp(s, "!ifndef", bIgnoreCase) == 0 || NsisCmp(s, "!ifdef", bIgnoreCase ) == 0 || NsisCmp(s, "!if", bIgnoreCase ) == 0 || NsisCmp(s, "!macro", bIgnoreCase ) == 0 ) if( NsisCmp(s, "!ifndef", bIgnoreCase) == 0 || NsisCmp(s, "!ifdef", bIgnoreCase ) == 0 || NsisCmp(s, "!ifmacrodef", bIgnoreCase ) == 0 || NsisCmp(s, "!ifmacrondef", bIgnoreCase ) == 0 || NsisCmp(s, "!if", bIgnoreCase ) == 0 || NsisCmp(s, "!macro", bIgnoreCase ) == 0 )
newFoldlevel++; newFoldlevel++;
else if( NsisCmp(s, "!endif", bIgnoreCase) == 0 || NsisCmp(s, "!macroend", bIgnoreCase ) == 0 ) else if( NsisCmp(s, "!endif", bIgnoreCase) == 0 || NsisCmp(s, "!macroend", bIgnoreCase ) == 0 )
newFoldlevel--; newFoldlevel--;
@ -191,16 +191,16 @@ static int classifyWordNsis(unsigned int start, unsigned int end, WordList *keyw
} }
// Check for special words... // Check for special words...
if( NsisCmp(s, "!macro", bIgnoreCase ) == 0 || NsisCmp(s, "!macroend", bIgnoreCase) == 0 ) // Covers !micro and !microend if( NsisCmp(s, "!macro", bIgnoreCase ) == 0 || NsisCmp(s, "!macroend", bIgnoreCase) == 0 ) // Covers !macro and !macroend
return SCE_NSIS_MACRODEF; return SCE_NSIS_MACRODEF;
if( NsisCmp(s, "!ifdef", bIgnoreCase ) == 0 || NsisCmp(s, "!ifndef", bIgnoreCase) == 0 || NsisCmp(s, "!endif", bIgnoreCase) == 0 ) if( NsisCmp(s, "!ifdef", bIgnoreCase ) == 0 || NsisCmp(s, "!ifndef", bIgnoreCase) == 0 || NsisCmp(s, "!endif", bIgnoreCase) == 0 ) // Covers !ifdef, !ifndef and !endif
return SCE_NSIS_IFDEFINEDEF; return SCE_NSIS_IFDEFINEDEF;
if( NsisCmp(s, "!else", bIgnoreCase ) == 0 ) // || NsisCmp(s, "!ifndef", bIgnoreCase) == 0 || NsisCmp(s, "!endif", bIgnoreCase) == 0 ) if( NsisCmp(s, "!if", bIgnoreCase ) == 0 || NsisCmp(s, "!else", bIgnoreCase ) == 0 ) // Covers !if and else
return SCE_NSIS_IFDEFINEDEF; return SCE_NSIS_IFDEFINEDEF;
if( NsisCmp(s, "!if", bIgnoreCase ) == 0 ) if (NsisCmp(s, "!ifmacrodef", bIgnoreCase ) == 0 || NsisCmp(s, "!ifmacrondef", bIgnoreCase ) == 0 ) // Covers !ifmacrodef and !ifnmacrodef
return SCE_NSIS_IFDEFINEDEF; return SCE_NSIS_IFDEFINEDEF;
if( NsisCmp(s, "SectionGroup", bIgnoreCase) == 0 || NsisCmp(s, "SectionGroupEnd", bIgnoreCase) == 0 ) // Covers SectionGroup and SectionGroupEnd if( NsisCmp(s, "SectionGroup", bIgnoreCase) == 0 || NsisCmp(s, "SectionGroupEnd", bIgnoreCase) == 0 ) // Covers SectionGroup and SectionGroupEnd

View File

@ -292,7 +292,7 @@ inline bool HandleInteger( unsigned int & cur, unsigned int one_too_much, Access
} }
ch = styler.SafeGetCharAt( cur ); ch = styler.SafeGetCharAt( cur );
if( !isdigit( ch ) ) if( !( isascii( ch ) && isdigit( ch ) ) )
{ {
styler.ColourTo( cur - 1, SCE_OPAL_INTEGER ); styler.ColourTo( cur - 1, SCE_OPAL_INTEGER );
styler.StartSegment( cur ); styler.StartSegment( cur );
@ -311,7 +311,7 @@ inline bool HandleWord( unsigned int & cur, unsigned int one_too_much, Accessor
{ {
ch = styler.SafeGetCharAt( cur ); ch = styler.SafeGetCharAt( cur );
if( ( ch != '_' ) && ( ch != '-' ) && if( ( ch != '_' ) && ( ch != '-' ) &&
!islower( ch ) && !isupper( ch ) && !isdigit( ch ) ) break; !( isascii( ch ) && ( islower( ch ) || isupper( ch ) || isdigit( ch ) ) ) ) break;
cur++; cur++;
if( cur >= one_too_much ) if( cur >= one_too_much )
@ -487,13 +487,13 @@ static void ColouriseOpalDoc( unsigned int startPos, int length, int initStyle,
default: default:
{ {
// Integer // Integer
if( isdigit( ch ) ) if( isascii( ch ) && isdigit( ch ) )
{ {
if( !HandleInteger( cur, one_too_much, styler ) ) return; if( !HandleInteger( cur, one_too_much, styler ) ) return;
} }
// Keyword // Keyword
else if( islower( ch ) || isupper( ch ) ) else if( isascii( ch ) && ( islower( ch ) || isupper( ch ) ) )
{ {
if( !HandleWord( cur, one_too_much, styler, keywordlists ) ) return; if( !HandleWord( cur, one_too_much, styler, keywordlists ) ) return;

View File

@ -37,6 +37,10 @@ static bool Is1To9(char ch) {
return (ch >= '1') && (ch <= '9'); return (ch >= '1') && (ch <= '9');
} }
static bool IsAlphabetic(int ch) {
return isascii(ch) && isalpha(ch);
}
static inline bool AtEOL(Accessor &styler, unsigned int i) { static inline bool AtEOL(Accessor &styler, unsigned int i) {
return (styler[i] == '\n') || return (styler[i] == '\n') ||
((styler[i] == '\r') && (styler.SafeGetCharAt(i + 1) != '\n')); ((styler[i] == '\r') && (styler.SafeGetCharAt(i + 1) != '\n'));
@ -101,7 +105,7 @@ static void ColouriseBatchLine(
} }
return; return;
// Check for Drive Change (Drive Change is internal command) - return if found // Check for Drive Change (Drive Change is internal command) - return if found
} else if ((isalpha(lineBuffer[offset])) && } else if ((IsAlphabetic(lineBuffer[offset])) &&
(lineBuffer[offset + 1] == ':') && (lineBuffer[offset + 1] == ':') &&
((isspacechar(lineBuffer[offset + 2])) || ((isspacechar(lineBuffer[offset + 2])) ||
(((lineBuffer[offset + 2] == '\\')) && (((lineBuffer[offset + 2] == '\\')) &&
@ -961,17 +965,17 @@ static int RecogniseErrorListLine(const char *lineBuffer, unsigned int lengthLin
} else if (strstart(lineBuffer, "Warning ")) { } else if (strstart(lineBuffer, "Warning ")) {
// Borland warning message // Borland warning message
return SCE_ERR_BORLAND; return SCE_ERR_BORLAND;
} else if (strstr(lineBuffer, "at line " ) && } else if (strstr(lineBuffer, "at line ") &&
(strstr(lineBuffer, "at line " ) < (lineBuffer + lengthLine)) && (strstr(lineBuffer, "at line ") < (lineBuffer + lengthLine)) &&
strstr(lineBuffer, "file ") && strstr(lineBuffer, "file ") &&
(strstr(lineBuffer, "file ") < (lineBuffer + lengthLine))) { (strstr(lineBuffer, "file ") < (lineBuffer + lengthLine))) {
// Lua 4 error message // Lua 4 error message
return SCE_ERR_LUA; return SCE_ERR_LUA;
} else if (strstr(lineBuffer, " at " ) && } else if (strstr(lineBuffer, " at ") &&
(strstr(lineBuffer, " at " ) < (lineBuffer + lengthLine)) && (strstr(lineBuffer, " at ") < (lineBuffer + lengthLine)) &&
strstr(lineBuffer, " line ") && strstr(lineBuffer, " line ") &&
(strstr(lineBuffer, " line ") < (lineBuffer + lengthLine)) && (strstr(lineBuffer, " line ") < (lineBuffer + lengthLine)) &&
(strstr(lineBuffer, " at " ) < (strstr(lineBuffer, " line ")))) { (strstr(lineBuffer, " at ") < (strstr(lineBuffer, " line ")))) {
// perl error message // perl error message
return SCE_ERR_PERL; return SCE_ERR_PERL;
} else if ((memcmp(lineBuffer, " at ", 6) == 0) && } else if ((memcmp(lineBuffer, " at ", 6) == 0) &&
@ -1065,7 +1069,7 @@ static int RecogniseErrorListLine(const char *lineBuffer, unsigned int lengthLin
numstep = 1; // ch was ' ', handle as if it's a delphi errorline, only add 1 to i. numstep = 1; // ch was ' ', handle as if it's a delphi errorline, only add 1 to i.
else else
numstep = 2; // otherwise add 2. numstep = 2; // otherwise add 2.
for (j = i + numstep; j < lengthLine && isalpha(lineBuffer[j]) && chPos < sizeof(word) - 1; j++) for (j = i + numstep; j < lengthLine && IsAlphabetic(lineBuffer[j]) && chPos < sizeof(word) - 1; j++)
word[chPos++] = lineBuffer[j]; word[chPos++] = lineBuffer[j];
word[chPos] = 0; word[chPos] = 0;
if (!CompareCaseInsensitive(word, "error") || !CompareCaseInsensitive(word, "warning") || if (!CompareCaseInsensitive(word, "error") || !CompareCaseInsensitive(word, "warning") ||
@ -1252,13 +1256,13 @@ static void ColouriseLatexDoc(unsigned int startPos, int length, int initStyle,
styler.ColourTo(lengthDoc-1, state); styler.ColourTo(lengthDoc-1, state);
} }
static const char * const batchWordListDesc[] = { static const char *const batchWordListDesc[] = {
"Internal Commands", "Internal Commands",
"External Commands", "External Commands",
0 0
}; };
static const char * const emptyWordListDesc[] = { static const char *const emptyWordListDesc[] = {
0 0
}; };

View File

@ -1243,7 +1243,7 @@ static void FoldPerlDoc(unsigned int startPos, int length, int, WordList *[],
else if (styler.Match(i, "=head")) else if (styler.Match(i, "=head"))
isPodHeading = true; isPodHeading = true;
} else if (style == SCE_PL_DATASECTION) { } else if (style == SCE_PL_DATASECTION) {
if (ch == '=' && isalpha(chNext) && levelCurrent == SC_FOLDLEVELBASE) if (ch == '=' && isascii(chNext) && isalpha(chNext) && levelCurrent == SC_FOLDLEVELBASE)
levelCurrent++; levelCurrent++;
else if (styler.Match(i, "=cut") && levelCurrent > SC_FOLDLEVELBASE) else if (styler.Match(i, "=cut") && levelCurrent > SC_FOLDLEVELBASE)
levelCurrent--; levelCurrent--;

View File

@ -9,7 +9,6 @@
/** TODO: /** TODO:
WebSpeed support in html lexer WebSpeed support in html lexer
Support "end triggers" expression of the triggers phrase Support "end triggers" expression of the triggers phrase
change lmPS to lmProgress
Support more than 6 comments levels Support more than 6 comments levels
**/ **/
#include <stdlib.h> #include <stdlib.h>
@ -39,7 +38,7 @@ static inline bool IsAWordStart(int ch) {
return (ch < 0x80) && (isalpha(ch) || ch == '_'); return (ch < 0x80) && (isalpha(ch) || ch == '_');
} }
enum SentenceStart { SetSentenceStart = 0xf, ResetSentenceStart = 0x10}; // true -> bit5 = 0 enum SentenceStart { SetSentenceStart = 0xf, ResetSentenceStart = 0x10}; // true -> bit = 0
static void Colourise4glDoc(unsigned int startPos, int length, int initStyle, WordList *keywordlists[], static void Colourise4glDoc(unsigned int startPos, int length, int initStyle, WordList *keywordlists[],
Accessor &styler) { Accessor &styler) {
@ -51,7 +50,7 @@ static void Colourise4glDoc(unsigned int startPos, int length, int initStyle, Wo
int visibleChars = 0; int visibleChars = 0;
int sentenceStartState; // true -> bit5 = 0 int mask;
StyleContext sc(startPos, length, initStyle, styler); StyleContext sc(startPos, length, initStyle, styler);
@ -64,6 +63,7 @@ static void Colourise4glDoc(unsigned int startPos, int length, int initStyle, Wo
} }
// Handle line continuation generically. // Handle line continuation generically.
if ((sc.state & 0xf) < SCE_4GL_COMMENT1) {
if (sc.ch == '~') { if (sc.ch == '~') {
if (sc.chNext > ' ') { if (sc.chNext > ' ') {
// skip special char after ~ // skip special char after ~
@ -85,22 +85,23 @@ static void Colourise4glDoc(unsigned int startPos, int length, int initStyle, Wo
} }
} }
} }
}
// Determine if a new state should be terminated. // Determine if a new state should be terminated.
sentenceStartState = sc.state & 0x10; mask = sc.state & 0x10;
switch (sc.state & 0xf) { switch (sc.state & 0xf) {
case SCE_4GL_OPERATOR: case SCE_4GL_OPERATOR:
sc.SetState(SCE_4GL_DEFAULT | sentenceStartState); sc.SetState(SCE_4GL_DEFAULT | mask);
break; break;
case SCE_4GL_NUMBER: case SCE_4GL_NUMBER:
if (!(IsADigit(sc.ch))) { if (!(IsADigit(sc.ch))) {
sc.SetState(SCE_4GL_DEFAULT | sentenceStartState); sc.SetState(SCE_4GL_DEFAULT | mask);
} }
break; break;
case SCE_4GL_IDENTIFIER: case SCE_4GL_IDENTIFIER:
if (!IsAWordChar(sc.ch) && sc.ch != '-') { if (!IsAWordChar(sc.ch) && sc.ch != '-') {
char s[1000]; char s[1000];
sc.GetCurrentLowered(s, sizeof(s)); sc.GetCurrentLowered(s, sizeof(s));
if (((sentenceStartState == 0) && keywords2.InList(s)) || keywords3.InList(s)) { if ((((sc.state & 0x10) == 0) && keywords2.InList(s)) || keywords3.InList(s)) {
sc.ChangeState(SCE_4GL_BLOCK | ResetSentenceStart); sc.ChangeState(SCE_4GL_BLOCK | ResetSentenceStart);
} }
else if (keywords1.InList(s)) { else if (keywords1.InList(s)) {
@ -122,18 +123,19 @@ static void Colourise4glDoc(unsigned int startPos, int length, int initStyle, Wo
case SCE_4GL_PREPROCESSOR: case SCE_4GL_PREPROCESSOR:
if (sc.atLineStart) { if (sc.atLineStart) {
sc.SetState(SCE_4GL_DEFAULT & SetSentenceStart); sc.SetState(SCE_4GL_DEFAULT & SetSentenceStart);
} else if (sc.ch == '*' && sc.chNext == '/') {
sc.ForwardSetState(SCE_4GL_DEFAULT | sentenceStartState);
} }
/* code removed to allow comments inside preprocessor
else if (sc.ch == '*' && sc.chNext == '/') {
sc.ForwardSetState(SCE_4GL_DEFAULT | sentenceStartState); } */
break; break;
case SCE_4GL_STRING: case SCE_4GL_STRING:
if (sc.ch == '\"') { if (sc.ch == '\"') {
sc.ForwardSetState(SCE_4GL_DEFAULT | sentenceStartState); sc.ForwardSetState(SCE_4GL_DEFAULT | mask);
} }
break; break;
case SCE_4GL_CHARACTER: case SCE_4GL_CHARACTER:
if (sc.ch == '\'') { if (sc.ch == '\'') {
sc.ForwardSetState(SCE_4GL_DEFAULT | sentenceStartState); sc.ForwardSetState(SCE_4GL_DEFAULT | mask);
} }
break; break;
default: default:
@ -141,7 +143,7 @@ static void Colourise4glDoc(unsigned int startPos, int length, int initStyle, Wo
if (sc.ch == '*' && sc.chNext == '/') { if (sc.ch == '*' && sc.chNext == '/') {
sc.Forward(); sc.Forward();
if ((sc.state & 0xf) == SCE_4GL_COMMENT1) { if ((sc.state & 0xf) == SCE_4GL_COMMENT1) {
sc.ForwardSetState(SCE_4GL_DEFAULT | sentenceStartState); sc.ForwardSetState(SCE_4GL_DEFAULT | mask);
} }
else else
sc.SetState((sc.state & 0x1f) - 1); sc.SetState((sc.state & 0x1f) - 1);
@ -153,14 +155,14 @@ static void Colourise4glDoc(unsigned int startPos, int length, int initStyle, Wo
} }
// Determine if a new state should be entered. // Determine if a new state should be entered.
sentenceStartState = sc.state & 0x10; mask = sc.state & 0x10;
if ((sc.state & 0xf) == SCE_4GL_DEFAULT) { if ((sc.state & 0xf) == SCE_4GL_DEFAULT) {
if (IsADigit(sc.ch) || (sc.ch == '.' && IsADigit(sc.chNext))) { if (IsADigit(sc.ch) || (sc.ch == '.' && IsADigit(sc.chNext))) {
sc.SetState(SCE_4GL_NUMBER | ResetSentenceStart); sc.SetState(SCE_4GL_NUMBER | ResetSentenceStart);
} else if (IsAWordStart(sc.ch) || sc.ch == '@') { } else if (IsAWordStart(sc.ch) || (sc.ch == '@')) {
sc.SetState(SCE_4GL_IDENTIFIER | sentenceStartState); sc.SetState(SCE_4GL_IDENTIFIER | mask);
} else if (sc.ch == '/' && sc.chNext == '*') { } else if (sc.ch == '/' && sc.chNext == '*') {
sc.SetState(SCE_4GL_COMMENT1 | sentenceStartState); sc.SetState(SCE_4GL_COMMENT1 | mask);
sc.Forward(); sc.Forward();
} else if (sc.ch == '\"') { } else if (sc.ch == '\"') {
sc.SetState(SCE_4GL_STRING | ResetSentenceStart); sc.SetState(SCE_4GL_STRING | ResetSentenceStart);
@ -176,12 +178,12 @@ static void Colourise4glDoc(unsigned int startPos, int length, int initStyle, Wo
} else if ((sc.ch == '.' || sc.ch == ':' || sc.ch == '}') && (sc.chNext == ' ' || sc.chNext == '\t' || sc.chNext == '\n' || sc.chNext == '\r')) { } else if ((sc.ch == '.' || sc.ch == ':' || sc.ch == '}') && (sc.chNext == ' ' || sc.chNext == '\t' || sc.chNext == '\n' || sc.chNext == '\r')) {
sc.SetState(sc.state & SetSentenceStart); sc.SetState(sc.state & SetSentenceStart);
} else if (isoperator(static_cast<char>(sc.ch))) { } else if (isoperator(static_cast<char>(sc.ch))) {
/* This code allows highlight of handles. Alas, it would cause the frase "last-event:function" /* This code allows highlight of handles. Alas, it would cause the phrase "last-event:function"
to be recognized as a BlockBegin to be recognized as a BlockBegin */
if (sc.ch == ':') if (sc.ch == ':')
sc.SetState(SCE_4GL_OPERATOR & SetSentenceStart); sc.SetState(SCE_4GL_OPERATOR & SetSentenceStart);
else */ /* else */
sc.SetState(SCE_4GL_OPERATOR | ResetSentenceStart); sc.SetState(SCE_4GL_OPERATOR | ResetSentenceStart);
} }
} }

View File

@ -158,6 +158,10 @@ static void ColourisePyDoc(unsigned int startPos, int length, int initStyle,
if (styler.GetPropertyInt("lexer.python.strings.b", 1)) if (styler.GetPropertyInt("lexer.python.strings.b", 1))
allowedLiterals = static_cast<literalsAllowed>(allowedLiterals | litB); allowedLiterals = static_cast<literalsAllowed>(allowedLiterals | litB);
// property lexer.python.strings.over.newline
// Set to 1 to allow strings to span newline characters.
bool stringsOverNewline = styler.GetPropertyInt("lexer.python.strings.over.newline") != 0;
initStyle = initStyle & 31; initStyle = initStyle & 31;
if (initStyle == SCE_P_STRINGEOL) { if (initStyle == SCE_P_STRINGEOL) {
initStyle = SCE_P_DEFAULT; initStyle = SCE_P_DEFAULT;
@ -204,7 +208,7 @@ static void ColourisePyDoc(unsigned int startPos, int length, int initStyle,
} }
lineCurrent++; lineCurrent++;
if ((sc.state == SCE_P_STRING) || (sc.state == SCE_P_CHARACTER)) { if ((sc.state == SCE_P_STRING) || (sc.state == SCE_P_CHARACTER)) {
if (inContinuedString) { if (inContinuedString || stringsOverNewline) {
inContinuedString = false; inContinuedString = false;
} else { } else {
sc.ChangeState(SCE_P_STRINGEOL); sc.ChangeState(SCE_P_STRINGEOL);
@ -534,7 +538,7 @@ static void FoldPyDoc(unsigned int startPos, int length, int /*initStyle - unuse
} }
// Set fold header on non-quote/non-comment line // Set fold header on non-quote/non-comment line
if (!quote && !comment && !(indentCurrent & SC_FOLDLEVELWHITEFLAG) ) { if (!quote && !comment && !(indentCurrent & SC_FOLDLEVELWHITEFLAG)) {
if ((indentCurrent & SC_FOLDLEVELNUMBERMASK) < (indentNext & SC_FOLDLEVELNUMBERMASK)) if ((indentCurrent & SC_FOLDLEVELNUMBERMASK) < (indentNext & SC_FOLDLEVELNUMBERMASK))
lev |= SC_FOLDLEVELHEADERFLAG; lev |= SC_FOLDLEVELHEADERFLAG;
} }
@ -554,7 +558,7 @@ static void FoldPyDoc(unsigned int startPos, int length, int /*initStyle - unuse
//styler.SetLevel(lineCurrent, indentCurrent); //styler.SetLevel(lineCurrent, indentCurrent);
} }
static const char * const pythonWordListDesc[] = { static const char *const pythonWordListDesc[] = {
"Keywords", "Keywords",
"Highlighted identifiers", "Highlighted identifiers",
0 0

View File

@ -77,9 +77,9 @@ static void ColouriseRDoc(unsigned int startPos, int length, int initStyle, Word
sc.SetState(SCE_R_DEFAULT); sc.SetState(SCE_R_DEFAULT);
} }
} else if (sc.state == SCE_R_IDENTIFIER) { } else if (sc.state == SCE_R_IDENTIFIER) {
if (!IsAWordChar(sc.ch) || (sc.ch == '.')) { if (!IsAWordChar(sc.ch)) {
char s[100]; char s[100];
sc.GetCurrentLowered(s, sizeof(s)); sc.GetCurrent(s, sizeof(s));
if (keywords.InList(s)) { if (keywords.InList(s)) {
sc.ChangeState(SCE_R_KWORD); sc.ChangeState(SCE_R_KWORD);
} else if (keywords2.InList(s)) { } else if (keywords2.InList(s)) {

View File

@ -203,13 +203,11 @@ void ColouriseSMLDoc(
} }
void FoldSMLDoc( void FoldSMLDoc(
unsigned int startPos, int length, unsigned int, int,
int initStyle, int,
WordList *keywordlists[], WordList *[],
Accessor &styler) Accessor &)
{ {
//supress "not used" warnings
startPos || length || initStyle || keywordlists[0] || styler.Length();
} }
static const char * const SMLWordListDesc[] = { static const char * const SMLWordListDesc[] = {

View File

@ -231,6 +231,10 @@ static void FoldSQLDoc(unsigned int startPos, int length, int initStyle,
bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0; bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0;
bool foldOnlyBegin = styler.GetPropertyInt("fold.sql.only.begin", 0) != 0; bool foldOnlyBegin = styler.GetPropertyInt("fold.sql.only.begin", 0) != 0;
// property fold.sql.exists
// Enables "EXISTS" to end a fold as is started by "IF" in "DROP TABLE IF EXISTS".
bool foldSqlExists = styler.GetPropertyInt("fold.sql.exists", 1) != 0;
unsigned int endPos = startPos + length; unsigned int endPos = startPos + length;
int visibleChars = 0; int visibleChars = 0;
int lineCurrent = styler.GetLine(startPos); int lineCurrent = styler.GetLine(startPos);
@ -303,9 +307,13 @@ static void FoldSQLDoc(unsigned int startPos, int length, int initStyle,
} }
} else if (strcmp(s, "begin") == 0) { } else if (strcmp(s, "begin") == 0) {
levelNext++; levelNext++;
} else if (strcmp(s, "end") == 0 || } else if ((strcmp(s, "end") == 0) ||
// DROP TABLE IF EXISTS or CREATE TABLE IF NOT EXISTS // // DROP TABLE IF EXISTS or CREATE TABLE IF NOT EXISTS
strcmp(s, "exists") == 0) { (foldSqlExists && (strcmp(s, "exists") == 0)) ||
// // SQL Anywhere permits IF ... ELSE ... ENDIF
// // will only be active if "endif" appears in the
// // keyword list.
(strcmp(s, "endif") == 0)) {
endFound = true; endFound = true;
levelNext--; levelNext--;
if (levelNext < SC_FOLDLEVELBASE) { if (levelNext < SC_FOLDLEVELBASE) {

View File

@ -214,6 +214,40 @@ static void ColouriseVBDoc(unsigned int startPos, int length, int initStyle,
visibleChars++; visibleChars++;
} }
} }
if (sc.state == SCE_B_IDENTIFIER && !IsAWordChar(sc.ch)) {
// In Basic (except VBScript), a variable name or a function name
// can end with a special character indicating the type of the value
// held or returned.
bool skipType = false;
if (!vbScriptSyntax && IsTypeCharacter(sc.ch)) {
sc.Forward(); // Skip it
skipType = true;
}
if (sc.ch == ']') {
sc.Forward();
}
char s[100];
sc.GetCurrentLowered(s, sizeof(s));
if (skipType) {
s[strlen(s) - 1] = '\0';
}
if (strcmp(s, "rem") == 0) {
sc.ChangeState(SCE_B_COMMENT);
} else {
if (keywords.InList(s)) {
sc.ChangeState(SCE_B_KEYWORD);
} else if (keywords2.InList(s)) {
sc.ChangeState(SCE_B_KEYWORD2);
} else if (keywords3.InList(s)) {
sc.ChangeState(SCE_B_KEYWORD3);
} else if (keywords4.InList(s)) {
sc.ChangeState(SCE_B_KEYWORD4);
} // Else, it is really an identifier...
sc.SetState(SCE_B_DEFAULT);
}
}
sc.Complete(); sc.Complete();
} }

View File

@ -161,7 +161,7 @@ static bool IsCommentLine(int line, Accessor &styler) {
static void FoldNoBoxVHDLDoc( static void FoldNoBoxVHDLDoc(
unsigned int startPos, unsigned int startPos,
int length, int length,
int initStyle, int,
Accessor &styler) Accessor &styler)
{ {
// Decided it would be smarter to have the lexer have all keywords included. Therefore I // Decided it would be smarter to have the lexer have all keywords included. Therefore I
@ -249,7 +249,6 @@ static void FoldNoBoxVHDLDoc(
char chPrev = '\0'; char chPrev = '\0';
char chNextNonBlank; char chNextNonBlank;
int styleNext = styler.StyleAt(startPos); int styleNext = styler.StyleAt(startPos);
int style = initStyle;
//Platform::DebugPrintf("Line[%04d] Prev[%20s] ************************* Level[%x]\n", lineCurrent+1, prevWord, levelCurrent); //Platform::DebugPrintf("Line[%04d] Prev[%20s] ************************* Level[%x]\n", lineCurrent+1, prevWord, levelCurrent);
/***************************************/ /***************************************/
@ -265,7 +264,7 @@ static void FoldNoBoxVHDLDoc(
j ++ ; j ++ ;
chNextNonBlank = styler.SafeGetCharAt(j); chNextNonBlank = styler.SafeGetCharAt(j);
} }
style = styleNext; int style = styleNext;
styleNext = styler.StyleAt(i + 1); styleNext = styler.StyleAt(i + 1);
bool atEOL = (ch == '\r' && chNext != '\n') || (ch == '\n'); bool atEOL = (ch == '\r' && chNext != '\n') || (ch == '\n');

View File

@ -150,6 +150,22 @@ static bool IsStreamCommentStyle(int style) {
return style == SCE_V_COMMENT; return style == SCE_V_COMMENT;
} }
static bool IsCommentLine(int line, Accessor &styler) {
int pos = styler.LineStart(line);
int eolPos = styler.LineStart(line + 1) - 1;
for (int i = pos; i < eolPos; i++) {
char ch = styler[i];
char chNext = styler.SafeGetCharAt(i + 1);
int style = styler.StyleAt(i);
if (ch == '/' && chNext == '/' &&
(style == SCE_V_COMMENTLINE || style == SCE_V_COMMENTLINEBANG)) {
return true;
} else if (!IsASpaceOrTab(ch)) {
return false;
}
}
return false;
}
// Store both the current line's fold level and the next lines in the // Store both the current line's fold level and the next lines in the
// level store to make it easy to pick up with each increment // level store to make it easy to pick up with each increment
// and to make it possible to fiddle the current level for "} else {". // and to make it possible to fiddle the current level for "} else {".
@ -195,6 +211,15 @@ static void FoldNoBoxVerilogDoc(unsigned int startPos, int length, int initStyle
levelNext--; levelNext--;
} }
} }
if (foldComment && atEOL && IsCommentLine(lineCurrent, styler))
{
if (!IsCommentLine(lineCurrent - 1, styler)
&& IsCommentLine(lineCurrent + 1, styler))
levelNext++;
else if (IsCommentLine(lineCurrent - 1, styler)
&& !IsCommentLine(lineCurrent+1, styler))
levelNext--;
}
if (foldComment && (style == SCE_V_COMMENTLINE)) { if (foldComment && (style == SCE_V_COMMENTLINE)) {
if ((ch == '/') && (chNext == '/')) { if ((ch == '/') && (chNext == '/')) {
char chNext2 = styler.SafeGetCharAt(i + 2); char chNext2 = styler.SafeGetCharAt(i + 2);

View File

@ -31,7 +31,7 @@ void LineMarker::SetXPM(const char *textForm) {
markType = SC_MARK_PIXMAP; markType = SC_MARK_PIXMAP;
} }
void LineMarker::SetXPM(const char * const *linesForm) { void LineMarker::SetXPM(const char *const *linesForm) {
delete pxpm; delete pxpm;
pxpm = new XPM(linesForm); pxpm = new XPM(linesForm);
markType = SC_MARK_PIXMAP; markType = SC_MARK_PIXMAP;

View File

@ -51,7 +51,7 @@ public:
} }
void RefreshColourPalette(Palette &pal, bool want); void RefreshColourPalette(Palette &pal, bool want);
void SetXPM(const char *textForm); void SetXPM(const char *textForm);
void SetXPM(const char * const *linesForm); void SetXPM(const char *const *linesForm);
void Draw(Surface *surface, PRectangle &rc, Font &fontForCharacter); void Draw(Surface *surface, PRectangle &rc, Font &fontForCharacter);
}; };

View File

@ -362,6 +362,7 @@ void LineAnnotation::Init() {
void LineAnnotation::InsertLine(int line) { void LineAnnotation::InsertLine(int line) {
if (annotations.Length()) { if (annotations.Length()) {
annotations.EnsureLength(line);
annotations.Insert(line, 0); annotations.Insert(line, 0);
} }
} }
@ -420,7 +421,7 @@ void LineAnnotation::SetText(int line, const char *text) {
delete []annotations[line]; delete []annotations[line];
} }
annotations[line] = AllocateAnnotation(strlen(text), style); annotations[line] = AllocateAnnotation(strlen(text), style);
AnnotationHeader *pah = reinterpret_cast<AnnotationHeader*>(annotations[line]); AnnotationHeader *pah = reinterpret_cast<AnnotationHeader *>(annotations[line]);
pah->style = static_cast<short>(style); pah->style = static_cast<short>(style);
pah->length = strlen(text); pah->length = strlen(text);
pah->lines = static_cast<short>(NumberLines(text)); pah->lines = static_cast<short>(NumberLines(text));

View File

@ -10,6 +10,7 @@
#include <stdio.h> #include <stdio.h>
#include <ctype.h> #include <ctype.h>
#include <string>
#include <vector> #include <vector>
#include "Platform.h" #include "Platform.h"
@ -361,7 +362,8 @@ void BreakFinder::Insert(int val) {
for (unsigned int j = 0; j<saeLen; j++) { for (unsigned int j = 0; j<saeLen; j++) {
if (val == selAndEdge[j]) { if (val == selAndEdge[j]) {
return; return;
} if (val < selAndEdge[j]) { }
if (val < selAndEdge[j]) {
for (unsigned int k = saeLen; k>j; k--) { for (unsigned int k = saeLen; k>j; k--) {
selAndEdge[k] = selAndEdge[k-1]; selAndEdge[k] = selAndEdge[k-1];
} }
@ -386,7 +388,7 @@ static int NextBadU(const char *s, int p, int len, int &trailBytes) {
return -1; return -1;
} }
BreakFinder::BreakFinder(LineLayout *ll_, int lineStart_, int lineEnd_, int posLineStart_, bool utf8_, int xStart) : BreakFinder::BreakFinder(LineLayout *ll_, int lineStart_, int lineEnd_, int posLineStart_, bool utf8_, int xStart, bool breakForSelection) :
ll(ll_), ll(ll_),
lineStart(lineStart_), lineStart(lineStart_),
lineEnd(lineEnd_), lineEnd(lineEnd_),
@ -412,14 +414,20 @@ BreakFinder::BreakFinder(LineLayout *ll_, int lineStart_, int lineEnd_, int posL
nextBreak--; nextBreak--;
} }
SelectionSegment segmentLine(SelectionPosition(posLineStart), SelectionPosition(posLineStart + lineEnd)); if (breakForSelection) {
SelectionPosition posStart(posLineStart);
SelectionPosition posEnd(posLineStart + lineEnd);
SelectionSegment segmentLine(posStart, posEnd);
for (size_t r=0; r<ll->psel->Count(); r++) { for (size_t r=0; r<ll->psel->Count(); r++) {
SelectionSegment portion = ll->psel->Range(r).Intersect(segmentLine); SelectionSegment portion = ll->psel->Range(r).Intersect(segmentLine);
if (!(portion.start == portion.end)) {
if (portion.start.IsValid()) if (portion.start.IsValid())
Insert(portion.start.Position() - posLineStart - 1); Insert(portion.start.Position() - posLineStart - 1);
if (portion.end.IsValid()) if (portion.end.IsValid())
Insert(portion.end.Position() - posLineStart - 1); Insert(portion.end.Position() - posLineStart - 1);
} }
}
}
Insert(ll->edgeColumn - 1); Insert(ll->edgeColumn - 1);
Insert(lineEnd - 1); Insert(lineEnd - 1);
@ -441,7 +449,7 @@ BreakFinder::~BreakFinder() {
delete []selAndEdge; delete []selAndEdge;
} }
int BreakFinder::First() { int BreakFinder::First() const {
return nextBreak; return nextBreak;
} }
@ -528,7 +536,7 @@ void PositionCacheEntry::Set(unsigned int styleNumber_, const char *s_,
clock = clock_; clock = clock_;
if (s_ && positions_) { if (s_ && positions_) {
positions = new short[len + (len + 1) / 2]; positions = new short[len + (len + 1) / 2];
for (unsigned int i=0;i<len;i++) { for (unsigned int i=0; i<len; i++) {
positions[i] = static_cast<short>(positions_[i]); positions[i] = static_cast<short>(positions_[i]);
} }
memcpy(reinterpret_cast<char *>(positions + len), s_, len); memcpy(reinterpret_cast<char *>(positions + len), s_, len);
@ -551,7 +559,7 @@ bool PositionCacheEntry::Retrieve(unsigned int styleNumber_, const char *s_,
unsigned int len_, int *positions_) const { unsigned int len_, int *positions_) const {
if ((styleNumber == styleNumber_) && (len == len_) && if ((styleNumber == styleNumber_) && (len == len_) &&
(memcmp(reinterpret_cast<char *>(positions + len), s_, len)== 0)) { (memcmp(reinterpret_cast<char *>(positions + len), s_, len)== 0)) {
for (unsigned int i=0;i<len;i++) { for (unsigned int i=0; i<len; i++) {
positions_[i] = positions[i]; positions_[i] = positions[i];
} }
return true; return true;
@ -573,7 +581,7 @@ int PositionCacheEntry::Hash(unsigned int styleNumber, const char *s, unsigned i
return ret; return ret;
} }
bool PositionCacheEntry::NewerThan(const PositionCacheEntry &other) { bool PositionCacheEntry::NewerThan(const PositionCacheEntry &other) const {
return clock > other.clock; return clock > other.clock;
} }
@ -597,7 +605,7 @@ PositionCache::~PositionCache() {
void PositionCache::Clear() { void PositionCache::Clear() {
if (!allClear) { if (!allClear) {
for (size_t i=0;i<size;i++) { for (size_t i=0; i<size; i++) {
pces[i].Clear(); pces[i].Clear();
} }
} }
@ -641,7 +649,7 @@ void PositionCache::MeasureWidths(Surface *surface, ViewStyle &vstyle, unsigned
if (clock > 60000) { if (clock > 60000) {
// Since there are only 16 bits for the clock, wrap it round and // Since there are only 16 bits for the clock, wrap it round and
// reset all cache entries so none get stuck with a high clock. // reset all cache entries so none get stuck with a high clock.
for (size_t i=0;i<size;i++) { for (size_t i=0; i<size; i++) {
pces[i].ResetClock(); pces[i].ResetClock();
} }
clock = 2; clock = 2;

View File

@ -93,7 +93,7 @@ public:
}; };
void Invalidate(LineLayout::validLevel validity_); void Invalidate(LineLayout::validLevel validity_);
void SetLevel(int level_); void SetLevel(int level_);
int GetLevel() { return level; } int GetLevel() const { return level; }
LineLayout *Retrieve(int lineNumber, int lineCaret, int maxChars, int styleClock_, LineLayout *Retrieve(int lineNumber, int lineCaret, int maxChars, int styleClock_,
int linesOnScreen, int linesInDoc); int linesOnScreen, int linesInDoc);
void Dispose(LineLayout *ll); void Dispose(LineLayout *ll);
@ -111,7 +111,7 @@ public:
void Clear(); void Clear();
bool Retrieve(unsigned int styleNumber_, const char *s_, unsigned int len_, int *positions_) const; bool Retrieve(unsigned int styleNumber_, const char *s_, unsigned int len_, int *positions_) const;
static int Hash(unsigned int styleNumber, const char *s, unsigned int len); static int Hash(unsigned int styleNumber, const char *s, unsigned int len);
bool NewerThan(const PositionCacheEntry &other); bool NewerThan(const PositionCacheEntry &other) const;
void ResetClock(); void ResetClock();
}; };
@ -136,9 +136,9 @@ class BreakFinder {
int subBreak; int subBreak;
void Insert(int val); void Insert(int val);
public: public:
BreakFinder(LineLayout *ll_, int lineStart_, int lineEnd_, int posLineStart_, bool utf8_, int xStart); BreakFinder(LineLayout *ll_, int lineStart_, int lineEnd_, int posLineStart_, bool utf8_, int xStart, bool breakForSelection);
~BreakFinder(); ~BreakFinder();
int First(); int First() const;
int Next(); int Next();
}; };
@ -152,7 +152,7 @@ public:
~PositionCache(); ~PositionCache();
void Clear(); void Clear();
void SetSize(size_t size_); void SetSize(size_t size_);
int GetSize() { return size; } int GetSize() const { return size; }
void MeasureWidths(Surface *surface, ViewStyle &vstyle, unsigned int styleNumber, void MeasureWidths(Surface *surface, ViewStyle &vstyle, unsigned int styleNumber,
const char *s, unsigned int len, int *positions); const char *s, unsigned int len, int *positions);
}; };

View File

@ -96,7 +96,7 @@ const char *PropSetSimple::Get(const char *key) const {
// for that, through a recursive function and a simple chain of pointers. // for that, through a recursive function and a simple chain of pointers.
struct VarChain { struct VarChain {
VarChain(const char*var_=NULL, const VarChain *link_=NULL): var(var_), link(link_) {} VarChain(const char *var_=NULL, const VarChain *link_=NULL): var(var_), link(link_) {}
bool contains(const char *testVar) const { bool contains(const char *testVar) const {
return (var && (0 == strcmp(var, testVar))) return (var && (0 == strcmp(var, testVar)))

View File

@ -248,6 +248,7 @@ const char bitarr[] = { 1, 2, 4, 8, 16, 32, 64, '\200' };
*/ */
RESearch::RESearch(CharClassify *charClassTable) { RESearch::RESearch(CharClassify *charClassTable) {
failure = 0;
charClass = charClassTable; charClass = charClassTable;
Init(); Init();
} }
@ -418,6 +419,7 @@ int RESearch::GetBackslashExpression(
ChSet(static_cast<unsigned char>(c)); ChSet(static_cast<unsigned char>(c));
} }
} }
break;
case 'w': case 'w':
for (c = 0; c < MAXCHR; c++) { for (c = 0; c < MAXCHR; c++) {
if (iswordc(static_cast<unsigned char>(c))) { if (iswordc(static_cast<unsigned char>(c))) {

View File

@ -31,7 +31,7 @@ class SVector {
newSize += allocSize; newSize += allocSize;
else else
newSize = (newSize * 3) / 2; newSize = (newSize * 3) / 2;
int* newv = new int[newSize]; int *newv = new int[newSize];
size = newSize; size = newSize;
unsigned int i=0; unsigned int i=0;
for (; i<len; i++) { for (; i<len; i++) {
@ -60,7 +60,7 @@ public:
size = 0; size = 0;
if (other.Length() > 0) { if (other.Length() > 0) {
SizeTo(other.Length()); SizeTo(other.Length());
for (int i=0;i<other.Length();i++) for (int i=0; i<other.Length(); i++)
v[i] = other.v[i]; v[i] = other.v[i];
len = other.Length(); len = other.Length();
} }
@ -74,7 +74,7 @@ public:
size = 0; size = 0;
if (other.Length() > 0) { if (other.Length() > 0) {
SizeTo(other.Length()); SizeTo(other.Length());
for (int i=0;i<other.Length();i++) for (int i=0; i<other.Length(); i++)
v[i] = other.v[i]; v[i] = other.v[i];
len = other.Length(); len = other.Length();
} }

View File

@ -10,6 +10,7 @@
#include <stdio.h> #include <stdio.h>
#include <ctype.h> #include <ctype.h>
#include <string>
#include <vector> #include <vector>
#include "Platform.h" #include "Platform.h"
@ -56,7 +57,7 @@ ScintillaBase::ScintillaBase() {
lexLanguage = SCLEX_CONTAINER; lexLanguage = SCLEX_CONTAINER;
performingStyle = false; performingStyle = false;
lexCurrent = 0; lexCurrent = 0;
for (int wl = 0;wl < numWordLists;wl++) for (int wl = 0; wl < numWordLists; wl++)
keyWordLists[wl] = new WordList; keyWordLists[wl] = new WordList;
keyWordLists[numWordLists] = 0; keyWordLists[numWordLists] = 0;
#endif #endif
@ -64,7 +65,7 @@ ScintillaBase::ScintillaBase() {
ScintillaBase::~ScintillaBase() { ScintillaBase::~ScintillaBase() {
#ifdef SCI_LEXER #ifdef SCI_LEXER
for (int wl = 0;wl < numWordLists;wl++) for (int wl = 0; wl < numWordLists; wl++)
delete keyWordLists[wl]; delete keyWordLists[wl];
#endif #endif
} }
@ -202,8 +203,8 @@ int ScintillaBase::KeyCommand(unsigned int iMessage) {
return Editor::KeyCommand(iMessage); return Editor::KeyCommand(iMessage);
} }
void ScintillaBase::AutoCompleteDoubleClick(void* p) { void ScintillaBase::AutoCompleteDoubleClick(void *p) {
ScintillaBase* sci = reinterpret_cast<ScintillaBase*>(p); ScintillaBase *sci = reinterpret_cast<ScintillaBase *>(p);
sci->AutoCompleteCompleted(); sci->AutoCompleteCompleted();
} }
@ -392,6 +393,23 @@ int ScintillaBase::AutoCompleteGetCurrent() {
return ac.lb->GetSelection(); return ac.lb->GetSelection();
} }
int ScintillaBase::AutoCompleteGetCurrentText(char *buffer) {
if (ac.Active()) {
int item = ac.lb->GetSelection();
char selected[1000];
selected[0] = '\0';
if (item != -1) {
ac.lb->GetValue(item, selected, sizeof(selected));
if (buffer != NULL)
strcpy(buffer, selected);
return strlen(selected);
}
}
if (buffer != NULL)
*buffer = '\0';
return 0;
}
void ScintillaBase::CallTipShow(Point pt, const char *defn) { void ScintillaBase::CallTipShow(Point pt, const char *defn) {
ac.Cancel(); ac.Cancel();
pt.y += vs.lineHeight; pt.y += vs.lineHeight;
@ -464,6 +482,8 @@ void ScintillaBase::SetLexer(uptr_t wParam) {
lexCurrent = LexerModule::Find(lexLanguage); lexCurrent = LexerModule::Find(lexLanguage);
if (!lexCurrent) if (!lexCurrent)
lexCurrent = LexerModule::Find(SCLEX_NULL); lexCurrent = LexerModule::Find(SCLEX_NULL);
int bits = lexCurrent ? lexCurrent->GetStyleBitsNeeded() : 5;
vs.EnsureStyle((1 << bits) - 1);
} }
void ScintillaBase::SetLexerLanguage(const char *languageName) { void ScintillaBase::SetLexerLanguage(const char *languageName) {
@ -473,6 +493,8 @@ void ScintillaBase::SetLexerLanguage(const char *languageName) {
lexCurrent = LexerModule::Find(SCLEX_NULL); lexCurrent = LexerModule::Find(SCLEX_NULL);
if (lexCurrent) if (lexCurrent)
lexLanguage = lexCurrent->GetLanguage(); lexLanguage = lexCurrent->GetLanguage();
int bits = lexCurrent ? lexCurrent->GetStyleBitsNeeded() : 5;
vs.EnsureStyle((1 << bits) - 1);
} }
void ScintillaBase::Colourise(int start, int end) { void ScintillaBase::Colourise(int start, int end) {
@ -564,6 +586,9 @@ sptr_t ScintillaBase::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lPara
case SCI_AUTOCGETCURRENT: case SCI_AUTOCGETCURRENT:
return AutoCompleteGetCurrent(); return AutoCompleteGetCurrent();
case SCI_AUTOCGETCURRENTTEXT:
return AutoCompleteGetCurrentText(reinterpret_cast<char *>(lParam));
case SCI_AUTOCSETCANCELATSTART: case SCI_AUTOCSETCANCELATSTART:
ac.cancelAtStartPos = wParam != 0; ac.cancelAtStartPos = wParam != 0;
break; break;
@ -706,15 +731,8 @@ sptr_t ScintillaBase::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lPara
reinterpret_cast<const char *>(lParam)); reinterpret_cast<const char *>(lParam));
break; break;
case SCI_GETPROPERTY: { case SCI_GETPROPERTY:
const char *val = props.Get(reinterpret_cast<const char *>(wParam)); return StringResult(lParam, props.Get(reinterpret_cast<const char *>(wParam)));
const int n = strlen(val);
if (lParam != 0) {
char *ptr = reinterpret_cast<char *>(lParam);
strcpy(ptr, val);
}
return n; // Not including NUL
}
case SCI_GETPROPERTYEXPANDED: { case SCI_GETPROPERTYEXPANDED: {
char *val = props.Expanded(reinterpret_cast<const char *>(wParam)); char *val = props.Expanded(reinterpret_cast<const char *>(wParam));
@ -741,8 +759,12 @@ sptr_t ScintillaBase::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lPara
SetLexerLanguage(reinterpret_cast<const char *>(lParam)); SetLexerLanguage(reinterpret_cast<const char *>(lParam));
break; break;
case SCI_GETLEXERLANGUAGE:
return StringResult(lParam, lexCurrent ? lexCurrent->languageName : "");
case SCI_GETSTYLEBITSNEEDED: case SCI_GETSTYLEBITSNEEDED:
return lexCurrent ? lexCurrent->GetStyleBitsNeeded() : 5; return lexCurrent ? lexCurrent->GetStyleBitsNeeded() : 5;
#endif #endif
default: default:

View File

@ -16,8 +16,8 @@ namespace Scintilla {
*/ */
class ScintillaBase : public Editor { class ScintillaBase : public Editor {
// Private so ScintillaBase objects can not be copied // Private so ScintillaBase objects can not be copied
ScintillaBase(const ScintillaBase &) : Editor() {} ScintillaBase(const ScintillaBase &);
ScintillaBase &operator=(const ScintillaBase &) { return *this; } ScintillaBase &operator=(const ScintillaBase &);
protected: protected:
/** Enumeration of commands and child windows. */ /** Enumeration of commands and child windows. */
@ -43,9 +43,8 @@ protected:
int listType; ///< 0 is an autocomplete list int listType; ///< 0 is an autocomplete list
int maxListWidth; /// Maximum width of list, in average character widths int maxListWidth; /// Maximum width of list, in average character widths
bool performingStyle; ///< Prevent reentrance
#ifdef SCI_LEXER #ifdef SCI_LEXER
bool performingStyle; ///< Prevent reentrance
int lexLanguage; int lexLanguage;
const LexerModule *lexCurrent; const LexerModule *lexCurrent;
PropSetSimple props; PropSetSimple props;
@ -72,11 +71,12 @@ protected:
void AutoCompleteCancel(); void AutoCompleteCancel();
void AutoCompleteMove(int delta); void AutoCompleteMove(int delta);
int AutoCompleteGetCurrent(); int AutoCompleteGetCurrent();
int AutoCompleteGetCurrentText(char *buffer);
void AutoCompleteCharacterAdded(char ch); void AutoCompleteCharacterAdded(char ch);
void AutoCompleteCharacterDeleted(); void AutoCompleteCharacterDeleted();
void AutoCompleteCompleted(); void AutoCompleteCompleted();
void AutoCompleteMoveToCurrentWord(); void AutoCompleteMoveToCurrentWord();
static void AutoCompleteDoubleClick(void* p); static void AutoCompleteDoubleClick(void *p);
void CallTipClick(); void CallTipClick();
void CallTipShow(Point pt, const char *defn); void CallTipShow(Point pt, const char *defn);

View File

@ -179,6 +179,27 @@ SelectionRange &Selection::Rectangular() {
return rangeRectangular; return rangeRectangular;
} }
SelectionSegment Selection::Limits() const {
if (ranges.empty()) {
return SelectionSegment();
} else {
SelectionSegment sr(ranges[0].anchor, ranges[0].caret);
for (size_t i=1; i<ranges.size(); i++) {
sr.Extend(ranges[i].anchor);
sr.Extend(ranges[i].caret);
}
return sr;
}
}
SelectionSegment Selection::LimitsForRectangularElseMain() const {
if (IsRectangular()) {
return Limits();
} else {
return SelectionSegment(ranges[mainRange].caret, ranges[mainRange].anchor);
}
}
size_t Selection::Count() const { size_t Selection::Count() const {
return ranges.size(); return ranges.size();
} }
@ -246,7 +267,7 @@ void Selection::TrimSelection(SelectionRange range) {
for (size_t i=0; i<ranges.size();) { for (size_t i=0; i<ranges.size();) {
if ((i != mainRange) && (ranges[i].Trim(range))) { if ((i != mainRange) && (ranges[i].Trim(range))) {
// Trimmed to empty so remove // Trimmed to empty so remove
for (size_t j=i;j<ranges.size()-1;j++) { for (size_t j=i; j<ranges.size()-1; j++) {
ranges[j] = ranges[j+1]; ranges[j] = ranges[j+1];
if (j == mainRange-1) if (j == mainRange-1)
mainRange--; mainRange--;

View File

@ -74,6 +74,12 @@ struct SelectionSegment {
bool Empty() const { bool Empty() const {
return start == end; return start == end;
} }
void Extend(SelectionPosition p) {
if (start > p)
start = p;
if (end < p)
end = p;
}
}; };
struct SelectionRange { struct SelectionRange {
@ -141,6 +147,11 @@ public:
int MainCaret() const; int MainCaret() const;
int MainAnchor() const; int MainAnchor() const;
SelectionRange &Rectangular(); SelectionRange &Rectangular();
SelectionSegment Limits() const;
// This is for when you want to move the caret in response to a
// user direction command - for rectangular selections, use the range
// that covers all selected text otherwise return the main selection.
SelectionSegment LimitsForRectangularElseMain() const;
size_t Count() const; size_t Count() const;
size_t Main() const; size_t Main() const;
void SetMain(size_t r); void SetMain(size_t r);

View File

@ -135,7 +135,7 @@ public:
} }
} }
T& operator[](int position) const { T &operator[](int position) const {
PLATFORM_ASSERT(position >= 0 && position < lengthBody); PLATFORM_ASSERT(position >= 0 && position < lengthBody);
if (position < part1Length) { if (position < part1Length) {
return body[position]; return body[position];
@ -238,7 +238,7 @@ public:
DeleteRange(0, lengthBody); DeleteRange(0, lengthBody);
} }
T* BufferPointer() { T *BufferPointer() {
RoomFor(1); RoomFor(1);
GapTo(lengthBody); GapTo(lengthBody);
body[lengthBody] = 0; body[lengthBody] = 0;

View File

@ -92,6 +92,13 @@ void Style::Clear(ColourDesired fore_, ColourDesired back_, int size_,
else else
font.Release(); font.Release();
aliasOfDefaultFont = false; aliasOfDefaultFont = false;
sizeZoomed = 2;
lineHeight = 2;
ascent = 1;
descent = 1;
externalLeading = 0;
aveCharWidth = 1;
spaceWidth = 1;
} }
void Style::ClearTo(const Style &source) { void Style::ClearTo(const Style &source) {
@ -126,7 +133,7 @@ bool Style::EquivalentFontTo(const Style *other) const {
return strcmp(fontName, other->fontName) == 0; return strcmp(fontName, other->fontName) == 0;
} }
void Style::Realise(Surface &surface, int zoomLevel, Style *defaultStyle, bool extraFontFlag) { void Style::Realise(Surface &surface, int zoomLevel, Style *defaultStyle, int extraFontFlag) {
sizeZoomed = size + zoomLevel; sizeZoomed = size + zoomLevel;
if (sizeZoomed <= 2) // Hangs if sizeZoomed <= 1 if (sizeZoomed <= 2) // Hangs if sizeZoomed <= 1
sizeZoomed = 2; sizeZoomed = 2;

View File

@ -53,8 +53,8 @@ public:
bool visible_, bool changeable_, bool hotspot_); bool visible_, bool changeable_, bool hotspot_);
void ClearTo(const Style &source); void ClearTo(const Style &source);
bool EquivalentFontTo(const Style *other) const; bool EquivalentFontTo(const Style *other) const;
void Realise(Surface &surface, int zoomLevel, Style *defaultStyle = 0, bool extraFontFlag = false); void Realise(Surface &surface, int zoomLevel, Style *defaultStyle = 0, int extraFontFlag = 0);
bool IsProtected() const { return !(changeable && visible);}; bool IsProtected() const { return !(changeable && visible);}
}; };
#ifdef SCI_NAMESPACE #ifdef SCI_NAMESPACE

View File

@ -16,9 +16,7 @@ namespace Scintilla {
class StyleContext { class StyleContext {
Accessor &styler; Accessor &styler;
unsigned int endPos; unsigned int endPos;
StyleContext& operator=(const StyleContext&) { StyleContext &operator=(const StyleContext &);
return *this;
}
void GetNextChar(unsigned int pos) { void GetNextChar(unsigned int pos) {
chNext = static_cast<unsigned char>(styler.SafeGetCharAt(pos+1)); chNext = static_cast<unsigned char>(styler.SafeGetCharAt(pos+1));
if (styler.IsLeadByte(static_cast<char>(chNext))) { if (styler.IsLeadByte(static_cast<char>(chNext))) {
@ -67,7 +65,7 @@ public:
void Complete() { void Complete() {
styler.ColourTo(currentPos - 1, state); styler.ColourTo(currentPos - 1, state);
} }
bool More() { bool More() const {
return currentPos < endPos; return currentPos < endPos;
} }
void Forward() { void Forward() {
@ -110,10 +108,10 @@ public:
int GetRelative(int n) { int GetRelative(int n) {
return static_cast<unsigned char>(styler.SafeGetCharAt(currentPos+n)); return static_cast<unsigned char>(styler.SafeGetCharAt(currentPos+n));
} }
bool Match(char ch0) { bool Match(char ch0) const {
return ch == static_cast<unsigned char>(ch0); return ch == static_cast<unsigned char>(ch0);
} }
bool Match(char ch0, char ch1) { bool Match(char ch0, char ch1) const {
return (ch == static_cast<unsigned char>(ch0)) && (chNext == static_cast<unsigned char>(ch1)); return (ch == static_cast<unsigned char>(ch0)) && (chNext == static_cast<unsigned char>(ch1));
} }
bool Match(const char *s) { bool Match(const char *s) {

View File

@ -1,6 +1,6 @@
// Scintilla source code edit control // Scintilla source code edit control
/** @file UniConversion.cxx /** @file UniConversion.cxx
** Functions to handle UFT-8 and UCS-2 strings. ** Functions to handle UTF-8 and UTF-16 strings.
**/ **/
// Copyright 1998-2001 by Neil Hodgson <neilh@scintilla.org> // Copyright 1998-2001 by Neil Hodgson <neilh@scintilla.org>
// The License.txt file describes the conditions under which this software may be distributed. // The License.txt file describes the conditions under which this software may be distributed.
@ -61,10 +61,22 @@ void UTF8FromUTF16(const wchar_t *uptr, unsigned int tlen, char *putf, unsigned
putf[len] = '\0'; putf[len] = '\0';
} }
unsigned int UTF8CharLength(unsigned char ch) {
if (ch < 0x80) {
return 1;
} else if (ch < 0x80 + 0x40 + 0x20) {
return 2;
} else if (ch < 0x80 + 0x40 + 0x20 + 0x10) {
return 3;
} else {
return 4;
}
}
unsigned int UTF16Length(const char *s, unsigned int len) { unsigned int UTF16Length(const char *s, unsigned int len) {
unsigned int ulen = 0; unsigned int ulen = 0;
unsigned int charLen; unsigned int charLen;
for (unsigned int i=0;i<len;) { for (unsigned int i=0; i<len;) {
unsigned char ch = static_cast<unsigned char>(s[i]); unsigned char ch = static_cast<unsigned char>(s[i]);
if (ch < 0x80) { if (ch < 0x80) {
charLen = 1; charLen = 1;

View File

@ -1,12 +1,13 @@
// Scintilla source code edit control // Scintilla source code edit control
/** @file UniConversion.h /** @file UniConversion.h
** Functions to handle UFT-8 and UCS-2 strings. ** Functions to handle UTF-8 and UTF-16 strings.
**/ **/
// Copyright 1998-2001 by Neil Hodgson <neilh@scintilla.org> // Copyright 1998-2001 by Neil Hodgson <neilh@scintilla.org>
// The License.txt file describes the conditions under which this software may be distributed. // The License.txt file describes the conditions under which this software may be distributed.
unsigned int UTF8Length(const wchar_t *uptr, unsigned int tlen); unsigned int UTF8Length(const wchar_t *uptr, unsigned int tlen);
void UTF8FromUTF16(const wchar_t *uptr, unsigned int tlen, char *putf, unsigned int len); void UTF8FromUTF16(const wchar_t *uptr, unsigned int tlen, char *putf, unsigned int len);
unsigned int UTF8CharLength(unsigned char ch);
unsigned int UTF16Length(const char *s, unsigned int len); unsigned int UTF16Length(const char *s, unsigned int len);
unsigned int UTF16FromUTF8(const char *s, unsigned int len, wchar_t *tbuf, unsigned int tlen); unsigned int UTF16FromUTF8(const char *s, unsigned int len, wchar_t *tbuf, unsigned int tlen);

View File

@ -41,7 +41,7 @@ FontNames::~FontNames() {
} }
void FontNames::Clear() { void FontNames::Clear() {
for (int i=0;i<max;i++) { for (int i=0; i<max; i++) {
delete []names[i]; delete []names[i];
} }
max = 0; max = 0;
@ -50,7 +50,7 @@ void FontNames::Clear() {
const char *FontNames::Save(const char *name) { const char *FontNames::Save(const char *name) {
if (!name) if (!name)
return 0; return 0;
for (int i=0;i<max;i++) { for (int i=0; i<max; i++) {
if (strcmp(names[i], name) == 0) { if (strcmp(names[i], name) == 0) {
return names[i]; return names[i];
} }
@ -59,7 +59,7 @@ const char *FontNames::Save(const char *name) {
// Grow array // Grow array
int sizeNew = size * 2; int sizeNew = size * 2;
char **namesNew = new char *[sizeNew]; char **namesNew = new char *[sizeNew];
for (int j=0;j<max;j++) { for (int j=0; j<max; j++) {
namesNew[j] = names[j]; namesNew[j] = names[j];
} }
delete []names; delete []names;
@ -78,15 +78,15 @@ ViewStyle::ViewStyle() {
ViewStyle::ViewStyle(const ViewStyle &source) { ViewStyle::ViewStyle(const ViewStyle &source) {
Init(source.stylesSize); Init(source.stylesSize);
for (unsigned int sty=0;sty<source.stylesSize;sty++) { for (unsigned int sty=0; sty<source.stylesSize; sty++) {
styles[sty] = source.styles[sty]; styles[sty] = source.styles[sty];
// Can't just copy fontname as its lifetime is relative to its owning ViewStyle // Can't just copy fontname as its lifetime is relative to its owning ViewStyle
styles[sty].fontName = fontNames.Save(source.styles[sty].fontName); styles[sty].fontName = fontNames.Save(source.styles[sty].fontName);
} }
for (int mrk=0;mrk<=MARKER_MAX;mrk++) { for (int mrk=0; mrk<=MARKER_MAX; mrk++) {
markers[mrk] = source.markers[mrk]; markers[mrk] = source.markers[mrk];
} }
for (int ind=0;ind<=INDIC_MAX;ind++) { for (int ind=0; ind<=INDIC_MAX; ind++) {
indicators[ind] = source.indicators[ind]; indicators[ind] = source.indicators[ind];
} }
@ -132,7 +132,7 @@ ViewStyle::ViewStyle(const ViewStyle &source) {
someStylesProtected = false; someStylesProtected = false;
leftMarginWidth = source.leftMarginWidth; leftMarginWidth = source.leftMarginWidth;
rightMarginWidth = source.rightMarginWidth; rightMarginWidth = source.rightMarginWidth;
for (int i=0;i < margins; i++) { for (int i=0; i < margins; i++) {
ms[i] = source.ms[i]; ms[i] = source.ms[i];
} }
symbolMargin = source.symbolMargin; symbolMargin = source.symbolMargin;
@ -140,6 +140,7 @@ ViewStyle::ViewStyle(const ViewStyle &source) {
fixedColumnWidth = source.fixedColumnWidth; fixedColumnWidth = source.fixedColumnWidth;
zoomLevel = source.zoomLevel; zoomLevel = source.zoomLevel;
viewWhitespace = source.viewWhitespace; viewWhitespace = source.viewWhitespace;
whitespaceSize = source.whitespaceSize;
viewIndentationGuides = source.viewIndentationGuides; viewIndentationGuides = source.viewIndentationGuides;
viewEOL = source.viewEOL; viewEOL = source.viewEOL;
showMarkedLines = source.showMarkedLines; showMarkedLines = source.showMarkedLines;
@ -244,10 +245,11 @@ void ViewStyle::Init(size_t stylesSize_) {
} }
zoomLevel = 0; zoomLevel = 0;
viewWhitespace = wsInvisible; viewWhitespace = wsInvisible;
whitespaceSize = 1;
viewIndentationGuides = ivNone; viewIndentationGuides = ivNone;
viewEOL = false; viewEOL = false;
showMarkedLines = true; showMarkedLines = true;
extraFontFlag = false; extraFontFlag = 0;
extraAscent = 0; extraAscent = 0;
extraDescent = 0; extraDescent = 0;
marginStyleOffset = 0; marginStyleOffset = 0;
@ -257,14 +259,14 @@ void ViewStyle::Init(size_t stylesSize_) {
void ViewStyle::RefreshColourPalette(Palette &pal, bool want) { void ViewStyle::RefreshColourPalette(Palette &pal, bool want) {
unsigned int i; unsigned int i;
for (i=0;i<stylesSize;i++) { for (i=0; i<stylesSize; i++) {
pal.WantFind(styles[i].fore, want); pal.WantFind(styles[i].fore, want);
pal.WantFind(styles[i].back, want); pal.WantFind(styles[i].back, want);
} }
for (i=0;i<(sizeof(indicators)/sizeof(indicators[0]));i++) { for (i=0; i<(sizeof(indicators)/sizeof(indicators[0])); i++) {
pal.WantFind(indicators[i].fore, want); pal.WantFind(indicators[i].fore, want);
} }
for (i=0;i<(sizeof(markers)/sizeof(markers[0]));i++) { for (i=0; i<(sizeof(markers)/sizeof(markers[0])); i++) {
markers[i].RefreshColourPalette(pal, want); markers[i].RefreshColourPalette(pal, want);
} }
pal.WantFind(selforeground, want); pal.WantFind(selforeground, want);

View File

@ -92,6 +92,7 @@ public:
int fixedColumnWidth; int fixedColumnWidth;
int zoomLevel; int zoomLevel;
WhiteSpaceVisibility viewWhitespace; WhiteSpaceVisibility viewWhitespace;
int whitespaceSize;
IndentView viewIndentationGuides; IndentView viewIndentationGuides;
bool viewEOL; bool viewEOL;
bool showMarkedLines; bool showMarkedLines;
@ -106,7 +107,7 @@ public:
int caretStyle; int caretStyle;
int caretWidth; int caretWidth;
bool someStylesProtected; bool someStylesProtected;
bool extraFontFlag; int extraFontFlag;
int extraAscent; int extraAscent;
int extraDescent; int extraDescent;
int marginStyleOffset; int marginStyleOffset;

View File

@ -174,7 +174,7 @@ int WindowAccessor::IndentAmount(int line, int *flags, PFNIsCommentLeader pfnIsC
*flags = spaceFlags; *flags = spaceFlags;
indent += SC_FOLDLEVELBASE; indent += SC_FOLDLEVELBASE;
// if completely empty line or the start of a comment... // if completely empty line or the start of a comment...
if (isspace(ch) || (pfnIsCommentLeader && (*pfnIsCommentLeader)(*this, pos, end-pos)) ) if (isspace(ch) || (pfnIsCommentLeader && (*pfnIsCommentLeader)(*this, pos, end-pos)))
return indent | SC_FOLDLEVELWHITEFLAG; return indent | SC_FOLDLEVELWHITEFLAG;
else else
return indent; return indent;

View File

@ -38,7 +38,7 @@ static size_t MeasureLength(const char *s) {
return i; return i;
} }
ColourAllocated XPM::ColourFromCode(int ch) { ColourAllocated XPM::ColourFromCode(int ch) const {
return colourCodeTable[ch]->allocated; return colourCodeTable[ch]->allocated;
#ifdef SLOW #ifdef SLOW
for (int i=0; i<nColours; i++) { for (int i=0; i<nColours; i++) {
@ -62,7 +62,7 @@ XPM::XPM(const char *textForm) :
Init(textForm); Init(textForm);
} }
XPM::XPM(const char * const *linesForm) : XPM::XPM(const char *const *linesForm) :
data(0), codes(0), colours(0), lines(0) { data(0), codes(0), colours(0), lines(0) {
Init(linesForm); Init(linesForm);
} }
@ -88,7 +88,7 @@ void XPM::Init(const char *textForm) {
} }
} }
void XPM::Init(const char * const *linesForm) { void XPM::Init(const char *const *linesForm) {
Clear(); Clear();
height = 1; height = 1;
width = 1; width = 1;
@ -185,7 +185,7 @@ void XPM::Draw(Surface *surface, PRectangle &rc) {
// Centre the pixmap // Centre the pixmap
int startY = rc.top + (rc.Height() - height) / 2; int startY = rc.top + (rc.Height() - height) / 2;
int startX = rc.left + (rc.Width() - width) / 2; int startX = rc.left + (rc.Width() - width) / 2;
for (int y=0;y<height;y++) { for (int y=0; y<height; y++) {
int prevCode = 0; int prevCode = 0;
int xStartRun = 0; int xStartRun = 0;
for (int x=0; x<width; x++) { for (int x=0; x<width; x++) {

View File

@ -24,16 +24,16 @@ class XPM {
char codeTransparent; char codeTransparent;
char *codes; char *codes;
ColourPair *colours; ColourPair *colours;
ColourAllocated ColourFromCode(int ch); ColourAllocated ColourFromCode(int ch) const;
void FillRun(Surface *surface, int code, int startX, int y, int x); void FillRun(Surface *surface, int code, int startX, int y, int x);
char **lines; char **lines;
ColourPair *colourCodeTable[256]; ColourPair *colourCodeTable[256];
public: public:
XPM(const char *textForm); XPM(const char *textForm);
XPM(const char * const *linesForm); XPM(const char *const *linesForm);
~XPM(); ~XPM();
void Init(const char *textForm); void Init(const char *textForm);
void Init(const char * const *linesForm); void Init(const char *const *linesForm);
void Clear(); void Clear();
/// Similar to same named method in ViewStyle: /// Similar to same named method in ViewStyle:
void RefreshColourPalette(Palette &pal, bool want); void RefreshColourPalette(Palette &pal, bool want);
@ -43,9 +43,9 @@ public:
void Draw(Surface *surface, PRectangle &rc); void Draw(Surface *surface, PRectangle &rc);
char **InLinesForm() { return lines; } char **InLinesForm() { return lines; }
void SetId(int pid_) { pid = pid_; } void SetId(int pid_) { pid = pid_; }
int GetId() { return pid; } int GetId() const { return pid; }
int GetHeight() { return height; } int GetHeight() const { return height; }
int GetWidth() { return width; } int GetWidth() const { return width; }
static const char **LinesFormFromTextForm(const char *textForm); static const char **LinesFormFromTextForm(const char *textForm);
}; };

View File

@ -43,8 +43,8 @@ RSC=rc.exe
# PROP Ignore_Export_Lib 0 # PROP Ignore_Export_Lib 0
# PROP Target_Dir "" # PROP Target_Dir ""
# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "SciLexer_EXPORTS" /Yu"stdafx.h" /FD /c # ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "SciLexer_EXPORTS" /Yu"stdafx.h" /FD /c
# ADD CPP /nologo /G6 /MT /W3 /GX /O1 /I "..\include" /I "..\src" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "SCI_LEXER" /D "_CRT_SECURE_NO_WARNINGS" /Fr /FD /c # ADD CPP /nologo /G6 /MT /W3 /GX /O1 /I "..\include" /I "..\src" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "SCI_LEXER" /D "_CRT_SECURE_NO_WARNINGS" /FD /c
# SUBTRACT CPP /YX /Yc /Yu # SUBTRACT CPP /Fr /YX /Yc /Yu
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 # ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 # ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x409 /d "NDEBUG" # ADD BASE RSC /l 0x409 /d "NDEBUG"
@ -298,6 +298,10 @@ SOURCE=..\src\LexMagik.cxx
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE=..\src\LexMarkdown.cxx
# End Source File
# Begin Source File
SOURCE=..\src\LexMatlab.cxx SOURCE=..\src\LexMatlab.cxx
# End Source File # End Source File
# Begin Source File # Begin Source File

View File

@ -1 +1 @@
201 212

View File

@ -22,6 +22,7 @@
#include "PlatformRes.h" #include "PlatformRes.h"
#include "UniConversion.h" #include "UniConversion.h"
#include "XPM.h" #include "XPM.h"
#include "FontQuality.h"
#ifndef IDC_HAND #ifndef IDC_HAND
#define IDC_HAND MAKEINTRESOURCE(32649) #define IDC_HAND MAKEINTRESOURCE(32649)
@ -179,13 +180,35 @@ void Palette::Allocate(Window &) {
} }
} }
static void SetLogFont(LOGFONTA &lf, const char *faceName, int characterSet, int size, bool bold, bool italic) { #ifndef CLEARTYPE_QUALITY
#define CLEARTYPE_QUALITY 5
#endif
static BYTE Win32MapFontQuality(int extraFontFlag) {
switch (extraFontFlag & SC_EFF_QUALITY_MASK) {
case SC_EFF_QUALITY_NON_ANTIALIASED:
return NONANTIALIASED_QUALITY;
case SC_EFF_QUALITY_ANTIALIASED:
return ANTIALIASED_QUALITY;
case SC_EFF_QUALITY_LCD_OPTIMIZED:
return CLEARTYPE_QUALITY;
default:
return SC_EFF_QUALITY_DEFAULT;
}
}
static void SetLogFont(LOGFONTA &lf, const char *faceName, int characterSet, int size, bool bold, bool italic, int extraFontFlag) {
memset(&lf, 0, sizeof(lf)); memset(&lf, 0, sizeof(lf));
// The negative is to allow for leading // The negative is to allow for leading
lf.lfHeight = -(abs(size)); lf.lfHeight = -(abs(size));
lf.lfWeight = bold ? FW_BOLD : FW_NORMAL; lf.lfWeight = bold ? FW_BOLD : FW_NORMAL;
lf.lfItalic = static_cast<BYTE>(italic ? 1 : 0); lf.lfItalic = static_cast<BYTE>(italic ? 1 : 0);
lf.lfCharSet = static_cast<BYTE>(characterSet); lf.lfCharSet = static_cast<BYTE>(characterSet);
lf.lfQuality = Win32MapFontQuality(extraFontFlag);
strncpy(lf.lfFaceName, faceName, sizeof(lf.lfFaceName)); strncpy(lf.lfFaceName, faceName, sizeof(lf.lfFaceName));
} }
@ -194,10 +217,11 @@ static void SetLogFont(LOGFONTA &lf, const char *faceName, int characterSet, int
* If one font is the same as another, its hash will be the same, but if the hash is the * If one font is the same as another, its hash will be the same, but if the hash is the
* same then they may still be different. * same then they may still be different.
*/ */
static int HashFont(const char *faceName, int characterSet, int size, bool bold, bool italic) { static int HashFont(const char *faceName, int characterSet, int size, bool bold, bool italic, int extraFontFlag) {
return return
size ^ size ^
(characterSet << 10) ^ (characterSet << 10) ^
((extraFontFlag & SC_EFF_QUALITY_MASK) << 9) ^
(bold ? 0x10000000 : 0) ^ (bold ? 0x10000000 : 0) ^
(italic ? 0x20000000 : 0) ^ (italic ? 0x20000000 : 0) ^
faceName[0]; faceName[0];
@ -208,33 +232,34 @@ class FontCached : Font {
int usage; int usage;
LOGFONTA lf; LOGFONTA lf;
int hash; int hash;
FontCached(const char *faceName_, int characterSet_, int size_, bool bold_, bool italic_); FontCached(const char *faceName_, int characterSet_, int size_, bool bold_, bool italic_, int extraFontFlag_);
~FontCached() {} ~FontCached() {}
bool SameAs(const char *faceName_, int characterSet_, int size_, bool bold_, bool italic_); bool SameAs(const char *faceName_, int characterSet_, int size_, bool bold_, bool italic_, int extraFontFlag_);
virtual void Release(); virtual void Release();
static FontCached *first; static FontCached *first;
public: public:
static FontID FindOrCreate(const char *faceName_, int characterSet_, int size_, bool bold_, bool italic_); static FontID FindOrCreate(const char *faceName_, int characterSet_, int size_, bool bold_, bool italic_, int extraFontFlag_);
static void ReleaseId(FontID fid_); static void ReleaseId(FontID fid_);
}; };
FontCached *FontCached::first = 0; FontCached *FontCached::first = 0;
FontCached::FontCached(const char *faceName_, int characterSet_, int size_, bool bold_, bool italic_) : FontCached::FontCached(const char *faceName_, int characterSet_, int size_, bool bold_, bool italic_, int extraFontFlag_) :
next(0), usage(0), hash(0) { next(0), usage(0), hash(0) {
SetLogFont(lf, faceName_, characterSet_, size_, bold_, italic_); SetLogFont(lf, faceName_, characterSet_, size_, bold_, italic_, extraFontFlag_);
hash = HashFont(faceName_, characterSet_, size_, bold_, italic_); hash = HashFont(faceName_, characterSet_, size_, bold_, italic_, extraFontFlag_);
fid = ::CreateFontIndirectA(&lf); fid = ::CreateFontIndirectA(&lf);
usage = 1; usage = 1;
} }
bool FontCached::SameAs(const char *faceName_, int characterSet_, int size_, bool bold_, bool italic_) { bool FontCached::SameAs(const char *faceName_, int characterSet_, int size_, bool bold_, bool italic_, int extraFontFlag_) {
return return
(lf.lfHeight == -(abs(size_))) && (lf.lfHeight == -(abs(size_))) &&
(lf.lfWeight == (bold_ ? FW_BOLD : FW_NORMAL)) && (lf.lfWeight == (bold_ ? FW_BOLD : FW_NORMAL)) &&
(lf.lfItalic == static_cast<BYTE>(italic_ ? 1 : 0)) && (lf.lfItalic == static_cast<BYTE>(italic_ ? 1 : 0)) &&
(lf.lfCharSet == characterSet_) && (lf.lfCharSet == characterSet_) &&
(lf.lfQuality == Win32MapFontQuality(extraFontFlag_)) &&
0 == strcmp(lf.lfFaceName,faceName_); 0 == strcmp(lf.lfFaceName,faceName_);
} }
@ -244,19 +269,19 @@ void FontCached::Release() {
fid = 0; fid = 0;
} }
FontID FontCached::FindOrCreate(const char *faceName_, int characterSet_, int size_, bool bold_, bool italic_) { FontID FontCached::FindOrCreate(const char *faceName_, int characterSet_, int size_, bool bold_, bool italic_, int extraFontFlag_) {
FontID ret = 0; FontID ret = 0;
::EnterCriticalSection(&crPlatformLock); ::EnterCriticalSection(&crPlatformLock);
int hashFind = HashFont(faceName_, characterSet_, size_, bold_, italic_); int hashFind = HashFont(faceName_, characterSet_, size_, bold_, italic_, extraFontFlag_);
for (FontCached *cur=first; cur; cur=cur->next) { for (FontCached *cur=first; cur; cur=cur->next) {
if ((cur->hash == hashFind) && if ((cur->hash == hashFind) &&
cur->SameAs(faceName_, characterSet_, size_, bold_, italic_)) { cur->SameAs(faceName_, characterSet_, size_, bold_, italic_, extraFontFlag_)) {
cur->usage++; cur->usage++;
ret = cur->fid; ret = cur->fid;
} }
} }
if (ret == 0) { if (ret == 0) {
FontCached *fc = new FontCached(faceName_, characterSet_, size_, bold_, italic_); FontCached *fc = new FontCached(faceName_, characterSet_, size_, bold_, italic_, extraFontFlag_);
if (fc) { if (fc) {
fc->next = first; fc->next = first;
first = fc; first = fc;
@ -296,14 +321,15 @@ Font::~Font() {
#define FONTS_CACHED #define FONTS_CACHED
void Font::Create(const char *faceName, int characterSet, int size, void Font::Create(const char *faceName, int characterSet, int size,
bool bold, bool italic, bool) { bool bold, bool italic, int extraFontFlag) {
Release(); Release();
#ifndef FONTS_CACHED #ifndef FONTS_CACHED
LOGFONT lf; LOGFONT lf;
SetLogFont(lf, faceName, characterSet, size, bold, italic); SetLogFont(lf, faceName, characterSet, size, bold, italic, extraFontFlag);
fid = ::CreateFontIndirect(&lf); fid = ::CreateFontIndirect(&lf);
#else #else
fid = FontCached::FindOrCreate(faceName, characterSet, size, bold, italic); if (faceName)
fid = FontCached::FindOrCreate(faceName, characterSet, size, bold, italic, extraFontFlag);
#endif #endif
} }
@ -346,8 +372,8 @@ class SurfaceImpl : public Surface {
void SetFont(Font &font_); void SetFont(Font &font_);
// Private so SurfaceImpl objects can not be copied // Private so SurfaceImpl objects can not be copied
SurfaceImpl(const SurfaceImpl &) : Surface() {} SurfaceImpl(const SurfaceImpl &);
SurfaceImpl &operator=(const SurfaceImpl &) { return *this; } SurfaceImpl &operator=(const SurfaceImpl &);
public: public:
SurfaceImpl(); SurfaceImpl();
virtual ~SurfaceImpl(); virtual ~SurfaceImpl();
@ -591,6 +617,18 @@ static void AllFour(DWORD *pixels, int width, int height, int x, int y, DWORD va
#define AC_SRC_ALPHA 0x01 #define AC_SRC_ALPHA 0x01
#endif #endif
static DWORD dwordFromBGRA(byte b, byte g, byte r, byte a) {
union {
byte pixVal[4];
DWORD val;
} converter;
converter.pixVal[0] = b;
converter.pixVal[1] = g;
converter.pixVal[2] = r;
converter.pixVal[3] = a;
return converter.val;
}
void SurfaceImpl::AlphaRectangle(PRectangle rc, int cornerSize, ColourAllocated fill, int alphaFill, void SurfaceImpl::AlphaRectangle(PRectangle rc, int cornerSize, ColourAllocated fill, int alphaFill,
ColourAllocated outline, int alphaOutline, int /* flags*/ ) { ColourAllocated outline, int alphaOutline, int /* flags*/ ) {
if (AlphaBlendFn && rc.Width() > 0) { if (AlphaBlendFn && rc.Width() > 0) {
@ -606,18 +644,17 @@ void SurfaceImpl::AlphaRectangle(PRectangle rc, int cornerSize, ColourAllocated
HBITMAP hbmOld = SelectBitmap(hMemDC, hbmMem); HBITMAP hbmOld = SelectBitmap(hMemDC, hbmMem);
byte pixVal[4] = {0}; DWORD valEmpty = dwordFromBGRA(0,0,0,0);
DWORD valEmpty = *(reinterpret_cast<DWORD *>(pixVal)); DWORD valFill = dwordFromBGRA(
pixVal[0] = static_cast<byte>(GetBValue(fill.AsLong()) * alphaFill / 255); static_cast<byte>(GetBValue(fill.AsLong()) * alphaFill / 255),
pixVal[1] = static_cast<byte>(GetGValue(fill.AsLong()) * alphaFill / 255); static_cast<byte>(GetGValue(fill.AsLong()) * alphaFill / 255),
pixVal[2] = static_cast<byte>(GetRValue(fill.AsLong()) * alphaFill / 255); static_cast<byte>(GetRValue(fill.AsLong()) * alphaFill / 255),
pixVal[3] = static_cast<byte>(alphaFill); static_cast<byte>(alphaFill));
DWORD valFill = *(reinterpret_cast<DWORD *>(pixVal)); DWORD valOutline = dwordFromBGRA(
pixVal[0] = static_cast<byte>(GetBValue(outline.AsLong()) * alphaOutline / 255); static_cast<byte>(GetBValue(outline.AsLong()) * alphaOutline / 255),
pixVal[1] = static_cast<byte>(GetGValue(outline.AsLong()) * alphaOutline / 255); static_cast<byte>(GetGValue(outline.AsLong()) * alphaOutline / 255),
pixVal[2] = static_cast<byte>(GetRValue(outline.AsLong()) * alphaOutline / 255); static_cast<byte>(GetRValue(outline.AsLong()) * alphaOutline / 255),
pixVal[3] = static_cast<byte>(alphaOutline); static_cast<byte>(alphaOutline));
DWORD valOutline = *(reinterpret_cast<DWORD *>(pixVal));
DWORD *pixels = reinterpret_cast<DWORD *>(image); DWORD *pixels = reinterpret_cast<DWORD *>(image);
for (int y=0; y<height; y++) { for (int y=0; y<height; y++) {
for (int x=0; x<width; x++) { for (int x=0; x<width; x++) {
@ -1257,8 +1294,8 @@ class ListBoxX : public ListBox {
int MinClientWidth() const; int MinClientWidth() const;
int TextOffset() const; int TextOffset() const;
Point GetClientExtent() const; Point GetClientExtent() const;
Point MinTrackSize() const; POINT MinTrackSize() const;
Point MaxTrackSize() const; POINT MaxTrackSize() const;
void SetRedraw(bool on); void SetRedraw(bool on);
void OnDoubleClick(); void OnDoubleClick();
void ResizeToCursor(); void ResizeToCursor();
@ -1604,19 +1641,21 @@ int ListBoxX::MinClientWidth() const {
return 12 * (aveCharWidth+aveCharWidth/3); return 12 * (aveCharWidth+aveCharWidth/3);
} }
Point ListBoxX::MinTrackSize() const { POINT ListBoxX::MinTrackSize() const {
PRectangle rc(0, 0, MinClientWidth(), ItemHeight()); PRectangle rc(0, 0, MinClientWidth(), ItemHeight());
AdjustWindowRect(&rc); AdjustWindowRect(&rc);
return Point(rc.Width(), rc.Height()); POINT ret = {rc.Width(), rc.Height()};
return ret;
} }
Point ListBoxX::MaxTrackSize() const { POINT ListBoxX::MaxTrackSize() const {
PRectangle rc(0, 0, PRectangle rc(0, 0,
maxCharWidth * maxItemCharacters + TextInset.x * 2 + maxCharWidth * maxItemCharacters + TextInset.x * 2 +
TextOffset() + ::GetSystemMetrics(SM_CXVSCROLL), TextOffset() + ::GetSystemMetrics(SM_CXVSCROLL),
ItemHeight() * lti.Count()); ItemHeight() * lti.Count());
AdjustWindowRect(&rc); AdjustWindowRect(&rc);
return Point(rc.Width(), rc.Height()); POINT ret = {rc.Width(), rc.Height()};
return ret;
} }
void ListBoxX::SetRedraw(bool on) { void ListBoxX::SetRedraw(bool on) {
@ -1663,8 +1702,8 @@ void ListBoxX::ResizeToCursor() {
break; break;
} }
Point ptMin = MinTrackSize(); POINT ptMin = MinTrackSize();
Point ptMax = MaxTrackSize(); POINT ptMax = MaxTrackSize();
// We don't allow the left edge to move at present, but just in case // We don't allow the left edge to move at present, but just in case
rc.left = Platform::Maximum(Platform::Minimum(rc.left, rcPreSize.right - ptMin.x), rcPreSize.right - ptMax.x); rc.left = Platform::Maximum(Platform::Minimum(rc.left, rcPreSize.right - ptMin.x), rcPreSize.right - ptMax.x);
rc.top = Platform::Maximum(Platform::Minimum(rc.top, rcPreSize.bottom - ptMin.y), rcPreSize.bottom - ptMax.y); rc.top = Platform::Maximum(Platform::Minimum(rc.top, rcPreSize.bottom - ptMin.y), rcPreSize.bottom - ptMax.y);
@ -1924,8 +1963,8 @@ LRESULT ListBoxX::WndProc(HWND hWnd, UINT iMessage, WPARAM wParam, LPARAM lParam
case WM_GETMINMAXINFO: { case WM_GETMINMAXINFO: {
MINMAXINFO *minMax = reinterpret_cast<MINMAXINFO*>(lParam); MINMAXINFO *minMax = reinterpret_cast<MINMAXINFO*>(lParam);
*reinterpret_cast<Point*>(&minMax->ptMaxTrackSize) = MaxTrackSize(); minMax->ptMaxTrackSize = MaxTrackSize();
*reinterpret_cast<Point*>(&minMax->ptMinTrackSize) = MinTrackSize(); minMax->ptMinTrackSize = MinTrackSize();
} }
break; break;
@ -2089,8 +2128,13 @@ public:
// Use GetProcAddress to get a pointer to the relevant function. // Use GetProcAddress to get a pointer to the relevant function.
virtual Function FindFunction(const char *name) { virtual Function FindFunction(const char *name) {
if (h != NULL) { if (h != NULL) {
return static_cast<Function>( // C++ standard doesn't like casts betwen function pointers and void pointers so use a union
(void *)(::GetProcAddress(h, name))); union {
FARPROC fp;
Function f;
} fnConv;
fnConv.fp = ::GetProcAddress(h, name);
return fnConv.f;
} else } else
return NULL; return NULL;
} }

View File

@ -1,5 +1,5 @@
// Resource file for Scintilla // Resource file for Scintilla
// Copyright 1998-2007 by Neil Hodgson <neilh@scintilla.org> // Copyright 1998-2010 by Neil Hodgson <neilh@scintilla.org>
// The License.txt file describes the conditions under which this software may be distributed. // The License.txt file describes the conditions under which this software may be distributed.
#ifndef __BORLANDC__ #ifndef __BORLANDC__
@ -9,8 +9,8 @@
#include "PlatformRes.h" #include "PlatformRes.h"
VS_VERSION_INFO VERSIONINFO VS_VERSION_INFO VERSIONINFO
FILEVERSION 2, 0, 1, 0 FILEVERSION 2, 1, 2, 0
PRODUCTVERSION 2, 0, 1, 0 PRODUCTVERSION 2, 1, 2, 0
FILEFLAGSMASK 0x3fL FILEFLAGSMASK 0x3fL
FILEFLAGS 0 FILEFLAGS 0
FILEOS VOS_NT_WINDOWS32 FILEOS VOS_NT_WINDOWS32
@ -27,12 +27,12 @@ BEGIN
BEGIN BEGIN
VALUE "CompanyName", "Neil Hodgson neilh@scintilla.org\0" VALUE "CompanyName", "Neil Hodgson neilh@scintilla.org\0"
VALUE "FileDescription", "Scintilla.DLL - a Source Editing Component\0" VALUE "FileDescription", "Scintilla.DLL - a Source Editing Component\0"
VALUE "FileVersion", "2.01\0" VALUE "FileVersion", "2.12\0"
VALUE "InternalName", "Scintilla\0" VALUE "InternalName", "Scintilla\0"
VALUE "LegalCopyright", "Copyright 1998-2009 by Neil Hodgson\0" VALUE "LegalCopyright", "Copyright 1998-2010 by Neil Hodgson\0"
VALUE "OriginalFilename", "Scintilla.DLL\0" VALUE "OriginalFilename", "Scintilla.DLL\0"
VALUE "ProductName", "Scintilla\0" VALUE "ProductName", "Scintilla\0"
VALUE "ProductVersion", "2.01\0" VALUE "ProductVersion", "2.12\0"
END END
END END
END END

View File

@ -93,11 +93,7 @@ extern bool IsNT();
extern void Platform_Initialise(void *hInstance); extern void Platform_Initialise(void *hInstance);
extern void Platform_Finalise(); extern void Platform_Finalise();
/** TOTAL_CONTROL ifdef surrounds code that will only work when ScintillaWin typedef BOOL (WINAPI *TrackMouseEventSig)(LPTRACKMOUSEEVENT);
* is derived from ScintillaBase (all features) rather than directly from Editor
* (lightweight editor).
*/
#define TOTAL_CONTROL
// GCC has trouble with the standard COM ABI so do it the old C way with explicit vtables. // GCC has trouble with the standard COM ABI so do it the old C way with explicit vtables.
@ -110,11 +106,13 @@ using namespace Scintilla;
class ScintillaWin; // Forward declaration for COM interface subobjects class ScintillaWin; // Forward declaration for COM interface subobjects
typedef void VFunction(void);
/** /**
*/ */
class FormatEnumerator { class FormatEnumerator {
public: public:
void **vtbl; VFunction **vtbl;
int ref; int ref;
int pos; int pos;
CLIPFORMAT formats[2]; CLIPFORMAT formats[2];
@ -126,7 +124,7 @@ public:
*/ */
class DropSource { class DropSource {
public: public:
void **vtbl; VFunction **vtbl;
ScintillaWin *sci; ScintillaWin *sci;
DropSource(); DropSource();
}; };
@ -135,7 +133,7 @@ public:
*/ */
class DataObject { class DataObject {
public: public:
void **vtbl; VFunction **vtbl;
ScintillaWin *sci; ScintillaWin *sci;
DataObject(); DataObject();
}; };
@ -144,7 +142,7 @@ public:
*/ */
class DropTarget { class DropTarget {
public: public:
void **vtbl; VFunction **vtbl;
ScintillaWin *sci; ScintillaWin *sci;
DropTarget(); DropTarget();
}; };
@ -157,6 +155,8 @@ class ScintillaWin :
bool lastKeyDownConsumed; bool lastKeyDownConsumed;
bool capturedMouse; bool capturedMouse;
bool trackedMouseLeave;
TrackMouseEventSig TrackMouseEventFn;
unsigned int linesPerScroll; ///< Intellimouse support unsigned int linesPerScroll; ///< Intellimouse support
int wheelDelta; ///< Wheel delta from roll int wheelDelta; ///< Wheel delta from roll
@ -176,9 +176,9 @@ class ScintillaWin :
static HINSTANCE hInstance; static HINSTANCE hInstance;
ScintillaWin(HWND hwnd); ScintillaWin(HWND hwnd);
ScintillaWin(const ScintillaWin &) : ScintillaBase() {} ScintillaWin(const ScintillaWin &);
virtual ~ScintillaWin(); virtual ~ScintillaWin();
ScintillaWin &operator=(const ScintillaWin &) { return *this; } ScintillaWin &operator=(const ScintillaWin &);
virtual void Initialise(); virtual void Initialise();
virtual void Finalise(); virtual void Finalise();
@ -197,12 +197,14 @@ class ScintillaWin :
virtual void StartDrag(); virtual void StartDrag();
sptr_t WndPaint(uptr_t wParam); sptr_t WndPaint(uptr_t wParam);
sptr_t HandleComposition(uptr_t wParam, sptr_t lParam); sptr_t HandleComposition(uptr_t wParam, sptr_t lParam);
UINT CodePageOfDocument();
virtual bool ValidCodePage(int codePage) const; virtual bool ValidCodePage(int codePage) const;
virtual sptr_t DefWndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam); virtual sptr_t DefWndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam);
virtual bool SetIdle(bool on); virtual bool SetIdle(bool on);
virtual void SetTicking(bool on); virtual void SetTicking(bool on);
virtual void SetMouseCapture(bool on); virtual void SetMouseCapture(bool on);
virtual bool HaveMouseCapture(); virtual bool HaveMouseCapture();
virtual void SetTrackMouseLeaveEvent(bool on);
virtual bool PaintContains(PRectangle rc); virtual bool PaintContains(PRectangle rc);
virtual void ScrollText(int linesToMove); virtual void ScrollText(int linesToMove);
virtual void UpdateSystemCaret(); virtual void UpdateSystemCaret();
@ -214,6 +216,8 @@ class ScintillaWin :
virtual int GetCtrlID(); virtual int GetCtrlID();
virtual void NotifyParent(SCNotification scn); virtual void NotifyParent(SCNotification scn);
virtual void NotifyDoubleClick(Point pt, bool shift, bool ctrl, bool alt); virtual void NotifyDoubleClick(Point pt, bool shift, bool ctrl, bool alt);
virtual CaseFolder *CaseFolderForEncoding();
virtual std::string CaseMapString(const std::string &s, int caseMapping);
virtual void Copy(); virtual void Copy();
virtual void CopyAllowLine(); virtual void CopyAllowLine();
virtual bool CanPaste(); virtual bool CanPaste();
@ -264,12 +268,6 @@ public:
/// Implement important part of IDataObject /// Implement important part of IDataObject
STDMETHODIMP GetData(FORMATETC *pFEIn, STGMEDIUM *pSTM); STDMETHODIMP GetData(FORMATETC *pFEIn, STGMEDIUM *pSTM);
// External Lexers
#ifdef SCI_LEXER
void SetLexerLanguage(const char *languageName);
void SetLexer(uptr_t wParam);
#endif
static bool Register(HINSTANCE hInstance_); static bool Register(HINSTANCE hInstance_);
static bool Unregister(); static bool Unregister();
@ -298,6 +296,9 @@ ScintillaWin::ScintillaWin(HWND hwnd) {
lastKeyDownConsumed = false; lastKeyDownConsumed = false;
capturedMouse = false; capturedMouse = false;
trackedMouseLeave = false;
TrackMouseEventFn = 0;
linesPerScroll = 0; linesPerScroll = 0;
wheelDelta = 0; // Wheel delta from roll wheelDelta = 0; // Wheel delta from roll
@ -338,6 +339,18 @@ void ScintillaWin::Initialise() {
// no effect. If the app hasnt, we really shouldnt ask them to call // no effect. If the app hasnt, we really shouldnt ask them to call
// it just so this internal feature works. // it just so this internal feature works.
hrOle = ::OleInitialize(NULL); hrOle = ::OleInitialize(NULL);
// Find TrackMouseEvent which is available on Windows > 95
HMODULE user32 = ::GetModuleHandle(TEXT("user32.dll"));
TrackMouseEventFn = (TrackMouseEventSig)::GetProcAddress(user32, "TrackMouseEvent");
if (TrackMouseEventFn == NULL) {
// Windows 95 has an emulation in comctl32.dll:_TrackMouseEvent
HMODULE commctrl32 = ::LoadLibrary(TEXT("comctl32.dll"));
if (commctrl32 != NULL) {
TrackMouseEventFn = (TrackMouseEventSig)
::GetProcAddress(commctrl32, "_TrackMouseEvent");
}
}
} }
void ScintillaWin::Finalise() { void ScintillaWin::Finalise() {
@ -483,7 +496,7 @@ LRESULT ScintillaWin::WndPaint(uptr_t wParam) {
hRgnUpdate = 0; hRgnUpdate = 0;
} }
if(!IsOcxCtrl) if (!IsOcxCtrl)
::EndPaint(MainHWND(), pps); ::EndPaint(MainHWND(), pps);
if (paintState == paintAbandoned) { if (paintState == paintAbandoned) {
// Painting area was insufficient to cover new styling or brace highlight positions // Painting area was insufficient to cover new styling or brace highlight positions
@ -571,6 +584,10 @@ static unsigned int SciMessageFromEM(unsigned int iMessage) {
} }
static UINT CodePageFromCharSet(DWORD characterSet, UINT documentCodePage) { static UINT CodePageFromCharSet(DWORD characterSet, UINT documentCodePage) {
if (documentCodePage == SC_CP_UTF8) {
// The system calls here are a little slow so avoid if known case.
return SC_CP_UTF8;
}
CHARSETINFO ci = { 0, 0, { { 0, 0, 0, 0 }, { 0, 0 } } }; CHARSETINFO ci = { 0, 0, { { 0, 0, 0, 0 }, { 0, 0 } } };
BOOL bci = ::TranslateCharsetInfo((DWORD*)characterSet, BOOL bci = ::TranslateCharsetInfo((DWORD*)characterSet,
&ci, TCI_SRCCHARSET); &ci, TCI_SRCCHARSET);
@ -588,6 +605,10 @@ static UINT CodePageFromCharSet(DWORD characterSet, UINT documentCodePage) {
return cp; return cp;
} }
UINT ScintillaWin::CodePageOfDocument() {
return CodePageFromCharSet(vs.styles[STYLE_DEFAULT].characterSet, pdoc->dbcsCodePage);
}
sptr_t ScintillaWin::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) { sptr_t ScintillaWin::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) {
try { try {
//Platform::DebugPrintf("S M:%x WP:%x L:%x\n", iMessage, wParam, lParam); //Platform::DebugPrintf("S M:%x WP:%x L:%x\n", iMessage, wParam, lParam);
@ -602,9 +623,7 @@ sptr_t ScintillaWin::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam
break; break;
case WM_COMMAND: case WM_COMMAND:
#ifdef TOTAL_CONTROL
Command(LoWord(wParam)); Command(LoWord(wParam));
#endif
break; break;
case WM_PAINT: case WM_PAINT:
@ -685,7 +704,7 @@ sptr_t ScintillaWin::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam
case SC_WIN_IDLE: case SC_WIN_IDLE:
// wParam=dwTickCountInitial, or 0 to initialize. lParam=bSkipUserInputTest // wParam=dwTickCountInitial, or 0 to initialize. lParam=bSkipUserInputTest
if (idler.state) { if (idler.state) {
if (lParam || (WAIT_TIMEOUT==MsgWaitForMultipleObjects(0,0,0,0, QS_INPUT|QS_HOTKEY))) { if (lParam || (WAIT_TIMEOUT == MsgWaitForMultipleObjects(0, 0, 0, 0, QS_INPUT|QS_HOTKEY))) {
if (Idle()) { if (Idle()) {
// User input was given priority above, but all events do get a turn. Other // User input was given priority above, but all events do get a turn. Other
// messages, notifications, etc. will get interleaved with the idle messages. // messages, notifications, etc. will get interleaved with the idle messages.
@ -735,9 +754,15 @@ sptr_t ScintillaWin::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam
break; break;
case WM_MOUSEMOVE: case WM_MOUSEMOVE:
SetTrackMouseLeaveEvent(true);
ButtonMove(Point::FromLong(lParam)); ButtonMove(Point::FromLong(lParam));
break; break;
case WM_MOUSELEAVE:
SetTrackMouseLeaveEvent(false);
MouseLeave();
return ::DefWindowProc(MainHWND(), iMessage, wParam, lParam);
case WM_LBUTTONUP: case WM_LBUTTONUP:
ButtonUp(Point::FromLong(lParam), ButtonUp(Point::FromLong(lParam),
::GetMessageTime(), ::GetMessageTime(),
@ -784,8 +809,7 @@ sptr_t ScintillaWin::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam
UTF8FromUTF16(wcs, 1, utfval, len); UTF8FromUTF16(wcs, 1, utfval, len);
AddCharUTF(utfval, len); AddCharUTF(utfval, len);
} else { } else {
UINT cpDest = CodePageFromCharSet( UINT cpDest = CodePageOfDocument();
vs.styles[STYLE_DEFAULT].characterSet, pdoc->dbcsCodePage);
char inBufferCP[20]; char inBufferCP[20];
int size = ::WideCharToMultiByte(cpDest, int size = ::WideCharToMultiByte(cpDest,
0, wcs, 1, inBufferCP, sizeof(inBufferCP) - 1, 0, 0); 0, wcs, 1, inBufferCP, sizeof(inBufferCP) - 1, 0, 0);
@ -856,7 +880,7 @@ sptr_t ScintillaWin::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam
HWND wThis = MainHWND(); HWND wThis = MainHWND();
HWND wCT = reinterpret_cast<HWND>(ct.wCallTip.GetID()); HWND wCT = reinterpret_cast<HWND>(ct.wCallTip.GetID());
if (!wParam || if (!wParam ||
!(::IsChild(wThis,wOther) || (wOther == wCT))) { !(::IsChild(wThis, wOther) || (wOther == wCT))) {
SetFocusState(false); SetFocusState(false);
DestroySystemCaret(); DestroySystemCaret();
} }
@ -905,7 +929,6 @@ sptr_t ScintillaWin::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam
} }
case WM_CONTEXTMENU: case WM_CONTEXTMENU:
#ifdef TOTAL_CONTROL
if (displayPopupMenu) { if (displayPopupMenu) {
Point pt = Point::FromLong(lParam); Point pt = Point::FromLong(lParam);
if ((pt.x == -1) && (pt.y == -1)) { if ((pt.x == -1) && (pt.y == -1)) {
@ -918,7 +941,6 @@ sptr_t ScintillaWin::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam
ContextMenu(pt); ContextMenu(pt);
return 0; return 0;
} }
#endif
return ::DefWindowProc(MainHWND(), iMessage, wParam, lParam); return ::DefWindowProc(MainHWND(), iMessage, wParam, lParam);
case WM_INPUTLANGCHANGE: case WM_INPUTLANGCHANGE:
@ -1032,14 +1054,14 @@ sptr_t ScintillaWin::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam
#ifdef SCI_LEXER #ifdef SCI_LEXER
case SCI_LOADLEXERLIBRARY: case SCI_LOADLEXERLIBRARY:
LexerManager::GetInstance()->Load(reinterpret_cast<const char*>(lParam)); LexerManager::GetInstance()->Load(reinterpret_cast<const char *>(lParam));
break; break;
#endif #endif
default: default:
return ScintillaBase::WndProc(iMessage, wParam, lParam); return ScintillaBase::WndProc(iMessage, wParam, lParam);
} }
} catch (std::bad_alloc&) { } catch (std::bad_alloc &) {
errorStatus = SC_STATUS_BADALLOC; errorStatus = SC_STATUS_BADALLOC;
} catch (...) { } catch (...) {
errorStatus = SC_STATUS_FAILURE; errorStatus = SC_STATUS_FAILURE;
@ -1105,6 +1127,17 @@ bool ScintillaWin::HaveMouseCapture() {
//return capturedMouse && (::GetCapture() == MainHWND()); //return capturedMouse && (::GetCapture() == MainHWND());
} }
void ScintillaWin::SetTrackMouseLeaveEvent(bool on) {
if (on && TrackMouseEventFn && !trackedMouseLeave) {
TRACKMOUSEEVENT tme;
tme.cbSize = sizeof(tme);
tme.dwFlags = TME_LEAVE;
tme.hwndTrack = MainHWND();
TrackMouseEventFn(&tme);
}
trackedMouseLeave = on;
}
bool ScintillaWin::PaintContains(PRectangle rc) { bool ScintillaWin::PaintContains(PRectangle rc) {
bool contains = true; bool contains = true;
if ((paintState == painting) && (!rc.Empty())) { if ((paintState == painting) && (!rc.Empty())) {
@ -1158,7 +1191,7 @@ bool ScintillaWin::GetScrollInfo(int nBar, LPSCROLLINFO lpsi) {
// Change the scroll position but avoid repaint if changing to same value // Change the scroll position but avoid repaint if changing to same value
void ScintillaWin::ChangeScrollPos(int barType, int pos) { void ScintillaWin::ChangeScrollPos(int barType, int pos) {
SCROLLINFO sci = { SCROLLINFO sci = {
sizeof(sci),0,0,0,0,0,0 sizeof(sci), 0, 0, 0, 0, 0, 0
}; };
sci.fMask = SIF_POS; sci.fMask = SIF_POS;
GetScrollInfo(barType, &sci); GetScrollInfo(barType, &sci);
@ -1180,7 +1213,7 @@ void ScintillaWin::SetHorizontalScrollPos() {
bool ScintillaWin::ModifyScrollBars(int nMax, int nPage) { bool ScintillaWin::ModifyScrollBars(int nMax, int nPage) {
bool modified = false; bool modified = false;
SCROLLINFO sci = { SCROLLINFO sci = {
sizeof(sci),0,0,0,0,0,0 sizeof(sci), 0, 0, 0, 0, 0, 0
}; };
sci.fMask = SIF_PAGE | SIF_RANGE; sci.fMask = SIF_PAGE | SIF_RANGE;
GetScrollInfo(SB_VERT, &sci); GetScrollInfo(SB_VERT, &sci);
@ -1264,6 +1297,153 @@ void ScintillaWin::NotifyDoubleClick(Point pt, bool shift, bool ctrl, bool alt)
MAKELPARAM(pt.x, pt.y)); MAKELPARAM(pt.x, pt.y));
} }
class CaseFolderUTF8 : public CaseFolderTable {
// Allocate the expandable storage here so that it does not need to be reallocated
// for each call to Fold.
std::vector<wchar_t> utf16Mixed;
std::vector<wchar_t> utf16Folded;
public:
CaseFolderUTF8() {
StandardASCII();
}
virtual size_t Fold(char *folded, size_t sizeFolded, const char *mixed, size_t lenMixed) {
if ((lenMixed == 1) && (sizeFolded > 0)) {
folded[0] = mapping[static_cast<unsigned char>(mixed[0])];
return 1;
} else {
if (lenMixed > utf16Mixed.size()) {
utf16Mixed.resize(lenMixed + 8);
}
size_t nUtf16Mixed = ::MultiByteToWideChar(65001, 0, mixed, lenMixed,
&utf16Mixed[0], utf16Mixed.size());
if (nUtf16Mixed * 4 > utf16Folded.size()) { // Maximum folding expansion factor of 4
utf16Folded.resize(nUtf16Mixed * 4 + 8);
}
int lenFlat = ::LCMapStringW(LOCALE_SYSTEM_DEFAULT,
LCMAP_LINGUISTIC_CASING | LCMAP_LOWERCASE,
&utf16Mixed[0], nUtf16Mixed, &utf16Folded[0], utf16Folded.size());
size_t lenOut = UTF8Length(&utf16Folded[0], lenFlat);
if (lenOut < sizeFolded) {
UTF8FromUTF16(&utf16Folded[0], lenFlat, folded, lenOut);
return lenOut;
} else {
return 0;
}
}
}
};
CaseFolder *ScintillaWin::CaseFolderForEncoding() {
UINT cpDest = CodePageOfDocument();
if (cpDest == SC_CP_UTF8) {
return new CaseFolderUTF8();
} else {
CaseFolderTable *pcf = new CaseFolderTable();
if (pdoc->dbcsCodePage == 0) {
pcf->StandardASCII();
// Only for single byte encodings
UINT cpDoc = CodePageOfDocument();
for (int i=0x80; i<0x100; i++) {
char sCharacter[2] = "A";
sCharacter[0] = static_cast<char>(i);
wchar_t wCharacter[20];
unsigned int lengthUTF16 = ::MultiByteToWideChar(cpDoc, 0, sCharacter, 1,
wCharacter, sizeof(wCharacter)/sizeof(wCharacter[0]));
if (lengthUTF16 == 1) {
wchar_t wLower[20];
int charsConverted = ::LCMapStringW(LOCALE_SYSTEM_DEFAULT,
LCMAP_LINGUISTIC_CASING | LCMAP_LOWERCASE,
wCharacter, lengthUTF16, wLower, sizeof(wLower)/sizeof(wLower[0]));
char sCharacterLowered[20];
unsigned int lengthConverted = ::WideCharToMultiByte(cpDoc, 0,
wLower, charsConverted,
sCharacterLowered, sizeof(sCharacterLowered), NULL, 0);
if ((lengthConverted == 1) && (sCharacter[0] != sCharacterLowered[0])) {
pcf->SetTranslation(sCharacter[0], sCharacterLowered[0]);
}
}
}
}
return pcf;
}
}
std::string ScintillaWin::CaseMapString(const std::string &s, int caseMapping) {
if (s.size() == 0)
return std::string();
if (caseMapping == cmSame)
return s;
UINT cpDoc = CodePageOfDocument();
unsigned int lengthUTF16 = ::MultiByteToWideChar(cpDoc, 0, s.c_str(), s.size(), NULL, 0);
if (lengthUTF16 == 0) // Failed to convert
return s;
DWORD mapFlags = LCMAP_LINGUISTIC_CASING |
((caseMapping == cmUpper) ? LCMAP_UPPERCASE : LCMAP_LOWERCASE);
// Many conversions performed by search function are short so optimize this case.
enum { shortSize=20 };
if (s.size() > shortSize) {
// Use dynamic allocations for long strings
// Change text to UTF-16
std::vector<wchar_t> vwcText(lengthUTF16);
::MultiByteToWideChar(cpDoc, 0, s.c_str(), s.size(), &vwcText[0], lengthUTF16);
// Change case
int charsConverted = ::LCMapStringW(LOCALE_SYSTEM_DEFAULT, mapFlags,
&vwcText[0], lengthUTF16, NULL, 0);
std::vector<wchar_t> vwcConverted(charsConverted);
::LCMapStringW(LOCALE_SYSTEM_DEFAULT, mapFlags,
&vwcText[0], lengthUTF16, &vwcConverted[0], charsConverted);
// Change back to document encoding
unsigned int lengthConverted = ::WideCharToMultiByte(cpDoc, 0,
&vwcConverted[0], vwcConverted.size(),
NULL, 0, NULL, 0);
std::vector<char> vcConverted(lengthConverted);
::WideCharToMultiByte(cpDoc, 0,
&vwcConverted[0], vwcConverted.size(),
&vcConverted[0], vcConverted.size(), NULL, 0);
return std::string(&vcConverted[0], vcConverted.size());
} else {
// Use static allocations for short strings as much faster
// A factor of 15 for single character strings
// Change text to UTF-16
wchar_t vwcText[shortSize];
::MultiByteToWideChar(cpDoc, 0, s.c_str(), s.size(), vwcText, lengthUTF16);
// Change case
int charsConverted = ::LCMapStringW(LOCALE_SYSTEM_DEFAULT, mapFlags,
vwcText, lengthUTF16, NULL, 0);
// Full mapping may produce up to 3 characters per input character
wchar_t vwcConverted[shortSize*3];
::LCMapStringW(LOCALE_SYSTEM_DEFAULT, mapFlags, vwcText, lengthUTF16,
vwcConverted, charsConverted);
// Change back to document encoding
unsigned int lengthConverted = ::WideCharToMultiByte(cpDoc, 0,
vwcConverted, charsConverted,
NULL, 0, NULL, 0);
// Each UTF-16 code unit may need up to 3 bytes in UTF-8
char vcConverted[shortSize * 3 * 3];
::WideCharToMultiByte(cpDoc, 0,
vwcConverted, charsConverted,
vcConverted, lengthConverted, NULL, 0);
return std::string(vcConverted, lengthConverted);
}
}
void ScintillaWin::Copy() { void ScintillaWin::Copy() {
//Platform::DebugPrintf("Copy\n"); //Platform::DebugPrintf("Copy\n");
if (!sel.Empty()) { if (!sel.Empty()) {
@ -1320,7 +1500,7 @@ public:
void SetClip(UINT uFormat) { void SetClip(UINT uFormat) {
::SetClipboardData(uFormat, Unlock()); ::SetClipboardData(uFormat, Unlock());
} }
operator bool() { operator bool() const {
return ptr != 0; return ptr != 0;
} }
SIZE_T Size() { SIZE_T Size() {
@ -1351,10 +1531,7 @@ void ScintillaWin::InsertPasteText(const char *text, int len, SelectionPosition
SetEmptySelection(sel.MainCaret() + len); SetEmptySelection(sel.MainCaret() + len);
} }
} else { } else {
selStart = SelectionPosition(InsertSpace(selStart.Position(), selStart.VirtualSpace())); InsertPaste(selStart, text, len);
if (pdoc->InsertString(selStart.Position(), text, len)) {
SetEmptySelection(selStart.Position() + len);
}
} }
delete []convertedText; delete []convertedText;
} }
@ -1366,7 +1543,9 @@ void ScintillaWin::Paste() {
UndoGroup ug(pdoc); UndoGroup ug(pdoc);
bool isLine = SelectionEmpty() && (::IsClipboardFormatAvailable(cfLineSelect) != 0); bool isLine = SelectionEmpty() && (::IsClipboardFormatAvailable(cfLineSelect) != 0);
ClearSelection(); ClearSelection();
SelectionPosition selStart = sel.Range(sel.Main()).Start(); SelectionPosition selStart = sel.IsRectangular() ?
sel.Rectangular().Start() :
sel.Range(sel.Main()).Start();
bool isRectangular = ::IsClipboardFormatAvailable(cfColumnSelect) != 0; bool isRectangular = ::IsClipboardFormatAvailable(cfColumnSelect) != 0;
// Always use CF_UNICODETEXT if available // Always use CF_UNICODETEXT if available
@ -1385,8 +1564,7 @@ void ScintillaWin::Paste() {
} else { } else {
// CF_UNICODETEXT available, but not in Unicode mode // CF_UNICODETEXT available, but not in Unicode mode
// Convert from Unicode to current Scintilla code page // Convert from Unicode to current Scintilla code page
UINT cpDest = CodePageFromCharSet( UINT cpDest = CodePageOfDocument();
vs.styles[STYLE_DEFAULT].characterSet, pdoc->dbcsCodePage);
len = ::WideCharToMultiByte(cpDest, 0, uptr, -1, len = ::WideCharToMultiByte(cpDest, 0, uptr, -1,
NULL, 0, NULL, NULL) - 1; // subtract 0 terminator NULL, 0, NULL, NULL) - 1; // subtract 0 terminator
putf = new char[len + 1]; putf = new char[len + 1];
@ -1443,7 +1621,6 @@ void ScintillaWin::Paste() {
} }
void ScintillaWin::CreateCallTipWindow(PRectangle) { void ScintillaWin::CreateCallTipWindow(PRectangle) {
#ifdef TOTAL_CONTROL
if (!ct.wCallTip.Created()) { if (!ct.wCallTip.Created()) {
ct.wCallTip = ::CreateWindow(callClassName, TEXT("ACallTip"), ct.wCallTip = ::CreateWindow(callClassName, TEXT("ACallTip"),
WS_POPUP, 100, 100, 150, 20, WS_POPUP, 100, 100, 150, 20,
@ -1452,11 +1629,9 @@ void ScintillaWin::CreateCallTipWindow(PRectangle) {
this); this);
ct.wDraw = ct.wCallTip; ct.wDraw = ct.wCallTip;
} }
#endif
} }
void ScintillaWin::AddToPopUp(const char *label, int cmd, bool enabled) { void ScintillaWin::AddToPopUp(const char *label, int cmd, bool enabled) {
#ifdef TOTAL_CONTROL
HMENU hmenuPopup = reinterpret_cast<HMENU>(popup.GetID()); HMENU hmenuPopup = reinterpret_cast<HMENU>(popup.GetID());
if (!label[0]) if (!label[0])
::AppendMenuA(hmenuPopup, MF_SEPARATOR, 0, ""); ::AppendMenuA(hmenuPopup, MF_SEPARATOR, 0, "");
@ -1464,42 +1639,12 @@ void ScintillaWin::AddToPopUp(const char *label, int cmd, bool enabled) {
::AppendMenuA(hmenuPopup, MF_STRING, cmd, label); ::AppendMenuA(hmenuPopup, MF_STRING, cmd, label);
else else
::AppendMenuA(hmenuPopup, MF_STRING | MF_DISABLED | MF_GRAYED, cmd, label); ::AppendMenuA(hmenuPopup, MF_STRING | MF_DISABLED | MF_GRAYED, cmd, label);
#endif
} }
void ScintillaWin::ClaimSelection() { void ScintillaWin::ClaimSelection() {
// Windows does not have a primary selection // Windows does not have a primary selection
} }
#ifdef SCI_LEXER
/*
Initial Windows-Only implementation of the external lexer
system in ScintillaWin class. Intention is to create a LexerModule
subclass (?) to have lex and fold methods which will call out to their
relevant DLLs...
*/
void ScintillaWin::SetLexer(uptr_t wParam) {
lexLanguage = wParam;
lexCurrent = LexerModule::Find(lexLanguage);
if (!lexCurrent)
lexCurrent = LexerModule::Find(SCLEX_NULL);
}
void ScintillaWin::SetLexerLanguage(const char *languageName) {
lexLanguage = SCLEX_CONTAINER;
lexCurrent = LexerModule::Find(languageName);
if (!lexCurrent)
lexCurrent = LexerModule::Find(SCLEX_NULL);
if (lexCurrent)
lexLanguage = lexCurrent->GetLanguage();
}
#endif
/// Implement IUnknown /// Implement IUnknown
STDMETHODIMP_(ULONG)FormatEnumerator_AddRef(FormatEnumerator *fe); STDMETHODIMP_(ULONG)FormatEnumerator_AddRef(FormatEnumerator *fe);
@ -1563,14 +1708,14 @@ STDMETHODIMP FormatEnumerator_Clone(FormatEnumerator *fe, IEnumFORMATETC **ppenu
reinterpret_cast<void **>(ppenum)); reinterpret_cast<void **>(ppenum));
} }
static void *vtFormatEnumerator[] = { static VFunction *vtFormatEnumerator[] = {
(void *)(FormatEnumerator_QueryInterface), (VFunction *)(FormatEnumerator_QueryInterface),
(void *)(FormatEnumerator_AddRef), (VFunction *)(FormatEnumerator_AddRef),
(void *)(FormatEnumerator_Release), (VFunction *)(FormatEnumerator_Release),
(void *)(FormatEnumerator_Next), (VFunction *)(FormatEnumerator_Next),
(void *)(FormatEnumerator_Skip), (VFunction *)(FormatEnumerator_Skip),
(void *)(FormatEnumerator_Reset), (VFunction *)(FormatEnumerator_Reset),
(void *)(FormatEnumerator_Clone) (VFunction *)(FormatEnumerator_Clone)
}; };
FormatEnumerator::FormatEnumerator(int pos_, CLIPFORMAT formats_[], int formatsLen_) { FormatEnumerator::FormatEnumerator(int pos_, CLIPFORMAT formats_[], int formatsLen_) {
@ -1578,7 +1723,7 @@ FormatEnumerator::FormatEnumerator(int pos_, CLIPFORMAT formats_[], int formatsL
ref = 0; // First QI adds first reference... ref = 0; // First QI adds first reference...
pos = pos_; pos = pos_;
formatsLen = formatsLen_; formatsLen = formatsLen_;
for (int i=0;i<formatsLen;i++) for (int i=0; i<formatsLen; i++)
formats[i] = formats_[i]; formats[i] = formats_[i];
} }
@ -1606,12 +1751,12 @@ STDMETHODIMP DropSource_GiveFeedback(DropSource *, DWORD) {
return DRAGDROP_S_USEDEFAULTCURSORS; return DRAGDROP_S_USEDEFAULTCURSORS;
} }
static void *vtDropSource[] = { static VFunction *vtDropSource[] = {
(void *)(DropSource_QueryInterface), (VFunction *)(DropSource_QueryInterface),
(void *)(DropSource_AddRef), (VFunction *)(DropSource_AddRef),
(void *)(DropSource_Release), (VFunction *)(DropSource_Release),
(void *)(DropSource_QueryContinueDrag), (VFunction *)(DropSource_QueryContinueDrag),
(void *)(DropSource_GiveFeedback) (VFunction *)(DropSource_GiveFeedback)
}; };
DropSource::DropSource() { DropSource::DropSource() {
@ -1701,7 +1846,7 @@ STDMETHODIMP DataObject_EnumFormatEtc(DataObject *pd, DWORD dwDirection, IEnumFO
} }
return FormatEnumerator_QueryInterface(pfe, IID_IEnumFORMATETC, return FormatEnumerator_QueryInterface(pfe, IID_IEnumFORMATETC,
reinterpret_cast<void **>(ppEnum)); reinterpret_cast<void **>(ppEnum));
} catch (std::bad_alloc&) { } catch (std::bad_alloc &) {
pd->sci->errorStatus = SC_STATUS_BADALLOC; pd->sci->errorStatus = SC_STATUS_BADALLOC;
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
} catch (...) { } catch (...) {
@ -1725,19 +1870,19 @@ STDMETHODIMP DataObject_EnumDAdvise(DataObject *, IEnumSTATDATA **) {
return E_FAIL; return E_FAIL;
} }
static void *vtDataObject[] = { static VFunction *vtDataObject[] = {
(void *)(DataObject_QueryInterface), (VFunction *)(DataObject_QueryInterface),
(void *)(DataObject_AddRef), (VFunction *)(DataObject_AddRef),
(void *)(DataObject_Release), (VFunction *)(DataObject_Release),
(void *)(DataObject_GetData), (VFunction *)(DataObject_GetData),
(void *)(DataObject_GetDataHere), (VFunction *)(DataObject_GetDataHere),
(void *)(DataObject_QueryGetData), (VFunction *)(DataObject_QueryGetData),
(void *)(DataObject_GetCanonicalFormatEtc), (VFunction *)(DataObject_GetCanonicalFormatEtc),
(void *)(DataObject_SetData), (VFunction *)(DataObject_SetData),
(void *)(DataObject_EnumFormatEtc), (VFunction *)(DataObject_EnumFormatEtc),
(void *)(DataObject_DAdvise), (VFunction *)(DataObject_DAdvise),
(void *)(DataObject_DUnadvise), (VFunction *)(DataObject_DUnadvise),
(void *)(DataObject_EnumDAdvise) (VFunction *)(DataObject_EnumDAdvise)
}; };
DataObject::DataObject() { DataObject::DataObject() {
@ -1793,14 +1938,14 @@ STDMETHODIMP DropTarget_Drop(DropTarget *dt, LPDATAOBJECT pIDataSource, DWORD gr
return E_FAIL; return E_FAIL;
} }
static void *vtDropTarget[] = { static VFunction *vtDropTarget[] = {
(void *)(DropTarget_QueryInterface), (VFunction *)(DropTarget_QueryInterface),
(void *)(DropTarget_AddRef), (VFunction *)(DropTarget_AddRef),
(void *)(DropTarget_Release), (VFunction *)(DropTarget_Release),
(void *)(DropTarget_DragEnter), (VFunction *)(DropTarget_DragEnter),
(void *)(DropTarget_DragOver), (VFunction *)(DropTarget_DragOver),
(void *)(DropTarget_DragLeave), (VFunction *)(DropTarget_DragLeave),
(void *)(DropTarget_Drop) (VFunction *)(DropTarget_Drop)
}; };
DropTarget::DropTarget() { DropTarget::DropTarget() {
@ -1831,7 +1976,7 @@ void ScintillaWin::ImeStartComposition() {
// Since the style creation code has been made platform independent, // Since the style creation code has been made platform independent,
// The logfont for the IME is recreated here. // The logfont for the IME is recreated here.
int styleHere = (pdoc->StyleAt(sel.MainCaret())) & 31; int styleHere = (pdoc->StyleAt(sel.MainCaret())) & 31;
LOGFONTA lf = {0,0,0,0,0,0,0,0,0,0,0,0,0, ""}; LOGFONTA lf = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ""};
int sizeZoomed = vs.styles[styleHere].size + vs.zoomLevel; int sizeZoomed = vs.styles[styleHere].size + vs.zoomLevel;
if (sizeZoomed <= 2) // Hangs if sizeZoomed <= 1 if (sizeZoomed <= 2) // Hangs if sizeZoomed <= 1
sizeZoomed = 2; sizeZoomed = 2;
@ -1867,7 +2012,7 @@ void ScintillaWin::AddCharBytes(char b0, char b1) {
int inputCodePage = InputCodePage(); int inputCodePage = InputCodePage();
if (inputCodePage && IsUnicodeMode()) { if (inputCodePage && IsUnicodeMode()) {
char utfval[4]="\0\0\0"; char utfval[4] = "\0\0\0";
char ansiChars[3]; char ansiChars[3];
wchar_t wcs[2]; wchar_t wcs[2];
if (b0) { // Two bytes from IME if (b0) { // Two bytes from IME
@ -1919,10 +2064,11 @@ void ScintillaWin::CopyToClipboard(const SelectionText &selectedText) {
// Convert to Unicode using the current Scintilla code page // Convert to Unicode using the current Scintilla code page
UINT cpSrc = CodePageFromCharSet( UINT cpSrc = CodePageFromCharSet(
selectedText.characterSet, selectedText.codePage); selectedText.characterSet, selectedText.codePage);
uniText.Allocate(2 * selectedText.len); int uLen = ::MultiByteToWideChar(cpSrc, 0, selectedText.s, selectedText.len, 0, 0);
uniText.Allocate(2 * uLen);
if (uniText) { if (uniText) {
::MultiByteToWideChar(cpSrc, 0, selectedText.s, selectedText.len, ::MultiByteToWideChar(cpSrc, 0, selectedText.s, selectedText.len,
static_cast<wchar_t *>(uniText.ptr), selectedText.len); static_cast<wchar_t *>(uniText.ptr), uLen);
} }
} }
@ -2194,7 +2340,7 @@ STDMETHODIMP ScintillaWin::Drop(LPDATAOBJECT pIDataSource, DWORD grfKeyState,
SetDragPosition(SelectionPosition(invalidPosition)); SetDragPosition(SelectionPosition(invalidPosition));
STGMEDIUM medium={0,{0},0}; STGMEDIUM medium = {0, {0}, 0};
char *data = 0; char *data = 0;
bool dataAllocated = false; bool dataAllocated = false;
@ -2216,8 +2362,7 @@ STDMETHODIMP ScintillaWin::Drop(LPDATAOBJECT pIDataSource, DWORD grfKeyState,
// Default Scintilla behavior in Unicode mode // Default Scintilla behavior in Unicode mode
// CF_UNICODETEXT available, but not in Unicode mode // CF_UNICODETEXT available, but not in Unicode mode
// Convert from Unicode to current Scintilla code page // Convert from Unicode to current Scintilla code page
UINT cpDest = CodePageFromCharSet( UINT cpDest = CodePageOfDocument();
vs.styles[STYLE_DEFAULT].characterSet, pdoc->dbcsCodePage);
int tlen = ::WideCharToMultiByte(cpDest, 0, udata, -1, int tlen = ::WideCharToMultiByte(cpDest, 0, udata, -1,
NULL, 0, NULL, NULL) - 1; // subtract 0 terminator NULL, 0, NULL, NULL) - 1; // subtract 0 terminator
data = new char[tlen + 1]; data = new char[tlen + 1];
@ -2236,6 +2381,16 @@ STDMETHODIMP ScintillaWin::Drop(LPDATAOBJECT pIDataSource, DWORD grfKeyState,
} }
} }
if (data && convertPastes) {
// Convert line endings of the drop into our local line-endings mode
int len = strlen(data);
char *convertedText = Document::TransformLineEnds(&len, data, len, pdoc->eolMode);
if (dataAllocated)
delete []data;
data = convertedText;
dataAllocated = true;
}
if (!data) { if (!data) {
//Platform::DebugPrintf("Bad data format: 0x%x\n", hres); //Platform::DebugPrintf("Bad data format: 0x%x\n", hres);
return hr; return hr;
@ -2376,7 +2531,7 @@ bool ScintillaWin::Unregister() {
bool ScintillaWin::HasCaretSizeChanged() { bool ScintillaWin::HasCaretSizeChanged() {
if ( if (
( (0 != vs.caretWidth) && (sysCaretWidth != vs.caretWidth) ) ( (0 != vs.caretWidth) && (sysCaretWidth != vs.caretWidth) )
|| (0 != vs.lineHeight) && (sysCaretHeight != vs.lineHeight) || ((0 != vs.lineHeight) && (sysCaretHeight != vs.lineHeight))
) { ) {
return true; return true;
} }
@ -2477,7 +2632,7 @@ sptr_t PASCAL ScintillaWin::CTWndProc(
sciThis->CallTipClick(); sciThis->CallTipClick();
return 0; return 0;
} else if (iMessage == WM_SETCURSOR) { } else if (iMessage == WM_SETCURSOR) {
::SetCursor(::LoadCursor(NULL,IDC_ARROW)); ::SetCursor(::LoadCursor(NULL, IDC_ARROW));
return 0; return 0;
} else if (iMessage == WM_NCHITTEST) { } else if (iMessage == WM_NCHITTEST) {
return HTCAPTION; return HTCAPTION;
@ -2541,7 +2696,7 @@ sptr_t PASCAL ScintillaWin::SWndProc(
// This function is externally visible so it can be called from container when building statically. // This function is externally visible so it can be called from container when building statically.
// Must be called once only. // Must be called once only.
bool Scintilla_RegisterClasses(void *hInstance) { int Scintilla_RegisterClasses(void *hInstance) {
Platform_Initialise(hInstance); Platform_Initialise(hInstance);
bool result = ScintillaWin::Register(reinterpret_cast<HINSTANCE>(hInstance)); bool result = ScintillaWin::Register(reinterpret_cast<HINSTANCE>(hInstance));
#ifdef SCI_LEXER #ifdef SCI_LEXER
@ -2551,7 +2706,7 @@ bool Scintilla_RegisterClasses(void *hInstance) {
} }
// This function is externally visible so it can be called from container when building statically. // This function is externally visible so it can be called from container when building statically.
bool Scintilla_ReleaseResources() { int Scintilla_ReleaseResources() {
bool result = ScintillaWin::Unregister(); bool result = ScintillaWin::Unregister();
Platform_Finalise(); Platform_Finalise();
return result; return result;

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