diff options
-rw-r--r-- | scintilla/doc/ScintillaDoc.html | 35 | ||||
-rw-r--r-- | scintilla/doc/ScintillaDownload.html | 10 | ||||
-rw-r--r-- | scintilla/doc/ScintillaHistory.html | 60 | ||||
-rw-r--r-- | scintilla/doc/index.html | 15 | ||||
-rw-r--r-- | scintilla/include/SciLexer.h | 10 | ||||
-rw-r--r-- | scintilla/include/Scintilla.h | 5 | ||||
-rw-r--r-- | scintilla/include/Scintilla.iface | 23 | ||||
-rw-r--r-- | scintilla/lexers/LexBibTeX.cxx | 310 | ||||
-rw-r--r-- | scintilla/lexers/LexRegistry.cxx | 4 | ||||
-rw-r--r-- | scintilla/lexers/LexSQL.cxx | 32 | ||||
-rw-r--r-- | scintilla/lexers/LexVHDL.cxx | 124 | ||||
-rw-r--r-- | scintilla/src/Catalogue.cxx | 1 | ||||
-rw-r--r-- | scintilla/src/Document.cxx | 14 | ||||
-rw-r--r-- | scintilla/src/EditModel.cxx | 1 | ||||
-rw-r--r-- | scintilla/src/EditModel.h | 2 | ||||
-rw-r--r-- | scintilla/src/EditView.cxx | 13 | ||||
-rw-r--r-- | scintilla/src/EditView.h | 4 | ||||
-rw-r--r-- | scintilla/src/Editor.cxx | 17 | ||||
-rw-r--r-- | scintilla/src/Editor.h | 1 | ||||
-rw-r--r-- | scintilla/src/Indicator.h | 7 | ||||
-rw-r--r-- | scintilla/src/RESearch.cxx | 3 | ||||
-rw-r--r-- | scintilla/src/ViewStyle.cxx | 12 | ||||
-rw-r--r-- | scintilla/version.txt | 2 | ||||
-rw-r--r-- | scintilla/win32/ScintillaWin.cxx | 49 |
24 files changed, 659 insertions, 95 deletions
diff --git a/scintilla/doc/ScintillaDoc.html b/scintilla/doc/ScintillaDoc.html index a4dd4cc..acb5910 100644 --- a/scintilla/doc/ScintillaDoc.html +++ b/scintilla/doc/ScintillaDoc.html @@ -82,7 +82,7 @@ <h1>Scintilla Documentation</h1> - <p>Last edited 24 May 2014 NH</p> + <p>Last edited 25 September 2014 NH</p> <p>There is <a class="jump" href="Design.html">an overview of the internal design of Scintilla</a>.<br /> @@ -3171,6 +3171,8 @@ struct Sci_TextToFind { <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_GETCODEPAGE">SCI_GETCODEPAGE</a><br /> + <a class="message" href="#SCI_SETIMEINTERACTION">SCI_SETIMEINTERACTION(int imeInteraction)</a><br /> + <a class="message" href="#SCI_GETIMEINTERACTION">SCI_GETIMEINTERACTION</a><br /> <a class="message" href="#SCI_SETKEYSUNICODE">SCI_SETKEYSUNICODE(bool keysUnicode)</a><br /> <a class="message" href="#SCI_GETKEYSUNICODE">SCI_GETKEYSUNICODE</a><br /> <a class="message" href="#SCI_SETWORDCHARS">SCI_SETWORDCHARS(<unused>, const char *characters)</a><br /> @@ -3240,10 +3242,16 @@ struct Sci_TextToFind { <b id="SCI_GETTECHNOLOGY">SCI_GETTECHNOLOGY</b><br /> The technology property allows choosing between different drawing APIs and options. On most platforms, the only choice is <code>SC_TECHNOLOGY_DEFAULT</code> (0). - On Windows Vista or later, <code>SC_TECHNOLOGY_DIRECTWRITE</code> (1) + On Windows Vista or later, <code>SC_TECHNOLOGY_DIRECTWRITE</code> (1) or + <code class="provisional">SC_TECHNOLOGY_DIRECTWRITERETAIN</code> (2) can be chosen to use the Direct2D and DirectWrite APIs for higher quality antialiased drawing. + <code class="provisional">SC_TECHNOLOGY_DIRECTWRITERETAIN</code> differs from + <code>SC_TECHNOLOGY_DIRECTWRITE</code> by requesting that the frame + is retained after being presented which may prevent drawing failures on some cards and drivers. Since Direct2D buffers drawing, Scintilla's buffering can be turned off with - <code>SCI_SETBUFFEREDDRAW(0)</code>.</p> + <code>SCI_SETBUFFEREDDRAW(0)</code>. + <span class="provisional">Since <code>SC_TECHNOLOGY_DIRECTWRITERETAIN</code> + is provisional, it may be changed or removed in a future release if a better solution is found.</span></p> <p><b id="SCI_SETFONTQUALITY">SCI_SETFONTQUALITY(int fontQuality)</b><br /> <b id="SCI_GETFONTQUALITY">SCI_GETFONTQUALITY</b><br /> @@ -3277,6 +3285,19 @@ struct Sci_TextToFind { 949 (Korean Unified Hangul Code), 950 (Traditional Chinese Big5), or 1361 (Korean Johab) although these may require installation of language specific support.</p> + <p><b id="SCI_SETIMEINTERACTION">SCI_SETIMEINTERACTION(int imeInteraction)</b><br /> + <b id="SCI_GETIMEINTERACTION">SCI_GETIMEINTERACTION</b><br /> + When entering text in Chinese, Japanese, or Korean an Input Method Editor (IME) may be displayed. + The IME may be an extra window appearing above Scintilla or may be displayed by Scintilla itself + as text. On some platforms there is a choice between the two techniques. + A windowed IME <code>SC_IME_WINDOWED</code> (0) may be more similar in appearance and + behaviour to the IME in other applications. + An inline IME <code>SC_IME_INLINE</code> (1) may work better with some Scintilla features such as + rectangular and multiple selection.</p> + <p>The windowed behaviour can be chosen with <code>SCI_SETIMEINTERACTION(SC_IME_WINDOWED)</code> + and the inline behaviour with <code>SCI_SETIMEINTERACTION(SC_IME_INLINE)</code>. + Scintilla may ignore this call in some cases. For example, the inline behaviour might only be supported for some languages.</p> + <p><b id="SCI_SETKEYSUNICODE">SCI_SETKEYSUNICODE(bool keysUnicode)</b><br /> <b id="SCI_GETKEYSUNICODE">SCI_GETKEYSUNICODE</b><br /> On Windows, character keys are normally handled differently depending on whether Scintilla is a wide @@ -3425,8 +3446,8 @@ struct Sci_TextToFind { <b id="SCI_GETNEXTTABSTOP">SCI_GETNEXTTABSTOP(int line, int x)</b><br /> <code>SCI_CLEARTABSTOPS</code> clears explicit tabstops on a line. <code>SCI_ADDTABSTOP</code> adds an explicit tabstop at the specified distance from the left (in pixels), and - <code>SCI_GETNEXTTABSTOP</code> gets the next explicit tabstop position, or zero if there - aren't any. + <code>SCI_GETNEXTTABSTOP</code> gets the next explicit tabstop position set after the given x position, + or zero if there aren't any. Changing tab stops produces a <a class="message" href="#SC_MOD_CHANGETABSTOPS">SC_MOD_CHANGETABSTOPS</a> notification. </p> @@ -7408,7 +7429,9 @@ for line = lineStart to lineEnd do SCI_ENSUREVISIBLE(line) next <p>Provisional features are displayed in this document with <span class="provisional">a distinctive background colour</span>.</p> - <p>There are currently no provisional features.</p> + <p>There are currently no provisional messages. + The <code class="provisional">SC_TECHNOLOGY_DIRECTWRITERETAIN</code> value for + <a class="message" href="#SCI_SETTECHNOLOGY">SCI_SETTECHNOLOGY</a> is provisional.</p> <p>Some developers may want to only use features that are stable and have graduated from provisional status. To avoid using provisional messages compile with the symbol diff --git a/scintilla/doc/ScintillaDownload.html b/scintilla/doc/ScintillaDownload.html index 04ff5ca..da04e24 100644 --- a/scintilla/doc/ScintillaDownload.html +++ b/scintilla/doc/ScintillaDownload.html @@ -25,9 +25,9 @@ <table bgcolor="#CCCCCC" width="100%" cellspacing="0" cellpadding="8" border="0">
<tr>
<td>
- <font size="4"> <a href="http://prdownloads.sourceforge.net/scintilla/scintilla350.zip?download">
+ <font size="4"> <a href="http://prdownloads.sourceforge.net/scintilla/scintilla351.zip?download">
Windows</a>
- <a href="http://prdownloads.sourceforge.net/scintilla/scintilla350.tgz?download">
+ <a href="http://prdownloads.sourceforge.net/scintilla/scintilla351.tgz?download">
GTK+/Linux</a>
</font>
</td>
@@ -41,7 +41,7 @@ containing very few restrictions.
</p>
<h3>
- Release 3.5.0
+ Release 3.5.1
</h3>
<h4>
Source Code
@@ -49,8 +49,8 @@ The source code package contains all of the source code for Scintilla but no binary
executable code and is available in
<ul>
- <li><a href="http://prdownloads.sourceforge.net/scintilla/scintilla350.zip?download">zip format</a> (1450K) commonly used on Windows</li>
- <li><a href="http://prdownloads.sourceforge.net/scintilla/scintilla350.tgz?download">tgz format</a> (1300K) commonly used on Linux and compatible operating systems</li>
+ <li><a href="http://prdownloads.sourceforge.net/scintilla/scintilla351.zip?download">zip format</a> (1450K) commonly used on Windows</li>
+ <li><a href="http://prdownloads.sourceforge.net/scintilla/scintilla351.tgz?download">tgz format</a> (1300K) commonly used on Linux and compatible operating systems</li>
</ul>
Instructions for building on both Windows and Linux are included in the readme file.
<h4>
diff --git a/scintilla/doc/ScintillaHistory.html b/scintilla/doc/ScintillaHistory.html index dd69fcc..6f931bd 100644 --- a/scintilla/doc/ScintillaHistory.html +++ b/scintilla/doc/ScintillaHistory.html @@ -453,6 +453,12 @@ </tr><tr>
<td>Vicente</td>
<td>Nick Gravgaard</td>
+ <td>Ian Goldby</td>
+ <td>Holger Stenger</td>
+ </tr><tr>
+ <td>danselmi</td>
+ <td>Mat Berchtold</td>
+ <td>Michael Staszewski</td>
</tr>
</table>
<p>
@@ -465,6 +471,60 @@ </li>
</ul>
<h3>
+ <a href="http://prdownloads.sourceforge.net/scintilla/scite351.zip?download">Release 3.5.1</a>
+ </h3>
+ <ul>
+ <li>
+ Released 30 September 2014.
+ </li>
+ <li>
+ BibTeX lexer added.
+ <a href="http://sourceforge.net/p/scintilla/feature-requests/1071/">Feature #1071.</a>
+ </li>
+ <li>
+ SQL lexer supports the q-quote operator as SCE_SQL_QOPERATOR(24).
+ </li>
+ <li>
+ VHDL lexer supports block comments.
+ <a href="http://sourceforge.net/p/scintilla/bugs/1527/">Bug #1527</a>.
+ </li>
+ <li>
+ VHDL folder fixes case where "component" used before name.
+ <a href="http://sourceforge.net/p/scintilla/bugs/613/">Bug #613</a>.
+ </li>
+ <li>
+ Restore fractional pixel tab positioning which was truncated to whole pixels in 3.5.0.
+ <a href="http://sourceforge.net/p/scintilla/bugs/1652/">Bug #1652</a>.
+ </li>
+ <li>
+ Allow choice between windowed and inline IME on some platforms.
+ </li>
+ <li>
+ On GTK+ cache autocomplete window to avoid platform bug where windows
+ were sometimes lost.
+ <a href="http://sourceforge.net/p/scintilla/bugs/1649/">Bug #1649</a>.
+ </li>
+ <li>
+ On GTK+ size autocomplete window more accurately.
+ </li>
+ <li>
+ On Windows only unregister windows classes registered.
+ <a href="http://sourceforge.net/p/scintilla/bugs/1639/">Bug #1639</a>.
+ </li>
+ <li>
+ On Windows another DirectWrite mode SC_TECHNOLOGY_DIRECTWRITERETAIN added
+ which may avoid drawing failures on some cards and drivers.
+ This feature is provisional and may be changed or removed if a better solution is found.
+ </li>
+ <li>
+ On Windows support the Visual Studio 2010+ clipboard format that indicates a line copy.
+ <a href="http://sourceforge.net/p/scintilla/bugs/1636/">Bug #1636</a>.
+ </li>
+ <li>
+ SciTE session files remember the scroll position.
+ </li>
+ </ul>
+ <h3>
<a href="http://prdownloads.sourceforge.net/scintilla/scite350.zip?download">Release 3.5.0</a>
</h3>
<ul>
diff --git a/scintilla/doc/index.html b/scintilla/doc/index.html index 0108706..6d61562 100644 --- a/scintilla/doc/index.html +++ b/scintilla/doc/index.html @@ -9,7 +9,7 @@ <meta name="keywords" content="Scintilla, SciTE, Editing Component, Text Editor" />
<meta name="Description"
content="www.scintilla.org is the home of the Scintilla editing component and SciTE text editor application." />
- <meta name="Date.Modified" content="20140813" />
+ <meta name="Date.Modified" content="20140930" />
<style type="text/css">
#versionlist {
margin: 0;
@@ -55,8 +55,8 @@ GTK+, and OS X</font>
</td>
<td width="40%" align="right">
- <font color="#FFCC99" size="3"> Release version 3.5.0<br />
- Site last modified August 13 2014</font>
+ <font color="#FFCC99" size="3"> Release version 3.5.1<br />
+ Site last modified September 30 2014</font>
</td>
<td width="20%">
@@ -71,6 +71,7 @@ </tr>
</table>
<ul id="versionlist">
+ <li>Version 3.5.1 fixes minor bugs and includes a lexer for BibTeX.</li>
<li>Version 3.5.0 can share space vertically so that extreme ascenders and descenders are not cut off.
Separate timers are used to minimize wake ups and thus power use.</li>
<li>Version 3.4.4 removes style byte indicators.</li>
@@ -134,7 +135,7 @@ if (!IsRemote()) { //if NOT remote... </p>
<p>
The source code can be downloaded via Mercurial at the Source Forge
- <a href="https://sourceforge.net/project/?group_id=2439">Scintilla project page</a>.
+ <a href="http://sourceforge.net/projects/scintilla/">Scintilla project page</a>.
</p>
<p>
<a href="http://www.scintilla.org/ScintillaRelated.html">Related sites.</a>
@@ -162,15 +163,15 @@ if (!IsRemote()) { //if NOT remote... may receive no response.
<br />
</p>
-There is a <a href="https://sourceforge.net/project/?group_id=2439">Scintilla project page</a>
+There is a <a href="http://sourceforge.net/projects/scintilla/">Scintilla project page</a>
hosted on
<script type="text/javascript" language="JavaScript">
<!--
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&type=8" width="80" height="15" alt="Get Scintilla at SourceForge.net. Fast, secure and Free Open Source software downloads" /></a> ');
} else {
- document.write('<a href="http://sourceforge.net/projects/scintilla">SourceForge<\/a>');
+ document.write('<a href="http://sourceforge.net/projects/scintilla/">SourceForge<\/a>');
}
//-->
</script>
diff --git a/scintilla/include/SciLexer.h b/scintilla/include/SciLexer.h index 9b15c99..6ef663a 100644 --- a/scintilla/include/SciLexer.h +++ b/scintilla/include/SciLexer.h @@ -128,6 +128,7 @@ #define SCLEX_AS 113
#define SCLEX_DMIS 114
#define SCLEX_REGISTRY 115
+#define SCLEX_BIBTEX 116
#define SCLEX_AHK 200
#define SCLEX_AUTOMATIC 1000
#define SCE_P_DEFAULT 0
@@ -1005,6 +1006,7 @@ #define SCE_VHDL_STDPACKAGE 12
#define SCE_VHDL_STDTYPE 13
#define SCE_VHDL_USERWORD 14
+#define SCE_VHDL_BLOCK_COMMENT 15
#define SCE_CAML_DEFAULT 0
#define SCE_CAML_IDENTIFIER 1
#define SCE_CAML_TAGNAME 2
@@ -1116,6 +1118,7 @@ #define SCE_SQL_USER3 21
#define SCE_SQL_USER4 22
#define SCE_SQL_QUOTEDIDENTIFIER 23
+#define SCE_SQL_QOPERATOR 24
#define SCE_ST_DEFAULT 0
#define SCE_ST_STRING 1
#define SCE_ST_NUMBER 2
@@ -1753,6 +1756,13 @@ #define SCE_REG_STRING_GUID 10
#define SCE_REG_PARAMETER 11
#define SCE_REG_OPERATOR 12
+#define SCE_BIBTEX_DEFAULT 0
+#define SCE_BIBTEX_ENTRY 1
+#define SCE_BIBTEX_UNKNOWN_ENTRY 2
+#define SCE_BIBTEX_KEY 3
+#define SCE_BIBTEX_PARAMETER 4
+#define SCE_BIBTEX_VALUE 5
+#define SCE_BIBTEX_COMMENT 6
/* --Autogenerated -- end of section automatically generated from Scintilla.iface */
#endif
diff --git a/scintilla/include/Scintilla.h b/scintilla/include/Scintilla.h index 278c3a3..b5c1c8f 100644 --- a/scintilla/include/Scintilla.h +++ b/scintilla/include/Scintilla.h @@ -97,6 +97,10 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam, #define SCI_GETNEXTTABSTOP 2677
#define SC_CP_UTF8 65001
#define SCI_SETCODEPAGE 2037
+#define SC_IME_WINDOWED 0
+#define SC_IME_INLINE 1
+#define SCI_GETIMEINTERACTION 2678
+#define SCI_SETIMEINTERACTION 2679
#define MARKER_MAX 31
#define SC_MARK_CIRCLE 0
#define SC_MARK_ROUNDRECT 1
@@ -888,6 +892,7 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam, #define SCI_SCROLLTOEND 2629
#define SC_TECHNOLOGY_DEFAULT 0
#define SC_TECHNOLOGY_DIRECTWRITE 1
+#define SC_TECHNOLOGY_DIRECTWRITERETAIN 2
#define SCI_SETTECHNOLOGY 2630
#define SCI_GETTECHNOLOGY 2631
#define SCI_CREATELOADER 2632
diff --git a/scintilla/include/Scintilla.iface b/scintilla/include/Scintilla.iface index 7d215bd..66edd0e 100644 --- a/scintilla/include/Scintilla.iface +++ b/scintilla/include/Scintilla.iface @@ -243,6 +243,16 @@ val SC_CP_UTF8=65001 # The SC_CP_UTF8 value can be used to enter Unicode mode.
set void SetCodePage=2037(int codePage,)
+enu IMEInteraction=SC_IME_
+val SC_IME_WINDOWED=0
+val SC_IME_INLINE=1
+
+# Is the IME displayed in a winow or inline?
+get int GetIMEInteraction=2678(,)
+
+# Choose to display the the IME in a winow or inline.
+set void SetIMEInteraction=2679(int imeInteraction,)
+
enu MarkerSymbol=SC_MARK_
val MARKER_MAX=31
val SC_MARK_CIRCLE=0
@@ -2349,6 +2359,7 @@ fun void ScrollToEnd=2629(,) val SC_TECHNOLOGY_DEFAULT=0
val SC_TECHNOLOGY_DIRECTWRITE=1
+val SC_TECHNOLOGY_DIRECTWRITERETAIN=2
# Set the technology used.
set void SetTechnology=2630(int technology,)
@@ -2700,6 +2711,7 @@ val SCLEX_DMAP=112 val SCLEX_AS=113
val SCLEX_DMIS=114
val SCLEX_REGISTRY=115
+val SCLEX_BIBTEX=116
## notepad2 custom code for the AHK lexer - start
val SCLEX_AHK=200
## notepad2 custom code for the AHK lexer - end
@@ -3706,6 +3718,7 @@ val SCE_VHDL_STDFUNCTION=11 val SCE_VHDL_STDPACKAGE=12
val SCE_VHDL_STDTYPE=13
val SCE_VHDL_USERWORD=14
+val SCE_VHDL_BLOCK_COMMENT=15
# Lexical states for SCLEX_CAML
lex Caml=SCLEX_CAML SCE_CAML_
val SCE_CAML_DEFAULT=0
@@ -3827,6 +3840,7 @@ val SCE_SQL_USER2=20 val SCE_SQL_USER3=21
val SCE_SQL_USER4=22
val SCE_SQL_QUOTEDIDENTIFIER=23
+val SCE_SQL_QOPERATOR=24
# Lexical states for SCLEX_SMALLTALK
lex Smalltalk=SCLEX_SMALLTALK SCE_ST_
val SCE_ST_DEFAULT=0
@@ -4540,6 +4554,15 @@ val SCE_REG_KEYPATH_GUID=9 val SCE_REG_STRING_GUID=10
val SCE_REG_PARAMETER=11
val SCE_REG_OPERATOR=12
+# Lexical state for SCLEX_BIBTEX
+lex BibTeX=SCLEX_BIBTEX SCE_BIBTEX_
+val SCE_BIBTEX_DEFAULT=0
+val SCE_BIBTEX_ENTRY=1
+val SCE_BIBTEX_UNKNOWN_ENTRY=2
+val SCE_BIBTEX_KEY=3
+val SCE_BIBTEX_PARAMETER=4
+val SCE_BIBTEX_VALUE=5
+val SCE_BIBTEX_COMMENT=6
# Events
diff --git a/scintilla/lexers/LexBibTeX.cxx b/scintilla/lexers/LexBibTeX.cxx new file mode 100644 index 0000000..cdbce8d --- /dev/null +++ b/scintilla/lexers/LexBibTeX.cxx @@ -0,0 +1,310 @@ +// Copyright 2008-2010 Sergiu Dotenco. The License.txt file describes the +// conditions under which this software may be distributed. + +/** + * @file LexBibTeX.cxx + * @brief General BibTeX coloring scheme. + * @author Sergiu Dotenco + * @date April 18, 2009 + */ + +#include <stdlib.h> +#include <string.h> + +#include <cassert> +#include <cctype> + +#include <string> +#include <algorithm> +#include <functional> + +#include "ILexer.h" +#include "Scintilla.h" +#include "SciLexer.h" + +#include "PropSetSimple.h" +#include "WordList.h" +#include "LexAccessor.h" +#include "Accessor.h" +#include "StyleContext.h" +#include "CharacterSet.h" +#include "LexerModule.h" + +#ifdef SCI_NAMESPACE +using namespace Scintilla; +#endif + +namespace { + bool IsAlphabetic(unsigned int ch) + { + return IsASCII(ch) && std::isalpha(ch) != 0; + } + bool IsAlphaNumeric(char ch) + { + return IsASCII(ch) && std::isalnum(ch); + } + + bool EqualCaseInsensitive(const char* a, const char* b) + { + return CompareCaseInsensitive(a, b) == 0; + } + + bool EntryWithoutKey(const char* name) + { + return EqualCaseInsensitive(name,"string"); + } + + char GetClosingBrace(char openbrace) + { + char result = openbrace; + + switch (openbrace) { + case '(': result = ')'; break; + case '{': result = '}'; break; + } + + return result; + } + + bool IsEntryStart(char prev, char ch) + { + return prev != '\\' && ch == '@'; + } + + bool IsEntryStart(const StyleContext& sc) + { + return IsEntryStart(sc.chPrev, sc.ch); + } + + void ColorizeBibTeX(unsigned start_pos, int length, int /*init_style*/, WordList* keywordlists[], Accessor& styler) + { + WordList &EntryNames = *keywordlists[0]; + bool fold_compact = styler.GetPropertyInt("fold.compact", 1) != 0; + + std::string buffer; + buffer.reserve(25); + + // We always colorize a section from the beginning, so let's + // search for the @ character which isn't escaped, i.e. \@ + while (start_pos > 0 && !IsEntryStart(styler.SafeGetCharAt(start_pos - 1), + styler.SafeGetCharAt(start_pos))) { + --start_pos; ++length; + } + + styler.StartAt(start_pos); + styler.StartSegment(start_pos); + + int current_line = styler.GetLine(start_pos); + int prev_level = styler.LevelAt(current_line) & SC_FOLDLEVELNUMBERMASK; + int current_level = prev_level; + int visible_chars = 0; + + bool in_comment = false ; + StyleContext sc(start_pos, length, SCE_BIBTEX_DEFAULT, styler); + + bool going = sc.More(); // needed because of a fuzzy end of file state + char closing_brace = 0; + bool collect_entry_name = false; + + for (; going; sc.Forward()) { + if (!sc.More()) + going = false; // we need to go one behind the end of text + + if (in_comment) { + if (sc.atLineEnd) { + sc.SetState(SCE_BIBTEX_DEFAULT); + in_comment = false; + } + } + else { + // Found @entry + if (IsEntryStart(sc)) { + sc.SetState(SCE_BIBTEX_UNKNOWN_ENTRY); + sc.Forward(); + ++current_level; + + buffer.clear(); + collect_entry_name = true; + } + else if ((sc.state == SCE_BIBTEX_ENTRY || sc.state == SCE_BIBTEX_UNKNOWN_ENTRY) + && (sc.ch == '{' || sc.ch == '(')) { + // Entry name colorization done + // Found either a { or a ( after entry's name, e.g. @entry(...) @entry{...} + // Closing counterpart needs to be stored. + closing_brace = GetClosingBrace(sc.ch); + + sc.SetState(SCE_BIBTEX_DEFAULT); // Don't colorize { ( + + // @string doesn't have any key + if (EntryWithoutKey(buffer.c_str())) + sc.ForwardSetState(SCE_BIBTEX_PARAMETER); + else + sc.ForwardSetState(SCE_BIBTEX_KEY); // Key/label colorization + } + + // Need to handle the case where entry's key is empty + // e.g. @book{,...} + if (sc.state == SCE_BIBTEX_KEY && sc.ch == ',') { + // Key/label colorization done + sc.SetState(SCE_BIBTEX_DEFAULT); // Don't colorize the , + sc.ForwardSetState(SCE_BIBTEX_PARAMETER); // Parameter colorization + } + else if (sc.state == SCE_BIBTEX_PARAMETER && sc.ch == '=') { + sc.SetState(SCE_BIBTEX_DEFAULT); // Don't colorize the = + sc.ForwardSetState(SCE_BIBTEX_VALUE); // Parameter value colorization + + int start = sc.currentPos; + + // We need to handle multiple situations: + // 1. name"one two {three}" + // 2. name={one {one two {two}} three} + // 3. year=2005 + + // Skip ", { until we encounter the first alphanumerical character + while (sc.More() && !(IsAlphaNumeric(sc.ch) || sc.ch == '"' || sc.ch == '{')) + sc.Forward(); + + if (sc.More()) { + // Store " or { + char ch = sc.ch; + + // Not interested in alphanumerical characters + if (IsAlphaNumeric(ch)) + ch = 0; + + int skipped = 0; + + if (ch) { + // Skip preceding " or { such as in name={{test}}. + // Remember how many characters have been skipped + // Make sure that empty values, i.e. "" are also handled correctly + while (sc.More() && (sc.ch == ch && (ch != '"' || skipped < 1))) { + sc.Forward(); + ++skipped; + } + } + + // Closing counterpart for " is the same character + if (ch == '{') + ch = '}'; + + // We have reached the parameter value + // In case the open character was a alnum char, skip until , is found + // otherwise until skipped == 0 + while (sc.More() && (skipped > 0 || (!ch && !(sc.ch == ',' || sc.ch == closing_brace)))) { + // Make sure the character isn't escaped + if (sc.chPrev != '\\') { + // Parameter value contains a { which is the 2nd case described above + if (sc.ch == '{') + ++skipped; // Remember it + else if (sc.ch == '}') + --skipped; + else if (skipped == 1 && sc.ch == ch && ch == '"') // Don't ignore cases like {"o} + skipped = 0; + } + + sc.Forward(); + } + } + + // Don't colorize the , + sc.SetState(SCE_BIBTEX_DEFAULT); + + // Skip until the , or entry's closing closing_brace is found + // since this parameter might be the last one + while (sc.More() && !(sc.ch == ',' || sc.ch == closing_brace)) + sc.Forward(); + + int state = SCE_BIBTEX_PARAMETER; // The might be more parameters + + // We've reached the closing closing_brace for the bib entry + // in case no " or {} has been used to enclose the value, + // as in 3rd case described above + if (sc.ch == closing_brace) { + --current_level; + // Make sure the text between entries is not colored + // using parameter's style + state = SCE_BIBTEX_DEFAULT; + } + + int end = sc.currentPos; + current_line = styler.GetLine(end); + + // We have possibly skipped some lines, so the folding levels + // have to be adjusted separately + for (int i = styler.GetLine(start); i <= styler.GetLine(end); ++i) + styler.SetLevel(i, prev_level); + + sc.ForwardSetState(state); + } + + if (sc.state == SCE_BIBTEX_PARAMETER && sc.ch == closing_brace) { + sc.SetState(SCE_BIBTEX_DEFAULT); + --current_level; + } + + // Non escaped % found which represents a comment until the end of the line + if (sc.chPrev != '\\' && sc.ch == '%') { + in_comment = true; + sc.SetState(SCE_BIBTEX_COMMENT); + } + } + + if (sc.state == SCE_BIBTEX_UNKNOWN_ENTRY || sc.state == SCE_BIBTEX_ENTRY) { + if (!IsAlphabetic(sc.ch) && collect_entry_name) + collect_entry_name = false; + + if (collect_entry_name) { + buffer += static_cast<char>(tolower(sc.ch)); + if (EntryNames.InList(buffer.c_str())) + sc.ChangeState(SCE_BIBTEX_ENTRY); + else + sc.ChangeState(SCE_BIBTEX_UNKNOWN_ENTRY); + } + } + + if (sc.atLineEnd) { + int level = prev_level; + + if (visible_chars == 0 && fold_compact) + level |= SC_FOLDLEVELWHITEFLAG; + + if ((current_level > prev_level)) + level |= SC_FOLDLEVELHEADERFLAG; + // else if (current_level < prev_level) + // level |= SC_FOLDLEVELBOXFOOTERFLAG; // Deprecated + + if (level != styler.LevelAt(current_line)) { + styler.SetLevel(current_line, level); + } + + ++current_line; + prev_level = current_level; + visible_chars = 0; + } + + if (!isspacechar(sc.ch)) + ++visible_chars; + } + + sc.Complete(); + + // Fill in the real level of the next line, keeping the current flags as they will be filled in later + int flagsNext = styler.LevelAt(current_line) & ~SC_FOLDLEVELNUMBERMASK; + styler.SetLevel(current_line, prev_level | flagsNext); + } +} +static const char * const BibTeXWordLists[] = { + "Entry Names", + 0, +}; + + +LexerModule lmBibTeX(SCLEX_BIBTEX, ColorizeBibTeX, "bib", 0, BibTeXWordLists); + +// Entry Names +// article, book, booklet, conference, inbook, +// incollection, inproceedings, manual, mastersthesis, +// misc, phdthesis, proceedings, techreport, unpublished, +// string, url + diff --git a/scintilla/lexers/LexRegistry.cxx b/scintilla/lexers/LexRegistry.cxx index 64b30d2..0f401fa 100644 --- a/scintilla/lexers/LexRegistry.cxx +++ b/scintilla/lexers/LexRegistry.cxx @@ -10,13 +10,13 @@ * */ +#include <cstdlib> #include <cassert> #include <cctype> #include <cstdio> -#include <cstdlib> -#include <map> #include <string> #include <vector> +#include <map> #include "ILexer.h" #include "Scintilla.h" diff --git a/scintilla/lexers/LexSQL.cxx b/scintilla/lexers/LexSQL.cxx index 8b631d7..3c3ded0 100644 --- a/scintilla/lexers/LexSQL.cxx +++ b/scintilla/lexers/LexSQL.cxx @@ -444,6 +444,8 @@ void SCI_METHOD LexerSQL::Lex(unsigned int startPos, int length, int initStyle, StyleContext sc(startPos, length, initStyle, styler);
int styleBeforeDCKeyword = SCE_SQL_DEFAULT;
int offset = 0;
+ char qOperator = 0x00;
+
for (; sc.More(); sc.Forward(), offset++) {
// Determine if the current state should terminate.
switch (sc.state) {
@@ -556,11 +558,39 @@ void SCI_METHOD LexerSQL::Lex(unsigned int startPos, int length, int initStyle, }
}
break;
+ case SCE_SQL_QOPERATOR:
+ if (qOperator == 0x00) {
+ qOperator = sc.ch;
+ } else {
+ char qComplement = 0x00;
+
+ if (qOperator == '<') {
+ qComplement = '>';
+ } else if (qOperator == '(') {
+ qComplement = ')';
+ } else if (qOperator == '{') {
+ qComplement = '}';
+ } else if (qOperator == '[') {
+ qComplement = ']';
+ } else {
+ qComplement = qOperator;
+ }
+
+ if (sc.Match(qComplement, '\'')) {
+ sc.Forward();
+ sc.ForwardSetState(SCE_SQL_DEFAULT);
+ qOperator = 0x00;
+ }
+ }
+ break;
}
// Determine if a new state should be entered.
if (sc.state == SCE_SQL_DEFAULT) {
- if (IsADigit(sc.ch) || (sc.ch == '.' && IsADigit(sc.chNext))) {
+ if (sc.Match('q', '\'') || sc.Match('Q', '\'')) {
+ sc.SetState(SCE_SQL_QOPERATOR);
+ sc.Forward();
+ } else if (IsADigit(sc.ch) || (sc.ch == '.' && IsADigit(sc.chNext))) {
sc.SetState(SCE_SQL_NUMBER);
} else if (IsAWordStart(sc.ch)) {
sc.SetState(SCE_SQL_IDENTIFIER);
diff --git a/scintilla/lexers/LexVHDL.cxx b/scintilla/lexers/LexVHDL.cxx index 30db20b..5101754 100644 --- a/scintilla/lexers/LexVHDL.cxx +++ b/scintilla/lexers/LexVHDL.cxx @@ -119,6 +119,11 @@ static void ColouriseVHDLDoc( sc.ChangeState(SCE_VHDL_STRINGEOL);
sc.ForwardSetState(SCE_VHDL_DEFAULT);
}
+ } else if (sc.state == SCE_VHDL_BLOCK_COMMENT){
+ if(sc.ch == '*' && sc.chNext == '/'){
+ sc.Forward();
+ sc.ForwardSetState(SCE_VHDL_DEFAULT);
+ }
}
// Determine if a new state should be entered.
@@ -132,6 +137,8 @@ static void ColouriseVHDLDoc( sc.SetState(SCE_VHDL_COMMENTLINEBANG);
else
sc.SetState(SCE_VHDL_COMMENT);
+ } else if (sc.Match('/', '*')){
+ sc.SetState(SCE_VHDL_BLOCK_COMMENT);
} else if (sc.ch == '\"') {
sc.SetState(SCE_VHDL_STRING);
} else if (isoperator(static_cast<char>(sc.ch))) {
@@ -155,6 +162,39 @@ static bool IsCommentLine(int line, Accessor &styler) { }
return false;
}
+static bool IsCommentBlockStart(int line, Accessor &styler)
+{
+ int pos = styler.LineStart(line);
+ int eol_pos = styler.LineStart(line + 1) - 1;
+ for (int i = pos; i < eol_pos; i++) {
+ char ch = styler[i];
+ char chNext = styler[i+1];
+ char style = styler.StyleAt(i);
+ if ((style == SCE_VHDL_BLOCK_COMMENT) && (ch == '/') && (chNext == '*'))
+ return true;
+ }
+ return false;
+}
+
+static bool IsCommentBlockEnd(int line, Accessor &styler)
+{
+ int pos = styler.LineStart(line);
+ int eol_pos = styler.LineStart(line + 1) - 1;
+
+ for (int i = pos; i < eol_pos; i++) {
+ char ch = styler[i];
+ char chNext = styler[i+1];
+ char style = styler.StyleAt(i);
+ if ((style == SCE_VHDL_BLOCK_COMMENT) && (ch == '*') && (chNext == '/'))
+ return true;
+ }
+ return false;
+}
+
+static bool IsCommentStyle(char style)
+{
+ return style == SCE_VHDL_BLOCK_COMMENT || style == SCE_VHDL_COMMENT || style == SCE_VHDL_COMMENTLINEBANG;
+}
//=============================================================================
// Folding the code
@@ -207,14 +247,14 @@ static void FoldNoBoxVHDLDoc( char chPrev = styler.SafeGetCharAt(j-1);
int style = styler.StyleAt(j);
int stylePrev = styler.StyleAt(j-1);
- if ((stylePrev != SCE_VHDL_COMMENT) && (stylePrev != SCE_VHDL_STRING))
+ if ((!IsCommentStyle(style)) && (stylePrev != SCE_VHDL_STRING))
{
if(IsAWordChar(chPrev) && !IsAWordChar(ch))
{
end = j-1;
}
}
- if ((style != SCE_VHDL_COMMENT) && (style != SCE_VHDL_STRING))
+ if ((!IsCommentStyle(style)) && (style != SCE_VHDL_STRING))
{
if(!IsAWordChar(chPrev) && IsAWordStart(ch) && (end != 0))
{
@@ -236,7 +276,7 @@ static void FoldNoBoxVHDLDoc( {
char ch = styler.SafeGetCharAt(j);
int style = styler.StyleAt(j);
- if ((style != SCE_VHDL_COMMENT) && (style != SCE_VHDL_STRING))
+ if ((!IsCommentStyle(style)) && (style != SCE_VHDL_STRING))
{
if((ch == ';') && (strcmp(prevWord, "end") == 0))
{
@@ -268,15 +308,29 @@ static void FoldNoBoxVHDLDoc( styleNext = styler.StyleAt(i + 1);
bool atEOL = (ch == '\r' && chNext != '\n') || (ch == '\n');
- if (foldComment && atEOL && IsCommentLine(lineCurrent, styler))
+ if (foldComment && atEOL)
{
- if(!IsCommentLine(lineCurrent-1, styler) && IsCommentLine(lineCurrent+1, styler))
+ if(IsCommentLine(lineCurrent, styler))
{
- levelNext++;
+ if(!IsCommentLine(lineCurrent-1, styler) && IsCommentLine(lineCurrent+1, styler))
+ {
+ levelNext++;
+ }
+ else if(IsCommentLine(lineCurrent-1, styler) && !IsCommentLine(lineCurrent+1, styler))
+ {
+ levelNext--;
+ }
}
- else if(IsCommentLine(lineCurrent-1, styler) && !IsCommentLine(lineCurrent+1, styler))
+ else
{
- levelNext--;
+ if (IsCommentBlockStart(lineCurrent, styler) && !IsCommentBlockEnd(lineCurrent, styler))
+ {
+ levelNext++;
+ }
+ else if (IsCommentBlockEnd(lineCurrent, styler) && !IsCommentBlockStart(lineCurrent, styler))
+ {
+ levelNext--;
+ }
}
}
@@ -289,7 +343,7 @@ static void FoldNoBoxVHDLDoc( }
}
- if ((style != SCE_VHDL_COMMENT) && (style != SCE_VHDL_STRING))
+ if ((!IsCommentStyle(style)) && (style != SCE_VHDL_STRING))
{
if((ch == ';') && (strcmp(prevWord, "end") == 0))
{
@@ -301,7 +355,7 @@ static void FoldNoBoxVHDLDoc( lastStart = i;
}
- if(iswordchar(ch) && !iswordchar(chNext)) {
+ if(IsAWordChar(ch) && !IsAWordChar(chNext)) {
char s[32];
unsigned int k;
for(k=0; (k<31 ) && (k<i-lastStart+1 ); k++) {
@@ -314,8 +368,6 @@ static void FoldNoBoxVHDLDoc( if (
strcmp(s, "architecture") == 0 ||
strcmp(s, "case") == 0 ||
- strcmp(s, "component") == 0 ||
- strcmp(s, "entity") == 0 ||
strcmp(s, "generate") == 0 ||
strcmp(s, "loop") == 0 ||
strcmp(s, "package") ==0 ||
@@ -331,6 +383,32 @@ static void FoldNoBoxVHDLDoc( levelNext++;
}
} else if (
+ strcmp(s, "component") == 0 ||
+ strcmp(s, "entity") == 0 ||
+ strcmp(s, "configuration") == 0 )
+ {
+ if (strcmp(prevWord, "end") != 0)
+ { // check for instantiated unit by backward searching for the colon.
+ unsigned pos = lastStart-1;
+ char chAtPos, styleAtPos;
+ do{// skip white spaces
+ styleAtPos = styler.StyleAt(pos);
+ chAtPos = styler.SafeGetCharAt(pos--);
+ }while(pos>0 &&
+ (chAtPos == ' ' || chAtPos == '\t' ||
+ chAtPos == '\n' || chAtPos == '\r' ||
+ IsCommentStyle(styleAtPos)));
+
+ // check for a colon (':') before the instantiated units "entity", "component" or "configuration". Don't fold thereafter.
+ if (chAtPos != ':')
+ {
+ if (levelMinCurrentElse > levelNext) {
+ levelMinCurrentElse = levelNext;
+ }
+ levelNext++;
+ }
+ }
+ } else if (
strcmp(s, "procedure") == 0 ||
strcmp(s, "function") == 0)
{
@@ -338,19 +416,19 @@ static void FoldNoBoxVHDLDoc( { // This code checks to see if the procedure / function is a definition within a "package"
// rather than the actual code in the body.
int BracketLevel = 0;
- for(int j=i+1; j<styler.Length(); j++)
+ for(int pos=i+1; pos<styler.Length(); pos++)
{
- int LocalStyle = styler.StyleAt(j);
- char LocalCh = styler.SafeGetCharAt(j);
- if(LocalCh == '(') BracketLevel++;
- if(LocalCh == ')') BracketLevel--;
+ int styleAtPos = styler.StyleAt(pos);
+ char chAtPos = styler.SafeGetCharAt(pos);
+ if(chAtPos == '(') BracketLevel++;
+ if(chAtPos == ')') BracketLevel--;
if(
(BracketLevel == 0) &&
- (LocalStyle != SCE_VHDL_COMMENT) &&
- (LocalStyle != SCE_VHDL_STRING) &&
- !iswordchar(styler.SafeGetCharAt(j-1)) &&
- styler.Match(j, "is") &&
- !iswordchar(styler.SafeGetCharAt(j+2)))
+ (!IsCommentStyle(styleAtPos)) &&
+ (styleAtPos != SCE_VHDL_STRING) &&
+ !iswordchar(styler.SafeGetCharAt(pos-1)) &&
+ styler.Match(pos, "is") &&
+ !iswordchar(styler.SafeGetCharAt(pos+2)))
{
if (levelMinCurrentElse > levelNext) {
levelMinCurrentElse = levelNext;
@@ -358,7 +436,7 @@ static void FoldNoBoxVHDLDoc( levelNext++;
break;
}
- if((BracketLevel == 0) && (LocalCh == ';'))
+ if((BracketLevel == 0) && (chAtPos == ';'))
{
break;
}
diff --git a/scintilla/src/Catalogue.cxx b/scintilla/src/Catalogue.cxx index 9e03ae9..2d556cc 100644 --- a/scintilla/src/Catalogue.cxx +++ b/scintilla/src/Catalogue.cxx @@ -91,6 +91,7 @@ int Scintilla_LinkLexers() { //LINK_LEXER(lmBaan);
LINK_LEXER(lmBash);
LINK_LEXER(lmBatch);
+ //LINK_LEXER(lmBibTeX);
//LINK_LEXER(lmBlitzBasic);
//LINK_LEXER(lmBullant);
//LINK_LEXER(lmCaml);
diff --git a/scintilla/src/Document.cxx b/scintilla/src/Document.cxx index 86bc79f..3ffda0c 100644 --- a/scintilla/src/Document.cxx +++ b/scintilla/src/Document.cxx @@ -937,6 +937,8 @@ void Document::CheckReadOnly() { // SetStyleAt does not change the persistent state of a document
bool Document::DeleteChars(int pos, int len) {
+ if (pos < 0)
+ return false;
if (len <= 0)
return false;
if ((pos + len) > Length())
@@ -2198,8 +2200,8 @@ public: long BuiltinRegex::FindText(Document *doc, int minPos, int maxPos, const char *s,
bool caseSensitive, bool, bool, int flags,
int *length) {
- bool posix = (flags & SCFIND_POSIX) != 0;
- int increment = (minPos <= maxPos) ? 1 : -1;
+ const bool posix = (flags & SCFIND_POSIX) != 0;
+ const int increment = (minPos <= maxPos) ? 1 : -1;
int startPos = minPos;
int endPos = maxPos;
@@ -2217,7 +2219,7 @@ long BuiltinRegex::FindText(Document *doc, int minPos, int maxPos, const char *s // Search: \$(\([A-Za-z0-9_-]+\)\.\([A-Za-z0-9_.]+\))
// Replace: $(\1-\2)
int lineRangeStart = doc->LineFromPosition(startPos);
- int lineRangeEnd = doc->LineFromPosition(endPos);
+ const int lineRangeEnd = doc->LineFromPosition(endPos);
if ((increment == 1) &&
(startPos >= doc->LineEnd(lineRangeStart)) &&
(lineRangeStart < lineRangeEnd)) {
@@ -2233,9 +2235,9 @@ long BuiltinRegex::FindText(Document *doc, int minPos, int maxPos, const char *s }
int pos = -1;
int lenRet = 0;
- char searchEnd = s[*length - 1];
- char searchEndPrev = (*length > 1) ? s[*length - 2] : '\0';
- int lineRangeBreak = lineRangeEnd + increment;
+ const char searchEnd = s[*length - 1];
+ const char searchEndPrev = (*length > 1) ? s[*length - 2] : '\0';
+ const int lineRangeBreak = lineRangeEnd + increment;
for (int line = lineRangeStart; line != lineRangeBreak; line += increment) {
int startOfLine = doc->LineStart(line);
int endOfLine = doc->LineEnd(line);
diff --git a/scintilla/src/EditModel.cxx b/scintilla/src/EditModel.cxx index 815d227..8f66da4 100644 --- a/scintilla/src/EditModel.cxx +++ b/scintilla/src/EditModel.cxx @@ -61,6 +61,7 @@ EditModel::EditModel() { bracesMatchStyle = STYLE_BRACEBAD; highlightGuideColumn = 0; primarySelection = true; + imeInteraction = imeWindowed; foldFlags = 0; hotspot = Range(invalidPosition); wrapWidth = LineLayout::wrapWidthInfinite; diff --git a/scintilla/src/EditModel.h b/scintilla/src/EditModel.h index f7ca749..d8def32 100644 --- a/scintilla/src/EditModel.h +++ b/scintilla/src/EditModel.h @@ -42,6 +42,8 @@ public: Selection sel; bool primarySelection; + enum IMEInteraction { imeWindowed, imeInline } imeInteraction; + int foldFlags; ContractionState cs; // Hotspot support diff --git a/scintilla/src/EditView.cxx b/scintilla/src/EditView.cxx index c46a0fb..7d5860e 100644 --- a/scintilla/src/EditView.cxx +++ b/scintilla/src/EditView.cxx @@ -215,11 +215,11 @@ void EditView::ClearAllTabstops() { ldTabstops = 0; } -int EditView::NextTabstopPos(int line, int x, int tabWidth) const { - int next = GetNextTabstop(line, x); +XYPOSITION EditView::NextTabstopPos(int line, XYPOSITION x, XYPOSITION tabWidth) const { + int next = GetNextTabstop(line, static_cast<int>(x + 2)); if (next > 0) - return next; - return ((((x + 2) / tabWidth) + 1) * tabWidth); + return static_cast<XYPOSITION>(next); + return (static_cast<int>((x + 2) / tabWidth) + 1) * tabWidth; } bool EditView::ClearTabstops(int line) { @@ -452,9 +452,8 @@ void EditView::LayoutLine(const EditModel &model, int line, Surface *surface, co XYPOSITION representationWidth = vstyle.controlCharWidth; if (ll->chars[ts.start] == '\t') { // Tab is a special case of representation, taking a variable amount of space - const int x = static_cast<int>(ll->positions[ts.start]); - const int tabWidth = static_cast<int>(vstyle.tabWidth); - representationWidth = static_cast<XYPOSITION>(NextTabstopPos(line, x, tabWidth) - ll->positions[ts.start]); + const XYPOSITION x = ll->positions[ts.start]; + representationWidth = NextTabstopPos(line, x, vstyle.tabWidth) - ll->positions[ts.start]; } else { if (representationWidth <= 0.0) { XYPOSITION positionsRepr[256]; // Should expand when needed diff --git a/scintilla/src/EditView.h b/scintilla/src/EditView.h index 1845110..733612e 100644 --- a/scintilla/src/EditView.h +++ b/scintilla/src/EditView.h @@ -32,7 +32,7 @@ enum DrawPhase { drawLineTranslucent = 0x40, drawFoldLines = 0x80, drawCarets = 0x100, - drawAll = 0x1FF, + drawAll = 0x1FF }; bool ValidStyledText(const ViewStyle &vs, size_t styleOffset, const StyledText &st); @@ -86,7 +86,7 @@ public: bool LinesOverlap() const; void ClearAllTabstops(); - int NextTabstopPos(int line, int x, int tabWidth) const; + XYPOSITION NextTabstopPos(int line, XYPOSITION x, XYPOSITION tabWidth) const; bool ClearTabstops(int line); bool AddTabstop(int line, int x); int GetNextTabstop(int line, int x) const; diff --git a/scintilla/src/Editor.cxx b/scintilla/src/Editor.cxx index 407a5b8..c2631e7 100644 --- a/scintilla/src/Editor.cxx +++ b/scintilla/src/Editor.cxx @@ -2132,14 +2132,6 @@ void Editor::Redo() { }
}
-void Editor::DelChar() {
- if (!RangeContainsProtected(sel.MainCaret(), sel.MainCaret() + 1)) {
- pdoc->DelChar(sel.MainCaret());
- }
- // Avoid blinking during rapid typing:
- ShowCaretAtCurrentPosition();
-}
-
void Editor::DelCharBack(bool allowLineStartDeletion) {
RefreshStyleData();
if (!sel.IsRectangular())
@@ -4300,7 +4292,7 @@ void Editor::ButtonDown(Point pt, unsigned int curTime, bool shift, bool ctrl, b }
bool Editor::PositionIsHotspot(int position) const {
- return vs.styles[pdoc->StyleAt(position)].hotspot;
+ return vs.styles[static_cast<unsigned char>(pdoc->StyleAt(position))].hotspot;
}
bool Editor::PointIsHotspot(Point pt) {
@@ -6275,6 +6267,13 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) { case SCI_GETCODEPAGE:
return pdoc->dbcsCodePage;
+ case SCI_SETIMEINTERACTION:
+ imeInteraction = static_cast<EditModel::IMEInteraction>(wParam);
+ break;
+
+ case SCI_GETIMEINTERACTION:
+ return imeInteraction;
+
#ifdef INCLUDE_DEPRECATED_FEATURES
case SCI_SETUSEPALETTE:
InvalidateStyleRedraw();
diff --git a/scintilla/src/Editor.h b/scintilla/src/Editor.h index e9f6df3..58e67a0 100644 --- a/scintilla/src/Editor.h +++ b/scintilla/src/Editor.h @@ -403,7 +403,6 @@ protected: // ScintillaBase subclass needs access to much of Editor void SelectAll();
void Undo();
void Redo();
- void DelChar();
void DelCharBack(bool allowLineStartDeletion);
virtual void ClaimSelection() = 0;
diff --git a/scintilla/src/Indicator.h b/scintilla/src/Indicator.h index 9deef45..8f2c170 100644 --- a/scintilla/src/Indicator.h +++ b/scintilla/src/Indicator.h @@ -17,11 +17,14 @@ namespace Scintilla { class Indicator {
public:
int style;
- bool under;
ColourDesired fore;
+ bool under;
int fillAlpha;
int outlineAlpha;
- Indicator() : style(INDIC_PLAIN), under(false), fore(ColourDesired(0,0,0)), fillAlpha(30), outlineAlpha(50) {
+ Indicator() : style(INDIC_PLAIN), fore(ColourDesired(0,0,0)), under(false), fillAlpha(30), outlineAlpha(50) {
+ }
+ Indicator(int style_, ColourDesired fore_=ColourDesired(0,0,0), bool under_=false, int fillAlpha_=30, int outlineAlpha_=50) :
+ style(style_), fore(fore_), under(under_), fillAlpha(fillAlpha_), outlineAlpha(outlineAlpha_) {
}
void Draw(Surface *surface, const PRectangle &rc, const PRectangle &rcLine) const;
};
diff --git a/scintilla/src/RESearch.cxx b/scintilla/src/RESearch.cxx index 46f09b3..e0fb9ca 100644 --- a/scintilla/src/RESearch.cxx +++ b/scintilla/src/RESearch.cxx @@ -276,10 +276,9 @@ void RESearch::GrabMatches(CharacterIndexer &ci) { for (unsigned int i = 0; i < MAXTAG; i++) {
if ((bopat[i] != NOTFOUND) && (eopat[i] != NOTFOUND)) {
unsigned int len = eopat[i] - bopat[i];
- pat[i] = std::string(len+1, '\0');
+ pat[i].resize(len);
for (unsigned int j = 0; j < len; j++)
pat[i][j] = ci.CharAt(bopat[i] + j);
- pat[i][len] = '\0';
}
}
}
diff --git a/scintilla/src/ViewStyle.cxx b/scintilla/src/ViewStyle.cxx index a06cd0a..8a62a90 100644 --- a/scintilla/src/ViewStyle.cxx +++ b/scintilla/src/ViewStyle.cxx @@ -192,15 +192,9 @@ void ViewStyle::Init(size_t stylesSize_) { // There are no image markers by default, so no need for calling CalcLargestMarkerHeight()
largestMarkerHeight = 0;
- indicators[0].style = INDIC_SQUIGGLE;
- indicators[0].under = false;
- indicators[0].fore = ColourDesired(0, 0x7f, 0);
- indicators[1].style = INDIC_TT;
- indicators[1].under = false;
- indicators[1].fore = ColourDesired(0, 0, 0xff);
- indicators[2].style = INDIC_PLAIN;
- indicators[2].under = false;
- indicators[2].fore = ColourDesired(0xff, 0, 0);
+ indicators[0] = Indicator(INDIC_SQUIGGLE, ColourDesired(0, 0x7f, 0));
+ indicators[1] = Indicator(INDIC_TT, ColourDesired(0, 0, 0xff));
+ indicators[2] = Indicator(INDIC_PLAIN, ColourDesired(0xff, 0, 0));
technology = SC_TECHNOLOGY_DEFAULT;
lineHeight = 1;
diff --git a/scintilla/version.txt b/scintilla/version.txt index 3e41be7..830faad 100644 --- a/scintilla/version.txt +++ b/scintilla/version.txt @@ -1 +1 @@ -350
+351
diff --git a/scintilla/win32/ScintillaWin.cxx b/scintilla/win32/ScintillaWin.cxx index a6b8cc8..2c6bab1 100644 --- a/scintilla/win32/ScintillaWin.cxx +++ b/scintilla/win32/ScintillaWin.cxx @@ -197,6 +197,7 @@ class ScintillaWin : CLIPFORMAT cfColumnSelect;
CLIPFORMAT cfBorlandIDEBlockType;
CLIPFORMAT cfLineSelect;
+ CLIPFORMAT cfVSLineTag;
HRESULT hrOle;
DropSource ds;
@@ -204,6 +205,8 @@ class ScintillaWin : DropTarget dt;
static HINSTANCE hInstance;
+ static ATOM scintillaClassAtom;
+ static ATOM callClassAtom;
#if defined(USE_D2D)
ID2D1HwndRenderTarget *pRenderTarget;
@@ -335,6 +338,8 @@ private: };
HINSTANCE ScintillaWin::hInstance = 0;
+ATOM ScintillaWin::scintillaClassAtom = 0;
+ATOM ScintillaWin::callClassAtom = 0;
ScintillaWin::ScintillaWin(HWND hwnd) {
@@ -362,7 +367,8 @@ ScintillaWin::ScintillaWin(HWND hwnd) { // Likewise for line-copy (copies a full line when no text is selected)
cfLineSelect = static_cast<CLIPFORMAT>(
::RegisterClipboardFormat(TEXT("MSDEVLineSelect")));
-
+ cfVSLineTag = static_cast<CLIPFORMAT>(
+ ::RegisterClipboardFormat(TEXT("VisualStudioEditorOperationsLineCutCopyClipboardTag")));
hrOle = E_FAIL;
wMain = hwnd;
@@ -451,7 +457,8 @@ void ScintillaWin::EnsureRenderTarget() { D2D1_HWND_RENDER_TARGET_PROPERTIES dhrtp;
dhrtp.hwnd = hw;
dhrtp.pixelSize = size;
- dhrtp.presentOptions = D2D1_PRESENT_OPTIONS_NONE;
+ dhrtp.presentOptions = (technology == SC_TECHNOLOGY_DIRECTWRITERETAIN) ?
+ D2D1_PRESENT_OPTIONS_RETAIN_CONTENTS : D2D1_PRESENT_OPTIONS_NONE;
D2D1_RENDER_TARGET_PROPERTIES drtp;
drtp.type = D2D1_RENDER_TARGET_TYPE_DEFAULT;
@@ -1396,9 +1403,11 @@ sptr_t ScintillaWin::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam return keysAlwaysUnicode;
case SCI_SETTECHNOLOGY:
- if ((wParam == SC_TECHNOLOGY_DEFAULT) || (wParam == SC_TECHNOLOGY_DIRECTWRITE)) {
+ if ((wParam == SC_TECHNOLOGY_DEFAULT) ||
+ (wParam == SC_TECHNOLOGY_DIRECTWRITERETAIN) ||
+ (wParam == SC_TECHNOLOGY_DIRECTWRITE)) {
if (technology != static_cast<int>(wParam)) {
- if (static_cast<int>(wParam) == SC_TECHNOLOGY_DIRECTWRITE) {
+ if (static_cast<int>(wParam) > SC_TECHNOLOGY_DEFAULT) {
#if defined(USE_D2D)
if (!LoadD2D())
// Failed to load Direct2D or DirectWrite so no effect
@@ -1880,7 +1889,8 @@ void ScintillaWin::Paste() { if (!::OpenClipboard(MainHWND()))
return;
UndoGroup ug(pdoc);
- const bool isLine = SelectionEmpty() && (::IsClipboardFormatAvailable(cfLineSelect) != 0);
+ const bool isLine = SelectionEmpty() &&
+ (::IsClipboardFormatAvailable(cfLineSelect) || ::IsClipboardFormatAvailable(cfVSLineTag));
ClearSelection(multiPasteMode == SC_MULTIPASTE_EACH);
bool isRectangular = (::IsClipboardFormatAvailable(cfColumnSelect) != 0);
@@ -2447,6 +2457,7 @@ void ScintillaWin::CopyToClipboard(const SelectionText &selectedText) { if (selectedText.lineCopy) {
::SetClipboardData(cfLineSelect, 0);
+ ::SetClipboardData(cfVSLineTag, 0);
}
::CloseClipboard();
@@ -2815,7 +2826,8 @@ bool ScintillaWin::Register(HINSTANCE hInstance_) { wndclass.lpszMenuName = NULL;
wndclass.lpszClassName = L"Scintilla";
wndclass.hIconSm = 0;
- result = ::RegisterClassExW(&wndclass) != 0;
+ scintillaClassAtom = ::RegisterClassExW(&wndclass);
+ result = 0 != scintillaClassAtom;
} else {
// Register Scintilla as a normal character window
@@ -2832,7 +2844,8 @@ bool ScintillaWin::Register(HINSTANCE hInstance_) { wndclass.lpszMenuName = NULL;
wndclass.lpszClassName = scintillaClassName;
wndclass.hIconSm = 0;
- result = ::RegisterClassEx(&wndclass) != 0;
+ scintillaClassAtom = ::RegisterClassEx(&wndclass);
+ result = 0 != scintillaClassAtom;
}
if (result) {
@@ -2851,16 +2864,27 @@ bool ScintillaWin::Register(HINSTANCE hInstance_) { wndclassc.lpszClassName = callClassName;
wndclassc.hIconSm = 0;
- result = ::RegisterClassEx(&wndclassc) != 0;
+ callClassAtom = ::RegisterClassEx(&wndclassc);
+ result = 0 != callClassAtom;
}
return result;
}
bool ScintillaWin::Unregister() {
- bool result = ::UnregisterClass(scintillaClassName, hInstance) != 0;
- if (::UnregisterClass(callClassName, hInstance) == 0)
- result = false;
+ bool result = true;
+ if (0 != scintillaClassAtom) {
+ if (::UnregisterClass(MAKEINTATOM(scintillaClassAtom), hInstance) == 0) {
+ result = false;
+ }
+ scintillaClassAtom = 0;
+ }
+ if (0 != callClassAtom) {
+ if (::UnregisterClass(MAKEINTATOM(callClassAtom), hInstance) == 0) {
+ result = false;
+ }
+ callClassAtom = 0;
+ }
return result;
}
@@ -2939,7 +2963,8 @@ sptr_t PASCAL ScintillaWin::CTWndProc( D2D1_HWND_RENDER_TARGET_PROPERTIES dhrtp;
dhrtp.hwnd = hWnd;
dhrtp.pixelSize = D2D1::SizeU(rc.right - rc.left, rc.bottom - rc.top);
- dhrtp.presentOptions = D2D1_PRESENT_OPTIONS_NONE;
+ dhrtp.presentOptions = (sciThis->technology == SC_TECHNOLOGY_DIRECTWRITERETAIN) ?
+ D2D1_PRESENT_OPTIONS_RETAIN_CONTENTS : D2D1_PRESENT_OPTIONS_NONE;
D2D1_RENDER_TARGET_PROPERTIES drtp;
drtp.type = D2D1_RENDER_TARGET_TYPE_DEFAULT;
|