From a2dd8284438ec1870fa8e35f228d5ffeeb0410a7 Mon Sep 17 00:00:00 2001 From: Don Ho Date: Mon, 12 Jul 2010 22:19:51 +0000 Subject: [PATCH] [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 --- scintilla/README | 23 +- scintilla/doc/Design.html | 3 +- scintilla/doc/Icons.html | 3 +- scintilla/doc/SciCoding.html | 13 +- scintilla/doc/ScintillaDoc.html | 317 +++++---- scintilla/doc/ScintillaDownload.html | 13 +- scintilla/doc/ScintillaHistory.html | 527 ++++++++++++-- scintilla/doc/ScintillaRelated.html | 26 +- scintilla/doc/ScintillaToDo.html | 21 +- scintilla/doc/ScintillaUsage.html | 3 +- scintilla/doc/Steps.html | 1 + scintilla/doc/index.html | 123 ++-- scintilla/gtk/Converter.h | 19 +- scintilla/gtk/PlatGTK.cxx | 452 +++--------- scintilla/gtk/ScintillaGTK.cxx | 702 +++++-------------- scintilla/gtk/deps.mak | 459 ++++++------ scintilla/gtk/makefile | 46 +- scintilla/include/Platform.h | 8 +- scintilla/include/SciLexer.h | 57 +- scintilla/include/Scintilla.h | 54 +- scintilla/include/Scintilla.iface | 115 +++- scintilla/include/ScintillaWidget.h | 10 +- scintilla/include/WindowAccessor.h | 2 +- scintilla/src/AutoComplete.cxx | 10 +- scintilla/src/AutoComplete.h | 6 +- scintilla/src/CallTip.cxx | 7 +- scintilla/src/CallTip.h | 8 +- scintilla/src/CellBuffer.cxx | 30 +- scintilla/src/CellBuffer.h | 12 +- scintilla/src/CharacterSet.h | 1 + scintilla/src/ContractionState.cxx | 4 +- scintilla/src/Decoration.h | 4 +- scintilla/src/Document.cxx | 471 ++++++------- scintilla/src/Document.h | 53 +- scintilla/src/DocumentAccessor.cxx | 2 +- scintilla/src/DocumentAccessor.h | 14 +- scintilla/src/Editor.cxx | 806 ++++++++++++++++------ scintilla/src/Editor.h | 63 +- scintilla/src/ExternalLexer.cxx | 31 +- scintilla/src/ExternalLexer.h | 21 +- scintilla/src/KeyWords.cxx | 15 +- scintilla/src/LexAVE.cxx | 2 +- scintilla/src/LexBash.cxx | 35 +- scintilla/src/LexBullant.cxx | 3 +- scintilla/src/LexCOBOL.cxx | 2 +- scintilla/src/LexCPP.cxx | 24 +- scintilla/src/LexCSS.cxx | 20 +- scintilla/src/LexCaml.cxx | 10 +- scintilla/src/LexConf.cxx | 12 +- scintilla/src/LexCrontab.cxx | 8 +- scintilla/src/LexCsound.cxx | 2 +- scintilla/src/LexErlang.cxx | 995 +++++++++++++++------------ scintilla/src/LexFlagship.cxx | 368 ++++++---- scintilla/src/LexGAP.cxx | 2 +- scintilla/src/LexGen.py | 9 +- scintilla/src/LexHTML.cxx | 245 ++++++- scintilla/src/LexLisp.cxx | 2 +- scintilla/src/LexMMIXAL.cxx | 2 +- scintilla/src/LexMPT.cxx | 2 +- scintilla/src/LexMySQL.cxx | 20 +- scintilla/src/LexNsis.cxx | 12 +- scintilla/src/LexOpal.cxx | 8 +- scintilla/src/LexOthers.cxx | 40 +- scintilla/src/LexPerl.cxx | 2 +- scintilla/src/LexProgress.cxx | 40 +- scintilla/src/LexPython.cxx | 26 +- scintilla/src/LexR.cxx | 4 +- scintilla/src/LexSML.cxx | 10 +- scintilla/src/LexSQL.cxx | 14 +- scintilla/src/LexVB.cxx | 34 + scintilla/src/LexVHDL.cxx | 43 +- scintilla/src/LexVerilog.cxx | 25 + scintilla/src/LineMarker.cxx | 4 +- scintilla/src/LineMarker.h | 2 +- scintilla/src/Partitioning.h | 2 +- scintilla/src/PerLine.cxx | 5 +- scintilla/src/PerLine.h | 2 +- scintilla/src/PositionCache.cxx | 38 +- scintilla/src/PositionCache.h | 10 +- scintilla/src/PropSet.cxx | 2 +- scintilla/src/RESearch.cxx | 2 + scintilla/src/SVector.h | 14 +- scintilla/src/ScintillaBase.cxx | 48 +- scintilla/src/ScintillaBase.h | 10 +- scintilla/src/Selection.cxx | 25 +- scintilla/src/Selection.h | 13 +- scintilla/src/SplitVector.h | 12 +- scintilla/src/Style.cxx | 9 +- scintilla/src/Style.h | 4 +- scintilla/src/StyleContext.h | 10 +- scintilla/src/UniConversion.cxx | 16 +- scintilla/src/UniConversion.h | 3 +- scintilla/src/ViewStyle.cxx | 28 +- scintilla/src/ViewStyle.h | 5 +- scintilla/src/WindowAccessor.cxx | 24 +- scintilla/src/XPM.cxx | 8 +- scintilla/src/XPM.h | 12 +- scintilla/vcbuild/SciLexer.dsp | 8 +- scintilla/version.txt | 2 +- scintilla/win32/PlatWin.cxx | 128 ++-- scintilla/win32/ScintRes.rc | 12 +- scintilla/win32/ScintillaWin.cxx | 403 +++++++---- scintilla/win32/makefile | 29 +- scintilla/win32/scintilla.mak | 5 +- scintilla/win32/scintilla_vc6.mak | 3 + 105 files changed, 4327 insertions(+), 3147 deletions(-) diff --git a/scintilla/README b/scintilla/README index 45bd3eff..7ab21463 100644 --- a/scintilla/README +++ b/scintilla/README @@ -6,8 +6,8 @@ To build SciTE, Scintilla must first be built. *** GTK+/Linux version *** -You must first have GTK+ 1.2 or later and GCC (3.1 or better) installed. -GTK+ 1.0x will not work and when it did it was very slow. +You must first have GTK+ 2.0 or later and GCC (4.1 or better) installed. +GTK+ 1.x will not work. Other C++ compilers may work but may require tweaking the make file. 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. 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 make uninstall @@ -45,9 +41,8 @@ The current make file only supports static linking between SciTE and Scintilla. *** Windows version *** A C++ compiler is required. Visual Studio .NET 2008 is the development system -used for most development although Mingw32 3.1 is also supported. -Borland did work but the command lines are now too long and the most recent -Borland version does not work. For older versions such as version 5.02, add the -l option. +used for most development although TDM Mingw32 4.4.1 is also supported. +For older versions of Borland C++ such as version 5.02, add the -l option. To build Scintilla, make in the scintilla/win32 directory 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 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 diff --git a/scintilla/doc/Design.html b/scintilla/doc/Design.html index d426cb36..24a6032b 100644 --- a/scintilla/doc/Design.html +++ b/scintilla/doc/Design.html @@ -244,6 +244,7 @@ does not follow platform conventions well. A second API could be implemented here that did follow platform conventions.

- + + diff --git a/scintilla/doc/Icons.html b/scintilla/doc/Icons.html index 0d8b8bf5..5ce93c1f 100644 --- a/scintilla/doc/Icons.html +++ b/scintilla/doc/Icons.html @@ -52,5 +52,6 @@ - + + diff --git a/scintilla/doc/SciCoding.html b/scintilla/doc/SciCoding.html index c7d072b8..abbefcac 100644 --- a/scintilla/doc/SciCoding.html +++ b/scintilla/doc/SciCoding.html @@ -247,5 +247,16 @@                 }
        
}
}; - +

+ Submitting a lexer +

+ +

Add a public feature request to the Feature Request Tracker.

+

Send all the modified and new files as full text (not patches) in an archive (.zip or .tgz).

+

Define all of the lexical states in a modified Scintilla.iface.

+

Ensure there are no warnings under the compiler you use. Warnings from other compilers + will be noted on the feature request.

+

sc.ch is an int: do not pass this around as a char.

+ + diff --git a/scintilla/doc/ScintillaDoc.html b/scintilla/doc/ScintillaDoc.html index 694a32c1..036aca3b 100644 --- a/scintilla/doc/ScintillaDoc.html +++ b/scintilla/doc/ScintillaDoc.html @@ -38,7 +38,7 @@

Scintilla Documentation

-

Last edited 7/August/2009 NH

+

Last edited 4/April/2010 NH

There is an overview of the internal design of Scintilla.
@@ -71,6 +71,10 @@

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.

+

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.

+

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 work out how to develop using Scintilla is to see how SciTE uses it. SciTE exercises most of @@ -233,7 +237,7 @@ o Key bindings o Popup edit menu - + o Macro recording @@ -241,7 +245,7 @@ o Printing o Direct access - + o Multiple views @@ -249,7 +253,7 @@ o Folding o Line wrapping - + o Zooming @@ -257,7 +261,7 @@ o Long lines o Lexer - + o Notifications @@ -265,7 +269,7 @@ o GTK+ o Deprecated messages - + o Edit messages never supported by Scintilla @@ -297,7 +301,7 @@ languages, and three independent indicators so that, for example, syntax errors, deprecated names and bad indentation could all be displayed at once. The number of bits used for styles can be altered with SCI_SETSTYLEBITS up to a maximum of 7 bits. + href="#SCI_SETSTYLEBITS">SCI_SETSTYLEBITS up to a maximum of 8 bits. The remaining bits can be used for indicators.

In this document, 'character' normally refers to a byte even when multi-byte characters are used. @@ -327,7 +331,7 @@ *text)
SCI_SETREADONLY(bool readOnly)
SCI_GETREADONLY
- SCI_GETTEXTRANGE(<unused>, TextRange + SCI_GETTEXTRANGE(<unused>, Sci_TextRange *tr)
SCI_ALLOCATE(int bytes, <unused>)
SCI_ADDTEXT(int length, const char *s)
@@ -338,7 +342,7 @@ SCI_CLEARDOCUMENTSTYLE
SCI_GETCHARAT(int position)
SCI_GETSTYLEAT(int position)
- SCI_GETSTYLEDTEXT(<unused>, TextRange + SCI_GETSTYLEDTEXT(<unused>, Sci_TextRange *tr)
SCI_SETSTYLEBITS(int bits)
SCI_GETSTYLEBITS
@@ -409,9 +413,9 @@ href="#SCN_MODIFYATTEMPTRO">SCN_MODIFYATTEMPTRO notification.

SCI_GETTEXTRANGE(<unused>, TextRange *tr)
+ href="#Sci_TextRange">Sci_TextRange *tr)
This collects the text between the positions cpMin and cpMax and - copies it to lpstrText (see struct TextRange in + copies it to lpstrText (see struct Sci_TextRange in Scintilla.h). If cpMax 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 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

SCI_GETSTYLEDTEXT(<unused>, TextRange *tr)
+ href="#Sci_TextRange">Sci_TextRange *tr)
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 positions cpMin and cpMax are copied to lpstrText (see - struct TextRange in Scintilla.h). Two 0 bytes are added to the end of + struct Sci_TextRange in Scintilla.h). Two 0 bytes are added to the end of the text, so the buffer that lpstrText points at must be at least 2*(cpMax-cpMin)+2 bytes long. No check is made for sensible values of cpMin or cpMax. Positions outside the document return character codes @@ -483,23 +487,23 @@

SCI_SETSTYLEBITS(int bits)
SCI_GETSTYLEBITS
This pair of routines sets and reads back the number of bits in each cell to use for styling, - to a maximum of 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 SCI_SETSTYLEBITS(5). The number of styling bits needed by the current lexer can be found with SCI_GETSTYLEBITSNEEDED.

-

TextRange and CharacterRange
+

Sci_TextRange and Sci_CharacterRange
These structures are defined to be exactly the same shape as the Win32 TEXTRANGE and CHARRANGE, so that older code that treats Scintilla as a RichEdit will work.

-struct CharacterRange {
+struct Sci_CharacterRange {
     long cpMin;
     long cpMax;
 };
 
-struct TextRange {
-    struct CharacterRange chrg;
+struct Sci_TextRange {
+    struct Sci_CharacterRange chrg;
     char *lpstrText;
 };
 
@@ -531,7 +535,7 @@ struct TextRange { or can be called from the container using direct access to the buffer contents through SCI_GETCHARACTERPOINTER.

- SCI_FINDTEXT(int flags, TextToFind + SCI_FINDTEXT(int flags, Sci_TextToFind *ttf)
SCI_SEARCHANCHOR
SCI_SEARCHNEXT(int searchFlags, const char @@ -678,35 +682,35 @@ struct TextRange {

SCI_FINDTEXT(int searchFlags, TextToFind *ttf)
+ href="#Sci_TextToFind">Sci_TextToFind *ttf)
This message searches for text in the document. It does not use or move the current selection. The searchFlags argument controls the search type, which includes regular expression searches.

-

The TextToFind structure is defined in Scintilla.h; set +

The Sci_TextToFind structure is defined in Scintilla.h; set chrg.cpMin and chrg.cpMax with the range of positions in the document to search. If SCFIND_REGEXP is not included in the flags, you can search backwards by setting chrg.cpMax less than chrg.cpMin. If SCFIND_REGEXP is included, the search is always forwards (even if chrg.cpMax is less than chrg.cpMin). - Set the lpstrText member of TextToFind to point at a zero terminated - text string holding the search pattern. If your language makes the use of TextToFind + Set the lpstrText member of Sci_TextToFind to point at a zero terminated + text string holding the search pattern. If your language makes the use of Sci_TextToFind difficult, you should consider using SCI_SEARCHINTARGET instead.

The return value is -1 if the search fails or the position of the start of the found text if it succeeds. The chrgText.cpMin and chrgText.cpMax members of - TextToFind are filled in with the start and end positions of the found text.

+ Sci_TextToFind are filled in with the start and end positions of the found text.

See also: SCI_SEARCHINTARGET

-

TextToFind
+

Sci_TextToFind
This structure is defined to have exactly the same shape as the Win32 structure FINDTEXTEX for old code that treated Scintilla as a RichEdit control.

-struct TextToFind {
-    struct CharacterRange chrg;     // range to search
+struct Sci_TextToFind {
+    struct Sci_CharacterRange chrg;     // range to search
     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
 };
 
@@ -747,8 +751,8 @@ struct TextToFind { SCI_REPLACETARGET or SCI_REPLACETARGETRE.

Searching can be performed within the target range with SCI_SEARCHINTARGET, - which uses a counted string to allow searching for null characters. It returns the length of - range or -1 for failure, in which case the target is not moved. The flags used by + which uses a counted string to allow searching for null characters. It returns the + 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 SCI_SEARCHINTARGET such as SCFIND_MATCHCASE, SCFIND_WHOLEWORD, SCFIND_WORDSTART, and SCFIND_REGEXP can be set with SCI_SETSEARCHFLAGS. SCI_SEARCHINTARGET may be simpler @@ -768,6 +772,7 @@ struct TextToFind { *text)
SCI_REPLACETARGETRE(int length, const char *text)
+ SCI_GETTAG(int tagNumber, char *tagValue)

SCI_SETTARGETSTART(int pos)
@@ -814,6 +819,10 @@ struct TextToFind { After replacement, the target range refers to the replacement text. The return value is the length of the replacement string.

+

SCI_GETTAG(int tagNumber, char *tagValue)
+ 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.

+

See also: SCI_FINDTEXT

Overtype

@@ -884,7 +893,7 @@ struct TextToFind {

SCI_SETSTATUS(int status)
SCI_GETSTATUS
If an error occurs, Scintilla may set an internal error number that can be retrieved with - SCI_GETSTATUS. + SCI_GETSTATUS. To clear the error status call SCI_SETSTATUS(0). The currently defined statuses are: @@ -982,12 +991,12 @@ struct TextToFind { combined with the preceding or following operations if they are undone.

SCI_ADDUNDOACTION(int token, int flags)
- The container can add its own actions into the undo stack by calling - SCI_ADDUNDOACTION and an SCN_MODIFIED - notification will be sent to the container with the + The container can add its own actions into the undo stack by calling + SCI_ADDUNDOACTION and an SCN_MODIFIED + notification will be sent to the container with the SC_MOD_CONTAINER - flag when it is time to undo (SC_PERFORMED_UNDO) or - redo (SC_PERFORMED_REDO) the action. The token argument supplied is + flag when it is time to undo (SC_PERFORMED_UNDO) or + redo (SC_PERFORMED_REDO) the action. The token argument supplied is returned in the token field of the notification.

For example, if the container wanted to allow undo and redo of a 'toggle bookmark' command then it could call SCI_ADDUNDOACTION(line, 0) each time the command is performed. @@ -995,13 +1004,13 @@ struct TextToFind { the token field. If there are different types of commands or parameters that need to be stored into the undo stack then the container should maintain a stack of its own for the document and use the current position in that stack as the argument to SCI_ADDUNDOACTION(line). - SCI_ADDUNDOACTION commands are not combined together + SCI_ADDUNDOACTION commands are not combined together into a single undo transaction unless grouped with SCI_BEGINUNDOACTION and SCI_ENDUNDOACTION.

-

The flags argument can be UNDO_MAY_COALESCE (1) if the container action may be +

The flags argument can be UNDO_MAY_COALESCE (1) if the container action may be coalesced along with any insertion and deletion actions into a single compound action, otherwise 0. - Coalescing treats coalescible container actions as transparent so will still only group together insertions that + Coalescing treats coalescible container actions as transparent so will still only group together insertions that look like typing or deletions that look like multiple uses of the Backspace or Delete keys.

Selection and information

@@ -1015,6 +1024,7 @@ struct TextToFind { SCI_GETTEXTLENGTH
SCI_GETLENGTH
SCI_GETLINECOUNT
+ SCI_SETFIRSTVISIBLELINE(int lineDisplay)
SCI_GETFIRSTVISIBLELINE
SCI_LINESONSCREEN
SCI_GETMODIFY
@@ -1074,8 +1084,9 @@ struct TextToFind { 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.

-

SCI_GETFIRSTVISIBLELINE
- This returns the line number of the first visible line in the Scintilla view. The first line +

SCI_SETFIRSTVISIBLELINE(int lineDisplay)
+ SCI_GETFIRSTVISIBLELINE
+ 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.

SCI_LINESONSCREEN
@@ -1209,15 +1220,15 @@ struct TextToFind { This copies the currently selected text and a terminating 0 byte to the text buffer. The buffer size should be determined by calling with a NULL pointer for the text argument SCI_GETSELTEXT(0,0). - This allows for rectangular and discontiguous selections as well as simple selections. - See Multiple Selection for information on + This allows for rectangular and discontiguous selections as well as simple selections. + See Multiple Selection for information on how multiple and rectangular selections and virtual space are copied.

- -

See also: SCI_GETCURLINE, - SCI_GETLINE, - SCI_GETTEXT, - SCI_GETSTYLEDTEXT, - SCI_GETTEXTRANGE + +

See also: SCI_GETCURLINE, + SCI_GETLINE, + SCI_GETTEXT, + SCI_GETSTYLEDTEXT, + SCI_GETTEXTRANGE

SCI_GETCURLINE(int textLen, char *text)
@@ -1387,7 +1398,7 @@ struct TextToFind { SCI_CHARPOSITIONFROMPOINTCLOSE(int x, int y)
SCI_CHARPOSITIONFROMPOINT finds the closest character to a point and SCI_CHARPOSITIONFROMPOINTCLOSE is similar but returns -1 if the point is outside the - window or not close to any characters. This is similar to the previous methods but finds characters rather than + window or not close to any characters. This is similar to the previous methods but finds characters rather than inter-character positions.

SCI_POINTXFROMPOSITION(<unused>, int pos)
@@ -1413,6 +1424,8 @@ struct TextToFind { SCI_GETMULTIPLESELECTION
SCI_SETADDITIONALSELECTIONTYPING(bool additionalSelectionTyping)
SCI_GETADDITIONALSELECTIONTYPING
+ SCI_SETMULTIPASTE(int multiPaste)
+ SCI_GETMULTIPASTE
SCI_SETVIRTUALSPACEOPTIONS(int virtualSpaceOptions)
SCI_GETVIRTUALSPACEOPTIONS
SCI_SETRECTANGULARSELECTIONMODIFIER(int modifier)
@@ -1459,14 +1472,17 @@ struct TextToFind { SCI_GETADDITIONALCARETFORE
SCI_SETADDITIONALCARETSBLINK(bool additionalCaretsBlink)
SCI_GETADDITIONALCARETSBLINK
+ SCI_SETADDITIONALCARETSVISIBLE(bool additionalCaretsVisible)
+ SCI_GETADDITIONALCARETSVISIBLE

SCI_SWAPMAINANCHORCARET
SCI_ROTATESELECTION
+

- There may be multiple selections active at one time. - More selections are made by holding down the Ctrl key while dragging with the mouse. + There may be multiple selections active at one time. + More selections are made by holding down the Ctrl key while dragging with the mouse. The most recent selection is the main selection and determines which part of the document is shown automatically. Any selection apart from the main selection is called an additional selection. The calls in the previous section operate on the main selection. @@ -1480,11 +1496,11 @@ struct TextToFind {

- Virtual space is space beyond the end of each line. The caret may be moved into virtual space but no real space will be + Virtual space is space beyond the end of each line. The caret may be moved into virtual space but no real space will be added to the document until there is some text typed or some other text insertion command is used.

- -

When discontiguous selections are copied to the clipboard, each selection is added to the clipboard text + +

When discontiguous selections are copied to the clipboard, each selection is added to the clipboard text in order with no delimiting characters. For rectangular selections the document's line end is added after each line's text. Rectangular selections are always copied from top line to bottom, not in the in order of selection.Virtual space is not copied.

@@ -1499,11 +1515,17 @@ struct TextToFind { SCI_GETADDITIONALSELECTIONTYPING
Whether typing, backspace, or delete works with multiple selections simultaneously.

+

+ SCI_SETMULTIPASTE(int multiPaste)
+ SCI_GETMULTIPASTE
+ When pasting into multiple selections, the pasted text can go into just the main selection with SC_MULTIPASTE_ONCE=0 + or into each selection with SC_MULTIPASTE_EACH=1. SC_MULTIPASTE_ONCE is the default.

+

SCI_SETVIRTUALSPACEOPTIONS(int virtualSpace)
SCI_GETVIRTUALSPACEOPTIONS
- Virtual space can be enabled or disabled for rectangular selections or in other circumstances or in both. - There are two bit flags SCVS_RECTANGULARSELECTION=1 and + Virtual space can be enabled or disabled for rectangular selections or in other circumstances or in both. + There are two bit flags SCVS_RECTANGULARSELECTION=1 and SCVS_USERACCESSIBLE=2 which can be set independently. SCVS_NONE=0, the default, disables all use of virtual space.

@@ -1513,13 +1535,13 @@ struct TextToFind { On GTK+, the key used to indicate that a rectangular selection should be created when combined with a mouse drag can be set. The three possible values are SCMOD_CTRL=2 (default), SCMOD_ALT=4 or SCMOD_SUPER=8. Since SCMOD_ALT is often already used by a window manager, the window manager may need configuring to allow this choice. - SCMOD_SUPER is often a system dependent modifier key such as the Left Windows key on a Windows keyboard or the + SCMOD_SUPER is often a system dependent modifier key such as the Left Windows key on a Windows keyboard or the Command key on a Mac.

SCI_GETSELECTIONS
Return the number of selections currently active.

- +

SCI_CLEARSELECTIONS
Set a single empty selection at 0 as the only selection.

@@ -1530,7 +1552,7 @@ struct TextToFind {

SCI_ADDSELECTION(int caret, int anchor)
- Add a new selection from anchor to caret as the main selection retaining all other + Add a new selection from anchor to caret as the main selection retaining all other selections as additional selections. Since there is always at least one selection, to set a list of selections, the first selection should be added with SCI_SETSELECTION and later selections added with SCI_ADDSELECTION

@@ -1595,6 +1617,11 @@ struct TextToFind { SCI_SETCARETPERIOD, and SCI_GETCARETPERIOD.

+

+ SCI_SETADDITIONALCARETSVISIBLE(bool additionalCaretsVisible)
+ SCI_GETADDITIONALCARETSVISIBLE
+ Determine whether to show additional carets (defaults to true). +

SCI_SWAPMAINANCHORCARET
SCI_ROTATESELECTION
@@ -1950,12 +1977,15 @@ struct TextToFind { useWhitespaceForeColour, int colour)
SCI_SETWHITESPACEBACK(bool useWhitespaceBackColour, int colour)
+ SCI_SETWHITESPACESIZE(int + size)
+ SCI_GETWHITESPACESIZE
SCI_SETEXTRAASCENT(int extraAscent)
SCI_GETEXTRAASCENT
SCI_SETEXTRADESCENT(int extraDescent)
SCI_GETEXTRADESCENT
- +

SCI_SETVIEWWS(int wsMode)
SCI_GETVIEWWS
White space can be made visible which may be useful for languages in which white space is @@ -2005,15 +2035,21 @@ struct TextToFind { the lexer's colours with SCI_SETWHITESPACEFORE and SCI_SETWHITESPACEBACK.

+ SCI_SETWHITESPACESIZE(int size)
+ SCI_GETWHITESPACESIZE
+ SCI_SETWHITESPACESIZE sets the size of the dots used for mark space characters. + The SCI_GETWHITESPACESIZE message retrieves the current size. +

+

SCI_SETEXTRAASCENT(int extraAscent)
SCI_GETEXTRAASCENT
SCI_SETEXTRADESCENT(int extraDescent)
SCI_GETEXTRADESCENT
- Text is drawn with the base of each character on a 'baseline'. The height of a line is found from the maximum - that any style extends above the baseline (its 'ascent'), added to the maximum that any style extends below the + Text is drawn with the base of each character on a 'baseline'. The height of a line is found from the maximum + that any style extends above the baseline (its 'ascent'), added to the maximum that any style extends below the baseline (its 'descent'). - Space may be added to the maximum ascent (SCI_SETEXTRAASCENT) and the + Space may be added to the maximum ascent (SCI_SETEXTRAASCENT) and the maximum descent (SCI_SETEXTRADESCENT) to allow for more space between lines. This may done to make the text easier to read or to accomodate underlines or highlights.

@@ -2620,7 +2656,7 @@ struct TextToFind { is hidden. Margin 1 is set to display non-folding symbols and is given a width of 16 pixels, so it is visible. Margin 2 is set to display the folding symbols, but is given a width of 0, so it is hidden. Of course, you can set the margins to be whatever you wish.

- +

Styled text margins used to show revision and blame information:

Styled text margins used to show revision and blame information

@@ -2734,20 +2770,20 @@ struct TextToFind { SCI_MARGINSETSTYLES(int line, char *styles)
SCI_MARGINGETSTYLES(int line, char *styles)
SCI_MARGINTEXTCLEARALL
- Text margins are created with the type SC_MARGIN_TEXT or SC_MARGIN_RTEXT. + Text margins are created with the type SC_MARGIN_TEXT or SC_MARGIN_RTEXT. A different string may be set for each line with SCI_MARGINSETTEXT. - The whole of the text margin on a line may be displayed in a particular style with - SCI_MARGINSETSTYLE or each character may be individually styled with + The whole of the text margin on a line may be displayed in a particular style with + SCI_MARGINSETSTYLE or each character may be individually styled with SCI_MARGINSETSTYLES which uses an array of bytes with each byte setting the style - of the corresponding text byte simlar to SCI_SETSTYLINGEX. - Setting a text margin will cause a + of the corresponding text byte similar to SCI_SETSTYLINGEX. + Setting a text margin will cause a SC_MOD_CHANGEMARGIN notification to be sent.

SCI_MARGINSETSTYLEOFFSET(int style)
SCI_MARGINGETSTYLEOFFSET
- Margin styles may be completely separated from standard text styles by setting a style offset. For example, + Margin styles may be completely separated from standard text styles by setting a style offset. For example, SCI_MARGINSETSTYLEOFFSET(256) would allow the margin styles to be numbered from 256 upto 511 so they do not overlap styles set by lexers. Each style number set with SCI_MARGINSETSTYLE or SCI_MARGINSETSTYLES has the offset added before looking up the style. @@ -2756,8 +2792,8 @@ struct TextToFind {

Annotations

Annotations are read-only lines of text underneath each line of editable text. - An annotation may consist of multiple lines separated by '\n'. - Annotations can be used to display an assembler version of code for debugging or to show diagnostic messages inline or to + An annotation may consist of multiple lines separated by '\n'. + Annotations can be used to display an assembler version of code for debugging or to show diagnostic messages inline or to line up different versions of text in a merge tool.

Annotations used for inline diagnostics:

Annotations used for inline diagnostics

@@ -2788,12 +2824,12 @@ struct TextToFind { SCI_ANNOTATIONCLEARALL
A different string may be set for each line with SCI_ANNOTATIONSETTEXT. To clear annotations call SCI_ANNOTATIONSETTEXT with a NULL pointer. - The whole of the text ANNOTATION on a line may be displayed in a particular style with - SCI_ANNOTATIONSETSTYLE or each character may be individually styled with + The whole of the text ANNOTATION on a line may be displayed in a particular style with + SCI_ANNOTATIONSETSTYLE or each character may be individually styled with SCI_ANNOTATIONSETSTYLES which uses an array of bytes with each byte setting the style - of the corresponding text byte simlar to SCI_SETSTYLINGEX. The text must be set first as it + of the corresponding text byte similar to SCI_SETSTYLINGEX. The text must be set first as it 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 SC_MOD_CHANGEANNOTATION notification to be sent.

@@ -2806,7 +2842,7 @@ struct TextToFind { SCI_ANNOTATIONSETVISIBLE(int visible)
SCI_ANNOTATIONGETVISIBLE
Annotations can be made visible in a view and there is a choice of display style when visible. - The two messages set and get the annotation display mode. The visible + The two messages set and get the annotation display mode. The visible argument can be one of:

@@ -2841,9 +2877,9 @@ struct TextToFind {

SCI_ANNOTATIONSETSTYLEOFFSET(int style)
SCI_ANNOTATIONGETSTYLEOFFSET
- Annotation styles may be completely separated from standard text styles by setting a style offset. For example, + Annotation styles may be completely separated from standard text styles by setting a style offset. For example, SCI_ANNOTATIONSETSTYLEOFFSET(512) would allow the annotation styles to be numbered from - 512 upto 767 so they do not overlap styles set by lexers (or margins if margins offset is 256). + 512 upto 767 so they do not overlap styles set by lexers (or margins if margins offset is 256). Each style number set with SCI_ANNOTATIONSETSTYLE or SCI_ANNOTATIONSETSTYLES has the offset added before looking up the style.

@@ -2856,6 +2892,8 @@ struct TextToFind { SCI_GETBUFFEREDDRAW
SCI_SETTWOPHASEDRAW(bool twoPhase)
SCI_GETTWOPHASEDRAW
+ SCI_SETFONTQUALITY(int fontQuality)
+ SCI_GETFONTQUALITY
SCI_SETCODEPAGE(int codePage)
SCI_GETCODEPAGE
SCI_SETKEYSUNICODE(bool keysUnicode)
@@ -2917,6 +2955,16 @@ struct TextToFind { 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.

+

SCI_SETFONTQUALITY(int fontQuality)
+ SCI_GETFONTQUALITY
+ Manage font quality (antialiasing method). Currently, the following values are available on Windows: + SC_EFF_QUALITY_DEFAULT (backward compatible), + SC_EFF_QUALITY_NON_ANTIALIASED, + SC_EFF_QUALITY_ANTIALIASED, + SC_EFF_QUALITY_LCD_OPTIMIZED.

+

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.

+

SCI_SETCODEPAGE(int codePage)
SCI_GETCODEPAGE
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, 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 - are drawn separately leading to visual glitches. Bi-directional text is not supported. Characters outside the - Basic Multilingual Plane are unlikely to work.

+ are drawn separately leading to visual glitches. Bi-directional text is not supported.

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) although these may require installation of language specific support.

-

On GTK+, code page SC_CP_DBCS (1) sets Scintilla into - multi byte character mode as is required for Japanese language processing with - the EUC encoding.

+

On GTK+, code page can be set to 932 (Japanese Shift-JIS), 936 (Simplified Chinese GBK), + or 950 (Traditional Chinese Big5). + The code page may also be set to SC_CP_DBCS (1) + which uses the current locale to handle multi byte characters which may work for otherwise unsupported + code pages.

For GTK+ 1.x, the locale should be set to a Unicode locale with a call similar to setlocale(LC_CTYPE, "en_US.UTF-8"). Fonts with an "iso10646" registry @@ -3057,8 +3106,7 @@ struct TextToFind { SCI_GETLINEINDENTATION(int line)
SCI_GETLINEINDENTPOSITION(int line)
- SCI_SETINDENTATIONGUIDES(bool - view)
+ SCI_SETINDENTATIONGUIDES(int indentView)
SCI_GETINDENTATIONGUIDES
SCI_SETHIGHLIGHTGUIDE(int column)
SCI_GETHIGHLIGHTGUIDE
@@ -3154,7 +3202,7 @@ struct TextToFind {

Markers

-

There are 32 markers, numbered 0 to 31, and you can assign any combination of them to each +

There are 32 markers, numbered 0 to MARKER_MAX (31), and you can assign any combination of them to each line in the document. Markers appear in the selection margin 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 @@ -3218,8 +3266,8 @@ struct TextToFind { The SC_MARK_EMPTY symbol is invisible, allowing client code to track the movement of lines. You would also use it if you changed the folding style and wanted one or more of the SC_FOLDERNUM_* markers to have no associated symbol.

- -

Applications may use the marker symbol SC_MARK_AVAILABLE to indicate that + +

Applications may use the marker symbol SC_MARK_AVAILABLE to indicate that plugins may allocate that marker number.

@@ -3364,7 +3412,7 @@ struct TextToFind { the XPM format here.

SCI_MARKERSYMBOLDEFINED(int markerNumber)
- Returns the symbol defined for a markerNumber with SCI_MARKERDEFINE + Returns the symbol defined for a markerNumber with SCI_MARKERDEFINE or SC_MARK_PIXMAP if defined with SCI_MARKERDEFINEPIXMAP.

SCI_MARKERSETFORE(int markerNumber, int

The number of bits used for styles can be altered with SCI_SETSTYLEBITS from 0 to 7 bits. The remaining bits + href="#SCI_SETSTYLEBITS">SCI_SETSTYLEBITS from 0 to 8 bits. The remaining bits can be used for indicators, so there can be from 1 to 8 indicators. However, the INDIC*_MASK constants defined in Scintilla.h all assume 5 bits of styling information and 3 indicators. If you use a different arrangement, you must define your @@ -3685,6 +3733,8 @@ struct TextToFind { SCI_AUTOCSELECT(<unused>, const char *select)
SCI_AUTOCGETCURRENT
+ SCI_AUTOCGETCURRENTTEXT(<unused>, + char *text)
SCI_AUTOCSETCANCELATSTART(bool cancel)
SCI_AUTOCGETCANCELATSTART
@@ -3764,8 +3814,18 @@ struct TextToFind { item is found, it is selected. If the item is not found, the autocompletion list closes if auto-hide is true (see SCI_AUTOCSETAUTOHIDE).
- The current selection can be retrieved with SCI_AUTOCGETCURRENT -

+ The current selection index can be retrieved with SCI_AUTOCGETCURRENT.

+ +

SCI_AUTOCGETCURRENTTEXT(<unused>, char *text)
+ This message retrieves the current selected text in the autocompletion list. Normally the + SCN_AUTOCSELECTION notification + is used instead.

+ +

The value is copied to the text buffer, returning the length (not including the + terminating 0). If not found, an empty string is copied to the buffer and 0 is returned.

+ +

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.

SCI_AUTOCSETCANCELATSTART(bool cancel)
SCI_AUTOCGETCANCELATSTART
@@ -4304,7 +4364,7 @@ struct TextToFind { 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 removed and the selection and caret are hidden.

- SCI_FORMATRANGE(bool bDraw, RangeToFormat + SCI_FORMATRANGE(bool bDraw, Sci_RangeToFormat *pfr)
SCI_SETPRINTMAGNIFICATION(int magnification)
@@ -4315,7 +4375,7 @@ struct TextToFind { SCI_GETPRINTWRAPMODE
-

SCI_FORMATRANGE(bool bDraw, RangeToFormat *pfr)
+

SCI_FORMATRANGE(bool bDraw, Sci_RangeToFormat *pfr)
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 not do this for you. See SciTEWin::Print() in SciTEWinDlg.cxx for an @@ -4326,12 +4386,14 @@ struct TextToFind { (for example, if you use this with MFC you will need to paginate in OnBeginPrinting() before you output each page.

-struct RangeToFormat {
-    SurfaceID hdc;        // The HDC (device context) we print to
-    SurfaceID hdcTarget;  // The HDC we use for measuring (may be same as hdc)
-    PRectangle rc;        // Rectangle in which to print
-    PRectangle rcPage;    // Physically printable page size
-    CharacterRange chrg;  // Range of characters to print
+struct Sci_Rectangle { int left; int top; int right; int bottom; };
+
+struct Sci_RangeToFormat {
+    Sci_SurfaceID hdc;        // The HDC (device context) we print to
+    Sci_SurfaceID hdcTarget;  // The HDC we use for measuring (may be same as hdc)
+    Sci_Rectangle rc;         // Rectangle in which to print
+    Sci_Rectangle rcPage;     // Physically printable page size
+    Sci_CharacterRange chrg;  // Range of characters to print
 };
 
@@ -4664,48 +4726,53 @@ sptr_t CallScintilla(unsigned int iMessage, uptr_t wParam, sptr_t lParam){
- - + + - - - + + + - + + - + + - + + - + + - + + + folding. The appearance of this feature may change in the future.
ValueSymbolValue Effect
1Experimental - draw boxes if expanded1Experimental feature that has been removed.
2SC_FOLDFLAG_LINEBEFORE_EXPANDED2 Draw above if expanded
4SC_FOLDFLAG_LINEBEFORE_CONTRACTED4 Draw above if not expanded
8SC_FOLDFLAG_LINEAFTER_EXPANDED8 Draw below if expanded
16SC_FOLDFLAG_LINEAFTER_CONTRACTED16 Draw below if not expanded
64SC_FOLDFLAG_LEVELNUMBERS64 display hexadecimal fold levels in line margin to aid debugging of - folding. This feature needs to be redesigned to be sensible.
@@ -4906,7 +4973,7 @@ sptr_t CallScintilla(unsigned int iMessage, uptr_t wParam, sptr_t lParam){ SC_WRAPINDENT_FIXED 0 - Wrapped sublines aligned to left of window plus amount set by + Wrapped sublines aligned to left of window plus amount set by SCI_SETWRAPSTARTINDENT @@ -5119,9 +5186,11 @@ sptr_t CallScintilla(unsigned int iMessage, uptr_t wParam, sptr_t lParam){ Fold. See externalLexer.cxx for more.

SCI_SETLEXER(int lexer)
SCI_GETLEXER
- SCI_SETLEXERLANGUAGE(<unused>, char + SCI_SETLEXERLANGUAGE(<unused>, const char *name)
- SCI_LOADLEXERLIBRARY(<unused>, char + SCI_GETLEXERLANGUAGE(<unused>, char + *name)
+ SCI_LOADLEXERLIBRARY(<unused>, const char *path)
SCI_COLOURISE(int start, int end)
SCI_SETPROPERTY(const char *key, const char *value)
@@ -5145,7 +5214,8 @@ sptr_t CallScintilla(unsigned int iMessage, uptr_t wParam, sptr_t lParam){ assigns unused lexer numbers to.

SCI_SETLEXERLANGUAGE(<unused>, const char *name)
- This message lets you select a lexer by name, and is the only method if you are using an + SCI_GETLEXERLANGUAGE(<unused>, char *name)
+ SCI_SETLEXERLANGUAGE 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 to assign it an explicit lexer number. To select an existing lexer, set name to 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">SCI_GETLEXER before and after setting the new lexer to see if the lexer number changed.

+

SCI_GETLEXERLANGUAGE retrieves the name of the lexer.

+

SCI_LOADLEXERLIBRARY(<unused>, const char *path)
Load a lexer implemented in a shared library. This is a .so file on GTK+/Linux or a .DLL file on Windows.

@@ -5193,6 +5265,12 @@ sptr_t CallScintilla(unsigned int iMessage, uptr_t wParam, sptr_t lParam){ Property names should start with "lexer.<lexer>." or "fold.<lexer>." when they apply to one lexer or start with "lexer." or "fold." if they apply to multiple lexers.

+

Applications may discover the set of properties used by searching the source code of lexers for lines that contain + GetProperty and a double quoted string and extract the value of the double quoted string as the property name. + The scintilla/src/LexGen.py 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 +
// property <property-name>

+

SCI_GETPROPERTY(const char *key, char *value)
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 @@ -5681,7 +5759,7 @@ href="#SCI_POSITIONFROMLINE">SCI_POSITIONFROMLINE(lineNumber); 0x40000 - This is set on for actions that the container stored into the undo stack with + This is set on for actions that the container stored into the undo stack with SCI_ADDUNDOACTION. @@ -6164,6 +6242,7 @@ EM_SETTARGETDEVICE to create an instance of your class. You must disable the built-in implementation by defining SCI_OWNREGEX.

- + + diff --git a/scintilla/doc/ScintillaDownload.html b/scintilla/doc/ScintillaDownload.html index 5c52191e..72cee43c 100644 --- a/scintilla/doc/ScintillaDownload.html +++ b/scintilla/doc/ScintillaDownload.html @@ -25,9 +25,9 @@ @@ -41,7 +41,7 @@ containing very few restrictions.

- Release 2.01 + Release 2.12

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
    -
  • zip format (1130K) commonly used on Windows
  • -
  • tgz format (970K) commonly used on Linux and compatible operating systems
  • +
  • zip format (1160K) commonly used on Windows
  • +
  • tgz format (1080K) commonly used on Linux and compatible operating systems
Instructions for building on both Windows and Linux are included in the readme file.

@@ -66,5 +66,6 @@ Previous versions can be downloaded from the history page.

- + + diff --git a/scintilla/doc/ScintillaHistory.html b/scintilla/doc/ScintillaHistory.html index e394b418..855705f7 100644 --- a/scintilla/doc/ScintillaHistory.html +++ b/scintilla/doc/ScintillaHistory.html @@ -339,6 +339,14 @@

+ + + + + + + +
- + Windows   - + GTK+/Linux   Eric Kidd maXmo David SeverwrightJon Strait
Oliver KiddleEtienne GirondelHaimag RenAndrey Moskalyov
Xavi

@@ -350,6 +358,411 @@ Icons Copyright(C) 1998 by Dean S. Jones
+

+ Release 2.12 +

+
    +
  • + Released 1 June 2010. +
  • +
  • + Drawing optimizations improve speed and fix some visible flashing when scrolling. +
  • +
  • + Copy Path command added to File menu in SciTE. + Feature #2986745. +
  • +
  • + Optional warning displayed by SciTE when saving a file which has been modified by another process. + Feature #2975041. +
  • +
  • + Flagship lexer for xBase languages updated to follow the language much more closely. + Feature #2992689. +
  • +
  • + HTML lexer highlights Django templates in more regions. + Feature #3002874. +
  • +
  • + Dropping files on SciTE on Windows, releases the drag object earlier and opens the files asynchronously, + leading to smoother user experience. + Feature #2986724. +
  • +
  • + SciTE HTML exports take the Use Monospaced Font setting into account. +
  • +
  • + SciTE window title "[n of m]" localised. +
  • +
  • + When new line inserted at start of line, markers are moved down. + Bug #2986727. +
  • +
  • + On Windows, dropped text has its line ends converted, similar to pasting. + Bug #3005328. +
  • +
  • + Fixed bug with middle-click paste in block select mode where text was pasted next to selection rather than at cursor. + Bug #2984460. +
  • +
  • + Fixed SciTE crash where a style had a size parameter without a value. + Bug #3003834. +
  • +
  • + Debug assertions in multiple lexers fixed. + Bug #3000566. +
  • +
  • + CSS lexer fixed bug where @font-face displayed incorrectly + Bug #2994224. +
  • +
  • + CSS lexer fixed bug where open comment caused highlighting error. + Bug #1683672. +
  • +
  • + Shell file lexer fixed highlight glitch with here docs where the first line is a comment. + Bug #2830239. +
  • +
  • + Bug fixed in SciTE openpath property that caused Open Selected File to fail to open the selected file. +
  • +
  • + Bug fixed in SciTE FileExt property when file name with no extension evaluated to whole path. +
  • +
  • + Fixed SciTE on Windows printing bug where the $(CurrentTime), $(CurrentPage) variables were not expanded. + Bug #2994612. +
  • +
  • + SciTE compiles for 64-bit Windows and runs without crashing. + Bug #2986312. +
  • +
  • + Full Screen mode in Windows Vista/7 improved to hide Start button and size borders a little better. + Bug #3002813. +
  • +
+

+ Release 2.11 +

+
    +
  • + Released 9 April 2010. +
  • +
  • + Fixes compatibility of Scintilla.h with the C language. +
  • +
  • + With a rectangular selection SCI_GETSELECTIONSTART and SCI_GETSELECTIONEND return limits of the + rectangular selection rather than the limits of the main selection. +
  • +
  • + When SciTE on Windows is minimized to tray, only takes a single click to restore rather than a double click. + Feature #981917. +
  • +
+

+ Release 2.10 +

+
    +
  • + Released 4 April 2010. +
  • +
  • + Version 1.x of GTK+ is no longer supported. +
  • +
  • + SciTE is no longer supported on Windows 95, 98 or ME. +
  • +
  • + 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. +
  • +
  • + Non-ASCII characters may be changed to upper and lower case. +
  • +
  • + SciTE on Windows can access all files including those with names outside the user's preferred character encoding. +
  • +
  • + SciTE may be extended with lexers written in Lua. +
  • +
  • + 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. +
  • +
  • + 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'. +
  • +
  • + SCI_GETTAG retrieves the value of captured expressions within regular expression searches. +
  • +
  • + Django template highlighting added to the HTML lexer. + Feature #2974889. +
  • +
  • + Verilog line comments can be folded. +
  • +
  • + SciTE on Windows allows specifying a filter for the Save As dialog. + Feature #2943445. +
  • +
  • + Bug fixed when multiple selection disabled where rectangular selections could be expanded into multiple selections. + Bug #2948260. +
  • +
  • + Bug fixed when document horizontally scrolled and up/down-arrow did not return to the same + column after horizontal scroll occurred. + Bug #2950799. +
  • +
  • + Bug fixed to remove hotspot highlight when mouse is moved out of the document. Windows only fix. + Bug #2951353. +
  • +
  • + R lexer now performs case-sensitive check for keywords. + Bug #2956543. +
  • +
  • + Bug fixed on GTK+ where text disappeared when a wrap occurred. + Bug #2958043. +
  • +
  • + Bug fixed where regular expression replace cannot escape the '\' character by using '\\'. + Bug #2959876. +
  • +
  • + Bug fixed on GTK+ when virtual space disabled, middle-click could still paste text beyond end of line. + Bug #2971618. +
  • +
  • + SciTE crash fixed when double clicking on a malformed error message in the output pane. + Bug #2976551. +
  • +
  • + Improved performance on GTK+ when changing parameters associated with scroll bars to the same value. + Bug #2964357. +
  • +
  • + Fixed bug with pressing Shift+Tab with a rectangular selection so that it performs an un-indent + similar to how Tab performs an indent. +
  • +
+

+ Release 2.03 +

+
    +
  • + Released 14 February 2010. +
  • +
  • + Added SCI_SETFIRSTVISIBLELINE to match SCI_GETFIRSTVISIBLELINE. +
  • +
  • + 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. + Bug #2942448. +
  • +
  • + 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. + Feature #2945550. +
  • +
  • + Fixed bugs with cursor movement after deleting a rectangular selection. + Bug #2942131. +
  • +
  • + Fixed bug where calling SCI_SETSEL when there is a rectangular selection left + the additional selections selected. + Bug #2947064. +
  • +
  • + Fixed macro recording bug where not all bytes in multi-byte character insertions were reported through + SCI_REPLACESEL. +
  • +
  • + Fixed SciTE bug where using Ctrl+Enter followed by Ctrl+Space produced an autocompletion list + with only a single line containing all the identifiers. +
  • +
  • + Fixed SciTE on GTK+ bug where running a tool made the user interface completely unresponsive. +
  • +
  • + Fixed SciTE on Windows Copy to RTF bug. + Bug #2108574. +
  • +
+

+ Release 2.02 +

+
    +
  • + Released on 25 January 2010. +
  • +
  • + Markdown lexer added. + Feature #2844081. +
  • +
  • + 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. +
  • +
  • + Allow changing the size of dots in visible whitespace using SCI_SETWHITESPACESIZE. + Feature #2839427. +
  • +
  • + Additional carets can be hidden with SCI_SETADDITIONALCARETSVISIBLE. +
  • +
  • + Can choose anti-aliased, non-anti-aliased or lcd-optimized text using SCI_SETFONTQUALITY. +
  • +
  • + Retrieve the current selected text in the autocompletion list with SCI_AUTOCGETCURRENTTEXT. +
  • +
  • + Retrieve the name of the current lexer with SCI_GETLEXERLANGUAGE. +
  • +
  • + Progress 4GL lexer improves handling of comments in preprocessor declaration. + Feature #2902206. +
  • +
  • + HTML lexer extended to handle Mako template language. +
  • +
  • + SQL folder extended for SQL Anywhere "EXISTS" and "ENDIF" keywords. + Feature #2887524. +
  • +
  • + SciTE adds APIPath and AbbrevPath variables. +
  • +
  • + SciTE on GTK+ uses pipes instead of temporary files for running tools. This should be more secure. +
  • +
  • + Fixed crash when calling SCI_STYLEGETFONT for a style which does not have a font set. + Bug #2857425. +
  • +
  • + Fixed crash caused by not having sufficient styles allocated after choosing a lexer. + Bug #2881279. +
  • +
  • + Fixed crash in SciTE using autocomplete word when word characters includes space. + Bug #2840141. +
  • +
  • + Fixed bug with handling upper-case file extensions SciTE on GTK+. +
  • +
  • + Fixed SciTE loading files from sessions with folded folds where it would not + be scrolled to the correct location. + Bug #2882775. +
  • +
  • + Fixed SciTE loading files from sessions when file no longer exists. + Bug #2883437. +
  • +
  • + Fixed SciTE export to HTML using the wrong background colour. +
  • +
  • + Fixed crash when adding an annotation and then adding a new line after the annotation. + Bug #2929708. +
  • +
  • + Fixed crash in SciTE setting a property to nil from Lua. +
  • +
  • + SCI_GETSELTEXT fixed to return correct length. + Bug #2929441. +
  • +
  • + Fixed text positioning problems with selection in some circumstances. +
  • +
  • + Fixed text positioning problems with ligatures on GTK+. +
  • +
  • + Fixed problem pasting into rectangular selection with caret at bottom caused text to go from the caret down + rather than replacing the selection. +
  • +
  • + Fixed problem replacing in a rectangular selection where only the final line was changed. +
  • +
  • + Fixed inability to select a rectangular area using Alt+Shift+Click at both corners. + Bug #2899746. +
  • +
  • + Fixed problem moving to start/end of a rectangular selection with left/right key. + Bug #2871358. +
  • +
  • + Fixed problem with Select All when there's a rectangular selection. + Bug #2930488. +
  • +
  • + Fixed SCI_LINEDUPLICATE on a rectangular selection to not produce multiple discontinuous selections. +
  • +
  • + 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. + Bug #2882566. +
  • +
  • + Fixed problem where Shift+Alt+Down did not move through wrapped lines. + Bug #2871749. +
  • +
  • + Fixed incorrect background colour when using coloured lines with virtual space. + Bug #2914691. +
  • +
  • + Fixed failure to display wrap symbol for SC_WRAPVISUALFLAGLOC_END_BY_TEXT. + Bug #2936108. +
  • +
  • + Fixed blank background colour with EOLFilled style on last line. + Bug #2890105. +
  • +
  • + Fixed problem in VB lexer with keyword at end of file. + Bug #2901239. +
  • +
  • + Fixed SciTE bug where double clicking on a tab closed the file. +
  • +
  • + Fixed SciTE brace matching commands to only work when the caret is next to the brace, not when + it is in virtual space. + Bug #2885560. +
  • +
  • + Fixed SciTE on Windows Vista to access files in the Program Files directory rather than allow Windows + to virtualize access. + Bug #2916685. +
  • +
  • + Fixed NSIS folder to handle keywords that start with '!'. + Bug #2872157. +
  • +
  • + Changed linkage of Scintilla_LinkLexers to "C" so that it can be used by clients written in C. + Bug #2844718. +
  • +

Release 2.01

@@ -387,7 +800,7 @@ Released on 11 August 2009.
  • - 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.
  • @@ -400,37 +813,37 @@ MagikSF lexer recognises numbers correctly.
  • - Folding of Python comments and blank lines improved. Bug #210240. + Folding of Python comments and blank lines improved. Bug #210240.
  • Bug fixed where background colour of last character in document leaked past that character.
  • - Crash fixed when adding marker beyond last line in document. Bug #2830307. + Crash fixed when adding marker beyond last line in document. Bug #2830307.
  • - Resource leak fixed in SciTE for Windows when printing fails. Bug #2816524. + Resource leak fixed in SciTE for Windows when printing fails. Bug #2816524.
  • - Bug fixed on Windows where the system caret was destroyed during destruction when another window - was using the system caret. Bug #2830223. + Bug fixed on Windows where the system caret was destroyed during destruction when another window + was using the system caret. Bug #2830223.
  • Bug fixed where indentation guides were drawn over text when the indentation used a style with a different space width to the default style.
  • - 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. Bug #2818104.
  • Reverted fix that led to wrapping whole document when displaying the first line of the document.
  • - 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. Bug #1286548.
  • Bug fixed where EN_CHANGE notification was sent when performing a paste operation in a - read-only document. Bug #2825485. + read-only document. Bug #2825485.
  • Refactored code so that Scintilla exposes less of its internal implementation and uses the C++ standard @@ -447,9 +860,9 @@
  • Memory exhaustion and other exceptions handled by placing an error value into the - status property rather than crashing. + status property rather than crashing. Scintilla now builds with exception handling enabled and requires exception handling to be enabled.
    - This is a major change and application developers should consider how they will deal with Scintilla exhausting + This is a major change and application developers should consider how they will deal with Scintilla exhausting memory since Scintilla may not be in a stable state.
  • @@ -479,13 +892,13 @@
  • 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. Feature #2796119.
  • - 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. Feature #2646738.
  • - 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 the full width of the window.
  • @@ -495,27 +908,28 @@ CAML lexer also supports SML.
  • - D lexer handles string and numeric literals more accurately. Feature #2793782. + D lexer handles string and numeric literals more accurately. Feature #2793782.
  • - 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. Feature #2804894.
  • - Lisp lexer treats '[', ']', '{', and '}' as balanced delimiters which is common usage. Feature #2794989.
    - It treats keyword argument names as being equivalent to symbols. Feature #2794901. + Lisp lexer treats '[', ']', '{', and '}' as balanced delimiters which is common usage. Feature #2794989. +
    + It treats keyword argument names as being equivalent to symbols. Feature #2794901.
  • - 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. Bug #2802863.
  • 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. Bug #2809168.
  • - XML lexer fixes bug where Unicode entities like '&—' were broken into fragments. Bug #2804760. + XML lexer fixes bug where Unicode entities like '&—' were broken into fragments. Bug #2804760.
  • - 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+. Feature #2061821.
  • 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.
  • - 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. Bug #2780566.
  • 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 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. Bug #2789430.
  • @@ -566,49 +980,49 @@ Can increase the amount of font ascent and descent.
  • - COBOL lexer added. Feature #2127406. + COBOL lexer added. Feature #2127406.
  • - Nimrod lexer added. Feature #2642620. + Nimrod lexer added. Feature #2642620.
  • - PowerPro lexer added. Feature #2195308. + PowerPro lexer added. Feature #2195308.
  • - SML lexer added. Feature #2710950. + SML lexer added. Feature #2710950.
  • - SORCUS Installation file lexer added. Feature #2343375. + SORCUS Installation file lexer added. Feature #2343375.
  • - TACL lexer added. Feature #2127406. + TACL lexer added. Feature #2127406.
  • - TAL lexer added. Feature #2127406. + TAL lexer added. Feature #2127406.
  • - Rewritten Pascal lexer with improved folding and other fixes. Feature #2190650. + Rewritten Pascal lexer with improved folding and other fixes. Feature #2190650.
  • - INDIC_ROUNDBOX translucency level can be modified. Feature #2586290. + INDIC_ROUNDBOX translucency level can be modified. Feature #2586290.
  • - 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. Bug #2551033.
  • - 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. Bug #2552973.
  • HTML lexer does not go into script mode when script tag is self-closing.
  • - 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. Bug #2532774.
  • - Perl lexer fixes problem with string matching caused by line endings. Bug #2648342. + Perl lexer fixes problem with string matching caused by line endings. Bug #2648342.
  • - Progress lexer fixes problem with "last-event:function" phrase. Bug #2483619. + Progress lexer fixes problem with "last-event:function" phrase. Bug #2483619.
  • 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.
  • - Shell lexer fixes heredoc problem caused by line endings. Bug #2635257. + Shell lexer fixes heredoc problem caused by line endings. Bug #2635257.
  • - TeX lexer handles comment at end of line correctly. Bug #2698766. + TeX lexer handles comment at end of line correctly. Bug #2698766.
  • - SciTE retains selection range when performing a replace selection command. Feature #2339160. + SciTE retains selection range when performing a replace selection command. Feature #2339160.
  • - SciTE definition of word characters fixed to match documentaiton. Bug #2464531. + SciTE definition of word characters fixed to match documentaiton. Bug #2464531.
  • SciTE on GTK+ performing Search or Replace when dialog already shown now brings dialog to foreground. - Bug #2634224. + Bug #2634224.
  • Fixed encoding bug with calltips on GTK+.
  • - Block caret drawn in correct place on wrapped lines. Bug #2126144. + Block caret drawn in correct place on wrapped lines. Bug #2126144.
  • - Compilation for 64 bit Windows works using MinGW. Bug #2515578. + Compilation for 64 bit Windows works using MinGW. Bug #2515578.
  • - Incorrect memory freeing fixed on OS X. Bug #2354098, #2671749. + Incorrect memory freeing fixed on OS X. + Bug #2354098, + Bug #2671749.
  • SciTE on GTK+ crash fixed on startup when child process exits before initialisation complete. - Bug #2716987. + Bug #2716987.
  • Crash fixed when AutoCompleteGetCurrent called with no active autocompletion.
  • - Flickering diminished when pressing Tab. Bug #2723006. + Flickering diminished when pressing Tab. Bug #2723006.
  • Namespace compilation issues with GTK+ on OS X fixed.
  • - 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. Bug #2528241.
  • - Fixed incorrect Python lexing for multi-line continued strings. Bug #2450963. + Fixed incorrect Python lexing for multi-line continued strings. Bug #2450963.
  • @@ -676,7 +1092,7 @@ to libraries like regular expression libraries.
  • - Scintilla on Windows can interpret keys as Unicode even when a narrow character + Scintilla on Windows can interpret keys as Unicode even when a narrow character window with SCI_SETKEYSUNICODE.
  • @@ -701,7 +1117,7 @@ CSS lexer updated and works with non-ASCII.
  • - Diff lexer adds style for changed lines, handles subversion diffs better and + Diff lexer adds style for changed lines, handles subversion diffs better and fixes styling and folding for lines containing chunk dividers ("---").
  • @@ -711,7 +1127,7 @@ Haskell lexer allows hexadecimal literals.
  • - HTML lexer improves PHP and JavaScript folding. + HTML lexer improves PHP and JavaScript folding. PHP heredocs, nowdocs, strings and comments processed more accurately. Internet Explorer's non-standard >comment< tag supported. Script recognition in XML can be controlled with lexer.xml.allow.scripts property. @@ -756,7 +1172,7 @@ SciTE bug fixed where eol.mode not used for initial buffer.
  • - SciTE bug fixed where a file could be saved as the same name as another + SciTE bug fixed where a file could be saved as the same name as another buffer leading to confusing behaviour.
  • @@ -6359,6 +6775,7 @@

    Beta releases of SciTE were called Tide

    - + + diff --git a/scintilla/doc/ScintillaRelated.html b/scintilla/doc/ScintillaRelated.html index b01596ab..6b736206 100644 --- a/scintilla/doc/ScintillaRelated.html +++ b/scintilla/doc/ScintillaRelated.html @@ -111,6 +111,27 @@

    Projects using Scintilla

    +

    + Enterprise Architect + is a UML 2.1 analysis and design tool. +

    +

    + The CodeAssistor Editor + is a small and simple MacOSX source code editor. +

    +

    + PBEditor + is a text editor for PowerBuilder. +

    +

    + CrypTool + is an application for applying and analyzing cryptographic algorithms. +

    +

    + FXiTe + is an advanced cross-platform text editor built with the Fox GUI toolkit + and the FXScintilla text widget. +

    Jabaco 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.

    - Geany + Geany is a small and fast GTK2 based IDE, which has only a few dependencies from other packages.

    @@ -469,6 +490,7 @@

    Inspirational coding soundscapes by David Bridie.

    - + + diff --git a/scintilla/doc/ScintillaToDo.html b/scintilla/doc/ScintillaToDo.html index 28644457..4134d631 100644 --- a/scintilla/doc/ScintillaToDo.html +++ b/scintilla/doc/ScintillaToDo.html @@ -82,9 +82,6 @@ Persisting view state such as current folding into a stream or blob so it is easy to restore.

    -

    - Move line up and move line down keys or move selected lines up / down. -

    Printing of highlight lines and folding margin.

    @@ -102,24 +99,12 @@

    More lexers for other languages.

    -

    - Automatically calculated range for horizontal scrolling. -

    -

    - 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. -

    SciTE To Do

    Good regular expression support through a plugin.

    -

    - Allow tools to transform the selection, performing an operation like - indentation or sorting. -

    Allow file name based selection on all properties rather than just a chosen few.

    @@ -142,9 +127,6 @@ These are features I don't like or don't think are important enough to work on. Implementations are welcome from others though.

    -

    - Automatically saving modified menu shortcuts on exit. -

    Mouse wheel panning (press the mouse wheel and then move the mouse) on Windows. @@ -171,5 +153,6 @@ 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.

    - + + diff --git a/scintilla/doc/ScintillaUsage.html b/scintilla/doc/ScintillaUsage.html index c19cbc55..0791e93b 100644 --- a/scintilla/doc/ScintillaUsage.html +++ b/scintilla/doc/ScintillaUsage.html @@ -370,6 +370,7 @@ SPAN {

    Page contributed by Andrew McKinlay.

    - + + diff --git a/scintilla/doc/Steps.html b/scintilla/doc/Steps.html index 765268da..99fb887c 100644 --- a/scintilla/doc/Steps.html +++ b/scintilla/doc/Steps.html @@ -138,5 +138,6 @@

    Page contributed by Holger Schmidt.

    + diff --git a/scintilla/doc/index.html b/scintilla/doc/index.html index 9550cf96..71d89d07 100644 --- a/scintilla/doc/index.html +++ b/scintilla/doc/index.html @@ -9,13 +9,32 @@ - + - - Documentation   - Bugs   - - - History   Related   - - -

    Scintilla is a free source code editing component. It comes with complete source code and a license that @@ -143,8 +131,8 @@ if (IsRemote()) {

    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 - with GTK+ 2.16. Here is a screenshot of + systems with GTK+. They have been run on Windows XP, Windows 7, and on Ubuntu 9.10 + with GTK+ 2.18. Here is a screenshot of SciTE.

    @@ -181,10 +169,10 @@ if (IsRemote()) { may receive no response.

    +There is a Scintilla project page +hosted on - + + + diff --git a/scintilla/gtk/Converter.h b/scintilla/gtk/Converter.h index aeb5e159..9c5123b2 100644 --- a/scintilla/gtk/Converter.h +++ b/scintilla/gtk/Converter.h @@ -3,12 +3,7 @@ // Copyright 2004 by Neil Hodgson // The License.txt file describes the conditions under which this software may be distributed. -#include -#if GTK_MAJOR_VERSION >= 2 - typedef GIConv ConverterHandle; -#else - typedef iconv_t ConverterHandle; -#endif +typedef GIConv ConverterHandle; const ConverterHandle iconvhBad = (ConverterHandle)(-1); // Since various versions of iconv can not agree on whether the src argument // 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 { ConverterHandle iconvh; void OpenHandle(const char *fullDestination, const char *charSetSource) { -#if GTK_MAJOR_VERSION >= 2 iconvh = g_iconv_open(fullDestination, charSetSource); -#else - iconvh = iconv_open(fullDestination, charSetSource); -#endif } bool Succeeded() const { return iconvh != iconvhBad; @@ -65,11 +56,7 @@ public: } void Close() { if (Succeeded()) { -#if GTK_MAJOR_VERSION >= 2 g_iconv_close(iconvh); -#else - iconv_close(iconvh); -#endif iconvh = iconvhBad; } } @@ -77,11 +64,7 @@ public: if (!Succeeded()) { return (size_t)(-1); } else { -#if GTK_MAJOR_VERSION >= 2 return iconv_adaptor(g_iconv, iconvh, src, srcleft, dst, dstleft); -#else - return iconv_adaptor(iconv, iconvh, src, srcleft, dst, dstleft); -#endif } } }; diff --git a/scintilla/gtk/PlatGTK.cxx b/scintilla/gtk/PlatGTK.cxx index 4a02eabe..b6e7f7e1 100644 --- a/scintilla/gtk/PlatGTK.cxx +++ b/scintilla/gtk/PlatGTK.cxx @@ -31,10 +31,7 @@ with gdk_string_extents. */ #define FAST_WAY -#if GTK_MAJOR_VERSION >= 2 -#define USE_PANGO 1 #include "Converter.h" -#endif #ifdef _MSC_VER // Ignore unreferenced local functions in GTK+ headers @@ -105,21 +102,16 @@ class FontHandle { public: int ascent; GdkFont *pfont; -#ifdef USE_PANGO PangoFontDescription *pfd; int characterSet; -#endif FontHandle(GdkFont *pfont_) { et = singleByte; ascent = 0; pfont = pfont_; -#ifdef USE_PANGO pfd = 0; characterSet = -1; -#endif ResetWidths(et); } -#ifdef USE_PANGO FontHandle(PangoFontDescription *pfd_, int characterSet_) { et = singleByte; ascent = 0; @@ -128,16 +120,13 @@ public: characterSet = characterSet_; ResetWidths(et); } -#endif ~FontHandle() { if (pfont) gdk_font_unref(pfont); pfont = 0; -#ifdef USE_PANGO if (pfd) pango_font_description_free(pfd); pfd = 0; -#endif } void ResetWidths(encodingType et_) { et = et_; @@ -352,12 +341,13 @@ static void GenerateFontSpecStrings(const char *fontName, int characterSet, char tmp[300]; char *d1 = NULL, *d2 = NULL, *d3 = NULL; strncpy(tmp, fontName, sizeof(tmp) - 1); + tmp[sizeof(tmp) - 1] = '\0'; d1 = strchr(tmp, '-'); // we know the first dash exists d2 = strchr(d1 + 1, '-'); if (d2) d3 = strchr(d2 + 1, '-'); - if (d3) { + if (d3 && d2) { // foundary-fontface-isoxxx-x *d2 = '\0'; foundary[0] = '-'; @@ -512,7 +502,6 @@ FontID FontCached::CreateNewFont(const char *fontName, int characterSet, faceName[0] = '\0'; charset[0] = '\0'; -#ifdef USE_PANGO if (fontName[0] == '!') { PangoFontDescription *pfd = pango_font_description_new(); if (pfd) { @@ -523,7 +512,6 @@ FontID FontCached::CreateNewFont(const char *fontName, int characterSet, return new FontHandle(pfd, characterSet); } } -#endif GdkFont *newid = 0; // If name of the font begins with a '-', assume, that it is @@ -666,7 +654,7 @@ Font::Font() : fid(0) {} Font::~Font() {} void Font::Create(const char *faceName, int characterSet, int size, - bool bold, bool italic, bool) { + bool bold, bool italic, int) { Release(); fid = FontCached::FindOrCreate(faceName, characterSet, size, bold, italic); } @@ -679,11 +667,9 @@ void Font::Release() { // Required on OS X #ifdef SCI_NAMESPACE -class Scintilla::SurfaceImpl : public Surface -#else -class SurfaceImpl : public Surface +namespace Scintilla { #endif -{ +class SurfaceImpl : public Surface { encodingType et; GdkDrawable *drawable; GdkGC *gc; @@ -692,13 +678,11 @@ class SurfaceImpl : public Surface int y; bool inited; bool createdGC; -#ifdef USE_PANGO PangoContext *pcontext; PangoLayout *layout; Converter conv; int characterSet; void SetConverter(int characterSet_); -#endif public: SurfaceImpl(); virtual ~SurfaceImpl(); @@ -745,6 +729,9 @@ public: void SetUnicodeMode(bool unicodeMode_); void SetDBCSMode(int codePage); }; +#ifdef SCI_NAMESPACE +} +#endif const char *CharacterSetID(int characterSet) { switch (characterSet) { @@ -795,22 +782,16 @@ const char *CharacterSetID(int characterSet) { } } -#ifdef USE_PANGO - void SurfaceImpl::SetConverter(int characterSet_) { if (characterSet != characterSet_) { characterSet = characterSet_; conv.Open("UTF-8", CharacterSetID(characterSet), false); } } -#endif SurfaceImpl::SurfaceImpl() : et(singleByte), drawable(0), gc(0), ppixmap(0), x(0), y(0), inited(false), createdGC(false) -#ifdef USE_PANGO -, pcontext(0), layout(0), characterSet(-1) -#endif -{ +, pcontext(0), layout(0), characterSet(-1) { } SurfaceImpl::~SurfaceImpl() { @@ -828,7 +809,6 @@ void SurfaceImpl::Release() { if (ppixmap) gdk_pixmap_unref(ppixmap); ppixmap = 0; -#ifdef USE_PANGO if (layout) g_object_unref(layout); layout = 0; @@ -837,7 +817,6 @@ void SurfaceImpl::Release() { pcontext = 0; conv.Close(); characterSet = -1; -#endif x = 0; y = 0; inited = false; @@ -848,34 +827,23 @@ bool SurfaceImpl::Initialised() { return inited; } -// The WindowID argument is only used for Pango builds -#ifdef USE_PANGO -#define WID_NAME wid -#else -#define WID_NAME -#endif - -void SurfaceImpl::Init(WindowID WID_NAME) { +void SurfaceImpl::Init(WindowID wid) { Release(); -#ifdef USE_PANGO PLATFORM_ASSERT(wid); pcontext = gtk_widget_create_pango_context(PWidget(wid)); PLATFORM_ASSERT(pcontext); layout = pango_layout_new(pcontext); PLATFORM_ASSERT(layout); -#endif inited = true; } -void SurfaceImpl::Init(SurfaceID sid, WindowID WID_NAME) { +void SurfaceImpl::Init(SurfaceID sid, WindowID wid) { PLATFORM_ASSERT(sid); GdkDrawable *drawable_ = reinterpret_cast(sid); Release(); -#ifdef USE_PANGO PLATFORM_ASSERT(wid); pcontext = gtk_widget_create_pango_context(PWidget(wid)); layout = pango_layout_new(pcontext); -#endif drawable = drawable_; gc = gdk_gc_new(drawable_); // 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; } -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_); Release(); SurfaceImpl *surfImpl = static_cast(surface_); PLATFORM_ASSERT(surfImpl->drawable); -#ifdef USE_PANGO PLATFORM_ASSERT(wid); pcontext = gtk_widget_create_pango_context(PWidget(wid)); PLATFORM_ASSERT(pcontext); layout = pango_layout_new(pcontext); PLATFORM_ASSERT(layout); -#endif if (height > 0 && width > 0) ppixmap = gdk_pixmap_new(surfImpl->drawable, width, height, -1); 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 static void AllFour(guint32 *pixels, int stride, int width, int height, int x, int y, guint32 val) { pixels[y*stride+x] = val; @@ -1044,20 +1008,6 @@ static unsigned int GetBValue(unsigned int co) { 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) { union { guint8 pixVal[4]; @@ -1081,9 +1031,9 @@ void SurfaceImpl::AlphaRectangle(PRectangle rc, int cornerSize, ColourAllocated GdkPixbuf *pixalpha = gdk_pixbuf_new(GDK_COLORSPACE_RGB, TRUE, 8, width, height); guint32 valEmpty = u32FromRGBA(0,0,0,0); - guint32 valFill = u32FromRGBA(GetRValue(fill.AsLong()), + guint32 valFill = u32FromRGBA(GetRValue(fill.AsLong()), GetGValue(fill.AsLong()), GetBValue(fill.AsLong()), alphaFill); - guint32 valOutline = u32FromRGBA(GetRValue(outline.AsLong()), + guint32 valOutline = u32FromRGBA(GetRValue(outline.AsLong()), GetGValue(outline.AsLong()), GetBValue(outline.AsLong()), alphaOutline); guint32 *pixels = reinterpret_cast(gdk_pixbuf_get_pixels(pixalpha)); int stride = gdk_pixbuf_get_rowstride(pixalpha) / 4; @@ -1113,8 +1063,6 @@ void SurfaceImpl::AlphaRectangle(PRectangle rc, int cornerSize, ColourAllocated } } -#endif - void SurfaceImpl::Ellipse(PRectangle rc, ColourAllocated fore, ColourAllocated back) { PenColour(back); gdk_draw_arc(drawable, gc, 1, @@ -1168,7 +1116,6 @@ char *UTF8FromLatin1(const char *s, int &len) { return utfForm; } -#ifdef USE_PANGO static char *UTF8FromIconv(const Converter &conv, const char *s, int &len) { if (conv) { 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 const int maxLengthTextRun = 10000; @@ -1264,7 +1209,6 @@ void SurfaceImpl::DrawTextBase(PRectangle rc, Font &font_, int ybase, const char PenColour(fore); if (gc && drawable) { int xText = rc.left; -#ifdef USE_PANGO if (PFont(font_)->pfd) { char *utfForm = 0; 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_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); +#endif gdk_draw_layout_line(drawable, gc, xText, ybase, pll); if (useGFree) { g_free(utfForm); @@ -1296,7 +1244,6 @@ void SurfaceImpl::DrawTextBase(PRectangle rc, Font &font_, int ybase, const char } return; } -#endif // Draw text as a series of segments to avoid limitations in X servers const int segmentLength = 1000; 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) { if (font_.GetID()) { int totalWidth = 0; -#ifdef USE_PANGO const int lenPositions = len; if (PFont(font_)->pfd) { if (len == 1) { @@ -1384,32 +1364,24 @@ void SurfaceImpl::MeasureWidths(Font &font_, const char *s, int len, int *positi return; } } - PangoRectangle pos; pango_layout_set_font_description(layout, PFont(font_)->pfd); if (et == UTF8) { // 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; - while (pango_layout_iter_next_cluster(iter)) { - pango_layout_iter_get_cluster_extents(iter, NULL, &pos); - int position = PANGO_PIXELS(pos.x); - int curIndex = pango_layout_iter_get_index(iter); - int places = curIndex - i; - int distance = position - positions[i-1]; - while (i < curIndex) { + pango_layout_set_text(layout, s, len); + ClusterIterator iti(layout, lenPositions); + while (!iti.finished) { + iti.Next(); + int places = iti.curIndex - i; + while (i < iti.curIndex) { // Evenly distribute space among bytes of this cluster. // Would be better to find number of characters and then // divide evenly between characters with each byte of a character // 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++; } } - while (i < lenPositions) - positions[i++] = PANGO_PIXELS(pos.x + pos.width); - pango_layout_iter_free(iter); PLATFORM_ASSERT(i == lenPositions); } else { 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); pango_layout_set_text(layout, utfForm, strlen(utfForm)); int i = 0; - int utfIndex = 0; - PangoLayoutIter *iter = pango_layout_get_iter(layout); - pango_layout_iter_get_cluster_extents(iter, NULL, &pos); - while (pango_layout_iter_next_cluster(iter)) { - pango_layout_iter_get_cluster_extents (iter, NULL, &pos); - int position = PANGO_PIXELS(pos.x); - int utfIndexNext = pango_layout_iter_get_index(iter); - while (utfIndex < utfIndexNext) { + int clusterStart = 0; + ClusterIterator iti(layout, strlen(utfForm)); + while (!iti.finished) { + iti.Next(); + int clusterEnd = iti.curIndex; + int places = g_utf8_strlen(utfForm + clusterStart, clusterEnd - clusterStart); + int place = 1; + while (clusterStart < clusterEnd) { size_t lenChar = MultiByteLenFromIconv(convMeasure, s+i, len-i); - //size_t lenChar = mblen(s+i, MB_CUR_MAX); while (lenChar--) { - positions[i++] = position; + positions[i++] = iti.position - (places - place) * iti.distance / places; 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; PLATFORM_ASSERT(i == lenPositions); } @@ -1456,29 +1425,21 @@ void SurfaceImpl::MeasureWidths(Font &font_, const char *s, int len, int *positi utfForm = UTF8FromLatin1(s, 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 positionStart = 0; int clusterStart = 0; // Each Latin1 input character may take 1 or 2 bytes in UTF-8 // and groups of up to 3 may be represented as ligatures. - while (pango_layout_iter_next_cluster(iter)) { - pango_layout_iter_get_cluster_extents(iter, NULL, &pos); - int position = PANGO_PIXELS(pos.x); - int distance = position - positionStart; - int clusterEnd = pango_layout_iter_get_index(iter); + ClusterIterator iti(layout, strlen(utfForm)); + while (!iti.finished) { + iti.Next(); + int clusterEnd = iti.curIndex; int ligatureLength = g_utf8_strlen(utfForm + clusterStart, clusterEnd - clusterStart); PLATFORM_ASSERT(ligatureLength > 0 && ligatureLength <= 3); for (int charInLig=0; charInLigpfont; bool measure8bit = true; 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) { if (font_.GetID()) { -#ifdef USE_PANGO if (PFont(font_)->pfd) { char *utfForm = 0; 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); } - 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); if (useGFree) { g_free(utfForm); @@ -1584,7 +1547,6 @@ int SurfaceImpl::WidthText(Font &font_, const char *s, int len) { } return PANGO_PIXELS(pos.width); } -#endif if (et == UTF8) { GdkWChar wctext[maxLengthTextRun]; size_t wclen = UTF16FromUTF8(s, len, static_cast(static_cast(wctext)), @@ -1601,11 +1563,9 @@ int SurfaceImpl::WidthText(Font &font_, const char *s, int len) { int SurfaceImpl::WidthChar(Font &font_, char ch) { if (font_.GetID()) { -#ifdef USE_PANGO if (PFont(font_)->pfd) { return WidthText(font_, &ch, 1); } -#endif return gdk_char_width(PFont(font_)->pfont, ch); } else { return 1; @@ -1635,7 +1595,6 @@ int SurfaceImpl::Ascent(Font &font_) { #ifdef FAST_WAY FontMutexLock(); int ascent = PFont(font_)->ascent; -#ifdef USE_PANGO if ((ascent == 0) && (PFont(font_)->pfd)) { PangoFontMetrics *metrics = pango_context_get_metrics(pcontext, PFont(font_)->pfd, pango_context_get_language(pcontext)); @@ -1644,7 +1603,6 @@ int SurfaceImpl::Ascent(Font &font_) { pango_font_metrics_unref(metrics); ascent = PFont(font_)->ascent; } -#endif if ((ascent == 0) && (PFont(font_)->pfont)) { ascent = PFont(font_)->pfont->ascent; } @@ -1672,7 +1630,6 @@ int SurfaceImpl::Descent(Font &font_) { return 1; #ifdef FAST_WAY -#ifdef USE_PANGO if (PFont(font_)->pfd) { PangoFontMetrics *metrics = pango_context_get_metrics(pcontext, PFont(font_)->pfd, pango_context_get_language(pcontext)); @@ -1680,7 +1637,6 @@ int SurfaceImpl::Descent(Font &font_) { pango_font_metrics_unref(metrics); return descent; } -#endif return PFont(font_)->pfont->descent; #else @@ -1766,18 +1722,12 @@ PRectangle Window::GetPosition() { } void Window::SetPosition(PRectangle rc) { -#if 1 GtkAllocation alloc; alloc.x = rc.left; alloc.y = rc.top; alloc.width = rc.Width(); alloc.height = rc.Height(); 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) { @@ -1803,21 +1753,8 @@ void Window::SetPositionRelative(PRectangle rc, Window relativeTo) { if (oy + sizey > screenHeight) oy = screenHeight - sizey; -#if GTK_MAJOR_VERSION >= 2 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); } @@ -1899,8 +1836,8 @@ PRectangle Window::GetMonitorRect(Point pt) { gdk_window_get_origin(PWidget(wid)->window, &x_offset, &y_offset); -// gtk 2.2+ -#if GTK_MAJOR_VERSION > 2 || (GTK_MAJOR_VERSION == 2 && GTK_MINOR_VERSION >= 2) +#if GTK_CHECK_VERSION(2,2,0) + // GTK+ 2.2+ { GdkScreen* screen; gint monitor_num; @@ -1921,25 +1858,13 @@ PRectangle Window::GetMonitorRect(Point pt) { struct ListImage { const char *xpm_data; -#if GTK_MAJOR_VERSION < 2 - GdkPixmap *pixmap; - GdkBitmap *bitmap; -#else GdkPixbuf *pixbuf; -#endif }; static void list_image_free(gpointer, gpointer value, gpointer) { 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) gdk_pixbuf_unref (list_image->pixbuf); -#endif g_free(list_image); } @@ -1949,27 +1874,18 @@ ListBox::ListBox() { ListBox::~ListBox() { } -#if GTK_MAJOR_VERSION >= 2 enum { PIXBUF_COLUMN, TEXT_COLUMN, N_COLUMNS }; -#endif class ListBoxX : public ListBox { WindowID list; WindowID scroller; -#if GTK_MAJOR_VERSION < 2 - int current; -#endif void *pixhash; -#if GTK_MAJOR_VERSION >= 2 - GtkCellRenderer* pixbuf_renderer; -#endif - int lineHeight; + GtkCellRenderer* pixbuf_renderer; XPMSet xset; - bool unicodeMode; int desiredVisibleRows; unsigned int maxItemCharacters; unsigned int aveCharWidth; @@ -1977,14 +1893,9 @@ public: CallBackAction doubleClickAction; void *doubleClickActionData; - ListBoxX() : list(0), pixhash(NULL), desiredVisibleRows(5), maxItemCharacters(0), - doubleClickAction(NULL), doubleClickActionData(NULL) { -#if GTK_MAJOR_VERSION < 2 - current = 0; -#endif -#if GTK_MAJOR_VERSION >= 2 - pixbuf_renderer = 0; -#endif + ListBoxX() : list(0), pixhash(NULL), pixbuf_renderer(0), + desiredVisibleRows(5), maxItemCharacters(0), + aveCharWidth(1), doubleClickAction(NULL), doubleClickActionData(NULL) { } virtual ~ListBoxX() { if (pixhash) { @@ -2020,19 +1931,6 @@ ListBox *ListBox::Allocate() { return lb; } -#if GTK_MAJOR_VERSION < 2 -static void UnselectionAC(GtkWidget *, gint, gint, - GdkEventButton *, gpointer p) { - int *pi = reinterpret_cast(p); - *pi = -1; -} -static void SelectionAC(GtkWidget *, gint row, gint, - GdkEventButton *, gpointer p) { - int *pi = reinterpret_cast(p); - *pi = row; -} -#endif - static gboolean ButtonPress(GtkWidget *, GdkEventButton* ev, gpointer p) { try { ListBoxX* lb = reinterpret_cast(p); @@ -2047,7 +1945,6 @@ static gboolean ButtonPress(GtkWidget *, GdkEventButton* ev, gpointer p) { return FALSE; } -#if GTK_MAJOR_VERSION >= 2 /* Change the active color to the selected color so the listbox uses the color scheme that it would use if it had the focus. */ 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])) gtk_widget_modify_text(w, GTK_STATE_ACTIVE, &style->text[GTK_STATE_SELECTED]); } -#endif void ListBoxX::Create(Window &, int, Point, int, bool) { 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_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), ¤t); - gtk_signal_connect(GTK_OBJECT(wid), "select_row", - GTK_SIGNAL_FUNC(SelectionAC), ¤t); - 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 */ GtkListStore *store = gtk_list_store_new(N_COLUMNS, GDK_TYPE_PIXBUF, G_TYPE_STRING); @@ -2126,7 +2007,7 @@ void ListBoxX::Create(Window &, int, Point, int, bool) { gtk_tree_view_column_pack_start(column, pixbuf_renderer, FALSE); gtk_tree_view_column_add_attribute(column, pixbuf_renderer, "pixbuf", PIXBUF_COLUMN); - + GtkCellRenderer* renderer = gtk_cell_renderer_text_new(); gtk_cell_renderer_text_set_fixed_height_from_font(GTK_CELL_RENDERER_TEXT(renderer), 1); gtk_tree_view_column_pack_start(column, renderer, TRUE); @@ -2142,28 +2023,15 @@ void ListBoxX::Create(Window &, int, Point, int, bool) { gtk_widget_show(wid); g_signal_connect(G_OBJECT(wid), "button_press_event", G_CALLBACK(ButtonPress), this); -#endif gtk_widget_realize(PWidget(wid)); } 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 if (Created() && PFont(scint_font)->pfd) { // Current font is Pango font gtk_widget_modify_font(PWidget(list), PFont(scint_font)->pfd); } -#endif } void ListBoxX::SetAverageCharWidth(int width) { @@ -2191,13 +2059,6 @@ PRectangle ListBoxX::GetDesiredRect() { // First calculate height of the clist for our desired visible // 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 int row_width=0; int row_height=0; @@ -2209,7 +2070,6 @@ PRectangle ListBoxX::GetDesiredRect() { height = (rows * row_height + 2 * (ythickness + GTK_CONTAINER(PWidget(list))->border_width + 1)); -#endif gtk_widget_set_usize(GTK_WIDGET(PWidget(list)), -1, height); // Get the size of the scroller because we set usize on the window @@ -2229,30 +2089,19 @@ PRectangle ListBoxX::GetDesiredRect() { } int ListBoxX::CaretFromEdge() { -#if GTK_MAJOR_VERSION >= 2 gint renderer_width, renderer_height; gtk_cell_renderer_get_fixed_size(pixbuf_renderer, &renderer_width, &renderer_height); return 4 + renderer_width; -#endif - return 4 + xset.GetWidth(); } 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)); gtk_list_store_clear(GTK_LIST_STORE(model)); -#endif maxItemCharacters = 0; } -#if GTK_MAJOR_VERSION < 2 -static void init_pixmap(ListImage *list_image, GtkWidget *window) { -#else static void init_pixmap(ListImage *list_image) { -#endif const char *textForm = list_image->xpm_data; const char * const * xpm_lineform = reinterpret_cast(textForm); 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 -#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) gdk_pixbuf_unref(list_image->pixbuf); list_image->pixbuf = gdk_pixbuf_new_from_xpm_data((const gchar**)xpm_lineform); -#endif delete []xpm_lineformfromtext; } @@ -2300,16 +2131,6 @@ void ListBoxX::Append(char *s, int type) { list_image = (ListImage *) g_hash_table_lookup((GHashTable *) pixhash , (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; GtkListStore *store = GTK_LIST_STORE(gtk_tree_view_get_model(GTK_TREE_VIEW(list))); @@ -2324,7 +2145,7 @@ void ListBoxX::Append(char *s, int type) { gint pixbuf_width = gdk_pixbuf_get_width(list_image->pixbuf); gint renderer_height, renderer_width; - gtk_cell_renderer_get_fixed_size(pixbuf_renderer, + gtk_cell_renderer_get_fixed_size(pixbuf_renderer, &renderer_width, &renderer_height); if (pixbuf_width > renderer_width) gtk_cell_renderer_set_fixed_size(pixbuf_renderer, @@ -2337,7 +2158,6 @@ void ListBoxX::Append(char *s, int type) { gtk_list_store_set(GTK_LIST_STORE(store), &iter, TEXT_COLUMN, s, -1); } -#endif size_t len = strlen(s); if (maxItemCharacters < len) maxItemCharacters = len; @@ -2345,24 +2165,12 @@ void ListBoxX::Append(char *s, int type) { int ListBoxX::Length() { 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 (GTK_TREE_VIEW(list)), NULL); -#endif return 0; } 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; GtkTreeModel *model = gtk_tree_view_get_model(GTK_TREE_VIEW(list)); GtkTreeSelection *selection = @@ -2410,13 +2218,9 @@ void ListBoxX::Select(int n) { } else { gtk_tree_selection_unselect_all(selection); } -#endif } int ListBoxX::GetSelection() { -#if GTK_MAJOR_VERSION < 2 - return current; -#else GtkTreeIter iter; GtkTreeModel *model; GtkTreeSelection *selection; @@ -2429,20 +2233,9 @@ int ListBoxX::GetSelection() { return indices[0]; } return -1; -#endif } 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; GtkTreeModel *model = 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; i++; } -#endif return -1; } void ListBoxX::GetValue(int n, char *value, int len) { 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; GtkTreeModel *model = gtk_tree_view_get_model(GTK_TREE_VIEW(list)); bool valid = gtk_tree_model_iter_nth_child(model, &iter, NULL, n) != FALSE; if (valid) { gtk_tree_model_get(model, &iter, TEXT_COLUMN, &text, -1); } -#endif if (text && len > 0) { strncpy(value, text, len); value[len - 1] = '\0'; @@ -2511,18 +2289,9 @@ void ListBoxX::RegisterImage(int type, const char *xpm_data) { (gconstpointer) GINT_TO_POINTER(type)); if (list_image) { // 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) gdk_pixbuf_unref(list_image->pixbuf); list_image->pixbuf = NULL; -#endif list_image->xpm_data = xpm_data; } else { list_image = g_new0(ListImage, 1); @@ -2575,11 +2344,7 @@ void Menu::CreatePopUp() { void Menu::Destroy() { if (mid) -#if GTK_MAJOR_VERSION < 2 - gtk_object_unref(GTK_OBJECT(mid)); -#else g_object_unref(G_OBJECT(mid)); -#endif mid = 0; } @@ -2597,12 +2362,8 @@ void Menu::Show(Point pt, Window &) { if ((pt.y + requisition.height) > screenHeight) { pt.y = screenHeight - requisition.height; } -#if GTK_MAJOR_VERSION >= 2 gtk_item_factory_popup(factory, pt.x - 4, pt.y - 4, 3, gtk_get_current_event_time()); -#else - gtk_item_factory_popup(factory, pt.x - 4, pt.y - 4, 3, 0); -#endif } ElapsedTime::ElapsedTime() { @@ -2674,11 +2435,7 @@ const char *Platform::DefaultFont() { #ifdef G_OS_WIN32 return "Lucida Console"; #else -#ifdef USE_PANGO return "!Sans"; -#else - return "lucidatypewriter"; -#endif #endif } @@ -2718,16 +2475,35 @@ long Platform::SendScintillaPointer( reinterpret_cast(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(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; } -int Platform::DBCSCharLength(int, const char *s) { - int bytes = mblen(s, MB_CUR_MAX); - if (bytes >= 1) - return bytes; - else - return 1; +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); + if (bytes >= 1) + return bytes; + else + return 1; + } } int Platform::DBCSCharMaxLength() { diff --git a/scintilla/gtk/ScintillaGTK.cxx b/scintilla/gtk/ScintillaGTK.cxx index 96763afa..3865a6ee 100644 --- a/scintilla/gtk/ScintillaGTK.cxx +++ b/scintilla/gtk/ScintillaGTK.cxx @@ -56,9 +56,7 @@ #include "gtk/gtksignal.h" #include "gtk/gtkmarshal.h" -#if GLIB_MAJOR_VERSION >= 2 #include "scintilla-marshal.h" -#endif #ifdef SCI_LEXER #include @@ -66,15 +64,7 @@ #include "ExternalLexer.h" #endif -#define INTERNATIONAL_INPUT - -#if !PLAT_GTK_WIN32 || GTK_MAJOR_VERSION >= 2 -#define USE_CONVERTER -#endif - -#ifdef USE_CONVERTER #include "Converter.h" -#endif #ifdef _MSC_VER // Constant conditional expressions are because of GTK+ headers @@ -87,11 +77,7 @@ #define USE_GTK_CLIPBOARD #endif -#if GLIB_MAJOR_VERSION < 2 -#define OBJECT_CLASS GtkObjectClass -#else #define OBJECT_CLASS GObjectClass -#endif #ifdef SCI_NAMESPACE using namespace Scintilla; @@ -135,17 +121,9 @@ class ScintillaGTK : public ScintillaBase { CLIPFORMAT cfColumnSelect; #endif -#ifdef INTERNATIONAL_INPUT -#if GTK_MAJOR_VERSION < 2 - // Input context used for supporting internationalized key entry - GdkIC *ic; - GdkICAttr *ic_attr; -#else Window wPreedit; Window wPreeditDraw; GtkIMContext *im_context; -#endif -#endif // Wheel mouse support unsigned int linesPerScroll; @@ -156,8 +134,8 @@ class ScintillaGTK : public ScintillaBase { GdkRegion *rgnUpdate; // Private so ScintillaGTK objects can not be copied - ScintillaGTK(const ScintillaGTK &) : ScintillaBase() {} - ScintillaGTK &operator=(const ScintillaGTK &) { return * this; } + ScintillaGTK(const ScintillaGTK &); + ScintillaGTK &operator=(const ScintillaGTK &); public: ScintillaGTK(_ScintillaObject *sci_); @@ -195,6 +173,8 @@ private: void NotifyKey(int key, int modifiers); void NotifyURIDropped(const char *list); const char *CharacterSetID() const; + virtual CaseFolder *CaseFolderForEncoding(); + virtual std::string CaseMapString(const std::string &s, int caseMapping); virtual int KeyDefault(int key, int modifiers); virtual void CopyToClipboard(const SelectionText &selectedText); virtual void Copy(); @@ -243,36 +223,25 @@ private: gint PressThis(GdkEventButton *event); static gint Press(GtkWidget *widget, GdkEventButton *event); static gint MouseRelease(GtkWidget *widget, GdkEventButton *event); -#if PLAT_GTK_WIN32 || (GTK_MAJOR_VERSION >= 2) static gint ScrollEvent(GtkWidget *widget, GdkEventScroll *event); -#endif static gint Motion(GtkWidget *widget, GdkEventMotion *event); gboolean KeyThis(GdkEventKey *event); static gboolean KeyPress(GtkWidget *widget, GdkEventKey *event); static gboolean KeyRelease(GtkWidget *widget, GdkEventKey *event); -#if GTK_MAJOR_VERSION >= 2 gboolean ExposePreeditThis(GtkWidget *widget, GdkEventExpose *ose); static gboolean ExposePreedit(GtkWidget *widget, GdkEventExpose *ose, ScintillaGTK *sciThis); void CommitThis(char *str); static void Commit(GtkIMContext *context, char *str, ScintillaGTK *sciThis); void PreeditChangedThis(); static void PreeditChanged(GtkIMContext *context, ScintillaGTK *sciThis); -#endif static gint StyleSetText(GtkWidget *widget, GtkStyle *previous, void*); static gint RealizeText(GtkWidget *widget, void*); -#if GLIB_MAJOR_VERSION < 2 - static void Destroy(GtkObject *object); -#else static void Destroy(GObject *object); -#endif static void SelectionReceived(GtkWidget *widget, GtkSelectionData *selection_data, guint time); static void SelectionGet(GtkWidget *widget, GtkSelectionData *selection_data, guint info, guint time); static gint SelectionClear(GtkWidget *widget, GdkEventSelection *selection_event); -#if GTK_MAJOR_VERSION < 2 - static gint SelectionNotify(GtkWidget *widget, GdkEventSelection *selection_event); -#endif static void DragBegin(GtkWidget *widget, GdkDragContext *context); gboolean DragMotionThis(GdkDragContext *context, gint x, gint y, guint dragtime); static gboolean DragMotion(GtkWidget *widget, GdkDragContext *context, @@ -287,7 +256,9 @@ private: static void DragDataGet(GtkWidget *widget, GdkDragContext *context, GtkSelectionData *selection_data, guint info, guint time); static gint TimeOut(ScintillaGTK *sciThis); - static gint IdleCallback(ScintillaGTK *sciThis); + static gboolean IdleCallback(ScintillaGTK *sciThis); + static gboolean StyleIdle(ScintillaGTK *sciThis); + virtual void QueueStyling(int upTo); static void PopUpCB(ScintillaGTK *sciThis, guint action, GtkWidget *widget); gint ExposeTextThis(GtkWidget *widget, GdkEventExpose *ose); @@ -307,9 +278,6 @@ enum { }; static gint scintilla_signals[LAST_SIGNAL] = { 0 }; -#if GLIB_MAJOR_VERSION < 2 -static GtkWidgetClass *parent_class = NULL; -#endif enum { TARGET_STRING, @@ -352,14 +320,7 @@ ScintillaGTK::ScintillaGTK(_ScintillaObject *sci_) : scrollBarWidth(30), scrollBarHeight(30), capturedMouse(false), dragWasDropped(false), lastKey(0), rectangularSelectionModifier(SCMOD_CTRL), parentClass(0), -#ifdef INTERNATIONAL_INPUT -#if GTK_MAJOR_VERSION < 2 - ic(NULL), - ic_attr(NULL), -#else im_context(NULL), -#endif -#endif lastWheelMouseDirection(0), wheelMouseIntensity(0), rgnUpdate(0) { @@ -418,65 +379,6 @@ void ScintillaGTK::RealizeThis(GtkWidget *widget) { gdk_window_show(widget->window); gdk_cursor_destroy(cursor); widget->style = gtk_style_attach(widget->style, widget->window); -#ifdef INTERNATIONAL_INPUT -#if GTK_MAJOR_VERSION < 2 - if (gdk_im_ready() && (ic_attr = gdk_ic_attr_new()) != NULL) { - gint width, height; - GdkColormap *colormap; - GdkEventMask mask; - GdkICAttr *attr = ic_attr; - GdkICAttributesType attrmask = GDK_IC_ALL_REQ; - GdkIMStyle style; - GdkIMStyle supported_style = (GdkIMStyle) (GDK_IM_PREEDIT_NONE | - GDK_IM_PREEDIT_NOTHING | - GDK_IM_PREEDIT_POSITION | - GDK_IM_STATUS_NONE | - GDK_IM_STATUS_NOTHING); - - if (widget->style && widget->style->font->type != GDK_FONT_FONTSET) - supported_style = (GdkIMStyle) ((int) supported_style & ~GDK_IM_PREEDIT_POSITION); - - attr->style = style = gdk_im_decide_style(supported_style); - attr->client_window = widget->window; - - if ((colormap = gtk_widget_get_colormap (widget)) != gtk_widget_get_default_colormap ()) { - attrmask = (GdkICAttributesType) ((int) attrmask | GDK_IC_PREEDIT_COLORMAP); - attr->preedit_colormap = colormap; - } - - switch (style & GDK_IM_PREEDIT_MASK) { - case GDK_IM_PREEDIT_POSITION: - if (widget->style && widget->style->font->type != GDK_FONT_FONTSET) { - g_warning("over-the-spot style requires fontset"); - break; - } - - attrmask = (GdkICAttributesType) ((int) attrmask | GDK_IC_PREEDIT_POSITION_REQ); - gdk_window_get_size(widget->window, &width, &height); - attr->spot_location.x = 0; - attr->spot_location.y = height; - attr->preedit_area.x = 0; - attr->preedit_area.y = 0; - attr->preedit_area.width = width; - attr->preedit_area.height = height; - attr->preedit_fontset = widget->style->font; - - break; - } - ic = gdk_ic_new(attr, attrmask); - - if (ic == NULL) { - g_warning("Can't create input context."); - } else { - mask = gdk_window_get_events(widget->window); - mask = (GdkEventMask) ((int) mask | gdk_ic_get_events(ic)); - gdk_window_set_events(widget->window, mask); - - if (GTK_WIDGET_HAS_FOCUS(widget)) - gdk_im_begin(ic, widget->window); - } - } -#else wPreedit = gtk_window_new(GTK_WINDOW_POPUP); wPreeditDraw = gtk_drawing_area_new(); GtkWidget *predrw = PWidget(wPreeditDraw); // No code inside the G_OBJECT macro @@ -493,20 +395,11 @@ void ScintillaGTK::RealizeThis(GtkWidget *widget) { g_signal_connect(G_OBJECT(im_context), "preedit_changed", G_CALLBACK(PreeditChanged), this); gtk_im_context_set_client_window(im_context, widget->window); -#endif -#endif GtkWidget *widtxt = PWidget(wText); // // No code inside the G_OBJECT macro -#if GLIB_MAJOR_VERSION < 2 - gtk_signal_connect_after(GTK_OBJECT(widtxt), "style_set", - GtkSignalFunc(ScintillaGTK::StyleSetText), NULL); - gtk_signal_connect_after(GTK_OBJECT(widtxt), "realize", - GtkSignalFunc(ScintillaGTK::RealizeText), NULL); -#else g_signal_connect_after(G_OBJECT(widtxt), "style_set", G_CALLBACK(ScintillaGTK::StyleSetText), NULL); g_signal_connect_after(G_OBJECT(widtxt), "realize", G_CALLBACK(ScintillaGTK::RealizeText), NULL); -#endif gtk_widget_realize(widtxt); gtk_widget_realize(PWidget(scrollbarv)); gtk_widget_realize(PWidget(scrollbarh)); @@ -526,23 +419,10 @@ void ScintillaGTK::UnRealizeThis(GtkWidget *widget) { gtk_widget_unrealize(PWidget(wText)); gtk_widget_unrealize(PWidget(scrollbarv)); gtk_widget_unrealize(PWidget(scrollbarh)); -#ifdef INTERNATIONAL_INPUT -#if GTK_MAJOR_VERSION < 2 - if (ic) { - gdk_ic_destroy(ic); - ic = NULL; - } - if (ic_attr) { - gdk_ic_attr_destroy(ic_attr); - ic_attr = NULL; - } -#else gtk_widget_unrealize(PWidget(wPreedit)); gtk_widget_unrealize(PWidget(wPreeditDraw)); g_object_unref(im_context); im_context = NULL; -#endif -#endif if (GTK_WIDGET_CLASS(parentClass)->unrealize) GTK_WIDGET_CLASS(parentClass)->unrealize(widget); @@ -624,18 +504,6 @@ void ScintillaGTK::MainForAll(GtkContainer *container, gboolean include_internal } } -#ifdef INTERNATIONAL_INPUT -#if GTK_MAJOR_VERSION < 2 -gint ScintillaGTK::CursorMoved(GtkWidget *widget, int xoffset, int yoffset, ScintillaGTK *sciThis) { - if (GTK_WIDGET_HAS_FOCUS(widget) && gdk_im_ready() && sciThis->ic && - (gdk_ic_get_style(sciThis->ic) & GDK_IM_PREEDIT_POSITION)) { - sciThis->ic_attr->spot_location.x = xoffset; - sciThis->ic_attr->spot_location.y = yoffset; - gdk_ic_set_attr(sciThis->ic, sciThis->ic_attr, GDK_IC_SPOT_LOCATION); - } - return FALSE; -} -#else gint ScintillaGTK::CursorMoved(GtkWidget *, int xoffset, int yoffset, ScintillaGTK *sciThis) { GdkRectangle area; area.x = xoffset; @@ -645,22 +513,11 @@ gint ScintillaGTK::CursorMoved(GtkWidget *, int xoffset, int yoffset, ScintillaG gtk_im_context_set_cursor_location(sciThis->im_context, &area); return FALSE; } -#endif -#else -gint ScintillaGTK::CursorMoved(GtkWidget *, int, int, ScintillaGTK *) { - return FALSE; -} -#endif gint ScintillaGTK::FocusInThis(GtkWidget *widget) { try { GTK_WIDGET_SET_FLAGS(widget, GTK_HAS_FOCUS); SetFocusState(true); -#ifdef INTERNATIONAL_INPUT -#if GTK_MAJOR_VERSION < 2 - if (ic) - gdk_im_begin(ic, widget->window); -#else if (im_context != NULL) { gchar *str = NULL; gint cursor_pos; @@ -676,8 +533,6 @@ gint ScintillaGTK::FocusInThis(GtkWidget *widget) { g_free(str); gtk_im_context_focus_in(im_context); } -#endif -#endif } catch (...) { errorStatus = SC_STATUS_FAILURE; @@ -695,16 +550,10 @@ gint ScintillaGTK::FocusOutThis(GtkWidget *widget) { GTK_WIDGET_UNSET_FLAGS(widget, GTK_HAS_FOCUS); SetFocusState(false); -#ifdef INTERNATIONAL_INPUT -#if GTK_MAJOR_VERSION < 2 - gdk_im_end(); -#else if (PWidget(wPreedit) != NULL) gtk_widget_hide(PWidget(wPreedit)); if (im_context != NULL) gtk_im_context_focus_out(im_context); -#endif -#endif } catch (...) { errorStatus = SC_STATUS_FAILURE; @@ -739,19 +588,6 @@ void ScintillaGTK::SizeAllocate(GtkWidget *widget, GtkAllocation *allocation) { sciThis->Resize(allocation->width, allocation->height); -#ifdef INTERNATIONAL_INPUT -#if GTK_MAJOR_VERSION < 2 - if (sciThis->ic && (gdk_ic_get_style(sciThis->ic) & GDK_IM_PREEDIT_POSITION)) { - gint width, height; - - gdk_window_get_size(widget->window, &width, &height); - sciThis->ic_attr->preedit_area.width = width; - sciThis->ic_attr->preedit_area.height = height; - - gdk_ic_set_attr(sciThis->ic, sciThis->ic_attr, GDK_IC_PREEDIT_AREA); - } -#endif -#endif } catch (...) { sciThis->errorStatus = SC_STATUS_FAILURE; } @@ -780,43 +616,26 @@ void ScintillaGTK::Initialise() { gtk_widget_set_parent(PWidget(wText), PWidget(wMain)); GtkWidget *widtxt = PWidget(wText); // No code inside the G_OBJECT macro gtk_widget_show(widtxt); -#if GLIB_MAJOR_VERSION < 2 - gtk_signal_connect(GTK_OBJECT(widtxt), "expose_event", - GtkSignalFunc(ScintillaGTK::ExposeText), this); -#else g_signal_connect(G_OBJECT(widtxt), "expose_event", G_CALLBACK(ScintillaGTK::ExposeText), this); -#endif gtk_widget_set_events(widtxt, GDK_EXPOSURE_MASK); -#if GTK_MAJOR_VERSION >= 2 // Avoid background drawing flash gtk_widget_set_double_buffered(widtxt, FALSE); -#endif gtk_drawing_area_size(GTK_DRAWING_AREA(widtxt), 100,100); adjustmentv = gtk_adjustment_new(0.0, 0.0, 201.0, 1.0, 20.0, 20.0); scrollbarv = gtk_vscrollbar_new(GTK_ADJUSTMENT(adjustmentv)); GTK_WIDGET_UNSET_FLAGS(PWidget(scrollbarv), GTK_CAN_FOCUS); -#if GLIB_MAJOR_VERSION < 2 - gtk_signal_connect(adjustmentv, "value_changed", - GtkSignalFunc(ScrollSignal), this); -#else g_signal_connect(G_OBJECT(adjustmentv), "value_changed", G_CALLBACK(ScrollSignal), this); -#endif gtk_widget_set_parent(PWidget(scrollbarv), PWidget(wMain)); gtk_widget_show(PWidget(scrollbarv)); adjustmenth = gtk_adjustment_new(0.0, 0.0, 101.0, 1.0, 20.0, 20.0); scrollbarh = gtk_hscrollbar_new(GTK_ADJUSTMENT(adjustmenth)); GTK_WIDGET_UNSET_FLAGS(PWidget(scrollbarh), GTK_CAN_FOCUS); -#if GLIB_MAJOR_VERSION < 2 - gtk_signal_connect(adjustmenth, "value_changed", - GtkSignalFunc(ScrollHSignal), this); -#else g_signal_connect(G_OBJECT(adjustmenth), "value_changed", G_CALLBACK(ScrollHSignal), this); -#endif gtk_widget_set_parent(PWidget(scrollbarh), PWidget(wMain)); gtk_widget_show(PWidget(scrollbarh)); @@ -834,7 +653,6 @@ void ScintillaGTK::Initialise() { GTK_DEST_DEFAULT_ALL, clipboardPasteTargets, nClipboardPasteTargets, static_cast(GDK_ACTION_COPY | GDK_ACTION_MOVE)); -#if GLIB_MAJOR_VERSION >= 2 // Set caret period based on GTK settings gboolean blinkOn = false; if (g_object_class_find_property(G_OBJECT_GET_CLASS( @@ -852,7 +670,6 @@ void ScintillaGTK::Initialise() { } else { caret.period = 0; } -#endif SetTicking(true); } @@ -870,12 +687,8 @@ void ScintillaGTK::DisplayCursor(Window::Cursor c) { } bool ScintillaGTK::DragThreshold(Point ptStart, Point ptNow) { -#if GTK_MAJOR_VERSION < 2 - return Editor::DragThreshold(ptStart, ptNow); -#else return gtk_drag_check_threshold(GTK_WIDGET(PWidget(wMain)), ptStart.x, ptStart.y, ptNow.x, ptNow.y); -#endif } void ScintillaGTK::StartDrag() { @@ -889,9 +702,9 @@ void ScintillaGTK::StartDrag() { reinterpret_cast(&evbtn)); } -#ifdef USE_CONVERTER static char *ConvertText(int *lenResult, char *s, size_t len, const char *charSetDest, - const char *charSetSource, bool transliterations) { + const char *charSetSource, bool transliterations, bool silent=false) { + // s is not const because of different versions of iconv disagreeing about const *lenResult = 0; char *destForm = 0; Converter conv(charSetDest, charSetSource, transliterations); @@ -903,7 +716,9 @@ static char *ConvertText(int *lenResult, char *s, size_t len, const char *charSe size_t outLeft = len*3+1; size_t conversions = conv.Convert(&pin, &inLeft, &pout, &outLeft); if (conversions == ((size_t)(-1))) { -fprintf(stderr, "iconv %s->%s failed for %s\n", charSetSource, charSetDest, static_cast(s)); + if (!silent) + fprintf(stderr, "iconv %s->%s failed for %s\n", + charSetSource, charSetDest, static_cast(s)); delete []destForm; destForm = 0; } else { @@ -921,7 +736,6 @@ fprintf(stderr, "Can not iconv %s %s\n", charSetDest, charSetSource); } return destForm; } -#endif // Returns the target converted to UTF8. // Return the length in bytes. @@ -933,7 +747,6 @@ int ScintillaGTK::TargetAsUTF8(char *text) { } } else { // Need to convert -#ifdef USE_CONVERTER const char *charSetBuffer = CharacterSetID(); if (*charSetBuffer) { //~ fprintf(stderr, "AsUTF8 %s %d %0d-%0d\n", charSetBuffer, targetLength, targetStart, targetEnd); @@ -954,10 +767,6 @@ int ScintillaGTK::TargetAsUTF8(char *text) { pdoc->GetCharRange(text, targetStart, targetLength); } } -#else - // Fail - return 0; -#endif } //~ fprintf(stderr, "Length = %d bytes\n", targetLength); return targetLength; @@ -974,14 +783,11 @@ int ScintillaGTK::EncodedFromUTF8(char *utf8, char *encoded) { return inputLength; } else { // Need to convert -#ifdef USE_CONVERTER const char *charSetBuffer = CharacterSetID(); if (*charSetBuffer) { -//~ fprintf(stderr, "Encode %s %d\n", charSetBuffer, inputLength); int outLength = 0; char *tmpEncoded = ConvertText(&outLength, utf8, inputLength, charSetBuffer, "UTF-8", true); if (tmpEncoded) { -//~ fprintf(stderr, " \"%s\"\n", tmpEncoded); if (encoded) { memcpy(encoded, tmpEncoded, outLength); } @@ -994,14 +800,18 @@ int ScintillaGTK::EncodedFromUTF8(char *utf8, char *encoded) { } return inputLength; } -#endif } // Fail return 0; } bool ScintillaGTK::ValidCodePage(int codePage) const { - return codePage == 0 || codePage == SC_CP_UTF8 || codePage == SC_CP_DBCS; + return codePage == 0 + || codePage == SC_CP_UTF8 + || codePage == 932 + || codePage == 936 + || codePage == 950 + || codePage == SC_CP_DBCS; } sptr_t ScintillaGTK::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) { @@ -1020,7 +830,7 @@ sptr_t ScintillaGTK::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam #ifdef SCI_LEXER case SCI_LOADLEXERLIBRARY: - LexerManager::GetInstance()->Load(reinterpret_cast(wParam)); + LexerManager::GetInstance()->Load(reinterpret_cast(lParam)); break; #endif case SCI_TARGETASUTF8: @@ -1033,10 +843,10 @@ sptr_t ScintillaGTK::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam case SCI_SETRECTANGULARSELECTIONMODIFIER: rectangularSelectionModifier = wParam; break; - + case SCI_GETRECTANGULARSELECTIONMODIFIER: return rectangularSelectionModifier; - + default: return ScintillaBase::WndProc(iMessage, wParam, lParam); } @@ -1067,16 +877,17 @@ void ScintillaGTK::SetTicking(bool on) { bool ScintillaGTK::SetIdle(bool on) { if (on) { // Start idler, if it's not running. - if (idler.state == false) { + if (!idler.state) { idler.state = true; - idler.idlerID = reinterpret_cast - (gtk_idle_add((GtkFunction)IdleCallback, this)); + idler.idlerID = reinterpret_cast( + g_idle_add_full(G_PRIORITY_DEFAULT_IDLE, + reinterpret_cast(IdleCallback), this, NULL)); } } else { // Stop idler, if it's running - if (idler.state == true) { + if (idler.state) { idler.state = false; - gtk_idle_remove(GPOINTER_TO_UINT(idler.idlerID)); + g_source_remove(GPOINTER_TO_UINT(idler.idlerID)); } } return true; @@ -1115,25 +926,7 @@ bool ScintillaGTK::PaintContains(PRectangle rc) { // Redraw all of text area. This paint will not be abandoned. void ScintillaGTK::FullPaint() { -#if GTK_MAJOR_VERSION < 2 - paintState = painting; - rcPaint = GetClientRectangle(); - //Platform::DebugPrintf("ScintillaGTK::FullPaint %0d,%0d %0d,%0d\n", - // rcPaint.left, rcPaint.top, rcPaint.right, rcPaint.bottom); - paintingAllText = true; - if ((PWidget(wText))->window) { - Surface *sw = Surface::Allocate(); - if (sw) { - sw->Init(PWidget(wText)->window, PWidget(wText)); - Paint(sw, rcPaint); - sw->Release(); - delete sw; - } - } - paintState = notPainting; -#else wText.InvalidateAll(); -#endif } PRectangle ScintillaGTK::GetClientRectangle() { @@ -1178,50 +971,8 @@ void ScintillaGTK::ScrollText(int linesToMove) { // rc.left, rc.top, rc.right, rc.bottom); GtkWidget *wi = PWidget(wText); -#if GTK_MAJOR_VERSION < 2 - PRectangle rc = GetClientRectangle(); - GdkGC *gc = gdk_gc_new(wi->window); - - // Set up gc so we get GraphicsExposures from gdk_draw_pixmap - // which calls XCopyArea - gdk_gc_set_exposures(gc, TRUE); - - // Redraw exposed bit : scrolling upwards - if (diff > 0) { - gdk_draw_pixmap(wi->window, - gc, wi->window, - 0, diff, - 0, 0, - rc.Width()-1, rc.Height() - diff); - SyncPaint(PRectangle(0, rc.Height() - diff, - rc.Width(), rc.Height()+1)); - - // Redraw exposed bit : scrolling downwards - } else { - gdk_draw_pixmap(wi->window, - gc, wi->window, - 0, 0, - 0, -diff, - rc.Width()-1, rc.Height() + diff); - SyncPaint(PRectangle(0, 0, rc.Width(), -diff)); - } - - // Look for any graphics expose - GdkEvent* event; - while ((event = gdk_event_get_graphics_expose(wi->window)) != NULL) { - gtk_widget_event(wi, event); - if (event->expose.count == 0) { - gdk_event_free(event); - break; - } - gdk_event_free(event); - } - - gdk_gc_unref(gc); -#else gdk_window_scroll(wi->window, 0, -diff); gdk_window_process_updates(wi->window, FALSE); -#endif } void ScintillaGTK::SetVerticalScrollPos() { @@ -1275,37 +1026,21 @@ void ScintillaGTK::ReconfigureScrollBars() { } void ScintillaGTK::NotifyChange() { -#if GLIB_MAJOR_VERSION < 2 - gtk_signal_emit(GTK_OBJECT(sci), scintilla_signals[COMMAND_SIGNAL], - Platform::LongFromTwoShorts(GetCtrlID(), SCEN_CHANGE), PWidget(wMain)); -#else g_signal_emit(G_OBJECT(sci), scintilla_signals[COMMAND_SIGNAL], 0, Platform::LongFromTwoShorts(GetCtrlID(), SCEN_CHANGE), PWidget(wMain)); -#endif } void ScintillaGTK::NotifyFocus(bool focus) { -#if GLIB_MAJOR_VERSION < 2 - gtk_signal_emit(GTK_OBJECT(sci), scintilla_signals[COMMAND_SIGNAL], - Platform::LongFromTwoShorts - (GetCtrlID(), focus ? SCEN_SETFOCUS : SCEN_KILLFOCUS), PWidget(wMain)); -#else g_signal_emit(G_OBJECT(sci), scintilla_signals[COMMAND_SIGNAL], 0, Platform::LongFromTwoShorts (GetCtrlID(), focus ? SCEN_SETFOCUS : SCEN_KILLFOCUS), PWidget(wMain)); -#endif } void ScintillaGTK::NotifyParent(SCNotification scn) { scn.nmhdr.hwndFrom = PWidget(wMain); scn.nmhdr.idFrom = GetCtrlID(); -#if GLIB_MAJOR_VERSION < 2 - gtk_signal_emit(GTK_OBJECT(sci), scintilla_signals[NOTIFY_SIGNAL], - GetCtrlID(), &scn); -#else g_signal_emit(G_OBJECT(sci), scintilla_signals[NOTIFY_SIGNAL], 0, GetCtrlID(), &scn); -#endif } void ScintillaGTK::NotifyKey(int key, int modifiers) { @@ -1331,6 +1066,110 @@ const char *ScintillaGTK::CharacterSetID() const { return ::CharacterSetID(vs.styles[STYLE_DEFAULT].characterSet); } +class CaseFolderUTF8 : public CaseFolderTable { +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(mixed[0])]; + return 1; + } else { + gchar *mapped = g_utf8_casefold(mixed, lenMixed); + size_t lenMapped = strlen(mapped); + if (lenMapped < sizeFolded) { + memcpy(folded, mapped, lenMapped); + } else { + lenMapped = 0; + } + g_free(mapped); + return lenMapped; + } + } +}; + +CaseFolder *ScintillaGTK::CaseFolderForEncoding() { + if (pdoc->dbcsCodePage == SC_CP_UTF8) { + return new CaseFolderUTF8(); + } else { + CaseFolderTable *pcf = new CaseFolderTable(); + const char *charSetBuffer = CharacterSetID(); + if ((pdoc->dbcsCodePage == 0) && charSetBuffer) { + pcf->StandardASCII(); + // Only for single byte encodings + for (int i=0x80; i<0x100; i++) { + char sCharacter[2] = "A"; + sCharacter[0] = i; + int convertedLength = 1; + const char *sUTF8 = ConvertText(&convertedLength, sCharacter, 1, + "UTF-8", charSetBuffer, false); + if (sUTF8) { + gchar *mapped = g_utf8_casefold(sUTF8, strlen(sUTF8)); + if (mapped) { + int mappedLength = strlen(mapped); + const char *mappedBack = ConvertText(&mappedLength, mapped, + mappedLength, charSetBuffer, "UTF-8", false, true); + if (mappedBack && (strlen(mappedBack) == 1) && (mappedBack[0] != sCharacter[0])) { + pcf->SetTranslation(sCharacter[0], mappedBack[0]); + } + delete []mappedBack; + g_free(mapped); + } + } + delete []sUTF8; + } + } + return pcf; + } +} + +std::string ScintillaGTK::CaseMapString(const std::string &s, int caseMapping) { + if (s.size() == 0) + return std::string(); + + if (caseMapping == cmSame) + return s; + + const char *needsFree1 = 0; // Must be freed with delete [] + const char *charSetBuffer = CharacterSetID(); + const char *sUTF8 = s.c_str(); + int rangeBytes = s.size(); + + int convertedLength = rangeBytes; + // Change text to UTF-8 + if (!IsUnicodeMode()) { + // Need to convert + if (*charSetBuffer) { + sUTF8 = ConvertText(&convertedLength, const_cast(s.c_str()), rangeBytes, + "UTF-8", charSetBuffer, false); + needsFree1 = sUTF8; + } + } + gchar *mapped; // Must be freed with g_free + if (caseMapping == cmUpper) { + mapped = g_utf8_strup(sUTF8, convertedLength); + } else { + mapped = g_utf8_strdown(sUTF8, convertedLength); + } + int mappedLength = strlen(mapped); + char *mappedBack = mapped; + + char *needsFree2 = 0; // Must be freed with delete [] + if (!IsUnicodeMode()) { + if (*charSetBuffer) { + mappedBack = ConvertText(&mappedLength, mapped, mappedLength, charSetBuffer, "UTF-8", false); + needsFree2 = mappedBack; + } + } + + std::string ret(mappedBack, mappedLength); + g_free(mapped); + delete []needsFree1; + delete []needsFree2; + return ret; +} + int ScintillaGTK::KeyDefault(int key, int modifiers) { if (!(modifiers & SCI_CTRL) && !(modifiers & SCI_ALT)) { if (key < 256) { @@ -1396,17 +1235,10 @@ void ScintillaGTK::CreateCallTipWindow(PRectangle rc) { ct.wDraw = gtk_drawing_area_new(); GtkWidget *widcdrw = PWidget(ct.wDraw); // // No code inside the G_OBJECT macro gtk_container_add(GTK_CONTAINER(PWidget(ct.wCallTip)), widcdrw); -#if GLIB_MAJOR_VERSION < 2 - gtk_signal_connect(GTK_OBJECT(widcdrw), "expose_event", - GtkSignalFunc(ScintillaGTK::ExposeCT), &ct); - gtk_signal_connect(GTK_OBJECT(widcdrw), "button_press_event", - GtkSignalFunc(ScintillaGTK::PressCT), static_cast(this)); -#else g_signal_connect(G_OBJECT(widcdrw), "expose_event", G_CALLBACK(ScintillaGTK::ExposeCT), &ct); g_signal_connect(G_OBJECT(widcdrw), "button_press_event", G_CALLBACK(ScintillaGTK::PressCT), static_cast(this)); -#endif gtk_widget_set_events(widcdrw, GDK_EXPOSURE_MASK | GDK_BUTTON_PRESS_MASK); } @@ -1428,9 +1260,7 @@ void ScintillaGTK::AddToPopUp(const char *label, int cmd, bool enabled) { menuSig, cmd, const_cast(label[0] ? "" : ""), -#if GTK_MAJOR_VERSION >= 2 NULL -#endif }; gtk_item_factory_create_item(GTK_ITEM_FACTORY(popup.GetID()), &itemEntry, this, 1); @@ -1486,6 +1316,8 @@ void ScintillaGTK::GetGtkSelectionText(GtkSelectionData *selectionData, Selectio isRectangular = ::IsClipboardFormatAvailable(cfColumnSelect) != 0; #else isRectangular = ((len > 2) && (data[len - 1] == 0 && data[len - 2] == '\n')); + if (isRectangular) + len--; // Forget the extra '\0' #endif char *dest; @@ -1505,16 +1337,13 @@ void ScintillaGTK::GetGtkSelectionText(GtkSelectionData *selectionData, Selectio } else { // UTF-8 dest = Document::TransformLineEnds(&len, data, len, pdoc->eolMode); selText.Set(dest, len, SC_CP_UTF8, 0, isRectangular, false); -#ifdef USE_CONVERTER const char *charSetBuffer = CharacterSetID(); if (!IsUnicodeMode() && *charSetBuffer) { -//fprintf(stderr, "Convert to locale %s\n", CharacterSetID()); - // Convert to locale - dest = ConvertText(&len, selText.s, selText.len, charSetBuffer, "UTF-8", true); - selText.Set(dest, len, pdoc->dbcsCodePage, - vs.styles[STYLE_DEFAULT].characterSet, selText.rectangular, false); + // Convert to locale + dest = ConvertText(&len, selText.s, selText.len, charSetBuffer, "UTF-8", true); + selText.Set(dest, len, pdoc->dbcsCodePage, + vs.styles[STYLE_DEFAULT].characterSet, selText.rectangular, false); } -#endif } } @@ -1535,15 +1364,14 @@ void ScintillaGTK::ReceivedSelection(GtkSelectionData *selection_data) { if (selection_data->selection != GDK_SELECTION_PRIMARY) { ClearSelection(); } - SelectionPosition selStart = SelectionStart(); + SelectionPosition selStart = sel.IsRectangular() ? + sel.Rectangular().Start() : + sel.Range(sel.Main()).Start(); if (selText.rectangular) { PasteRectangular(selStart, selText.s, selText.len); } else { - selStart = SelectionPosition(InsertSpace(selStart.Position(), selStart.VirtualSpace())); - if (pdoc->InsertString(selStart.Position(),selText.s, selText.len)) { - SetEmptySelection(selStart.Position() + selText.len); - } + InsertPaste(selStart, selText.s, selText.len); } EnsureCaretVisible(); } @@ -1593,7 +1421,6 @@ void ScintillaGTK::GetSelection(GtkSelectionData *selection_data, guint info, Se } #endif -#if GTK_MAJOR_VERSION >= 2 // Convert text to utf8 if it isn't already SelectionText *converted = 0; if ((text->codePage != SC_CP_UTF8) && (info == TARGET_UTF8_STRING)) { @@ -1630,64 +1457,6 @@ void ScintillaGTK::GetSelection(GtkSelectionData *selection_data, guint info, Se } delete converted; -#else /* Gtk 1 */ - char *selBuffer = text->s; - - char *tmputf = 0; - if ((info == TARGET_UTF8_STRING) || (info == TARGET_STRING)) { - int len = strlen(selBuffer); -#ifdef USE_CONVERTER - // Possible character set conversion - const char *charSetBuffer = ::CharacterSetID(text->characterSet); - if (info == TARGET_UTF8_STRING) { - //fprintf(stderr, "Copy to clipboard as UTF-8\n"); - if (text->codePage != SC_CP_UTF8) { - // Convert to UTF-8 - //fprintf(stderr, "Convert to UTF-8 from %s\n", charSetBuffer); - tmputf = ConvertText(&len, selBuffer, len, "UTF-8", charSetBuffer, false); - selBuffer = tmputf; - } - } else if (info == TARGET_STRING) { - if (text->codePage == SC_CP_UTF8) { - //fprintf(stderr, "Convert to locale %s\n", charSetBuffer); - // Convert to locale - tmputf = ConvertText(&len, selBuffer, len, charSetBuffer, "UTF-8", true); - selBuffer = tmputf; - } - } -#endif - - // Here is a somewhat evil kludge. - // As I can not work out how to store data on the clipboard in multiple formats - // and need some way to mark the clipping as being stream or rectangular, - // the terminating \0 is included in the length for rectangular clippings. - // All other tested aplications behave benignly by ignoring the \0. - // The #if is here because on Windows cfColumnSelect clip entry is used - // instead as standard indicator of rectangularness (so no need to kludge) -#if PLAT_GTK_WIN32 == 0 - if (text->rectangular) - len++; -#endif - gtk_selection_data_set(selection_data, - (info == TARGET_STRING) ? - static_cast(GDK_SELECTION_TYPE_STRING) : atomUTF8, - 8, reinterpret_cast(selBuffer), - len); - } else if ((info == TARGET_TEXT) || (info == TARGET_COMPOUND_TEXT)) { - guchar *text; - GdkAtom encoding; - gint format; - gint new_length; - - gdk_string_to_compound_text(reinterpret_cast(selBuffer), - &encoding, &format, &text, &new_length); - gtk_selection_data_set(selection_data, encoding, format, text, new_length); - gdk_free_compound_text(text); - } - - delete []tmputf; -#endif /* Gtk >= 2 */ - #if PLAT_GTK_WIN32 delete newline_normalized; #endif @@ -1746,9 +1515,6 @@ void ScintillaGTK::Resize(int width, int height) { int horizontalScrollBarHeight = scrollBarHeight; if (!showSBHorizontal) horizontalScrollBarHeight = 0; - int verticalScrollBarHeight = scrollBarWidth; - if (!verticalScrollBarVisible) - verticalScrollBarHeight = 0; GtkAllocation alloc; if (showSBHorizontal) { @@ -1810,7 +1576,7 @@ static int modifierTranslated(int sciModifier) { return GDK_MOD1_MASK; case SCMOD_SUPER: return GDK_MOD4_MASK; - default: + default: return 0; } } @@ -1847,10 +1613,11 @@ gint ScintillaGTK::PressThis(GdkEventButton *event) { (event->state & modifierTranslated(rectangularSelectionModifier)) != 0); } else if (event->button == 2) { // Grab the primary selection if it exists - SelectionPosition pos = SPositionFromLocation(pt); + SelectionPosition pos = SPositionFromLocation(pt, false, false, UserVirtualSpace()); if (OwnPrimarySelection() && primary.s == NULL) CopySelectionRange(&primary); + sel.Clear(); SetSelection(pos, pos); atomSought = atomUTF8; gtk_selection_convert(GTK_WIDGET(PWidget(wMain)), GDK_SELECTION_PRIMARY, @@ -1882,11 +1649,7 @@ gint ScintillaGTK::PressThis(GdkEventButton *event) { } catch (...) { errorStatus = SC_STATUS_FAILURE; } -#if GTK_MAJOR_VERSION >= 2 return TRUE; -#else - return FALSE; -#endif } gint ScintillaGTK::Press(GtkWidget *widget, GdkEventButton *event) { @@ -1922,7 +1685,6 @@ gint ScintillaGTK::MouseRelease(GtkWidget *widget, GdkEventButton *event) { // win32gtk and GTK >= 2 use SCROLL_* events instead of passing the // button4/5/6/7 events to the GTK app -#if PLAT_GTK_WIN32 || (GTK_MAJOR_VERSION >= 2) gint ScintillaGTK::ScrollEvent(GtkWidget *widget, GdkEventScroll *event) { ScintillaGTK *sciThis = ScintillaFromWidget(widget); @@ -1999,7 +1761,6 @@ gint ScintillaGTK::ScrollEvent(GtkWidget *widget, } return FALSE; } -#endif gint ScintillaGTK::Motion(GtkWidget *widget, GdkEventMotion *event) { ScintillaGTK *sciThis = ScintillaFromWidget(widget); @@ -2104,11 +1865,9 @@ gboolean ScintillaGTK::KeyThis(GdkEventKey *event) { try { //fprintf(stderr, "SC-key: %d %x [%s]\n", // event->keyval, event->state, (event->length > 0) ? event->string : "empty"); -#if GTK_MAJOR_VERSION >= 2 if (gtk_im_context_filter_keypress(im_context, event)) { return 1; } -#endif if (!event->keyval) { return true; } @@ -2125,10 +1884,6 @@ gboolean ScintillaGTK::KeyThis(GdkEventKey *event) { // This will have to change for Unicode else if (key >= 0xFE00) key = KeyTranslate(key); -#if GTK_MAJOR_VERSION < 2 - else if (!IsUnicodeMode() && (key >= 0x100) && (key < 0x1000)) - key &= 0xff; -#endif bool consumed = false; bool added = KeyDown(key, shift, ctrl, alt, &consumed) != 0; @@ -2158,7 +1913,6 @@ gboolean ScintillaGTK::KeyRelease(GtkWidget *, GdkEventKey * /*event*/) { return FALSE; } -#if GTK_MAJOR_VERSION >= 2 gboolean ScintillaGTK::ExposePreeditThis(GtkWidget *widget, GdkEventExpose *ose) { try { gchar *str; @@ -2274,7 +2028,6 @@ void ScintillaGTK::PreeditChangedThis() { void ScintillaGTK::PreeditChanged(GtkIMContext *, ScintillaGTK *sciThis) { sciThis->PreeditChangedThis(); } -#endif gint ScintillaGTK::StyleSetText(GtkWidget *widget, GtkStyle *, void*) { if (widget->window != NULL) @@ -2288,12 +2041,7 @@ gint ScintillaGTK::RealizeText(GtkWidget *widget, void*) { return FALSE; } -#if GLIB_MAJOR_VERSION < 2 -void ScintillaGTK::Destroy(GtkObject *object) -#else -void ScintillaGTK::Destroy(GObject *object) -#endif -{ +void ScintillaGTK::Destroy(GObject *object) { try { ScintillaObject *scio = reinterpret_cast(object); // This avoids a double destruction @@ -2303,13 +2051,6 @@ void ScintillaGTK::Destroy(GObject *object) //Platform::DebugPrintf("Destroying %x %x\n", sciThis, object); sciThis->Finalise(); -#if GLIB_MAJOR_VERSION < 2 - if (GTK_OBJECT_CLASS(parent_class)->destroy) - (* GTK_OBJECT_CLASS(parent_class)->destroy)(object); -#else - // IS ANYTHING NEEDED ? -#endif - delete sciThis; scio->pscin = 0; } catch (...) { @@ -2337,13 +2078,11 @@ void ScintillaGTK::Draw(GtkWidget *widget, GdkRectangle *area) { DrawChild(PWidget(sciThis->scrollbarv), area); } -#ifdef INTERNATIONAL_INPUT Point pt = sciThis->PointMainCaret(); pt.y += sciThis->vs.lineHeight - 2; if (pt.x < 0) pt.x = 0; if (pt.y < 0) pt.y = 0; CursorMoved(widget, pt.x, pt.y, sciThis); -#endif } catch (...) { sciThis->errorStatus = SC_STATUS_FAILURE; } @@ -2359,9 +2098,7 @@ gint ScintillaGTK::ExposeTextThis(GtkWidget * /*widget*/, GdkEventExpose *ose) { rcPaint.bottom = ose->area.y + ose->area.height; PLATFORM_ASSERT(rgnUpdate == NULL); -#if GTK_MAJOR_VERSION >= 2 rgnUpdate = gdk_region_copy(ose->region); -#endif PRectangle rcClient = GetClientRectangle(); paintingAllText = rcPaint.Contains(rcClient); Surface *surfaceWindow = Surface::Allocate(); @@ -2404,51 +2141,11 @@ gint ScintillaGTK::Expose(GtkWidget *, GdkEventExpose *ose) { //fprintf(stderr, "Expose %0d,%0d %0d,%0d\n", //ose->area.x, ose->area.y, ose->area.width, ose->area.height); -#if GTK_MAJOR_VERSION < 2 - - paintState = painting; - - rcPaint.left = ose->area.x; - rcPaint.top = ose->area.y; - rcPaint.right = ose->area.x + ose->area.width; - rcPaint.bottom = ose->area.y + ose->area.height; - - PRectangle rcClient = GetClientRectangle(); - paintingAllText = rcPaint.Contains(rcClient); - Surface *surfaceWindow = Surface::Allocate(); - if (surfaceWindow) { - surfaceWindow->Init(PWidget(wMain)->window, PWidget(wMain)); - - // Fill the corner between the scrollbars - if (verticalScrollBarVisible) { - if (horizontalScrollBarVisible && (wrapState == eWrapNone)) { - PRectangle rcCorner = wMain.GetClientPosition(); - rcCorner.left = rcCorner.right - scrollBarWidth + 1; - rcCorner.top = rcCorner.bottom - scrollBarHeight + 1; - //fprintf(stderr, "Corner %0d,%0d %0d,%0d\n", - //rcCorner.left, rcCorner.top, rcCorner.right, rcCorner.bottom); - surfaceWindow->FillRectangle(rcCorner, - vs.styles[STYLE_LINENUMBER].back.allocated); - } - } - - //Paint(surfaceWindow, rcPaint); - surfaceWindow->Release(); - delete surfaceWindow; - } - if (paintState == paintAbandoned) { - // Painting area was insufficient to cover new styling or brace highlight positions - FullPaint(); - } - paintState = notPainting; - -#else - // For GTK+ 2, the text is painted in ExposeText + // The text is painted in ExposeText gtk_container_propagate_expose( GTK_CONTAINER(PWidget(wMain)), PWidget(scrollbarh), ose); gtk_container_propagate_expose( GTK_CONTAINER(PWidget(wMain)), PWidget(scrollbarv), ose); -#endif } catch (...) { errorStatus = SC_STATUS_FAILURE; @@ -2507,13 +2204,6 @@ gint ScintillaGTK::SelectionClear(GtkWidget *widget, GdkEventSelection *selectio return gtk_selection_clear(widget, selection_event); } -#if GTK_MAJOR_VERSION < 2 -gint ScintillaGTK::SelectionNotify(GtkWidget *widget, GdkEventSelection *selection_event) { - //Platform::DebugPrintf("Selection notify\n"); - return gtk_selection_notify(widget, selection_event); -} -#endif - void ScintillaGTK::DragBegin(GtkWidget *, GdkDragContext *) { //Platform::DebugPrintf("DragBegin\n"); } @@ -2624,8 +2314,8 @@ int ScintillaGTK::TimeOut(ScintillaGTK *sciThis) { return 1; } -int ScintillaGTK::IdleCallback(ScintillaGTK *sciThis) { - // Idler will be automatically stoped, if there is nothing +gboolean ScintillaGTK::IdleCallback(ScintillaGTK *sciThis) { + // Idler will be automatically stopped, if there is nothing // to do while idle. bool ret = sciThis->Idle(); if (ret == false) { @@ -2637,6 +2327,22 @@ int ScintillaGTK::IdleCallback(ScintillaGTK *sciThis) { return ret; } +gboolean ScintillaGTK::StyleIdle(ScintillaGTK *sciThis) { + sciThis->IdleStyling(); + // Idler will be automatically stopped + return FALSE; +} + +void ScintillaGTK::QueueStyling(int upTo) { + Editor::QueueStyling(upTo); + if (!styleNeeded.active) { + // Only allow one style needed to be queued + styleNeeded.active = true; + g_idle_add_full(G_PRIORITY_HIGH_IDLE, + reinterpret_cast(StyleIdle), this, NULL); + } +} + void ScintillaGTK::PopUpCB(ScintillaGTK *sciThis, guint action, GtkWidget *) { if (action) { sciThis->Command(action); @@ -2656,11 +2362,7 @@ gint ScintillaGTK::PressCT(GtkWidget *widget, GdkEventButton *event, ScintillaGT sciThis->CallTipClick(); } catch (...) { } -#if GTK_MAJOR_VERSION >= 2 return TRUE; -#else - return FALSE; -#endif } gint ScintillaGTK::ExposeCT(GtkWidget *widget, GdkEventExpose * /*ose*/, CallTip *ctip) { @@ -2696,32 +2398,6 @@ static void scintilla_init(ScintillaObject *sci); extern void Platform_Initialise(); extern void Platform_Finalise(); -#if GLIB_MAJOR_VERSION < 2 -GtkType scintilla_get_type() { - static GtkType scintilla_type = 0; - try { - - if (!scintilla_type) { - Platform_Initialise(); - static GtkTypeInfo scintilla_info = { - "Scintilla", - sizeof (ScintillaObject), - sizeof (ScintillaClass), - (GtkClassInitFunc) scintilla_class_init, - (GtkObjectInitFunc) scintilla_init, - (gpointer) NULL, - (gpointer) NULL, - 0 - }; - - scintilla_type = gtk_type_unique(gtk_container_get_type(), &scintilla_info); - } - - } catch (...) { - } - return scintilla_type; -} -#else GType scintilla_get_type() { static GType scintilla_type = 0; try { @@ -2751,12 +2427,9 @@ GType scintilla_get_type() { } return scintilla_type; } -#endif void ScintillaGTK::ClassInit(OBJECT_CLASS* object_class, GtkWidgetClass *widget_class, GtkContainerClass *container_class) { -#if GLIB_MAJOR_VERSION >= 2 Platform_Initialise(); -#endif atomClipboard = gdk_atom_intern("CLIPBOARD", FALSE); atomUTF8 = gdk_atom_intern("UTF8_STRING", FALSE); atomString = GDK_SELECTION_TYPE_STRING; @@ -2767,23 +2440,14 @@ void ScintillaGTK::ClassInit(OBJECT_CLASS* object_class, GtkWidgetClass *widget_ // of the signal handlers here (those that currently attached to wDraw // in Initialise() may require coordinate translation?) -#if GLIB_MAJOR_VERSION < 2 - object_class->destroy = Destroy; -#else object_class->finalize = Destroy; -#endif widget_class->size_request = SizeRequest; widget_class->size_allocate = SizeAllocate; widget_class->expose_event = ExposeMain; -#if GTK_MAJOR_VERSION < 2 - widget_class->draw = Draw; -#endif widget_class->motion_notify_event = Motion; widget_class->button_press_event = Press; widget_class->button_release_event = MouseRelease; -#if PLAT_GTK_WIN32 || (GTK_MAJOR_VERSION >= 2) widget_class->scroll_event = ScrollEvent; -#endif widget_class->key_press_event = KeyPress; widget_class->key_release_event = KeyRelease; widget_class->focus_in_event = FocusIn; @@ -2791,9 +2455,6 @@ void ScintillaGTK::ClassInit(OBJECT_CLASS* object_class, GtkWidgetClass *widget_ widget_class->selection_received = SelectionReceived; widget_class->selection_get = SelectionGet; widget_class->selection_clear_event = SelectionClear; -#if GTK_MAJOR_VERSION < 2 - widget_class->selection_notify_event = SelectionNotify; -#endif widget_class->drag_data_received = DragDataReceived; widget_class->drag_motion = DragMotion; @@ -2810,14 +2471,8 @@ void ScintillaGTK::ClassInit(OBJECT_CLASS* object_class, GtkWidgetClass *widget_ container_class->forall = MainForAll; } -#if GLIB_MAJOR_VERSION < 2 -#define GTK_CLASS_TYPE(c) (c->type) -#define SIG_MARSHAL gtk_marshal_NONE__INT_POINTER -#define MARSHAL_ARGUMENTS GTK_TYPE_INT, GTK_TYPE_POINTER -#else #define SIG_MARSHAL scintilla_marshal_NONE__INT_POINTER #define MARSHAL_ARGUMENTS G_TYPE_INT, G_TYPE_POINTER -#endif static void scintilla_class_init(ScintillaClass *klass) { try { @@ -2825,29 +2480,6 @@ static void scintilla_class_init(ScintillaClass *klass) { GtkWidgetClass *widget_class = (GtkWidgetClass*) klass; GtkContainerClass *container_class = (GtkContainerClass*) klass; -#if GLIB_MAJOR_VERSION < 2 - parent_class = (GtkWidgetClass*) gtk_type_class(gtk_container_get_type()); - - scintilla_signals[COMMAND_SIGNAL] = gtk_signal_new( - "command", - GTK_RUN_LAST, - GTK_CLASS_TYPE(object_class), - GTK_SIGNAL_OFFSET(ScintillaClass, command), - SIG_MARSHAL, - GTK_TYPE_NONE, - 2, MARSHAL_ARGUMENTS); - - scintilla_signals[NOTIFY_SIGNAL] = gtk_signal_new( - SCINTILLA_NOTIFY, - GTK_RUN_LAST, - GTK_CLASS_TYPE(object_class), - GTK_SIGNAL_OFFSET(ScintillaClass, notify), - SIG_MARSHAL, - GTK_TYPE_NONE, - 2, MARSHAL_ARGUMENTS); - gtk_object_class_add_signals(object_class, - reinterpret_cast(scintilla_signals), LAST_SIGNAL); -#else GSignalFlags sigflags = GSignalFlags(G_SIGNAL_ACTION | G_SIGNAL_RUN_LAST); scintilla_signals[COMMAND_SIGNAL] = g_signal_new( "command", @@ -2870,7 +2502,7 @@ static void scintilla_class_init(ScintillaClass *klass) { SIG_MARSHAL, G_TYPE_NONE, 2, MARSHAL_ARGUMENTS); -#endif + klass->command = NULL; klass->notify = NULL; @@ -2888,11 +2520,7 @@ static void scintilla_init(ScintillaObject *sci) { } GtkWidget* scintilla_new() { -#if GLIB_MAJOR_VERSION < 2 - return GTK_WIDGET(gtk_type_new(scintilla_get_type())); -#else return GTK_WIDGET(g_object_new(scintilla_get_type(), NULL)); -#endif } void scintilla_set_id(ScintillaObject *sci, uptr_t id) { diff --git a/scintilla/gtk/deps.mak b/scintilla/gtk/deps.mak index ffd30695..226705b2 100644 --- a/scintilla/gtk/deps.mak +++ b/scintilla/gtk/deps.mak @@ -1,334 +1,337 @@ PlatGTK.o: PlatGTK.cxx \ - ../include/Scintilla.h ../include/ScintillaWidget.h \ - ../src/UniConversion.h ../src/XPM.h Converter.h + ../include/Scintilla.h ../include/ScintillaWidget.h \ + ../src/UniConversion.h ../src/XPM.h Converter.h ScintillaGTK.o: ScintillaGTK.cxx \ - ../include/Scintilla.h ../include/ScintillaWidget.h \ - ../include/SciLexer.h ../include/PropSet.h ../src/PropSetSimple.h \ - ../include/Accessor.h ../include/KeyWords.h ../src/SVector.h \ - ../src/SplitVector.h ../src/Partitioning.h ../src/RunStyles.h \ - ../src/ContractionState.h ../src/CellBuffer.h ../src/CallTip.h \ - ../src/KeyMap.h ../src/Indicator.h ../src/XPM.h ../src/LineMarker.h \ - ../src/Style.h ../src/AutoComplete.h ../src/ViewStyle.h \ - ../src/Decoration.h ../src/CharClassify.h ../src/Document.h \ - ../src/Selection.h ../src/PositionCache.h ../src/Editor.h \ - ../src/ScintillaBase.h ../src/UniConversion.h scintilla-marshal.h \ - ../src/ExternalLexer.h Converter.h + ../include/Scintilla.h ../include/ScintillaWidget.h \ + ../include/SciLexer.h ../include/PropSet.h ../src/PropSetSimple.h \ + ../include/Accessor.h ../include/KeyWords.h ../src/SVector.h \ + ../src/SplitVector.h ../src/Partitioning.h ../src/RunStyles.h \ + ../src/ContractionState.h ../src/CellBuffer.h ../src/CallTip.h \ + ../src/KeyMap.h ../src/Indicator.h ../src/XPM.h ../src/LineMarker.h \ + ../src/Style.h ../src/AutoComplete.h ../src/ViewStyle.h \ + ../src/Decoration.h ../src/CharClassify.h ../src/Document.h \ + ../src/Selection.h ../src/PositionCache.h ../src/Editor.h \ + ../src/ScintillaBase.h ../src/UniConversion.h scintilla-marshal.h \ + ../src/ExternalLexer.h Converter.h AutoComplete.o: ../src/AutoComplete.cxx ../include/Platform.h \ - ../src/CharClassify.h ../src/AutoComplete.h + ../src/CharClassify.h ../src/AutoComplete.h CallTip.o: ../src/CallTip.cxx ../include/Platform.h \ - ../include/Scintilla.h ../src/CallTip.h + ../include/Scintilla.h ../src/CallTip.h CellBuffer.o: ../src/CellBuffer.cxx ../include/Platform.h \ - ../include/Scintilla.h ../src/SplitVector.h ../src/Partitioning.h \ - ../src/CellBuffer.h + ../include/Scintilla.h ../src/SplitVector.h ../src/Partitioning.h \ + ../src/CellBuffer.h CharClassify.o: ../src/CharClassify.cxx ../src/CharClassify.h ContractionState.o: ../src/ContractionState.cxx ../include/Platform.h \ - ../src/SplitVector.h ../src/Partitioning.h ../src/RunStyles.h \ - ../src/ContractionState.h + ../src/SplitVector.h ../src/Partitioning.h ../src/RunStyles.h \ + ../src/ContractionState.h Decoration.o: ../src/Decoration.cxx ../include/Platform.h \ - ../include/Scintilla.h ../src/SplitVector.h ../src/Partitioning.h \ - ../src/RunStyles.h ../src/Decoration.h + ../include/Scintilla.h ../src/SplitVector.h ../src/Partitioning.h \ + ../src/RunStyles.h ../src/Decoration.h DocumentAccessor.o: ../src/DocumentAccessor.cxx ../include/Platform.h \ - ../include/PropSet.h ../include/Accessor.h ../src/DocumentAccessor.h \ - ../src/SplitVector.h ../src/Partitioning.h ../src/RunStyles.h \ - ../src/CellBuffer.h ../include/Scintilla.h ../src/CharClassify.h \ - ../src/Decoration.h ../src/Document.h + ../include/PropSet.h ../include/Accessor.h ../src/DocumentAccessor.h \ + ../src/SplitVector.h ../src/Partitioning.h ../src/RunStyles.h \ + ../src/CellBuffer.h ../include/Scintilla.h ../src/CharClassify.h \ + ../src/Decoration.h ../src/Document.h Document.o: ../src/Document.cxx ../include/Platform.h \ - ../include/Scintilla.h ../src/SplitVector.h ../src/Partitioning.h \ - ../src/RunStyles.h ../src/CellBuffer.h ../src/PerLine.h \ - ../src/CharClassify.h ../src/Decoration.h ../src/Document.h \ - ../src/RESearch.h + ../include/Scintilla.h ../src/SplitVector.h ../src/Partitioning.h \ + ../src/RunStyles.h ../src/CellBuffer.h ../src/PerLine.h \ + ../src/CharClassify.h ../src/Decoration.h ../src/Document.h \ + ../src/RESearch.h Editor.o: ../src/Editor.cxx ../include/Platform.h ../include/Scintilla.h \ - ../src/SplitVector.h ../src/Partitioning.h ../src/RunStyles.h \ - ../src/ContractionState.h ../src/CellBuffer.h ../src/KeyMap.h \ - ../src/Indicator.h ../src/XPM.h ../src/LineMarker.h ../src/Style.h \ - ../src/ViewStyle.h ../src/CharClassify.h ../src/Decoration.h \ - ../src/Document.h ../src/Selection.h ../src/PositionCache.h \ - ../src/Editor.h + ../src/SplitVector.h ../src/Partitioning.h ../src/RunStyles.h \ + ../src/ContractionState.h ../src/CellBuffer.h ../src/KeyMap.h \ + ../src/Indicator.h ../src/XPM.h ../src/LineMarker.h ../src/Style.h \ + ../src/ViewStyle.h ../src/CharClassify.h ../src/Decoration.h \ + ../src/Document.h ../src/Selection.h ../src/PositionCache.h \ + ../src/Editor.h ExternalLexer.o: ../src/ExternalLexer.cxx ../include/Platform.h \ - ../include/Scintilla.h ../include/SciLexer.h ../include/PropSet.h \ - ../include/Accessor.h ../src/DocumentAccessor.h ../include/KeyWords.h \ - ../src/ExternalLexer.h + ../include/Scintilla.h ../include/SciLexer.h ../include/PropSet.h \ + ../include/Accessor.h ../src/DocumentAccessor.h ../include/KeyWords.h \ + ../src/ExternalLexer.h Indicator.o: ../src/Indicator.cxx ../include/Platform.h \ - ../include/Scintilla.h ../src/Indicator.h + ../include/Scintilla.h ../src/Indicator.h KeyMap.o: ../src/KeyMap.cxx ../include/Platform.h ../include/Scintilla.h \ - ../src/KeyMap.h + ../src/KeyMap.h KeyWords.o: ../src/KeyWords.cxx ../include/Platform.h \ - ../include/PropSet.h ../include/Accessor.h ../include/KeyWords.h \ - ../include/Scintilla.h ../include/SciLexer.h + ../include/PropSet.h ../include/Accessor.h ../include/KeyWords.h \ + ../include/Scintilla.h ../include/SciLexer.h LexAbaqus.o: ../src/LexAbaqus.cxx ../include/Platform.h \ - ../include/PropSet.h ../include/Accessor.h ../src/StyleContext.h \ - ../include/KeyWords.h ../include/Scintilla.h ../include/SciLexer.h + ../include/PropSet.h ../include/Accessor.h ../src/StyleContext.h \ + ../include/KeyWords.h ../include/Scintilla.h ../include/SciLexer.h LexAda.o: ../src/LexAda.cxx ../include/Platform.h ../include/Accessor.h \ - ../src/StyleContext.h ../include/PropSet.h ../include/KeyWords.h \ - ../include/SciLexer.h + ../src/StyleContext.h ../include/PropSet.h ../include/KeyWords.h \ + ../include/SciLexer.h LexAPDL.o: ../src/LexAPDL.cxx ../include/Platform.h ../include/PropSet.h \ - ../include/Accessor.h ../src/StyleContext.h ../include/KeyWords.h \ - ../include/Scintilla.h ../include/SciLexer.h + ../include/Accessor.h ../src/StyleContext.h ../include/KeyWords.h \ + ../include/Scintilla.h ../include/SciLexer.h LexAsm.o: ../src/LexAsm.cxx ../include/Platform.h ../include/PropSet.h \ - ../include/Accessor.h ../src/StyleContext.h ../include/KeyWords.h \ - ../include/Scintilla.h ../include/SciLexer.h + ../include/Accessor.h ../src/StyleContext.h ../include/KeyWords.h \ + ../include/Scintilla.h ../include/SciLexer.h LexAsn1.o: ../src/LexAsn1.cxx ../include/Platform.h ../include/PropSet.h \ - ../include/Accessor.h ../src/StyleContext.h ../include/KeyWords.h \ - ../include/Scintilla.h ../include/SciLexer.h + ../include/Accessor.h ../src/StyleContext.h ../include/KeyWords.h \ + ../include/Scintilla.h ../include/SciLexer.h LexASY.o: ../src/LexASY.cxx ../include/Platform.h ../include/PropSet.h \ - ../include/Accessor.h ../src/StyleContext.h ../include/KeyWords.h \ - ../include/Scintilla.h ../include/SciLexer.h ../src/CharacterSet.h + ../include/Accessor.h ../src/StyleContext.h ../include/KeyWords.h \ + ../include/Scintilla.h ../include/SciLexer.h ../src/CharacterSet.h LexAU3.o: ../src/LexAU3.cxx ../include/Platform.h ../include/PropSet.h \ - ../include/Accessor.h ../src/StyleContext.h ../include/KeyWords.h \ - ../include/Scintilla.h ../include/SciLexer.h + ../include/Accessor.h ../src/StyleContext.h ../include/KeyWords.h \ + ../include/Scintilla.h ../include/SciLexer.h LexAVE.o: ../src/LexAVE.cxx ../include/Platform.h ../include/PropSet.h \ - ../include/Accessor.h ../src/StyleContext.h ../include/KeyWords.h \ - ../include/Scintilla.h ../include/SciLexer.h + ../include/Accessor.h ../src/StyleContext.h ../include/KeyWords.h \ + ../include/Scintilla.h ../include/SciLexer.h LexBaan.o: ../src/LexBaan.cxx ../include/Platform.h ../include/PropSet.h \ - ../include/Accessor.h ../src/StyleContext.h ../include/KeyWords.h \ - ../include/Scintilla.h ../include/SciLexer.h + ../include/Accessor.h ../src/StyleContext.h ../include/KeyWords.h \ + ../include/Scintilla.h ../include/SciLexer.h LexBash.o: ../src/LexBash.cxx ../include/Platform.h ../include/PropSet.h \ - ../include/Accessor.h ../src/StyleContext.h ../include/KeyWords.h \ - ../include/Scintilla.h ../include/SciLexer.h ../src/CharacterSet.h + ../include/Accessor.h ../src/StyleContext.h ../include/KeyWords.h \ + ../include/Scintilla.h ../include/SciLexer.h ../src/CharacterSet.h LexBasic.o: ../src/LexBasic.cxx ../include/Platform.h \ - ../include/PropSet.h ../include/Accessor.h ../src/StyleContext.h \ - ../include/KeyWords.h ../include/Scintilla.h ../include/SciLexer.h + ../include/PropSet.h ../include/Accessor.h ../src/StyleContext.h \ + ../include/KeyWords.h ../include/Scintilla.h ../include/SciLexer.h LexBullant.o: ../src/LexBullant.cxx ../include/Platform.h \ - ../include/PropSet.h ../include/Accessor.h ../include/KeyWords.h \ - ../include/Scintilla.h ../include/SciLexer.h + ../include/PropSet.h ../include/Accessor.h ../include/KeyWords.h \ + ../include/Scintilla.h ../include/SciLexer.h LexCaml.o: ../src/LexCaml.cxx ../include/Platform.h ../include/PropSet.h \ - ../src/PropSetSimple.h ../include/Accessor.h ../src/StyleContext.h \ - ../include/KeyWords.h ../include/Scintilla.h ../include/SciLexer.h + ../src/PropSetSimple.h ../include/Accessor.h ../src/StyleContext.h \ + ../include/KeyWords.h ../include/Scintilla.h ../include/SciLexer.h LexCLW.o: ../src/LexCLW.cxx ../include/Platform.h ../include/PropSet.h \ - ../include/Accessor.h ../src/StyleContext.h ../include/KeyWords.h \ - ../include/Scintilla.h ../include/SciLexer.h + ../include/Accessor.h ../src/StyleContext.h ../include/KeyWords.h \ + ../include/Scintilla.h ../include/SciLexer.h LexCmake.o: ../src/LexCmake.cxx ../include/Platform.h \ - ../src/CharClassify.h ../include/PropSet.h ../include/Accessor.h \ - ../include/KeyWords.h ../include/Scintilla.h ../include/SciLexer.h + ../src/CharClassify.h ../include/PropSet.h ../include/Accessor.h \ + ../include/KeyWords.h ../include/Scintilla.h ../include/SciLexer.h LexCOBOL.o: ../src/LexCOBOL.cxx ../include/Platform.h \ - ../include/PropSet.h ../include/Accessor.h ../include/KeyWords.h \ - ../include/Scintilla.h ../include/SciLexer.h ../src/StyleContext.h + ../include/PropSet.h ../include/Accessor.h ../include/KeyWords.h \ + ../include/Scintilla.h ../include/SciLexer.h ../src/StyleContext.h LexConf.o: ../src/LexConf.cxx ../include/Platform.h ../include/PropSet.h \ - ../include/Accessor.h ../include/KeyWords.h ../include/Scintilla.h \ - ../include/SciLexer.h + ../include/Accessor.h ../include/KeyWords.h ../include/Scintilla.h \ + ../include/SciLexer.h LexCPP.o: ../src/LexCPP.cxx ../include/Platform.h ../include/PropSet.h \ - ../include/Accessor.h ../src/StyleContext.h ../include/KeyWords.h \ - ../include/Scintilla.h ../include/SciLexer.h ../src/CharacterSet.h + ../include/Accessor.h ../src/StyleContext.h ../include/KeyWords.h \ + ../include/Scintilla.h ../include/SciLexer.h ../src/CharacterSet.h LexCrontab.o: ../src/LexCrontab.cxx ../include/Platform.h \ - ../include/PropSet.h ../include/Accessor.h ../include/KeyWords.h \ - ../include/Scintilla.h ../include/SciLexer.h + ../include/PropSet.h ../include/Accessor.h ../include/KeyWords.h \ + ../include/Scintilla.h ../include/SciLexer.h LexCsound.o: ../src/LexCsound.cxx ../include/Platform.h \ - ../include/PropSet.h ../include/Accessor.h ../src/StyleContext.h \ - ../include/KeyWords.h ../include/Scintilla.h ../include/SciLexer.h + ../include/PropSet.h ../include/Accessor.h ../src/StyleContext.h \ + ../include/KeyWords.h ../include/Scintilla.h ../include/SciLexer.h LexCSS.o: ../src/LexCSS.cxx ../include/Platform.h ../include/PropSet.h \ - ../include/Accessor.h ../src/StyleContext.h ../include/KeyWords.h \ - ../include/Scintilla.h ../include/SciLexer.h + ../include/Accessor.h ../src/StyleContext.h ../include/KeyWords.h \ + ../include/Scintilla.h ../include/SciLexer.h LexD.o: ../src/LexD.cxx ../include/Platform.h ../include/PropSet.h \ - ../include/Accessor.h ../src/StyleContext.h ../include/KeyWords.h \ - ../include/Scintilla.h ../include/SciLexer.h + ../include/Accessor.h ../src/StyleContext.h ../include/KeyWords.h \ + ../include/Scintilla.h ../include/SciLexer.h LexEiffel.o: ../src/LexEiffel.cxx ../include/Platform.h \ - ../include/PropSet.h ../include/Accessor.h ../src/StyleContext.h \ - ../include/KeyWords.h ../include/Scintilla.h ../include/SciLexer.h + ../include/PropSet.h ../include/Accessor.h ../src/StyleContext.h \ + ../include/KeyWords.h ../include/Scintilla.h ../include/SciLexer.h LexErlang.o: ../src/LexErlang.cxx ../include/Platform.h \ - ../include/PropSet.h ../include/Accessor.h ../src/StyleContext.h \ - ../include/KeyWords.h ../include/Scintilla.h ../include/SciLexer.h + ../include/PropSet.h ../include/Accessor.h ../src/StyleContext.h \ + ../include/KeyWords.h ../include/Scintilla.h ../include/SciLexer.h LexEScript.o: ../src/LexEScript.cxx ../include/Platform.h \ - ../include/PropSet.h ../include/Accessor.h ../src/StyleContext.h \ - ../include/KeyWords.h ../include/Scintilla.h ../include/SciLexer.h + ../include/PropSet.h ../include/Accessor.h ../src/StyleContext.h \ + ../include/KeyWords.h ../include/Scintilla.h ../include/SciLexer.h LexFlagship.o: ../src/LexFlagship.cxx ../include/Platform.h \ - ../include/PropSet.h ../include/Accessor.h ../src/StyleContext.h \ - ../include/KeyWords.h ../include/Scintilla.h ../include/SciLexer.h + ../include/PropSet.h ../include/Accessor.h ../src/StyleContext.h \ + ../include/KeyWords.h ../include/Scintilla.h ../include/SciLexer.h LexForth.o: ../src/LexForth.cxx ../include/Platform.h \ - ../include/PropSet.h ../include/Accessor.h ../src/StyleContext.h \ - ../include/KeyWords.h ../include/Scintilla.h ../include/SciLexer.h + ../include/PropSet.h ../include/Accessor.h ../src/StyleContext.h \ + ../include/KeyWords.h ../include/Scintilla.h ../include/SciLexer.h LexFortran.o: ../src/LexFortran.cxx ../include/Platform.h \ - ../include/PropSet.h ../include/Accessor.h ../src/StyleContext.h \ - ../include/KeyWords.h ../include/Scintilla.h ../include/SciLexer.h + ../include/PropSet.h ../include/Accessor.h ../src/StyleContext.h \ + ../include/KeyWords.h ../include/Scintilla.h ../include/SciLexer.h LexGAP.o: ../src/LexGAP.cxx ../include/Platform.h ../include/PropSet.h \ - ../include/Accessor.h ../src/StyleContext.h ../include/KeyWords.h \ - ../include/Scintilla.h ../include/SciLexer.h + ../include/Accessor.h ../src/StyleContext.h ../include/KeyWords.h \ + ../include/Scintilla.h ../include/SciLexer.h LexGui4Cli.o: ../src/LexGui4Cli.cxx ../include/Platform.h \ - ../include/PropSet.h ../include/Accessor.h ../src/StyleContext.h \ - ../include/KeyWords.h ../include/Scintilla.h ../include/SciLexer.h + ../include/PropSet.h ../include/Accessor.h ../src/StyleContext.h \ + ../include/KeyWords.h ../include/Scintilla.h ../include/SciLexer.h LexHaskell.o: ../src/LexHaskell.cxx ../include/Platform.h \ - ../include/PropSet.h ../src/PropSetSimple.h ../include/Accessor.h \ - ../src/StyleContext.h ../include/KeyWords.h ../include/Scintilla.h \ - ../include/SciLexer.h + ../include/PropSet.h ../src/PropSetSimple.h ../include/Accessor.h \ + ../src/StyleContext.h ../include/KeyWords.h ../include/Scintilla.h \ + ../include/SciLexer.h LexHTML.o: ../src/LexHTML.cxx ../include/Platform.h ../include/PropSet.h \ - ../include/Accessor.h ../src/StyleContext.h ../include/KeyWords.h \ - ../include/Scintilla.h ../include/SciLexer.h ../src/CharacterSet.h + ../include/Accessor.h ../src/StyleContext.h ../include/KeyWords.h \ + ../include/Scintilla.h ../include/SciLexer.h ../src/CharacterSet.h LexInno.o: ../src/LexInno.cxx ../include/Platform.h ../src/CharClassify.h \ - ../include/PropSet.h ../include/Accessor.h ../src/StyleContext.h \ - ../include/KeyWords.h ../include/Scintilla.h ../include/SciLexer.h + ../include/PropSet.h ../include/Accessor.h ../src/StyleContext.h \ + ../include/KeyWords.h ../include/Scintilla.h ../include/SciLexer.h LexKix.o: ../src/LexKix.cxx ../include/Platform.h ../include/PropSet.h \ - ../include/Accessor.h ../src/StyleContext.h ../include/KeyWords.h \ - ../include/Scintilla.h ../include/SciLexer.h + ../include/Accessor.h ../src/StyleContext.h ../include/KeyWords.h \ + ../include/Scintilla.h ../include/SciLexer.h LexLisp.o: ../src/LexLisp.cxx ../include/Platform.h ../include/PropSet.h \ - ../include/Accessor.h ../include/KeyWords.h ../include/Scintilla.h \ - ../include/SciLexer.h ../src/StyleContext.h + ../include/Accessor.h ../include/KeyWords.h ../include/Scintilla.h \ + ../include/SciLexer.h ../src/StyleContext.h LexLout.o: ../src/LexLout.cxx ../include/Platform.h ../include/PropSet.h \ - ../include/Accessor.h ../src/StyleContext.h ../include/KeyWords.h \ - ../include/Scintilla.h ../include/SciLexer.h + ../include/Accessor.h ../src/StyleContext.h ../include/KeyWords.h \ + ../include/Scintilla.h ../include/SciLexer.h LexLua.o: ../src/LexLua.cxx ../include/Platform.h ../include/PropSet.h \ - ../include/Accessor.h ../src/StyleContext.h ../include/KeyWords.h \ - ../include/Scintilla.h ../include/SciLexer.h ../src/CharacterSet.h + ../include/Accessor.h ../src/StyleContext.h ../include/KeyWords.h \ + ../include/Scintilla.h ../include/SciLexer.h ../src/CharacterSet.h LexMagik.o: ../src/LexMagik.cxx ../include/Platform.h \ - ../include/PropSet.h ../include/Accessor.h ../src/StyleContext.h \ - ../include/KeyWords.h ../include/Scintilla.h ../include/SciLexer.h + ../include/PropSet.h ../include/Accessor.h ../src/StyleContext.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 \ - ../include/PropSet.h ../include/Accessor.h ../src/StyleContext.h \ - ../include/KeyWords.h ../include/Scintilla.h ../include/SciLexer.h + ../include/PropSet.h ../include/Accessor.h ../src/StyleContext.h \ + ../include/KeyWords.h ../include/Scintilla.h ../include/SciLexer.h LexMetapost.o: ../src/LexMetapost.cxx ../include/Platform.h \ - ../include/PropSet.h ../include/Accessor.h ../include/KeyWords.h \ - ../include/Scintilla.h ../include/SciLexer.h ../src/StyleContext.h + ../include/PropSet.h ../include/Accessor.h ../include/KeyWords.h \ + ../include/Scintilla.h ../include/SciLexer.h ../src/StyleContext.h LexMMIXAL.o: ../src/LexMMIXAL.cxx ../include/Platform.h \ - ../include/PropSet.h ../include/Accessor.h ../src/StyleContext.h \ - ../include/KeyWords.h ../include/Scintilla.h ../include/SciLexer.h + ../include/PropSet.h ../include/Accessor.h ../src/StyleContext.h \ + ../include/KeyWords.h ../include/Scintilla.h ../include/SciLexer.h LexMPT.o: ../src/LexMPT.cxx ../include/Platform.h ../include/PropSet.h \ - ../include/Accessor.h ../include/KeyWords.h ../include/Scintilla.h \ - ../include/SciLexer.h + ../include/Accessor.h ../include/KeyWords.h ../include/Scintilla.h \ + ../include/SciLexer.h LexMSSQL.o: ../src/LexMSSQL.cxx ../include/Platform.h \ - ../include/PropSet.h ../include/Accessor.h ../include/KeyWords.h \ - ../include/Scintilla.h ../include/SciLexer.h + ../include/PropSet.h ../include/Accessor.h ../include/KeyWords.h \ + ../include/Scintilla.h ../include/SciLexer.h LexMySQL.o: ../src/LexMySQL.cxx ../include/Platform.h \ - ../include/PropSet.h ../include/Accessor.h ../src/StyleContext.h \ - ../include/KeyWords.h ../include/Scintilla.h ../include/SciLexer.h + ../include/PropSet.h ../include/Accessor.h ../src/StyleContext.h \ + ../include/KeyWords.h ../include/Scintilla.h ../include/SciLexer.h LexNimrod.o: ../src/LexNimrod.cxx ../include/Platform.h \ - ../include/PropSet.h ../include/Accessor.h ../src/StyleContext.h \ - ../include/KeyWords.h ../include/Scintilla.h ../include/SciLexer.h + ../include/PropSet.h ../include/Accessor.h ../src/StyleContext.h \ + ../include/KeyWords.h ../include/Scintilla.h ../include/SciLexer.h LexNsis.o: ../src/LexNsis.cxx ../include/Platform.h ../src/CharClassify.h \ - ../include/PropSet.h ../include/Accessor.h ../include/KeyWords.h \ - ../include/Scintilla.h ../include/SciLexer.h + ../include/PropSet.h ../include/Accessor.h ../include/KeyWords.h \ + ../include/Scintilla.h ../include/SciLexer.h LexOpal.o: ../src/LexOpal.cxx ../include/Platform.h ../include/PropSet.h \ - ../include/Accessor.h ../include/KeyWords.h ../include/Scintilla.h \ - ../include/SciLexer.h ../src/StyleContext.h + ../include/Accessor.h ../include/KeyWords.h ../include/Scintilla.h \ + ../include/SciLexer.h ../src/StyleContext.h LexOthers.o: ../src/LexOthers.cxx ../include/Platform.h \ - ../src/CharClassify.h ../include/PropSet.h ../include/Accessor.h \ - ../include/KeyWords.h ../include/Scintilla.h ../include/SciLexer.h + ../src/CharClassify.h ../include/PropSet.h ../include/Accessor.h \ + ../include/KeyWords.h ../include/Scintilla.h ../include/SciLexer.h LexPascal.o: ../src/LexPascal.cxx ../include/Platform.h \ - ../include/PropSet.h ../include/Accessor.h ../include/KeyWords.h \ - ../include/Scintilla.h ../include/SciLexer.h ../src/StyleContext.h \ - ../src/CharacterSet.h + ../include/PropSet.h ../include/Accessor.h ../include/KeyWords.h \ + ../include/Scintilla.h ../include/SciLexer.h ../src/StyleContext.h \ + ../src/CharacterSet.h LexPB.o: ../src/LexPB.cxx ../include/Platform.h ../include/PropSet.h \ - ../include/Accessor.h ../src/StyleContext.h ../include/KeyWords.h \ - ../include/Scintilla.h ../include/SciLexer.h + ../include/Accessor.h ../src/StyleContext.h ../include/KeyWords.h \ + ../include/Scintilla.h ../include/SciLexer.h LexPerl.o: ../src/LexPerl.cxx ../include/Platform.h ../include/PropSet.h \ - ../include/Accessor.h ../src/StyleContext.h ../include/KeyWords.h \ - ../include/Scintilla.h ../include/SciLexer.h ../src/CharacterSet.h + ../include/Accessor.h ../src/StyleContext.h ../include/KeyWords.h \ + ../include/Scintilla.h ../include/SciLexer.h ../src/CharacterSet.h LexPLM.o: ../src/LexPLM.cxx ../include/Platform.h ../include/PropSet.h \ - ../include/Accessor.h ../include/KeyWords.h ../include/Scintilla.h \ - ../include/SciLexer.h ../src/StyleContext.h + ../include/Accessor.h ../include/KeyWords.h ../include/Scintilla.h \ + ../include/SciLexer.h ../src/StyleContext.h LexPOV.o: ../src/LexPOV.cxx ../include/Platform.h ../include/PropSet.h \ - ../include/Accessor.h ../src/StyleContext.h ../include/KeyWords.h \ - ../include/Scintilla.h ../include/SciLexer.h + ../include/Accessor.h ../src/StyleContext.h ../include/KeyWords.h \ + ../include/Scintilla.h ../include/SciLexer.h LexPowerPro.o: ../src/LexPowerPro.cxx ../include/Platform.h \ - ../include/PropSet.h ../include/Accessor.h ../src/StyleContext.h \ - ../include/KeyWords.h ../include/Scintilla.h ../include/SciLexer.h \ - ../src/CharacterSet.h + ../include/PropSet.h ../include/Accessor.h ../src/StyleContext.h \ + ../include/KeyWords.h ../include/Scintilla.h ../include/SciLexer.h \ + ../src/CharacterSet.h LexPowerShell.o: ../src/LexPowerShell.cxx ../include/Platform.h \ - ../include/PropSet.h ../include/Accessor.h ../src/StyleContext.h \ - ../include/KeyWords.h ../include/Scintilla.h ../include/SciLexer.h + ../include/PropSet.h ../include/Accessor.h ../src/StyleContext.h \ + ../include/KeyWords.h ../include/Scintilla.h ../include/SciLexer.h LexProgress.o: ../src/LexProgress.cxx ../include/Platform.h \ - ../include/PropSet.h ../include/Accessor.h ../src/StyleContext.h \ - ../include/KeyWords.h ../include/Scintilla.h ../include/SciLexer.h + ../include/PropSet.h ../include/Accessor.h ../src/StyleContext.h \ + ../include/KeyWords.h ../include/Scintilla.h ../include/SciLexer.h LexPS.o: ../src/LexPS.cxx ../include/Platform.h ../include/PropSet.h \ - ../include/Accessor.h ../src/StyleContext.h ../include/KeyWords.h \ - ../include/Scintilla.h ../include/SciLexer.h + ../include/Accessor.h ../src/StyleContext.h ../include/KeyWords.h \ + ../include/Scintilla.h ../include/SciLexer.h LexPython.o: ../src/LexPython.cxx ../include/Platform.h \ - ../include/PropSet.h ../include/Accessor.h ../src/StyleContext.h \ - ../include/KeyWords.h ../include/Scintilla.h ../include/SciLexer.h + ../include/PropSet.h ../include/Accessor.h ../src/StyleContext.h \ + ../include/KeyWords.h ../include/Scintilla.h ../include/SciLexer.h LexR.o: ../src/LexR.cxx ../include/Platform.h ../include/PropSet.h \ - ../include/Accessor.h ../src/StyleContext.h ../include/KeyWords.h \ - ../include/Scintilla.h ../include/SciLexer.h + ../include/Accessor.h ../src/StyleContext.h ../include/KeyWords.h \ + ../include/Scintilla.h ../include/SciLexer.h LexRebol.o: ../src/LexRebol.cxx ../include/Platform.h \ - ../include/PropSet.h ../include/Accessor.h ../include/KeyWords.h \ - ../include/Scintilla.h ../include/SciLexer.h ../src/StyleContext.h + ../include/PropSet.h ../include/Accessor.h ../include/KeyWords.h \ + ../include/Scintilla.h ../include/SciLexer.h ../src/StyleContext.h LexRuby.o: ../src/LexRuby.cxx ../include/Platform.h ../include/PropSet.h \ - ../include/Accessor.h ../include/KeyWords.h ../include/Scintilla.h \ - ../include/SciLexer.h + ../include/Accessor.h ../include/KeyWords.h ../include/Scintilla.h \ + ../include/SciLexer.h LexScriptol.o: ../src/LexScriptol.cxx ../include/Platform.h \ - ../include/PropSet.h ../include/Accessor.h ../include/KeyWords.h \ - ../include/Scintilla.h ../include/SciLexer.h + ../include/PropSet.h ../include/Accessor.h ../include/KeyWords.h \ + ../include/Scintilla.h ../include/SciLexer.h LexSmalltalk.o: ../src/LexSmalltalk.cxx ../include/Platform.h \ - ../include/PropSet.h ../include/Accessor.h ../src/StyleContext.h \ - ../include/KeyWords.h ../include/Scintilla.h ../include/SciLexer.h + ../include/PropSet.h ../include/Accessor.h ../src/StyleContext.h \ + ../include/KeyWords.h ../include/Scintilla.h ../include/SciLexer.h LexSML.o: ../src/LexSML.cxx ../include/Platform.h ../include/PropSet.h \ - ../include/Accessor.h ../src/StyleContext.h ../include/KeyWords.h \ - ../include/Scintilla.h ../include/SciLexer.h + ../include/Accessor.h ../src/StyleContext.h ../include/KeyWords.h \ + ../include/Scintilla.h ../include/SciLexer.h LexSorcus.o: ../src/LexSorcus.cxx ../include/Platform.h \ - ../include/PropSet.h ../include/Accessor.h ../src/StyleContext.h \ - ../include/KeyWords.h ../include/Scintilla.h ../include/SciLexer.h + ../include/PropSet.h ../include/Accessor.h ../src/StyleContext.h \ + ../include/KeyWords.h ../include/Scintilla.h ../include/SciLexer.h LexSpecman.o: ../src/LexSpecman.cxx ../include/Platform.h \ - ../include/PropSet.h ../include/Accessor.h ../src/StyleContext.h \ - ../include/KeyWords.h ../include/Scintilla.h ../include/SciLexer.h + ../include/PropSet.h ../include/Accessor.h ../src/StyleContext.h \ + ../include/KeyWords.h ../include/Scintilla.h ../include/SciLexer.h LexSpice.o: ../src/LexSpice.cxx ../include/Platform.h \ - ../include/Accessor.h ../src/StyleContext.h ../include/PropSet.h \ - ../include/KeyWords.h ../include/SciLexer.h + ../include/Accessor.h ../src/StyleContext.h ../include/PropSet.h \ + ../include/KeyWords.h ../include/SciLexer.h LexSQL.o: ../src/LexSQL.cxx ../include/Platform.h ../include/PropSet.h \ - ../include/Accessor.h ../src/StyleContext.h ../include/KeyWords.h \ - ../include/Scintilla.h ../include/SciLexer.h + ../include/Accessor.h ../src/StyleContext.h ../include/KeyWords.h \ + ../include/Scintilla.h ../include/SciLexer.h LexTACL.o: ../src/LexTACL.cxx ../include/Platform.h ../include/PropSet.h \ - ../include/Accessor.h ../include/KeyWords.h ../include/Scintilla.h \ - ../include/SciLexer.h ../src/StyleContext.h + ../include/Accessor.h ../include/KeyWords.h ../include/Scintilla.h \ + ../include/SciLexer.h ../src/StyleContext.h LexTADS3.o: ../src/LexTADS3.cxx ../include/Platform.h \ - ../include/PropSet.h ../include/Accessor.h ../src/StyleContext.h \ - ../include/KeyWords.h ../include/Scintilla.h ../include/SciLexer.h + ../include/PropSet.h ../include/Accessor.h ../src/StyleContext.h \ + ../include/KeyWords.h ../include/Scintilla.h ../include/SciLexer.h LexTAL.o: ../src/LexTAL.cxx ../include/Platform.h ../include/PropSet.h \ - ../include/Accessor.h ../include/KeyWords.h ../include/Scintilla.h \ - ../include/SciLexer.h ../src/StyleContext.h + ../include/Accessor.h ../include/KeyWords.h ../include/Scintilla.h \ + ../include/SciLexer.h ../src/StyleContext.h LexTCL.o: ../src/LexTCL.cxx ../include/Platform.h ../include/PropSet.h \ - ../include/Accessor.h ../src/StyleContext.h ../include/KeyWords.h \ - ../include/Scintilla.h ../include/SciLexer.h + ../include/Accessor.h ../src/StyleContext.h ../include/KeyWords.h \ + ../include/Scintilla.h ../include/SciLexer.h LexTeX.o: ../src/LexTeX.cxx ../include/Platform.h ../include/PropSet.h \ - ../include/Accessor.h ../include/KeyWords.h ../include/Scintilla.h \ - ../include/SciLexer.h ../src/StyleContext.h + ../include/Accessor.h ../include/KeyWords.h ../include/Scintilla.h \ + ../include/SciLexer.h ../src/StyleContext.h LexVB.o: ../src/LexVB.cxx ../include/Platform.h ../include/PropSet.h \ - ../include/Accessor.h ../src/StyleContext.h ../include/KeyWords.h \ - ../include/Scintilla.h ../include/SciLexer.h + ../include/Accessor.h ../src/StyleContext.h ../include/KeyWords.h \ + ../include/Scintilla.h ../include/SciLexer.h LexVerilog.o: ../src/LexVerilog.cxx ../include/Platform.h \ - ../include/PropSet.h ../include/Accessor.h ../src/StyleContext.h \ - ../include/KeyWords.h ../include/Scintilla.h ../include/SciLexer.h + ../include/PropSet.h ../include/Accessor.h ../src/StyleContext.h \ + ../include/KeyWords.h ../include/Scintilla.h ../include/SciLexer.h LexVHDL.o: ../src/LexVHDL.cxx ../include/Platform.h ../include/PropSet.h \ - ../include/Accessor.h ../src/StyleContext.h ../include/KeyWords.h \ - ../include/Scintilla.h ../include/SciLexer.h + ../include/Accessor.h ../src/StyleContext.h ../include/KeyWords.h \ + ../include/Scintilla.h ../include/SciLexer.h LexYAML.o: ../src/LexYAML.cxx ../include/Platform.h ../include/PropSet.h \ - ../include/Accessor.h ../src/StyleContext.h ../include/KeyWords.h \ - ../include/Scintilla.h ../include/SciLexer.h + ../include/Accessor.h ../src/StyleContext.h ../include/KeyWords.h \ + ../include/Scintilla.h ../include/SciLexer.h LineMarker.o: ../src/LineMarker.cxx ../include/Platform.h \ - ../include/Scintilla.h ../src/XPM.h ../src/LineMarker.h + ../include/Scintilla.h ../src/XPM.h ../src/LineMarker.h PerLine.o: ../src/PerLine.cxx ../include/Platform.h \ - ../include/Scintilla.h ../src/SplitVector.h ../src/Partitioning.h \ - ../src/CellBuffer.h ../src/PerLine.h + ../include/Scintilla.h ../src/SplitVector.h ../src/Partitioning.h \ + ../src/CellBuffer.h ../src/PerLine.h PositionCache.o: ../src/PositionCache.cxx ../include/Platform.h \ - ../include/Scintilla.h ../src/SplitVector.h ../src/Partitioning.h \ - ../src/RunStyles.h ../src/ContractionState.h ../src/CellBuffer.h \ - ../src/KeyMap.h ../src/Indicator.h ../src/XPM.h ../src/LineMarker.h \ - ../src/Style.h ../src/ViewStyle.h ../src/CharClassify.h \ - ../src/Decoration.h ../src/Document.h ../src/Selection.h \ - ../src/PositionCache.h + ../include/Scintilla.h ../src/SplitVector.h ../src/Partitioning.h \ + ../src/RunStyles.h ../src/ContractionState.h ../src/CellBuffer.h \ + ../src/KeyMap.h ../src/Indicator.h ../src/XPM.h ../src/LineMarker.h \ + ../src/Style.h ../src/ViewStyle.h ../src/CharClassify.h \ + ../src/Decoration.h ../src/Document.h ../src/Selection.h \ + ../src/PositionCache.h PropSet.o: ../src/PropSet.cxx ../include/Platform.h ../include/PropSet.h \ - ../src/PropSetSimple.h + ../src/PropSetSimple.h RESearch.o: ../src/RESearch.cxx ../src/CharClassify.h ../src/RESearch.h RunStyles.o: ../src/RunStyles.cxx ../include/Platform.h \ - ../include/Scintilla.h ../src/SplitVector.h ../src/Partitioning.h \ - ../src/RunStyles.h + ../include/Scintilla.h ../src/SplitVector.h ../src/Partitioning.h \ + ../src/RunStyles.h ScintillaBase.o: ../src/ScintillaBase.cxx ../include/Platform.h \ - ../include/Scintilla.h ../include/PropSet.h ../src/PropSetSimple.h \ - ../include/SciLexer.h ../include/Accessor.h ../src/DocumentAccessor.h \ - ../include/KeyWords.h ../src/SplitVector.h ../src/Partitioning.h \ - ../src/RunStyles.h ../src/ContractionState.h ../src/CellBuffer.h \ - ../src/CallTip.h ../src/KeyMap.h ../src/Indicator.h ../src/XPM.h \ - ../src/LineMarker.h ../src/Style.h ../src/ViewStyle.h \ - ../src/AutoComplete.h ../src/CharClassify.h ../src/Decoration.h \ - ../src/Document.h ../src/Selection.h ../src/PositionCache.h \ - ../src/Editor.h ../src/ScintillaBase.h + ../include/Scintilla.h ../include/PropSet.h ../src/PropSetSimple.h \ + ../include/SciLexer.h ../include/Accessor.h ../src/DocumentAccessor.h \ + ../include/KeyWords.h ../src/SplitVector.h ../src/Partitioning.h \ + ../src/RunStyles.h ../src/ContractionState.h ../src/CellBuffer.h \ + ../src/CallTip.h ../src/KeyMap.h ../src/Indicator.h ../src/XPM.h \ + ../src/LineMarker.h ../src/Style.h ../src/ViewStyle.h \ + ../src/AutoComplete.h ../src/CharClassify.h ../src/Decoration.h \ + ../src/Document.h ../src/Selection.h ../src/PositionCache.h \ + ../src/Editor.h ../src/ScintillaBase.h Selection.o: ../src/Selection.cxx ../include/Platform.h \ - ../include/Scintilla.h ../src/Selection.h + ../include/Scintilla.h ../src/Selection.h StyleContext.o: ../src/StyleContext.cxx ../include/Platform.h \ - ../include/PropSet.h ../include/Accessor.h ../src/StyleContext.h + ../include/PropSet.h ../include/Accessor.h ../src/StyleContext.h Style.o: ../src/Style.cxx ../include/Platform.h ../include/Scintilla.h \ - ../src/Style.h + ../src/Style.h UniConversion.o: ../src/UniConversion.cxx ../src/UniConversion.h ViewStyle.o: ../src/ViewStyle.cxx ../include/Platform.h \ - ../include/Scintilla.h ../src/SplitVector.h ../src/Partitioning.h \ - ../src/RunStyles.h ../src/Indicator.h ../src/XPM.h ../src/LineMarker.h \ - ../src/Style.h ../src/ViewStyle.h + ../include/Scintilla.h ../src/SplitVector.h ../src/Partitioning.h \ + ../src/RunStyles.h ../src/Indicator.h ../src/XPM.h ../src/LineMarker.h \ + ../src/Style.h ../src/ViewStyle.h WindowAccessor.o: ../src/WindowAccessor.cxx ../include/Platform.h \ - ../include/PropSet.h ../include/Accessor.h ../include/WindowAccessor.h \ - ../include/Scintilla.h + ../include/PropSet.h ../include/Accessor.h ../include/WindowAccessor.h \ + ../include/Scintilla.h XPM.o: ../src/XPM.cxx ../include/Platform.h ../src/XPM.h diff --git a/scintilla/gtk/makefile b/scintilla/gtk/makefile index 6fa7c804..d62c8f34 100644 --- a/scintilla/gtk/makefile +++ b/scintilla/gtk/makefile @@ -1,21 +1,27 @@ # Make file for Scintilla on Linux or compatible OS -# Copyright 1998-2001 by Neil Hodgson +# Copyright 1998-2010 by Neil Hodgson # 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. -# Builds for GTK+ 2 if available else GTK+ 1. -# To force GTK+ 2 build, define GTK2 on the make command line. -# To force GTK+ 1 build, define GTK1 on the make command line. +# Builds for GTK+ 2 and no longer supports GTK+ 1. +# Also works with ming32-make on Windows. .SUFFIXES: .cxx .c .o .h .a +ifdef CLANG +CC = clang +CCOMP = clang +else CC = g++ CCOMP = gcc +endif AR = ar RANLIB = touch +ifndef windir ifeq ($(shell uname),Darwin) RANLIB = ranlib endif +endif COMPLIB=../bin/scintilla.a @@ -23,7 +29,7 @@ vpath %.h ../src ../include vpath %.cxx ../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 THREADFLAGS=-DG_THREADS_IMPL_NONE @@ -37,23 +43,8 @@ else CXXFLAGS=-DNDEBUG -Os $(CXXBASEFLAGS) $(THREADFLAGS) 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) 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: $(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 \ 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 \ -LexLout.o LexLua.o LexMagik.o LexMatlab.o LexMetapost.o LexMMIXAL.o LexMPT.o \ -LexMSSQL.o LexMySQL.o LexNimrod.o LexNsis.o LexOpal.o LexOthers.o LexPascal.o \ -LexPB.o LexPerl.o LexPLM.o LexPOV.o LexPowerPro.o LexPowerShell.o \ -LexProgress.o LexPS.o LexPython.o LexR.o LexRebol.o LexRuby.o LexScriptol.o \ -LexSmalltalk.o LexSML.o LexSorcus.o LexSpecman.o LexSpice.o LexSQL.o LexTACL.o \ -LexTADS3.o LexTAL.o LexTCL.o LexTeX.o LexVB.o LexVerilog.o LexVHDL.o LexYAML.o +LexLout.o LexLua.o LexMagik.o LexMarkdown.o LexMatlab.o LexMetapost.o \ +LexMMIXAL.o LexMPT.o LexMSSQL.o LexMySQL.o LexNimrod.o LexNsis.o LexOpal.o \ +LexOthers.o LexPascal.o LexPB.o LexPerl.o LexPLM.o LexPOV.o LexPowerPro.o \ +LexPowerShell.o LexProgress.o LexPS.o LexPython.o LexR.o LexRebol.o LexRuby.o \ +LexScriptol.o LexSmalltalk.o LexSML.o LexSorcus.o LexSpecman.o LexSpice.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 all: $(COMPLIB) diff --git a/scintilla/include/Platform.h b/scintilla/include/Platform.h index b5b4f64e..84b20529 100644 --- a/scintilla/include/Platform.h +++ b/scintilla/include/Platform.h @@ -295,7 +295,7 @@ public: virtual ~Font(); 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(); FontID GetID() { return fid; } @@ -314,8 +314,8 @@ private: Surface(const Surface &) {} Surface &operator=(const Surface &) { return *this; } public: - Surface() {}; - virtual ~Surface() {}; + Surface() {} + virtual ~Surface() {} static Surface *Allocate(); virtual void Init(WindowID wid)=0; @@ -474,7 +474,7 @@ public: */ class DynamicLibrary { public: - virtual ~DynamicLibrary() {}; + virtual ~DynamicLibrary() {} /// @return Pointer to function "name", or NULL on failure. virtual Function FindFunction(const char *name) = 0; diff --git a/scintilla/include/SciLexer.h b/scintilla/include/SciLexer.h index 68068877..2902b55e 100644 --- a/scintilla/include/SciLexer.h +++ b/scintilla/include/SciLexer.h @@ -110,11 +110,13 @@ #define SCLEX_POWERPRO 95 #define SCLEX_NIMROD 96 #define SCLEX_SML 97 +#define SCLEX_MARKDOWN 198 #define SCLEX_SEARCHRESULT 98 #define SCLEX_OBJC 99 #define SCLEX_USER 100 + #define SCLEX_AUTOMATIC 1000 //For All lexer @@ -682,6 +684,7 @@ #define SCE_CSS_EXTENDED_IDENTIFIER 19 #define SCE_CSS_EXTENDED_PSEUDOCLASS 20 #define SCE_CSS_EXTENDED_PSEUDOELEMENT 21 +#define SCE_CSS_MEDIA 22 #define SCE_POV_DEFAULT 0 #define SCE_POV_COMMENT 1 #define SCE_POV_COMMENTLINE 2 @@ -834,8 +837,19 @@ #define SCE_ERLANG_CHARACTER 9 #define SCE_ERLANG_MACRO 10 #define SCE_ERLANG_RECORD 11 -#define SCE_ERLANG_SEPARATOR 12 +#define SCE_ERLANG_PREPROC 12 #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_MSSQL_DEFAULT 0 #define SCE_MSSQL_COMMENT 1 @@ -1115,11 +1129,19 @@ #define SCE_FS_DATE 16 #define SCE_FS_STRINGEOL 17 #define SCE_FS_CONSTANT 18 -#define SCE_FS_ASM 19 -#define SCE_FS_LABEL 20 -#define SCE_FS_ERROR 21 -#define SCE_FS_HEXNUMBER 22 -#define SCE_FS_BINNUMBER 23 +#define SCE_FS_WORDOPERATOR 19 +#define SCE_FS_DISABLEDCODE 20 +#define SCE_FS_DEFAULT_C 21 +#define SCE_FS_COMMENTDOC_C 22 +#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_COMMENT 1 #define SCE_CSOUND_NUMBER 2 @@ -1142,7 +1164,6 @@ #define SCE_INNO_PARAMETER 3 #define SCE_INNO_SECTION 4 #define SCE_INNO_PREPROC 5 -#define SCE_INNO_PREPROC_INLINE 6 #define SCE_INNO_INLINE_EXPANSION 6 #define SCE_INNO_COMMENT_PASCAL 7 #define SCE_INNO_KEYWORD_PASCAL 8 @@ -1389,6 +1410,28 @@ #define SCE_SML_COMMENT1 13 #define SCE_SML_COMMENT2 14 #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 */ #endif diff --git a/scintilla/include/Scintilla.h b/scintilla/include/Scintilla.h index fcfa9e01..856f667e 100644 --- a/scintilla/include/Scintilla.h +++ b/scintilla/include/Scintilla.h @@ -11,17 +11,21 @@ #ifndef SCINTILLA_H #define SCINTILLA_H -#if LCCWIN -typedef BOOL bool; +#ifdef __cplusplus +extern "C" { #endif -#if PLAT_WIN +#if defined(_WIN32) /* Return false on failure: */ -bool Scintilla_RegisterClasses(void *hInstance); -bool Scintilla_ReleaseResources(); +int Scintilla_RegisterClasses(void *hInstance); +int Scintilla_ReleaseResources(); #endif int Scintilla_LinkLexers(); +#ifdef __cplusplus +} +#endif + /* 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. * 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_SETWHITESPACEBACK 2085 +#define SCI_SETWHITESPACESIZE 2086 +#define SCI_GETWHITESPACESIZE 2087 #define SCI_SETSTYLEBITS 2090 #define SCI_GETSTYLEBITS 2091 #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_GETTWOPHASEDRAW 2283 #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_LINESJOIN 2288 #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_SETCHARSDEFAULT 2444 #define SCI_AUTOCGETCURRENT 2445 +#define SCI_AUTOCGETCURRENTTEXT 2610 #define SCI_ALLOCATE 2446 #define SCI_TARGETASUTF8 2447 #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_SETADDITIONALCARETSBLINK 2567 #define SCI_GETADDITIONALCARETSBLINK 2568 +#define SCI_SETADDITIONALCARETSVISIBLE 2608 +#define SCI_GETADDITIONALCARETSVISIBLE 2609 #define SCI_GETSELECTIONS 2570 #define SCI_CLEARSELECTIONS 2571 #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_GETPROPERTYINT 4010 #define SCI_GETSTYLEBITSNEEDED 4011 +#define SCI_GETLEXERLANGUAGE 4012 #define SC_MOD_INSERTTEXT 0x1 #define SC_MOD_DELETETEXT 0x2 #define SC_MOD_CHANGESTYLE 0x4 @@ -886,23 +909,28 @@ struct Sci_TextToFind { #define TextRange Sci_TextRange #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 * from Platform.h. Not needed by most client code. */ struct Sci_RangeToFormat { - SurfaceID hdc; - SurfaceID hdcTarget; - PRectangle rc; - PRectangle rcPage; - Sci_CharacterRange chrg; + Sci_SurfaceID hdc; + Sci_SurfaceID hdcTarget; + struct Sci_Rectangle rc; + struct Sci_Rectangle rcPage; + struct Sci_CharacterRange chrg; }; #define RangeToFormat Sci_RangeToFormat -#endif - struct Sci_NotifyHeader { /* Compatible with Windows NMHDR. * hwndFrom is really an environment specific window handle or pointer diff --git a/scintilla/include/Scintilla.iface b/scintilla/include/Scintilla.iface index 8ac2822f..2a895316 100644 --- a/scintilla/include/Scintilla.iface +++ b/scintilla/include/Scintilla.iface @@ -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. 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 # bits (default: 3). If a lexer requires more than 32 lexical states, then this # 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. 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. fun void TargetFromSelection=2287(,) @@ -1718,6 +1755,10 @@ fun void SetCharsDefault=2444(,) # Get currently selected item position in the auto-completion list 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. fun void Allocate=2446(int bytes,) @@ -1945,6 +1986,12 @@ set void SetAdditionalCaretsBlink=2567(bool additionalCaretsBlink,) # Whether additional carets will blink 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? get int GetSelections=2570(,) @@ -1976,13 +2023,13 @@ get int GetSelectionNAnchorVirtualSpace=2583(int selection,) set void SetSelectionNStart=2584(int selection, position pos) # 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. set void SetSelectionNEnd=2586(int selection, position pos,) # 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,) 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. get int GetStyleBitsNeeded=4011(,) +# Retrieve the name of the lexer. +# Return the length of the text. +get int GetLexerLanguage=4012(, stringresult text) + # Notifications # 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. @@ -2247,6 +2298,7 @@ val SCLEX_SORCUS=94 val SCLEX_POWERPRO=95 val SCLEX_NIMROD=96 val SCLEX_SML=97 +val SCLEX_MARKDOWN=98 # When a lexer specifies its language as SCLEX_AUTOMATIC it receives a # 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_PSEUDOCLASS=20 val SCE_CSS_EXTENDED_PSEUDOELEMENT=21 +val SCE_CSS_MEDIA=22 # Lexical states for SCLEX_POV lex POV=SCLEX_POV SCE_POV_ val SCE_POV_DEFAULT=0 @@ -3029,8 +3082,19 @@ val SCE_ERLANG_FUNCTION_NAME=8 val SCE_ERLANG_CHARACTER=9 val SCE_ERLANG_MACRO=10 val SCE_ERLANG_RECORD=11 -val SCE_ERLANG_SEPARATOR=12 +val SCE_ERLANG_PREPROC=12 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 # Lexical states for SCLEX_OCTAVE are identical to MatLab lex Octave=SCLEX_OCTAVE SCE_MATLAB_ @@ -3325,7 +3389,7 @@ val SCE_ST_ASSIGN=14 val SCE_ST_CHARACTER=15 val SCE_ST_SPEC_SEL=16 # 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_COMMENT=1 val SCE_FS_COMMENTLINE=2 @@ -3345,11 +3409,19 @@ val SCE_FS_IDENTIFIER=15 val SCE_FS_DATE=16 val SCE_FS_STRINGEOL=17 val SCE_FS_CONSTANT=18 -val SCE_FS_ASM=19 -val SCE_FS_LABEL=20 -val SCE_FS_ERROR=21 -val SCE_FS_HEXNUMBER=22 -val SCE_FS_BINNUMBER=23 +val SCE_FS_WORDOPERATOR=19 +val SCE_FS_DISABLEDCODE=20 +val SCE_FS_DEFAULT_C=21 +val SCE_FS_COMMENTDOC_C=22 +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 lex Csound=SCLEX_CSOUND SCE_CSOUND_ val SCE_CSOUND_DEFAULT=0 @@ -3376,7 +3448,6 @@ val SCE_INNO_KEYWORD=2 val SCE_INNO_PARAMETER=3 val SCE_INNO_SECTION=4 val SCE_INNO_PREPROC=5 -val SCE_INNO_PREPROC_INLINE=6 val SCE_INNO_INLINE_EXPANSION=6 val SCE_INNO_COMMENT_PASCAL=7 val SCE_INNO_KEYWORD_PASCAL=8 @@ -3657,6 +3728,30 @@ val SCE_SML_COMMENT=12 val SCE_SML_COMMENT1=13 val SCE_SML_COMMENT2=14 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 diff --git a/scintilla/include/ScintillaWidget.h b/scintilla/include/ScintillaWidget.h index e0acbd1f..44cff60e 100644 --- a/scintilla/include/ScintillaWidget.h +++ b/scintilla/include/ScintillaWidget.h @@ -9,7 +9,7 @@ #ifndef SCINTILLAWIDGET_H #define SCINTILLAWIDGET_H -#if PLAT_GTK +#if defined(GTK) #ifdef __cplusplus extern "C" { @@ -34,21 +34,13 @@ struct _ScintillaClass { void (* notify) (ScintillaObject *ttt); }; -#if GLIB_MAJOR_VERSION < 2 -GtkType scintilla_get_type (void); -#else GType scintilla_get_type (void); -#endif GtkWidget* scintilla_new (void); 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); void scintilla_release_resources(void); -#if GTK_MAJOR_VERSION < 2 -#define SCINTILLA_NOTIFY "notify" -#else #define SCINTILLA_NOTIFY "sci-notify" -#endif #ifdef __cplusplus } diff --git a/scintilla/include/WindowAccessor.h b/scintilla/include/WindowAccessor.h index 09443cef..ed67e292 100644 --- a/scintilla/include/WindowAccessor.h +++ b/scintilla/include/WindowAccessor.h @@ -53,7 +53,7 @@ public: } 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; } void StartSegment(unsigned int pos); void ColourTo(unsigned int pos, int chAttr); diff --git a/scintilla/src/AutoComplete.cxx b/scintilla/src/AutoComplete.cxx index 87255c6c..e7d6164f 100644 --- a/scintilla/src/AutoComplete.cxx +++ b/scintilla/src/AutoComplete.cxx @@ -43,12 +43,12 @@ AutoComplete::~AutoComplete() { } } -bool AutoComplete::Active() { +bool AutoComplete::Active() const { return active; } -void AutoComplete::Start(Window &parent, int ctrlID, - int position, Point location, int startLen_, +void AutoComplete::Start(Window &parent, int ctrlID, + int position, Point location, int startLen_, int lineHeight, bool unicodeMode) { if (active) { Cancel(); @@ -82,7 +82,7 @@ void AutoComplete::SetSeparator(char separator_) { separator = separator_; } -char AutoComplete::GetSeparator() { +char AutoComplete::GetSeparator() const { return separator; } @@ -90,7 +90,7 @@ void AutoComplete::SetTypesep(char separator_) { typesep = separator_; } -char AutoComplete::GetTypesep() { +char AutoComplete::GetTypesep() const { return typesep; } diff --git a/scintilla/src/AutoComplete.h b/scintilla/src/AutoComplete.h index 0a38d80e..258a9f59 100644 --- a/scintilla/src/AutoComplete.h +++ b/scintilla/src/AutoComplete.h @@ -36,7 +36,7 @@ public: ~AutoComplete(); /// Is the auto completion list displayed? - bool Active(); + bool Active() const; /// Display the auto completion list positioned to be near a character position 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 void SetSeparator(char separator_); - char GetSeparator(); + char GetSeparator() const; /// The typesep character is used for seperating the word from the type void SetTypesep(char separator_); - char GetTypesep(); + char GetTypesep() const; /// The list string contains a sequence of words separated by the separator character void SetList(const char *list); diff --git a/scintilla/src/CallTip.cxx b/scintilla/src/CallTip.cxx index f323746e..45eff35b 100644 --- a/scintilla/src/CallTip.cxx +++ b/scintilla/src/CallTip.cxx @@ -68,7 +68,7 @@ static bool IsArrowCharacter(char ch) { } // 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'); } @@ -95,7 +95,7 @@ void CallTip::DrawChunk(Surface *surface, int &x, const char *s, int maxEnd = 0; const int numEnds = 10; int ends[numEnds + 2]; - for (int i=0;i 0) @@ -254,8 +254,7 @@ PRectangle CallTip::CallTipStart(int pos, Point pt, const char *defn, const char *faceName, int size, int codePage_, int characterSet, Window &wParent) { clickPlace = 0; - if (val) - delete []val; + delete []val; val = 0; val = new char[strlen(defn) + 1]; strcpy(val, defn); diff --git a/scintilla/src/CallTip.h b/scintilla/src/CallTip.h index 52fddd13..21b48adf 100644 --- a/scintilla/src/CallTip.h +++ b/scintilla/src/CallTip.h @@ -27,13 +27,13 @@ class CallTip { bool useStyleCallTip; // if true, STYLE_CALLTIP should be used // Private so CallTip objects can not be copied - CallTip(const CallTip &) {} - CallTip &operator=(const CallTip &) { return *this; } + CallTip(const CallTip &); + CallTip &operator=(const CallTip &); void DrawChunk(Surface *surface, int &x, const char *s, int posStart, int posEnd, int ytext, PRectangle rcClient, bool highlight, bool draw); int PaintContents(Surface *surfaceWindow, bool draw); - bool IsTabCharacter(char c); + bool IsTabCharacter(char c) const; int NextTabPos(int x); public: @@ -61,7 +61,7 @@ public: /// Setup the calltip and return a rectangle of the area required. PRectangle CallTipStart(int pos, Point pt, const char *defn, - const char *faceName, int size, int codePage_, + const char *faceName, int size, int codePage_, int characterSet, Window &wParent); void CallTipCancel(); diff --git a/scintilla/src/CellBuffer.cxx b/scintilla/src/CellBuffer.cxx index 080ada68..079d00a6 100644 --- a/scintilla/src/CellBuffer.cxx +++ b/scintilla/src/CellBuffer.cxx @@ -44,9 +44,11 @@ void LineVector::InsertText(int line, int 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); if (perLine) { + if ((line > 0) && lineStart) + line--; perLine->InsertLine(line); } } @@ -71,6 +73,7 @@ Action::Action() { position = 0; data = 0; lenData = 0; + mayCoalesce = false; } Action::~Action() { @@ -196,7 +199,7 @@ void UndoHistory::AppendAction(actionType at, int position, char *data, int leng // Insertions must be immediately after to coalesce currentAction++; } else if (at == removeAction) { - if ((lengthData == 1) || (lengthData == 2)){ + if ((lengthData == 1) || (lengthData == 2)) { if ((position + lengthData) == actPrevious->position) { ; // Backspace -> OK } else if (position == actPrevious->position) { @@ -338,7 +341,7 @@ char CellBuffer::CharAt(int position) const { 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) return; if (position < 0) @@ -348,17 +351,17 @@ void CellBuffer::GetCharRange(char *buffer, int position, int lengthRetrieve) { lengthRetrieve, substance.Length()); return; } - + for (int i=0; i= 0); + if (val < 0) return false; return (val < size) ? bset[val] : valueAfter; } }; diff --git a/scintilla/src/ContractionState.cxx b/scintilla/src/ContractionState.cxx index d6a6be4b..57821824 100644 --- a/scintilla/src/ContractionState.cxx +++ b/scintilla/src/ContractionState.cxx @@ -232,11 +232,11 @@ void ContractionState::ShowAll() { void ContractionState::Check() const { #ifdef CHECK_CORRECTNESS - for (int vline = 0;vline < LinesDisplayed(); vline++) { + for (int vline = 0; vline < LinesDisplayed(); vline++) { const int lineDoc = DocFromDisplay(vline); 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 displayNext = DisplayFromDoc(lineDoc + 1); const int height = displayNext - displayThis; diff --git a/scintilla/src/Decoration.h b/scintilla/src/Decoration.h index 25c28e5c..2b75f970 100644 --- a/scintilla/src/Decoration.h +++ b/scintilla/src/Decoration.h @@ -40,10 +40,10 @@ public: ~DecorationList(); void SetCurrentIndicator(int indicator); - int GetCurrentIndicator() { return currentIndicator; } + int GetCurrentIndicator() const { return currentIndicator; } void SetCurrentValue(int value); - int GetCurrentValue() { return currentValue; } + int GetCurrentValue() const { return currentValue; } // Returns true if some values may have changed bool FillRange(int &position, int value, int &fillLength); diff --git a/scintilla/src/Document.cxx b/scintilla/src/Document.cxx index 4b252733..4ed22d4a 100644 --- a/scintilla/src/Document.cxx +++ b/scintilla/src/Document.cxx @@ -10,6 +10,17 @@ #include #include +#include +#include + +// With Borland C++ 5.5, including 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 "Scintilla.h" @@ -22,103 +33,12 @@ #include "Decoration.h" #include "Document.h" #include "RESearch.h" +#include "UniConversion.h" #ifdef SCI_NAMESPACE using namespace Scintilla; #endif -//Vitaliy -#include "UniConversion.h" -#include -#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(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(ch - 'A' + 'a'); - else - return Platform_MakeLowerCharA(ch); -} -// yilatiV - // This is ASCII specific but is safe with chars >= 0x80 static inline bool isspacechar(unsigned char ch) { return (ch == ' ') || ((ch >= 0x09) && (ch <= 0x0d)); @@ -232,13 +152,13 @@ void Document::SetSavePoint() { NotifySavePoint(true); } -int Document::GetMark(int line) { - return static_cast(perLineData[ldMarkers])->MarkValue(line); +int Document::GetMark(int line) { + return static_cast(perLineData[ldMarkers])->MarkValue(line); } int Document::AddMark(int line, int markerNum) { if (line <= LinesTotal()) { - int prev = static_cast(perLineData[ldMarkers])-> + int prev = static_cast(perLineData[ldMarkers])-> AddMark(line, markerNum, LinesTotal()); DocModification mh(SC_MOD_CHANGEMARKER, LineStart(line), 0, 0, 0, line); NotifyModified(mh); @@ -252,20 +172,20 @@ void Document::AddMarkSet(int line, int valueSet) { unsigned int m = valueSet; for (int i = 0; m; i++, m >>= 1) if (m & 1) - static_cast(perLineData[ldMarkers])-> + static_cast(perLineData[ldMarkers])-> AddMark(line, i, LinesTotal()); DocModification mh(SC_MOD_CHANGEMARKER, LineStart(line), 0, 0, 0, line); NotifyModified(mh); } void Document::DeleteMark(int line, int markerNum) { - static_cast(perLineData[ldMarkers])->DeleteMark(line, markerNum, false); + static_cast(perLineData[ldMarkers])->DeleteMark(line, markerNum, false); DocModification mh(SC_MOD_CHANGEMARKER, LineStart(line), 0, 0, 0, line); NotifyModified(mh); } void Document::DeleteMarkFromHandle(int markerHandle) { - static_cast(perLineData[ldMarkers])->DeleteMarkFromHandle(markerHandle); + static_cast(perLineData[ldMarkers])->DeleteMarkFromHandle(markerHandle); DocModification mh(SC_MOD_CHANGEMARKER, 0, 0, 0, 0); mh.line = -1; NotifyModified(mh); @@ -273,15 +193,15 @@ void Document::DeleteMarkFromHandle(int markerHandle) { void Document::DeleteAllMarks(int markerNum) { for (int line = 0; line < LinesTotal(); line++) { - static_cast(perLineData[ldMarkers])->DeleteMark(line, markerNum, true); + static_cast(perLineData[ldMarkers])->DeleteMark(line, markerNum, true); } DocModification mh(SC_MOD_CHANGEMARKER, 0, 0, 0, 0); mh.line = -1; NotifyModified(mh); } -int Document::LineFromHandle(int markerHandle) { - return static_cast(perLineData[ldMarkers])->LineFromHandle(markerHandle); +int Document::LineFromHandle(int markerHandle) { + return static_cast(perLineData[ldMarkers])->LineFromHandle(markerHandle); } int Document::LineStart(int line) const { @@ -318,7 +238,7 @@ int Document::VCHomePosition(int position) const { int startPosition = LineStart(line); int endLine = LineEnd(line); int startText = startPosition; - while (startText < endLine && (cb.CharAt(startText) == ' ' || cb.CharAt(startText) == '\t' ) ) + while (startText < endLine && (cb.CharAt(startText) == ' ' || cb.CharAt(startText) == '\t')) startText++; if (position == startText) return startPosition; @@ -327,7 +247,7 @@ int Document::VCHomePosition(int position) const { } int Document::SetLevel(int line, int level) { - int prev = static_cast(perLineData[ldLevels])->SetLevel(line, level, LinesTotal()); + int prev = static_cast(perLineData[ldLevels])->SetLevel(line, level, LinesTotal()); if (prev != level) { DocModification mh(SC_MOD_CHANGEFOLD | SC_MOD_CHANGEMARKER, LineStart(line), 0, 0, 0, line); @@ -338,12 +258,12 @@ int Document::SetLevel(int line, int level) { return prev; } -int Document::GetLevel(int line) { - return static_cast(perLineData[ldLevels])->GetLevel(line); +int Document::GetLevel(int line) const { + return static_cast(perLineData[ldLevels])->GetLevel(line); } -void Document::ClearLevels() { - static_cast(perLineData[ldLevels])->ClearLevels(); +void Document::ClearLevels() { + static_cast(perLineData[ldLevels])->ClearLevels(); } static bool IsSubordinate(int levelStart, int levelTry) { @@ -529,7 +449,7 @@ int Document::MovePositionOutsideChar(int pos, int moveDir, bool checkLineEnd) { while (posCheck < pos) { char mbstr[maxBytesInDBCSCharacter+1]; int i; - for(i=0;i= 0) && (line < LinesTotal())) { int lineStart = LineStart(line); int length = Length(); - for (int i = lineStart;i < length;i++) { + for (int i = lineStart; i < length; i++) { char ch = cb.CharAt(i); if (ch == ' ') indent++; @@ -874,7 +794,7 @@ int Document::GetColumn(int pos) { int column = 0; int line = LineFromPosition(pos); if ((line >= 0) && (line < LinesTotal())) { - for (int i = LineStart(line);i < pos;) { + for (int i = LineStart(line); i < pos;) { char ch = cb.CharAt(i); if (ch == '\t') { column = NextTab(column, tabInChars); @@ -896,8 +816,8 @@ int Document::GetColumn(int pos) { int Document::FindColumn(int line, int column) { int position = LineStart(line); - int columnCurrent = 0; if ((line >= 0) && (line < LinesTotal())) { + int columnCurrent = 0; while ((columnCurrent < column) && (position < Length())) { char ch = cb.CharAt(position); if (ch == '\t') { @@ -1061,7 +981,7 @@ int Document::ExtendWordSelect(int pos, int delta, bool onlyWordCharacters) { while (pos < (Length()) && (WordCharClass(cb.CharAt(pos)) == ccStart)) pos++; } - return MovePositionOutsideChar(pos, delta); + return MovePositionOutsideChar(pos, delta, true); } /** @@ -1166,157 +1086,172 @@ static inline char MakeLowerCase(char ch) { return static_cast(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(cb.CharAt(pos)); + size_t widthChar = UTF8CharLength(ch); + bytes[0] = ch; + for (size_t i=1; i(bytes[i]))) { // Bad byte + widthChar = 1; + } + } + return widthChar; +} + +CaseFolderTable::CaseFolderTable() { + for (size_t iChar=0; iChar(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(mixed[i])]; + } + return lenMixed; + } +} + +void CaseFolderTable::SetTranslation(char ch, char chTranslation) { + mapping[static_cast(ch)] = chTranslation; +} + +void CaseFolderTable::StandardASCII() { + for (size_t iChar=0; iChar= 'A' && iChar <= 'Z') { + mapping[iChar] = static_cast(iChar - 'A' + 'a'); + } else { + mapping[iChar] = static_cast(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 * searches (just pass minPos > maxPos to do a backward search) * 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, - int *length) { + int *length, CaseFolder *pcf) { if (regExp) { if (!regex) 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 { - bool forward = minPos <= maxPos; - int increment = forward ? 1 : -1; + const bool forward = minPos <= maxPos; + const int increment = forward ? 1 : -1; // Range endpoints should not be inside DBCS characters, but just in case, move them. - int startPos = MovePositionOutsideChar(minPos, increment, false); - int endPos = MovePositionOutsideChar(maxPos, increment, false); + const int startPos = MovePositionOutsideChar(minPos, increment, false); + const int endPos = MovePositionOutsideChar(maxPos, increment, false); // Compute actual search ranges needed - int lengthFind = *length; - if (lengthFind == -1) - lengthFind = static_cast(strlen(s)); - int endSearch = endPos; - if (startPos <= endPos) { - endSearch = endPos - lengthFind + 1; - } + const int lengthFind = (*length == -1) ? static_cast(strlen(search)) : *length; + const int endSearch = (startPos <= endPos) ? endPos - lengthFind + 1 : endPos; + //Platform::DebugPrintf("Find %d %d %s %d\n", startPos, endPos, ft->lpstrText, lengthFind); - - // >>> 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 + const int limitPos = Platform::Maximum(startPos, endPos); + int pos = forward ? startPos : (startPos - 1); + if (caseSensitive) { + while (forward ? (pos < endSearch) : (pos >= endSearch)) { + bool found = (pos + lengthFind) <= limitPos; + for (int indexSearch = 0; (indexSearch < lengthFind) && found; indexSearch++) { + found = CharAt(pos + indexSearch) == search[indexSearch]; + } + if (found && MatchesWordOptions(word, wordStart, pos, lengthFind)) { + return 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 we are searching for Latin characters - // i.e. no special processing required - } - // <<< Added by DV - - char firstChar = s[0]; - if (!caseSensitive) - firstChar = static_cast(MakeUpperCaseA(firstChar)); - int pos = forward ? startPos : (startPos - 1); - while (forward ? (pos < endSearch) : (pos >= endSearch)) { - char ch = CharAt(pos); - if (caseSensitive) { - if (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 (ch != s[posMatch]) - found = false; - } - if (found) { - if ((!word && !wordStart) || - (word && IsWordAt(pos, pos + lengthFind)) || - (wordStart && IsWordStartAt(pos))) - return pos; - } + } else if (SC_CP_UTF8 == dbcsCodePage) { + const size_t maxBytesCharacter = 4; + const size_t maxFoldingExpansion = 4; + std::vector 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; } - } - - // >>> 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) { - if ((!word && !wordStart) || - (word && IsWordAt(pos, pos + lengthFind)) || - (wordStart && IsWordStartAt(pos))) { - delete [] ws_upr; + if (characterMatches && (indexSearch == static_cast(lenSearch))) { + if (MatchesWordOptions(word, wordStart, pos, indexDocument)) { + *length = indexDocument; 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; + if (forward) { + pos += widthFirstCharacter; + } else { + pos--; + if (pos > 0) { + // Ensure trying to match from start of character + pos = MovePositionOutsideChar(pos, increment, false); } } } - pos += increment; - if (dbcsCodePage && (pos >= 0)) { - // Ensure trying to match from start of character - pos = MovePositionOutsideChar(pos, increment, false); + } else { + CaseFolderTable caseFolder; + std::vector searchThing(lengthFind + 1); + pcf->Fold(&searchThing[0], searchThing.size(), search, lengthFind); + 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; + } + pos += increment; + if (dbcsCodePage && (pos >= 0)) { + // Ensure trying to match from start of character + pos = MovePositionOutsideChar(pos, increment, false); + } } } - - // >>> Added by DV - if (ws_upr) { - delete [] ws_upr; - } - // <<< Added by DV - } //Platform::DebugPrintf("Not found\n"); return -1; @@ -1337,11 +1272,11 @@ void Document::ChangeCase(Range r, bool makeUpperCase) { char ch = CharAt(pos); if (makeUpperCase) { if (IsLowerCase(ch)) { - ChangeChar(pos, static_cast(MakeUpperCaseA(ch))); + ChangeChar(pos, static_cast(MakeUpperCase(ch))); } } else { if (IsUpperCase(ch)) { - ChangeChar(pos, static_cast(MakeLowerCaseA(ch))); + ChangeChar(pos, static_cast(MakeLowerCase(ch))); } } } @@ -1424,7 +1359,7 @@ void Document::EnsureStyledTo(int pos) { } int Document::SetLineState(int line, int state) { - int statePrevious = static_cast(perLineData[ldState])->SetLineState(line, state); + int statePrevious = static_cast(perLineData[ldState])->SetLineState(line, state); if (state != statePrevious) { DocModification mh(SC_MOD_CHANGELINESTATE, 0, 0, 0, 0, line); NotifyModified(mh); @@ -1432,59 +1367,59 @@ int Document::SetLineState(int line, int state) { return statePrevious; } -int Document::GetLineState(int line) { - return static_cast(perLineData[ldState])->GetLineState(line); +int Document::GetLineState(int line) const { + return static_cast(perLineData[ldState])->GetLineState(line); } -int Document::GetMaxLineState() { - return static_cast(perLineData[ldState])->GetMaxLineState(); +int Document::GetMaxLineState() { + return static_cast(perLineData[ldState])->GetMaxLineState(); } StyledText Document::MarginStyledText(int line) { - LineAnnotation *pla = static_cast(perLineData[ldMargin]); - return StyledText(pla->Length(line), pla->Text(line), + LineAnnotation *pla = static_cast(perLineData[ldMargin]); + return StyledText(pla->Length(line), pla->Text(line), pla->MultipleStyles(line), pla->Style(line), pla->Styles(line)); } void Document::MarginSetText(int line, const char *text) { - static_cast(perLineData[ldMargin])->SetText(line, text); + static_cast(perLineData[ldMargin])->SetText(line, text); DocModification mh(SC_MOD_CHANGEMARGIN, LineStart(line), 0, 0, 0, line); NotifyModified(mh); } void Document::MarginSetStyle(int line, int style) { - static_cast(perLineData[ldMargin])->SetStyle(line, style); + static_cast(perLineData[ldMargin])->SetStyle(line, style); } void Document::MarginSetStyles(int line, const unsigned char *styles) { - static_cast(perLineData[ldMargin])->SetStyles(line, styles); + static_cast(perLineData[ldMargin])->SetStyles(line, styles); } int Document::MarginLength(int line) const { - return static_cast(perLineData[ldMargin])->Length(line); + return static_cast(perLineData[ldMargin])->Length(line); } void Document::MarginClearAll() { int maxEditorLine = LinesTotal(); - for (int l=0;l(perLineData[ldMargin])->ClearAll(); + static_cast(perLineData[ldMargin])->ClearAll(); } bool Document::AnnotationAny() const { - return static_cast(perLineData[ldAnnotation])->AnySet(); + return static_cast(perLineData[ldAnnotation])->AnySet(); } StyledText Document::AnnotationStyledText(int line) { - LineAnnotation *pla = static_cast(perLineData[ldAnnotation]); - return StyledText(pla->Length(line), pla->Text(line), + LineAnnotation *pla = static_cast(perLineData[ldAnnotation]); + return StyledText(pla->Length(line), pla->Text(line), pla->MultipleStyles(line), pla->Style(line), pla->Styles(line)); } void Document::AnnotationSetText(int line, const char *text) { const int linesBefore = AnnotationLines(line); - static_cast(perLineData[ldAnnotation])->SetText(line, text); + static_cast(perLineData[ldAnnotation])->SetText(line, text); const int linesAfter = AnnotationLines(line); DocModification mh(SC_MOD_CHANGEANNOTATION, LineStart(line), 0, 0, 0, line); mh.annotationLinesAdded = linesAfter - linesBefore; @@ -1492,27 +1427,27 @@ void Document::AnnotationSetText(int line, const char *text) { } void Document::AnnotationSetStyle(int line, int style) { - static_cast(perLineData[ldAnnotation])->SetStyle(line, style); + static_cast(perLineData[ldAnnotation])->SetStyle(line, style); } void Document::AnnotationSetStyles(int line, const unsigned char *styles) { - static_cast(perLineData[ldAnnotation])->SetStyles(line, styles); + static_cast(perLineData[ldAnnotation])->SetStyles(line, styles); } int Document::AnnotationLength(int line) const { - return static_cast(perLineData[ldAnnotation])->Length(line); + return static_cast(perLineData[ldAnnotation])->Length(line); } int Document::AnnotationLines(int line) const { - return static_cast(perLineData[ldAnnotation])->Lines(line); + return static_cast(perLineData[ldAnnotation])->Lines(line); } void Document::AnnotationClearAll() { int maxEditorLine = LinesTotal(); - for (int l=0;l(perLineData[ldAnnotation])->ClearAll(); + static_cast(perLineData[ldAnnotation])->ClearAll(); } void Document::IncrementStyleClock() { @@ -1691,11 +1626,11 @@ bool IsLineEndChar(char c) { int Document::ExtendStyleRange(int pos, int delta, bool singleLine) { int sStart = cb.StyleAt(pos); 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++; } 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++; } return pos; @@ -1737,7 +1672,7 @@ int Document::BraceMatch(int position, int /*maxReStyle*/) { int depth = 1; position = position + direction; while ((position >= 0) && (position < Length())) { - position = MovePositionOutsideChar(position, direction); + position = MovePositionOutsideChar(position, direction, true); char chAtPos = CharAt(position); char styAtPos = static_cast(StyleAt(position) & stylingBitsMask); if ((position > GetEndStyled()) || (styAtPos == styBrace)) { @@ -1768,7 +1703,7 @@ public: bool caseSensitive, bool word, bool wordStart, int flags, 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: RESearch search; @@ -1883,7 +1818,7 @@ long BuiltinRegex::FindText(Document *doc, int minPos, int maxPos, const char *s 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; substituted = 0; DocumentIndexer di(doc, doc->Length()); @@ -1905,6 +1840,7 @@ const char *BuiltinRegex::SubstituteByPosition(Document* doc, const char *text, case 'r': case 't': case 'v': + case '\\': i++; } lenResult++; @@ -1948,6 +1884,9 @@ const char *BuiltinRegex::SubstituteByPosition(Document* doc, const char *text, case 'v': *o++ = '\v'; break; + case '\\': + *o++ = '\\'; + break; default: *o++ = '\\'; j--; diff --git a/scintilla/src/Document.h b/scintilla/src/Document.h index 0d5459c7..ceb2c6d8 100644 --- a/scintilla/src/Document.h +++ b/scintilla/src/Document.h @@ -32,10 +32,10 @@ public: Range(Position pos=0) : start(pos), end(pos) { - }; + } Range(Position start_, Position end_) : start(start_), end(end_) { - }; + } bool Valid() const { return (start != invalidPosition) && (end != invalidPosition); @@ -81,17 +81,17 @@ class Document; */ class RegexSearchBase { 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; ///@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 -extern RegexSearchBase* CreateRegexSearch(CharClassify *charClassTable); +extern RegexSearchBase *CreateRegexSearch(CharClassify *charClassTable); struct StyledText { size_t length; @@ -99,7 +99,7 @@ struct StyledText { bool multipleStyles; size_t style; 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_) { } // 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 { @@ -147,11 +165,11 @@ private: int lenWatchers; // ldSize is not real data - it is for dimensions and loops - enum lineData { ldMarkers, ldLevels, ldState, ldMargin, ldAnnotation, ldSize }; + enum lineData { ldMarkers, ldLevels, ldState, ldMargin, ldAnnotation, ldSize }; PerLine *perLineData[ldSize]; bool matchesValid; - RegexSearchBase* regex; + RegexSearchBase *regex; public: int stylingBits; @@ -225,10 +243,10 @@ public: void DelCharBack(int pos); 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); } - char StyleAt(int position) { return cb.StyleAt(position); } + char StyleAt(int position) const { return cb.StyleAt(position); } int GetMark(int line); int AddMark(int line, int markerNum); void AddMarkSet(int line, int valueSet); @@ -243,7 +261,7 @@ public: int VCHomePosition(int position) const; int SetLevel(int line, int level); - int GetLevel(int line); + int GetLevel(int line) const; void ClearLevels(); int GetLastChild(int lineParent, int level=-1); int GetFoldParent(int line); @@ -254,9 +272,10 @@ public: int NextWordEnd(int pos, int delta); int Length() const { return cb.Length(); } void Allocate(int newSize) { cb.Allocate(newSize); } - long FindText(int minPos, int maxPos, const char *s, - bool caseSensitive, bool word, bool wordStart, bool regExp, int flags, int *length); - long FindText(int iMessage, unsigned long wParam, long lParam); + size_t ExtractChar(int pos, char *bytes); + bool MatchesWordOptions(bool word, bool wordStart, int pos, int length); + 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); int LinesTotal() const; @@ -275,7 +294,7 @@ public: void DecorationFillRange(int position, int value, int fillLength); int SetLineState(int line, int state); - int GetLineState(int line); + int GetLineState(int line) const; int GetMaxLineState(); StyledText MarginStyledText(int line); @@ -324,7 +343,7 @@ class UndoGroup { Document *pdoc; bool groupNeeded; public: - UndoGroup(Document *pdoc_, bool groupNeeded_=true) : + UndoGroup(Document *pdoc_, bool groupNeeded_=true) : pdoc(pdoc_), groupNeeded(groupNeeded_) { if (groupNeeded) { pdoc->BeginUndoAction(); diff --git a/scintilla/src/DocumentAccessor.cxx b/scintilla/src/DocumentAccessor.cxx index 7dd38fe9..6c590024 100644 --- a/scintilla/src/DocumentAccessor.cxx +++ b/scintilla/src/DocumentAccessor.cxx @@ -187,7 +187,7 @@ int DocumentAccessor::IndentAmount(int line, int *flags, PFNIsCommentLeader pfnI indent += SC_FOLDLEVELBASE; // if completely empty line or the start of a comment... if ((ch == ' ' || ch == '\t' || ch == '\n' || ch == '\r') || - (pfnIsCommentLeader && (*pfnIsCommentLeader)(*this, pos, end-pos)) ) + (pfnIsCommentLeader && (*pfnIsCommentLeader)(*this, pos, end-pos))) return indent | SC_FOLDLEVELWHITEFLAG; else return indent; diff --git a/scintilla/src/DocumentAccessor.h b/scintilla/src/DocumentAccessor.h index 9b992b50..5e1f4348 100644 --- a/scintilla/src/DocumentAccessor.h +++ b/scintilla/src/DocumentAccessor.h @@ -17,8 +17,8 @@ class Document; class DocumentAccessor : public Accessor { // Private so DocumentAccessor objects can not be copied - DocumentAccessor(const DocumentAccessor &source) : Accessor(), props(source.props) {} - DocumentAccessor &operator=(const DocumentAccessor &) { return *this; } + DocumentAccessor(const DocumentAccessor &source); + DocumentAccessor &operator=(const DocumentAccessor &); protected: Document *pdoc; @@ -38,9 +38,9 @@ protected: void Fill(int position); public: - DocumentAccessor(Document *pdoc_, PropertyGet &props_, WindowID id_=0) : + DocumentAccessor(Document *pdoc_, PropertyGet &props_, WindowID id_=0) : Accessor(), pdoc(pdoc_), props(props_), id(id_), - lenDoc(-1), validLen(0), chFlags(0), chWhile(0), + lenDoc(-1), validLen(0), chFlags(0), chWhile(0), startSeg(0), startPosStyling(0), mask(127) { // Initialize the mask to be big enough for any lexer. } @@ -54,8 +54,8 @@ public: void Flush(); int GetLineState(int line); int SetLineState(int line, int state); - int GetPropertyInt(const char *key, int defaultValue=0) { - return props.GetInt(key, defaultValue); + int GetPropertyInt(const char *key, int defaultValue=0) { + return props.GetInt(key, defaultValue); } char *GetProperties() { return props.ToString(); @@ -63,7 +63,7 @@ public: WindowID GetWindow() { return id; } 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; } void StartSegment(unsigned int pos); void ColourTo(unsigned int pos, int chAttr); diff --git a/scintilla/src/Editor.cxx b/scintilla/src/Editor.cxx index 972f34b8..506ee34b 100644 --- a/scintilla/src/Editor.cxx +++ b/scintilla/src/Editor.cxx @@ -13,6 +13,7 @@ #include #include #include +#include // With Borland C++ 5.5, including includes Windows.h leading to defining // FindText to FindTextA which makes calls here to Document::FindText fail. @@ -52,7 +53,7 @@ using namespace Scintilla; return whether this modification represents an operation that may reasonably be deferred (not done now OR [possibly] at all) */ -static bool CanDeferToLastStep(const DocModification& mh) { +static bool CanDeferToLastStep(const DocModification &mh) { if (mh.modificationType & (SC_MOD_BEFOREINSERT | SC_MOD_BEFOREDELETE)) return true; // CAN skip if (!(mh.modificationType & (SC_PERFORMED_UNDO | SC_PERFORMED_REDO))) @@ -62,7 +63,7 @@ static bool CanDeferToLastStep(const DocModification& mh) { return false; // PRESUMABLY must do } -static bool CanEliminate(const DocModification& mh) { +static bool CanEliminate(const DocModification &mh) { return (mh.modificationType & (SC_MOD_BEFOREINSERT | SC_MOD_BEFOREDELETE)) != 0; } @@ -71,7 +72,7 @@ static bool CanEliminate(const DocModification& mh) { return whether this modification represents the FINAL step in a [possibly lengthy] multi-step Undo/Redo sequence */ -static bool IsLastStep(const DocModification& mh) { +static bool IsLastStep(const DocModification &mh) { return (mh.modificationType & (SC_PERFORMED_UNDO | SC_PERFORMED_REDO)) != 0 && (mh.modificationType & SC_MULTISTEPUNDOREDO) != 0 @@ -150,7 +151,9 @@ Editor::Editor() { caretSticky = false; multipleSelection = false; additionalSelectionTyping = false; + multiPasteMode = SC_MULTIPASTE_ONCE; additionalCaretsBlink = true; + additionalCaretsVisible = true; virtualSpaceOptions = SCVS_NONE; pixmapLine = Surface::Allocate(); @@ -335,7 +338,7 @@ const char *ControlCharacterString(unsigned char ch) { class AutoLineLayout { LineLayoutCache &llc; LineLayout *ll; - AutoLineLayout &operator=(const AutoLineLayout &) { return * this; } + AutoLineLayout &operator=(const AutoLineLayout &); public: AutoLineLayout(LineLayoutCache &llc_, LineLayout *ll_) : llc(llc_), ll(ll_) {} ~AutoLineLayout() { @@ -361,7 +364,7 @@ SelectionPosition Editor::ClampPositionIntoDocument(SelectionPosition sp) const return SelectionPosition(pdoc->Length()); } else { // If not at end of line then set offset to 0 - if (!pdoc->IsLineEndPosition(sp.Position())) + if (!pdoc->IsLineEndPosition(sp.Position())) sp.SetVirtualSpace(0); return sp; } @@ -486,7 +489,7 @@ SelectionPosition Editor::SPositionFromLocation(Point pt, bool canReturnInvalid, } if (virtualSpace) { const int spaceWidth = static_cast(vs.styles[ll->EndLineStyle()].spaceWidth); - int spaceOffset = (pt.x + subLineStart - ll->positions[lineEnd] + spaceWidth / 2) / + int spaceOffset = (pt.x + subLineStart - ll->positions[lineEnd] + spaceWidth / 2) / spaceWidth; return SelectionPosition(lineEnd + posLineStart, spaceOffset); } else if (canReturnInvalid) { @@ -620,7 +623,7 @@ void Editor::Redraw() { //wMain.InvalidateAll(); } -void Editor::RedrawSelMargin(int line) { +void Editor::RedrawSelMargin(int line, bool allAfter) { if (!AbandonPaint()) { if (vs.maskInLine) { Redraw(); @@ -631,7 +634,8 @@ void Editor::RedrawSelMargin(int line) { int position = pdoc->LineStart(line); PRectangle rcLine = RectangleFromRange(position, position); rcSelMargin.top = rcLine.top; - rcSelMargin.bottom = rcLine.bottom; + if (!allAfter) + rcSelMargin.bottom = rcLine.bottom; } wMain.InvalidateRectangle(rcSelMargin); } @@ -705,6 +709,18 @@ void Editor::SetRectangularRange() { } } +void Editor::ThinRectangularRange() { + if (sel.IsRectangular()) { + sel.selType = Selection::selThin; + if (sel.Rectangular().caret < sel.Rectangular().anchor) { + sel.Rectangular() = SelectionRange(sel.Range(sel.Count()-1).caret, sel.Range(0).anchor); + } else { + sel.Rectangular() = SelectionRange(sel.Range(sel.Count()-1).anchor, sel.Range(0).caret); + } + SetRectangularRange(); + } +} + void Editor::InvalidateSelection(SelectionRange newMain, bool invalidateWholeSelection) { if (sel.Count() > 1 || !(sel.RangeMain().anchor == newMain.anchor) || sel.IsRectangular()) { invalidateWholeSelection = true; @@ -726,7 +742,7 @@ void Editor::InvalidateSelection(SelectionRange newMain, bool invalidateWholeSel } void Editor::SetSelection(SelectionPosition currentPos_, SelectionPosition anchor_) { - SelectionRange rangeNew(ClampPositionIntoDocument(currentPos_), + SelectionRange rangeNew(ClampPositionIntoDocument(currentPos_), ClampPositionIntoDocument(anchor_)); if (sel.Count() > 1 || !(sel.RangeMain() == rangeNew)) { InvalidateSelection(rangeNew); @@ -795,7 +811,7 @@ bool Editor::RangeContainsProtected(int start, int end) const { bool Editor::SelectionContainsProtected() { for (size_t r=0; r rcClient.bottom) { int yOfLastLineFullyDisplayed = rcClient.top + (LinesOnScreen() - 1) * vs.lineHeight; MovePositionTo(SPositionFromLocation( - Point(lastXChosen, rcClient.top + yOfLastLineFullyDisplayed)), + Point(lastXChosen - xOffset, rcClient.top + yOfLastLineFullyDisplayed)), Selection::noSel, ensureVisible); } } @@ -1018,29 +1052,24 @@ slop | strict | jumps | even | Caret can go to the margin | When 1 | 1 | 0 | 1 | No, kept out of UZ | moved by one position 1 | 1 | 1 | 1 | No, kept out of UZ | moved to put caret at 3UZ of the margin */ -void Editor::EnsureCaretVisible(bool useMargin, bool vert, bool horiz) { - //Platform::DebugPrintf("EnsureCaretVisible %d %s\n", xOffset, useMargin ? " margin" : " "); + +Editor::XYScrollPosition Editor::XYScrollToMakeVisible(const bool useMargin, const bool vert, const bool horiz) { PRectangle rcClient = GetTextRectangle(); - //int rcClientFullWidth = rcClient.Width(); - SelectionPosition posCaret = sel.RangeMain().caret; - if (posDrag.IsValid()) { - posCaret = posDrag; - } - Point pt = LocationFromPosition(posCaret); - Point ptBottomCaret = pt; - ptBottomCaret.y += vs.lineHeight - 1; - int lineCaret = DisplayFromPosition(posCaret.Position()); - bool bSlop, bStrict, bJump, bEven; + const SelectionPosition posCaret = posDrag.IsValid() ? posDrag : sel.RangeMain().caret; + const Point pt = LocationFromPosition(posCaret); + const Point ptBottomCaret(pt.x, pt.y + vs.lineHeight - 1); + const int lineCaret = DisplayFromPosition(posCaret.Position()); + + XYScrollPosition newXY(xOffset, topLine); // Vertical positioning if (vert && (pt.y < rcClient.top || ptBottomCaret.y > rcClient.bottom || (caretYPolicy & CARET_STRICT) != 0)) { - int linesOnScreen = LinesOnScreen(); - int halfScreen = Platform::Maximum(linesOnScreen - 1, 2) / 2; - int newTopLine = topLine; - bSlop = (caretYPolicy & CARET_SLOP) != 0; - bStrict = (caretYPolicy & CARET_STRICT) != 0; - bJump = (caretYPolicy & CARET_JUMPS) != 0; - bEven = (caretYPolicy & CARET_EVEN) != 0; + const int linesOnScreen = LinesOnScreen(); + const int halfScreen = Platform::Maximum(linesOnScreen - 1, 2) / 2; + const bool bSlop = (caretYPolicy & CARET_SLOP) != 0; + const bool bStrict = (caretYPolicy & CARET_STRICT) != 0; + const bool bJump = (caretYPolicy & CARET_JUMPS) != 0; + const bool bEven = (caretYPolicy & CARET_EVEN) != 0; // It should be possible to scroll the window to show the caret, // but this fails to remove the caret on GTK+ @@ -1073,10 +1102,10 @@ void Editor::EnsureCaretVisible(bool useMargin, bool vert, bool horiz) { } if (lineCaret < topLine + yMarginT) { // Caret goes too high - newTopLine = lineCaret - yMoveT; + newXY.topLine = lineCaret - yMoveT; } else if (lineCaret > topLine + linesOnScreen - 1 - yMarginB) { // Caret goes too low - newTopLine = lineCaret - linesOnScreen + 1 + yMoveB; + newXY.topLine = lineCaret - linesOnScreen + 1 + yMoveB; } } else { // Not strict yMoveT = bJump ? caretYSlop * 3 : caretYSlop; @@ -1088,10 +1117,10 @@ void Editor::EnsureCaretVisible(bool useMargin, bool vert, bool horiz) { } if (lineCaret < topLine) { // Caret goes too high - newTopLine = lineCaret - yMoveT; + newXY.topLine = lineCaret - yMoveT; } else if (lineCaret > topLine + linesOnScreen - 1) { // Caret goes too low - newTopLine = lineCaret - linesOnScreen + 1 + yMoveB; + newXY.topLine = lineCaret - linesOnScreen + 1 + yMoveB; } } } else { // No slop @@ -1099,41 +1128,35 @@ void Editor::EnsureCaretVisible(bool useMargin, bool vert, bool horiz) { // Minimal move if (lineCaret < topLine) { // Caret goes too high - newTopLine = lineCaret; + newXY.topLine = lineCaret; } else if (lineCaret > topLine + linesOnScreen - 1) { // Caret goes too low if (bEven) { - newTopLine = lineCaret - linesOnScreen + 1; + newXY.topLine = lineCaret - linesOnScreen + 1; } else { - newTopLine = lineCaret; + newXY.topLine = lineCaret; } } } else { // Strict or going out of display if (bEven) { // Always center caret - newTopLine = lineCaret - halfScreen; + newXY.topLine = lineCaret - halfScreen; } else { // Always put caret on top of display - newTopLine = lineCaret; + newXY.topLine = lineCaret; } } } - newTopLine = Platform::Clamp(newTopLine, 0, MaxScrollPos()); - if (newTopLine != topLine) { - Redraw(); - SetTopLine(newTopLine); - SetVerticalScrollPos(); - } + newXY.topLine = Platform::Clamp(newXY.topLine, 0, MaxScrollPos()); } // Horizontal positioning if (horiz && (wrapState == eWrapNone)) { - int halfScreen = Platform::Maximum(rcClient.Width() - 4, 4) / 2; - int xOffsetNew = xOffset; - bSlop = (caretXPolicy & CARET_SLOP) != 0; - bStrict = (caretXPolicy & CARET_STRICT) != 0; - bJump = (caretXPolicy & CARET_JUMPS) != 0; - bEven = (caretXPolicy & CARET_EVEN) != 0; + const int halfScreen = Platform::Maximum(rcClient.Width() - 4, 4) / 2; + const bool bSlop = (caretXPolicy & CARET_SLOP) != 0; + const bool bStrict = (caretXPolicy & CARET_STRICT) != 0; + const bool bJump = (caretXPolicy & CARET_JUMPS) != 0; + const bool bEven = (caretXPolicy & CARET_EVEN) != 0; if (bSlop) { // A margin is defined int xMoveL, xMoveR; @@ -1162,18 +1185,18 @@ void Editor::EnsureCaretVisible(bool useMargin, bool vert, bool horiz) { if (pt.x < rcClient.left + xMarginL) { // Caret is on the left of the display if (bJump && bEven) { - xOffsetNew -= xMoveL; + newXY.xOffset -= xMoveL; } else { // Move just enough to allow to display the caret - xOffsetNew -= (rcClient.left + xMarginL) - pt.x; + newXY.xOffset -= (rcClient.left + xMarginL) - pt.x; } } else if (pt.x >= rcClient.right - xMarginR) { // Caret is on the right of the display if (bJump && bEven) { - xOffsetNew += xMoveR; + newXY.xOffset += xMoveR; } else { // Move just enough to allow to display the caret - xOffsetNew += pt.x - (rcClient.right - xMarginR) + 1; + newXY.xOffset += pt.x - (rcClient.right - xMarginR) + 1; } } } else { // Not strict @@ -1186,10 +1209,10 @@ void Editor::EnsureCaretVisible(bool useMargin, bool vert, bool horiz) { } if (pt.x < rcClient.left) { // Caret is on the left of the display - xOffsetNew -= xMoveL; + newXY.xOffset -= xMoveL; } else if (pt.x >= rcClient.right) { // Caret is on the right of the display - xOffsetNew += xMoveR; + newXY.xOffset += xMoveR; } } } else { // No slop @@ -1198,54 +1221,69 @@ void Editor::EnsureCaretVisible(bool useMargin, bool vert, bool horiz) { // Strict or going out of display if (bEven) { // Center caret - xOffsetNew += pt.x - rcClient.left - halfScreen; + newXY.xOffset += pt.x - rcClient.left - halfScreen; } else { // Put caret on right - xOffsetNew += pt.x - rcClient.right + 1; + newXY.xOffset += pt.x - rcClient.right + 1; } } else { // Move just enough to allow to display the caret if (pt.x < rcClient.left) { // Caret is on the left of the display if (bEven) { - xOffsetNew -= rcClient.left - pt.x; + newXY.xOffset -= rcClient.left - pt.x; } else { - xOffsetNew += pt.x - rcClient.right + 1; + newXY.xOffset += pt.x - rcClient.right + 1; } } else if (pt.x >= rcClient.right) { // Caret is on the right of the display - xOffsetNew += pt.x - rcClient.right + 1; + newXY.xOffset += pt.x - rcClient.right + 1; } } } // In case of a jump (find result) largely out of display, adjust the offset to display the caret - if (pt.x + xOffset < rcClient.left + xOffsetNew) { - xOffsetNew = pt.x + xOffset - rcClient.left; - } else if (pt.x + xOffset >= rcClient.right + xOffsetNew) { - xOffsetNew = pt.x + xOffset - rcClient.right + 1; + if (pt.x + xOffset < rcClient.left + newXY.xOffset) { + newXY.xOffset = pt.x + xOffset - rcClient.left; + } else if (pt.x + xOffset >= rcClient.right + newXY.xOffset) { + newXY.xOffset = pt.x + xOffset - rcClient.right + 1; if (vs.caretStyle == CARETSTYLE_BLOCK) { // Ensure we can see a good portion of the block caret - xOffsetNew += vs.aveCharWidth; + newXY.xOffset += vs.aveCharWidth; } } - if (xOffsetNew < 0) { - xOffsetNew = 0; + if (newXY.xOffset < 0) { + newXY.xOffset = 0; } - if (xOffset != xOffsetNew) { - xOffset = xOffsetNew; - if (xOffsetNew > 0) { + } + + return newXY; +} + +void Editor::SetXYScroll(XYScrollPosition newXY) { + if ((newXY.topLine != topLine) || (newXY.xOffset != xOffset)) { + if (newXY.topLine != topLine) { + SetTopLine(newXY.topLine); + SetVerticalScrollPos(); + } + if (newXY.xOffset != xOffset) { + xOffset = newXY.xOffset; + if (newXY.xOffset > 0) { PRectangle rcText = GetTextRectangle(); if (horizontalScrollBarVisible && - rcText.Width() + xOffset > scrollWidth) { + rcText.Width() + xOffset > scrollWidth) { scrollWidth = xOffset + rcText.Width(); SetScrollBars(); } } SetHorizontalScrollPos(); - Redraw(); } + Redraw(); + UpdateSystemCaret(); } - UpdateSystemCaret(); +} + +void Editor::EnsureCaretVisible(bool useMargin, bool vert, bool horiz) { + SetXYScroll(XYScrollToMakeVisible(useMargin, vert, horiz)); } void Editor::ShowCaretAtCurrentPosition() { @@ -1302,7 +1340,7 @@ bool Editor::WrapOneLine(Surface *surface, int lineToWrap) { LayoutLine(lineToWrap, surface, vs, ll, wrapWidth); linesWrapped = ll->lines; } - return cs.SetHeight(lineToWrap, linesWrapped + + return cs.SetHeight(lineToWrap, linesWrapped + (vs.annotationVisible ? pdoc->AnnotationLines(lineToWrap) : 0)); } @@ -1341,7 +1379,7 @@ bool Editor::WrapLines(bool fullWrap, int priorityWrapLineStart) { if (wrapWidth != LineLayout::wrapWidthInfinite) { wrapWidth = LineLayout::wrapWidthInfinite; for (int lineDoc = 0; lineDoc < pdoc->LinesTotal(); lineDoc++) { - cs.SetHeight(lineDoc, 1 + + cs.SetHeight(lineDoc, 1 + (vs.annotationVisible ? pdoc->AnnotationLines(lineDoc) : 0)); } wrapOccurred = true; @@ -1484,7 +1522,7 @@ static int istrlen(const char *s) { bool ValidStyledText(ViewStyle &vs, size_t styleOffset, const StyledText &st) { if (st.multipleStyles) { - for (size_t iStyle=0;iStyleMarginStyledText(lineDoc); if (stMargin.text && ValidStyledText(vs, vs.marginStyleOffset, stMargin)) { - surface->FillRectangle(rcMarker, + surface->FillRectangle(rcMarker, vs.styles[stMargin.StyleAt(0)+vs.marginStyleOffset].back.allocated); if (vs.ms[margin].style == SC_MARGIN_RTEXT) { int width = WidestLineWidth(surface, vs, vs.marginStyleOffset, stMargin); rcMarker.left = rcMarker.right - width - 3; } - DrawStyledText(surface, vs, vs.marginStyleOffset, rcMarker, rcMarker.top + vs.maxAscent, + DrawStyledText(surface, vs, vs.marginStyleOffset, rcMarker, rcMarker.top + vs.maxAscent, stMargin, 0, stMargin.length); } } @@ -1813,6 +1851,7 @@ static bool GoodTrailByte(int v) { } bool BadUTF(const char *s, int len, int &trailBytes) { + // For the rules: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 if (trailBytes) { trailBytes--; return false; @@ -1829,6 +1868,23 @@ bool BadUTF(const char *s, int len, int &trailBytes) { if (len < 4) return true; if (GoodTrailByte(us[1]) && GoodTrailByte(us[2]) && GoodTrailByte(us[3])) { + if (*us == 0xf4) { + // Check if encoding a value beyond the last Unicode character 10FFFF + if (us[1] > 0x8f) { + return true; + } else if (us[1] == 0x8f) { + if (us[2] > 0xbf) { + return true; + } else if (us[2] == 0xbf) { + if (us[3] > 0xbf) { + return true; + } + } + } + } else if ((*us == 0xf0) && ((us[1] & 0xf0) == 0x80)) { + // Overlong + return true; + } trailBytes = 3; return false; } else { @@ -1839,6 +1895,22 @@ bool BadUTF(const char *s, int len, int &trailBytes) { if (len < 3) return true; if (GoodTrailByte(us[1]) && GoodTrailByte(us[2])) { + if ((*us == 0xe0) && ((us[1] & 0xe0) == 0x80)) { + // Overlong + return true; + } + if ((*us == 0xed) && ((us[1] & 0xe0) == 0xa0)) { + // Surrogate + return true; + } + if ((*us == 0xef) && (us[1] == 0xbf) && (us[2] == 0xbe)) { + // U+FFFE + return true; + } + if ((*us == 0xef) && (us[1] == 0xbf) && (us[2] == 0xbf)) { + // U+FFFF + return true; + } trailBytes = 2; return false; } else { @@ -2007,8 +2079,8 @@ void Editor::LayoutLine(int line, Surface *surface, ViewStyle &vstyle, LineLayou } lastSegItalics = false; } else if (isBadUTF) { - char hexits[3]; - sprintf(hexits, "%2X", ll->chars[charInLine] & 0xff); + char hexits[4]; + sprintf(hexits, "x%2X", ll->chars[charInLine] & 0xff); ll->positions[charInLine + 1] = surface->WidthText(ctrlCharsFont, hexits, istrlen(hexits)) + 3; } else { // Regular character @@ -2122,8 +2194,8 @@ void Editor::LayoutLine(int line, Surface *surface, ViewStyle &vstyle, LineLayou } ColourAllocated Editor::SelectionBackground(ViewStyle &vsDraw, bool main) { - return main ? - (primarySelection ? vsDraw.selbackground.allocated : vsDraw.selbackground2.allocated) : + return main ? + (primarySelection ? vsDraw.selbackground.allocated : vsDraw.selbackground2.allocated) : vsDraw.selAdditionalBackground.allocated; } @@ -2258,7 +2330,7 @@ void Editor::DrawEOL(Surface *surface, ViewStyle &vsDraw, PRectangle rcLine, Lin if (virtualSpace) { rcSegment.left = xEol + xStart; rcSegment.right = xEol + xStart + virtualSpace; - surface->FillRectangle(rcSegment, vsDraw.styles[ll->styles[ll->numCharsInLine] & styleMask].back.allocated); + surface->FillRectangle(rcSegment, overrideBackground ? background : vsDraw.styles[ll->styles[ll->numCharsInLine] & styleMask].back.allocated); if (!hideSelection && ((vsDraw.selAlpha == SC_ALPHA_NOALPHA) || (vsDraw.selAdditionalAlpha == SC_ALPHA_NOALPHA))) { SelectionSegment virtualSpaceRange(SelectionPosition(pdoc->LineEnd(line)), SelectionPosition(pdoc->LineEnd(line), sel.VirtualSpaceFor(pdoc->LineEnd(line)))); for (size_t r=0; rFillRectangle(rcSegment, background); } else if (line < pdoc->LinesTotal() - 1) { surface->FillRectangle(rcSegment, vsDraw.styles[ll->styles[ll->numCharsInLine] & styleMask].back.allocated); + } else if (vsDraw.styles[ll->styles[ll->numCharsInLine] & styleMask].eolFilled) { + surface->FillRectangle(rcSegment, vsDraw.styles[ll->styles[ll->numCharsInLine] & styleMask].back.allocated); } else { surface->FillRectangle(rcSegment, vsDraw.styles[STYLE_DEFAULT].back.allocated); } @@ -2351,7 +2425,7 @@ void Editor::DrawEOL(Surface *surface, ViewStyle &vsDraw, PRectangle rcLine, Lin PRectangle rcPlace = rcSegment; if (wrapVisualFlagsLocation & SC_WRAPVISUALFLAGLOC_END_BY_TEXT) { - rcPlace.left = ll->positions[ll->numCharsInLine] + xStart + virtualSpace; + rcPlace.left = xEol + xStart + virtualSpace; rcPlace.right = rcPlace.left + vsDraw.aveCharWidth; } else { // draw left of the right text margin, to avoid clipping by the current clip rect @@ -2458,21 +2532,21 @@ void Editor::DrawAnnotation(Surface *surface, ViewStyle &vsDraw, int line, int x } PRectangle rcText = rcSegment; if (vs.annotationVisible == ANNOTATION_BOXED) { - surface->FillRectangle(rcText, + surface->FillRectangle(rcText, vsDraw.styles[stAnnotation.StyleAt(start) + vsDraw.annotationStyleOffset].back.allocated); rcText.left += vsDraw.spaceWidth; } - DrawStyledText(surface, vsDraw, vsDraw.annotationStyleOffset, rcText, rcText.top + vsDraw.maxAscent, + DrawStyledText(surface, vsDraw, vsDraw.annotationStyleOffset, rcText, rcText.top + vsDraw.maxAscent, stAnnotation, start, lengthAnnotation); if (vs.annotationVisible == ANNOTATION_BOXED) { surface->MoveTo(rcSegment.left, rcSegment.top); surface->LineTo(rcSegment.left, rcSegment.bottom); surface->MoveTo(rcSegment.right, rcSegment.top); surface->LineTo(rcSegment.right, rcSegment.bottom); - if (subLine == ll->lines){ + if (subLine == ll->lines) { surface->MoveTo(rcSegment.left, rcSegment.top); surface->LineTo(rcSegment.right, rcSegment.top); - } + } if (subLine == ll->lines+annotationLines-1) { surface->MoveTo(rcSegment.left, rcSegment.bottom - 1); surface->LineTo(rcSegment.right, rcSegment.bottom - 1); @@ -2603,11 +2677,15 @@ void Editor::DrawLine(Surface *surface, ViewStyle &vsDraw, int line, int lineVis } } + bool selBackDrawn = vsDraw.selbackset && + ((vsDraw.selAlpha == SC_ALPHA_NOALPHA) || (vsDraw.selAdditionalAlpha == SC_ALPHA_NOALPHA)); + // Does not take margin into account but not significant int xStartVisible = subLineStart - xStart; ll->psel = &sel; - BreakFinder bfBack(ll, lineStart, lineEnd, posLineStart, IsUnicodeMode(), xStartVisible); + + BreakFinder bfBack(ll, lineStart, lineEnd, posLineStart, IsUnicodeMode(), xStartVisible, selBackDrawn); int next = bfBack.First(); // Background drawing loop @@ -2697,7 +2775,8 @@ void Editor::DrawLine(Surface *surface, ViewStyle &vsDraw, int line, int lineVis inIndentation = subLine == 0; // Do not handle indentation except on first subline. // Foreground drawing loop - BreakFinder bfFore(ll, lineStart, lineEnd, posLineStart, IsUnicodeMode(), xStartVisible); + BreakFinder bfFore(ll, lineStart, lineEnd, posLineStart, IsUnicodeMode(), xStartVisible, + ((!twoPhaseDraw && selBackDrawn) || vsDraw.selforeset)); next = bfFore.First(); while (next < lineEnd) { @@ -2770,8 +2849,9 @@ void Editor::DrawLine(Surface *surface, ViewStyle &vsDraw, int line, int lineVis cc, 1, textBack, textFore); } } else if ((i == startseg) && (static_cast(ll->chars[i]) >= 0x80) && IsUnicodeMode()) { - char hexits[3]; - sprintf(hexits, "%2X", ll->chars[i] & 0xff); + // A single byte >= 0x80 in UTF-8 is a bad byte and is displayed as its hex value + char hexits[4]; + sprintf(hexits, "x%2X", ll->chars[i] & 0xff); DrawTextBlob(surface, vsDraw, rcSegment, hexits, textBack, textFore, twoPhaseDraw); } else { // Normal text display @@ -2805,8 +2885,8 @@ void Editor::DrawLine(Surface *surface, ViewStyle &vsDraw, int line, int lineVis surface->FillRectangle(rcSpace, textBack); } PRectangle rcDot(xmid + xStart - subLineStart, rcSegment.top + vsDraw.lineHeight / 2, 0, 0); - rcDot.right = rcDot.left + 1; - rcDot.bottom = rcDot.top + 1; + rcDot.right = rcDot.left + vs.whitespaceSize; + rcDot.bottom = rcDot.top + vs.whitespaceSize; surface->FillRectangle(rcDot, textFore); } } @@ -2823,7 +2903,7 @@ void Editor::DrawLine(Surface *surface, ViewStyle &vsDraw, int line, int lineVis } } } - if (ll->hsStart != -1 && vsDraw.hotspotUnderline && iDoc >= ll->hsStart && iDoc < ll->hsEnd ) { + if (ll->hsStart != -1 && vsDraw.hotspotUnderline && iDoc >= ll->hsStart && iDoc < ll->hsEnd) { PRectangle rcUL = rcSegment; rcUL.top = rcUL.top + vsDraw.maxAscent + 1; rcUL.bottom = rcUL.top + 1; @@ -2904,7 +2984,9 @@ void Editor::DrawLine(Surface *surface, ViewStyle &vsDraw, int line, int lineVis if (subLine == (ll->lines - 1)) { virtualSpaces = sel.VirtualSpaceFor(pdoc->LineEnd(line)); } - SelectionSegment virtualSpaceRange(SelectionPosition(posLineStart), SelectionPosition(posLineStart + lineEnd, virtualSpaces)); + SelectionPosition posStart(posLineStart); + SelectionPosition posEnd(posLineStart + lineEnd, virtualSpaces); + SelectionSegment virtualSpaceRange(posStart, posEnd); for (size_t r=0; rLineStart(subLine); @@ -3095,14 +3177,16 @@ void Editor::DrawCarets(Surface *surface, ViewStyle &vsDraw, int lineDoc, int xS const int spaceWidth = static_cast(vsDraw.styles[ll->EndLineStyle()].spaceWidth); const int virtualOffset = posCaret.VirtualSpace() * spaceWidth; if (ll->InLine(offset, subLine) && offset <= ll->numCharsBeforeEOL) { - int xposCaret = ll->positions[offset] + virtualOffset - ll->positions[ll->LineStart(subLine)] + xStart; + int xposCaret = ll->positions[offset] + virtualOffset - ll->positions[ll->LineStart(subLine)]; if (ll->wrapIndent != 0) { int lineStart = ll->LineStart(subLine); if (lineStart != 0) // Wrapped xposCaret += ll->wrapIndent; } + bool caretBlinkState = (caret.active && caret.on) || (!additionalCaretsBlink && !mainCaret); + bool caretVisibleState = additionalCaretsVisible || mainCaret; if ((xposCaret >= 0) && (vsDraw.caretWidth > 0) && (vsDraw.caretStyle != CARETSTYLE_INVISIBLE) && - ((posDrag.IsValid()) || ((caret.active && caret.on) || (!additionalCaretsBlink && !mainCaret)))) { + ((posDrag.IsValid()) || (caretBlinkState && caretVisibleState))) { bool caretAtEOF = false; bool caretAtEOL = false; bool drawBlockCaret = false; @@ -3122,8 +3206,9 @@ void Editor::DrawCarets(Surface *surface, ViewStyle &vsDraw, int lineDoc, int xS if (widthOverstrikeCaret < 3) // Make sure its visible widthOverstrikeCaret = 3; - if (posCaret > SelectionPosition(ll->LineStart(subLine) + posLineStart)) + if (xposCaret > 0) caretWidthOffset = 1; // Move back so overlaps both character cells. + xposCaret += xStart; if (posDrag.IsValid()) { /* Dragging text, use a line caret */ rcCaret.left = xposCaret - caretWidthOffset; @@ -3155,7 +3240,7 @@ void Editor::DrawCarets(Surface *surface, ViewStyle &vsDraw, int lineDoc, int xS } } } - if (drawDrag) + if (drawDrag) break; } } @@ -3164,6 +3249,8 @@ void Editor::Paint(Surface *surfaceWindow, PRectangle rcArea) { //Platform::DebugPrintf("Paint:%1d (%3d,%3d) ... (%3d,%3d)\n", // paintingAllText, rcArea.left, rcArea.top, rcArea.right, rcArea.bottom); + StyleToPositionInView(PositionAfterArea(rcArea)); + pixmapLine->Release(); RefreshStyleData(); RefreshPixMaps(surfaceWindow); @@ -3176,13 +3263,6 @@ void Editor::Paint(Surface *surfaceWindow, PRectangle rcArea) { pixmapLine->SetPalette(&palette, !hasFocus); int screenLinePaintFirst = rcArea.top / vs.lineHeight; - // The area to be painted plus one extra line is styled. - // The extra line is to determine when a style change, such as starting a comment flows on to other lines. - int lineStyleLast = topLine + (rcArea.bottom - 1) / vs.lineHeight + 1; - //Platform::DebugPrintf("Paint lines = %d .. %d\n", topLine + screenLinePaintFirst, lineStyleLast); - int endPosPaint = pdoc->Length(); - if (lineStyleLast < cs.LinesDisplayed()) - endPosPaint = pdoc->LineStart(cs.DocFromDisplay(lineStyleLast) + 1); int xStart = vs.fixedColumnWidth - xOffset; int ypos = 0; @@ -3190,8 +3270,6 @@ void Editor::Paint(Surface *surfaceWindow, PRectangle rcArea) { ypos += screenLinePaintFirst * vs.lineHeight; int yposScreen = screenLinePaintFirst * vs.lineHeight; - // Ensure we are styled as far as we are painting. - pdoc->EnsureStyledTo(endPosPaint); bool paintAbandonedByStyling = paintState == paintAbandoned; if (needUpdateUI) { // Deselect palette by selecting a temporary palette @@ -3223,12 +3301,14 @@ void Editor::Paint(Surface *surfaceWindow, PRectangle rcArea) { } PLATFORM_ASSERT(pixmapSelPattern->Initialised()); - PaintSelMargin(surfaceWindow, rcArea); + if (paintState != paintAbandoned) { + PaintSelMargin(surfaceWindow, rcArea); - PRectangle rcRightMargin = rcClient; - rcRightMargin.left = rcRightMargin.right - vs.rightMarginWidth; - if (rcArea.Intersects(rcRightMargin)) { - surfaceWindow->FillRectangle(rcRightMargin, vs.styles[STYLE_DEFAULT].back.allocated); + PRectangle rcRightMargin = rcClient; + rcRightMargin.left = rcRightMargin.right - vs.rightMarginWidth; + if (rcArea.Intersects(rcRightMargin)) { + surfaceWindow->FillRectangle(rcRightMargin, vs.styles[STYLE_DEFAULT].back.allocated); + } } if (paintState == paintAbandoned) { @@ -3351,6 +3431,9 @@ void Editor::Paint(Surface *surfaceWindow, PRectangle rcArea) { rcClient.right, yposScreen + vs.lineHeight); surfaceWindow->Copy(rcCopyArea, from, *pixmapLine); } + + lineWidthMaxSeen = Platform::Maximum( + lineWidthMaxSeen, ll->positions[ll->numCharsInLine]); //durCopy += et.Duration(true); } @@ -3361,8 +3444,6 @@ void Editor::Paint(Surface *surfaceWindow, PRectangle rcArea) { yposScreen += vs.lineHeight; visibleLine++; - lineWidthMaxSeen = Platform::Maximum( - lineWidthMaxSeen, ll->positions[ll->numCharsInLine]); //gdk_flush(); } ll.Set(0); @@ -3449,10 +3530,10 @@ long Editor::FormatRange(bool draw, Sci_RangeToFormat *pfr) { vsPrint.whitespaceBackgroundSet = false; vsPrint.whitespaceForegroundSet = false; vsPrint.showCaretLineBackground = false; - vsPrint.showCaretLineBackgroundAlways = false; - + vsPrint.showCaretLineBackgroundAlways = false; + // Set colours for printing according to users settings - for (size_t sty = 0;sty < vsPrint.stylesSize;sty++) { + for (size_t sty = 0; sty < vsPrint.stylesSize; sty++) { if (printColourMode == SC_PRINT_INVERTLIGHT) { vsPrint.styles[sty].fore.desired = InvertedLight(vsPrint.styles[sty].fore.desired); vsPrint.styles[sty].back.desired = InvertedLight(vsPrint.styles[sty].back.desired); @@ -3507,7 +3588,7 @@ long Editor::FormatRange(bool draw, Sci_RangeToFormat *pfr) { int nPrintPos = pfr->chrg.cpMin; int visibleLine = 0; - int widthPrint = pfr->rc.Width() - vsPrint.fixedColumnWidth; + int widthPrint = pfr->rc.right - pfr->rc.left - vsPrint.fixedColumnWidth; if (printWrapState == eWrapNone) widthPrint = LineLayout::wrapWidthInfinite; @@ -3676,7 +3757,7 @@ void Editor::AddCharUTF(char *s, unsigned int len, bool treatAsDBCS) { { UndoGroup ug(pdoc, (sel.Count() > 1) || !sel.Empty() || inOverstrike); for (size_t r=0; rLineFromPosition(positionInsert)); + if (WrapOneLine(surface, pdoc->LineFromPosition(positionInsert))) { + SetScrollBars(); + SetVerticalScrollPos(); + Redraw(); + } } } } @@ -3714,10 +3799,7 @@ void Editor::AddCharUTF(char *s, unsigned int len, bool treatAsDBCS) { if (wrapState != eWrapNone) { SetScrollBars(); } - if (sel.IsRectangular()) { - sel.selType = Selection::selThin; - sel.Rectangular() = SelectionRange(sel.Rectangular().caret, sel.Range(0).anchor); - } + ThinRectangularRange(); // If in wrap mode rewrap current line so EnsureCaretVisible has accurate information EnsureCaretVisible(); // Avoid blinking during rapid typing: @@ -3762,6 +3844,42 @@ void Editor::AddCharUTF(char *s, unsigned int len, bool treatAsDBCS) { } NotifyChar(byte); } + + if (recordingMacro) { + NotifyMacroRecord(SCI_REPLACESEL, 0, reinterpret_cast(s)); + } +} + +void Editor::InsertPaste(SelectionPosition selStart, const char *text, int len) { + if (multiPasteMode == SC_MULTIPASTE_ONCE) { + selStart = SelectionPosition(InsertSpace(selStart.Position(), selStart.VirtualSpace())); + if (pdoc->InsertString(selStart.Position(), text, len)) { + SetEmptySelection(selStart.Position() + len); + } + } else { + // SC_MULTIPASTE_EACH + for (size_t r=0; rDeleteChars(positionInsert, sel.Range(r).Length()); + sel.Range(r).ClearVirtualSpace(); + } else { + // Range is all virtual so collapse to start of virtual space + sel.Range(r).MinimizeVirtualSpace(); + } + } + positionInsert = InsertSpace(positionInsert, sel.Range(r).caret.VirtualSpace()); + if (pdoc->InsertString(positionInsert, text, len)) { + sel.Range(r).caret.SetPosition(positionInsert + len); + sel.Range(r).anchor.SetPosition(positionInsert + len); + } + sel.Range(r).ClearVirtualSpace(); + } + } + } } void Editor::ClearSelection() { @@ -3770,14 +3888,15 @@ void Editor::ClearSelection() { UndoGroup ug(pdoc); for (size_t r=0; rDeleteChars(sel.Range(r).Start().Position(), + pdoc->DeleteChars(sel.Range(r).Start().Position(), sel.Range(r).Length()); - sel.Range(r).ClearVirtualSpace(); + sel.Range(r) = sel.Range(r).Start(); } } } + ThinRectangularRange(); sel.RemoveDuplicates(); ClaimSelection(); } @@ -3878,11 +3997,17 @@ bool Editor::CanPaste() { } void Editor::Clear() { - UndoGroup ug(pdoc); // If multiple selections, don't delete EOLS if (sel.Empty()) { + UndoGroup ug(pdoc, sel.Count() > 1); for (size_t r=0; rCharAt(sel.Range(r).caret.Position()))) { pdoc->DelChar(sel.Range(r).caret.Position()); sel.Range(r).ClearVirtualSpace(); @@ -3898,6 +4023,7 @@ void Editor::Clear() { } void Editor::SelectAll() { + sel.Clear(); SetSelection(0, pdoc->Length()); Redraw(); } @@ -3955,7 +4081,7 @@ void Editor::DelCharBack(bool allowLineStartDeletion) { pdoc->SetLineIndentation(lineCurrentPos, indentation - (indentation % indentationStep)); } // SetEmptySelection - sel.Range(r) = SelectionRange(pdoc->GetLineIndentPosition(lineCurrentPos), + sel.Range(r) = SelectionRange(pdoc->GetLineIndentPosition(lineCurrentPos), pdoc->GetLineIndentPosition(lineCurrentPos)); } else { pdoc->DelCharBack(sel.Range(r).caret.Position()); @@ -3968,11 +4094,6 @@ void Editor::DelCharBack(bool allowLineStartDeletion) { } } else { ClearSelection(); - if (sel.IsRectangular()) { - sel.selType = Selection::selThin; - sel.Rectangular() = SelectionRange(sel.Rectangular().caret, sel.Range(0).anchor); - } - //SetEmptySelection(sel.MainCaret()); } sel.RemoveDuplicates(); // Avoid blinking during rapid typing: @@ -3988,7 +4109,7 @@ void Editor::NotifyStyleToNeeded(int endStyleNeeded) { NotifyParent(scn); } -void Editor::NotifyStyleNeeded(Document*, void *, int endStyleNeeded) { +void Editor::NotifyStyleNeeded(Document *, void *, int endStyleNeeded) { NotifyStyleToNeeded(endStyleNeeded); } @@ -3997,12 +4118,6 @@ void Editor::NotifyChar(int ch) { scn.nmhdr.code = SCN_CHARADDED; scn.ch = ch; NotifyParent(scn); - if (recordingMacro) { - char txt[2]; - txt[0] = static_cast(ch); - txt[1] = '\0'; - NotifyMacroRecord(SCI_REPLACESEL, 0, reinterpret_cast(txt)); - } } void Editor::NotifySavePoint(bool isSavePoint) { @@ -4125,12 +4240,12 @@ void Editor::NotifyZoom() { } // Notifications from document -void Editor::NotifyModifyAttempt(Document*, void *) { +void Editor::NotifyModifyAttempt(Document *, void *) { //Platform::DebugPrintf("** Modify Attempt\n"); NotifyModifyAttempt(); } -void Editor::NotifySavePoint(Document*, void *, bool atSavePoint) { +void Editor::NotifySavePoint(Document *, void *, bool atSavePoint) { //Platform::DebugPrintf("** Save Point %s\n", atSavePoint ? "On" : "Off"); NotifySavePoint(atSavePoint); } @@ -4173,7 +4288,7 @@ static inline int MovePositionForDeletion(int position, int startDeletion, int l } } -void Editor::NotifyModified(Document*, DocModification mh, void *) { +void Editor::NotifyModified(Document *, DocModification mh, void *) { needUpdateUI = true; if (paintState == painting) { CheckForChangeOutsidePaint(Range(mh.position, mh.position + mh.length)); @@ -4253,12 +4368,14 @@ void Editor::NotifyModified(Document*, DocModification mh, void *) { // TODO: could invalidate from mh.startModification to end of screen //InvalidateRange(mh.position, mh.position + mh.length); if (paintState == notPainting && !CanDeferToLastStep(mh)) { + QueueStyling(pdoc->Length()); Redraw(); } } else { //Platform::DebugPrintf("** %x Line Changed %d .. %d\n", this, // mh.position, mh.position + mh.length); if (paintState == notPainting && mh.length && !CanEliminate(mh)) { + QueueStyling(mh.position + mh.length); InvalidateRange(mh.position, mh.position + mh.length); } } @@ -4272,7 +4389,7 @@ void Editor::NotifyModified(Document*, DocModification mh, void *) { if ((paintState == notPainting) || !PaintContainsMargin()) { if (mh.modificationType & SC_MOD_CHANGEFOLD) { // Fold changes can affect the drawing of following lines so redraw whole margin - RedrawSelMargin(); + RedrawSelMargin(mh.line-1, true); } else { RedrawSelMargin(mh.line); } @@ -4449,16 +4566,16 @@ void Editor::PageMove(int direction, Selection::selTypes selt, bool stuttered) { int topStutterLine = topLine + caretYSlop; int bottomStutterLine = pdoc->LineFromPosition(PositionFromLocation( - Point(lastXChosen, direction * vs.lineHeight * LinesToScroll()))) + Point(lastXChosen - xOffset, direction * vs.lineHeight * LinesToScroll()))) - caretYSlop - 1; if (stuttered && (direction < 0 && currentLine > topStutterLine)) { topLineNew = topLine; - newPos = PositionFromLocation(Point(lastXChosen, vs.lineHeight * caretYSlop)); + newPos = PositionFromLocation(Point(lastXChosen - xOffset, vs.lineHeight * caretYSlop)); } else if (stuttered && (direction > 0 && currentLine < bottomStutterLine)) { topLineNew = topLine; - newPos = PositionFromLocation(Point(lastXChosen, vs.lineHeight * (LinesToScroll() - caretYSlop))); + newPos = PositionFromLocation(Point(lastXChosen - xOffset, vs.lineHeight * (LinesToScroll() - caretYSlop))); } else { Point pt = LocationFromPosition(sel.MainCaret()); @@ -4466,7 +4583,7 @@ void Editor::PageMove(int direction, Selection::selTypes selt, bool stuttered) { topLineNew = Platform::Clamp( topLine + direction * LinesToScroll(), 0, MaxScrollPos()); newPos = PositionFromLocation( - Point(lastXChosen, pt.y + direction * (vs.lineHeight * LinesToScroll()))); + Point(lastXChosen - xOffset, pt.y + direction * (vs.lineHeight * LinesToScroll()))); } if (topLineNew != topLine) { @@ -4479,14 +4596,36 @@ void Editor::PageMove(int direction, Selection::selTypes selt, bool stuttered) { } } -void Editor::ChangeCaseOfSelection(bool makeUpperCase) { +void Editor::ChangeCaseOfSelection(int caseMapping) { UndoGroup ug(pdoc); for (size_t r=0; rChangeCase(Range(current.Start().Position(), current.End().Position()), - makeUpperCase); - // Automatic movement cuts off last character so reset to exactly the same as it was. - sel.Range(r) = current; + SelectionRange currentNoVS = current; + currentNoVS.ClearVirtualSpace(); + char *text = CopyRange(currentNoVS.Start().Position(), currentNoVS.End().Position()); + size_t rangeBytes = currentNoVS.Length(); + if (rangeBytes > 0) { + std::string sText(text, rangeBytes); + + std::string sMapped = CaseMapString(sText, caseMapping); + + if (sMapped != sText) { + size_t firstDifference = 0; + while (sMapped[firstDifference] == sText[firstDifference]) + firstDifference++; + size_t lastDifference = sMapped.size() - 1; + while (sMapped[lastDifference] == sText[lastDifference]) + lastDifference--; + size_t endSame = sMapped.size() - 1 - lastDifference; + pdoc->DeleteChars(currentNoVS.Start().Position() + firstDifference, + rangeBytes - firstDifference - endSame); + pdoc->InsertString(currentNoVS.Start().Position() + firstDifference, + sMapped.c_str() + firstDifference, lastDifference - firstDifference + 1); + // Automatic movement changes selection so reset to exactly the same as it was. + sel.Range(r) = current; + } + } + delete []text; } } @@ -4517,6 +4656,13 @@ void Editor::Duplicate(bool forLine) { forLine = true; } UndoGroup ug(pdoc, sel.Count() > 1); + SelectionPosition last; + const char *eol = ""; + int eolLen = 0; + if (forLine) { + eol = StringFromEOLMode(pdoc->eolMode); + eolLen = istrlen(eol); + } for (size_t r=0; rLineEnd(line)); } char *text = CopyRange(start.Position(), end.Position()); - if (forLine) { - const char *eol = StringFromEOLMode(pdoc->eolMode); - pdoc->InsertCString(end.Position(), eol); - pdoc->InsertString(end.Position() + istrlen(eol), text, SelectionRange(end, start).Length()); - } else { - pdoc->InsertString(end.Position(), text, SelectionRange(end, start).Length()); - } + if (forLine) + pdoc->InsertString(end.Position(), eol, eolLen); + pdoc->InsertString(end.Position() + eolLen, text, SelectionRange(end, start).Length()); delete []text; } + if (sel.Count() && sel.IsRectangular()) { + SelectionPosition last = sel.Last(); + if (forLine) { + int line = pdoc->LineFromPosition(last.Position()); + last = SelectionPosition(last.Position() + pdoc->LineStart(line+1) - pdoc->LineStart(line)); + } + if (sel.Rectangular().anchor > sel.Rectangular().caret) + sel.Rectangular().anchor = last; + else + sel.Rectangular().caret = last; + SetRectangularRange(); + } } void Editor::CancelModes() { @@ -4553,6 +4707,12 @@ void Editor::NewLine() { SetEmptySelection(sel.MainCaret() + istrlen(eol)); while (*eol) { NotifyChar(*eol); + if (recordingMacro) { + char txt[2]; + txt[0] = *eol; + txt[1] = '\0'; + NotifyMacroRecord(SCI_REPLACESEL, 0, reinterpret_cast(txt)); + } eol++; } } @@ -4564,16 +4724,24 @@ void Editor::NewLine() { } void Editor::CursorUpOrDown(int direction, Selection::selTypes selt) { - Point pt = PointMainCaret(); - int lineDoc = pdoc->LineFromPosition(sel.MainCaret()); + SelectionPosition caretToUse = sel.Range(sel.Main()).caret; + if (sel.IsRectangular()) { + if (selt == Selection::noSel) { + caretToUse = (direction > 0) ? sel.Limits().end : sel.Limits().start; + } else { + caretToUse = sel.Rectangular().caret; + } + } + Point pt = LocationFromPosition(caretToUse); + int lineDoc = pdoc->LineFromPosition(caretToUse.Position()); Point ptStartLine = LocationFromPosition(pdoc->LineStart(lineDoc)); int subLine = (pt.y - ptStartLine.y) / vs.lineHeight; int commentLines = vs.annotationVisible ? pdoc->AnnotationLines(lineDoc) : 0; SelectionPosition posNew = SPositionFromLocation( - Point(lastXChosen, pt.y + direction * vs.lineHeight), false, false, UserVirtualSpace()); + Point(lastXChosen - xOffset, pt.y + direction * vs.lineHeight), false, false, UserVirtualSpace()); if ((direction > 0) && (subLine >= (cs.GetHeight(lineDoc) - 1 - commentLines))) { posNew = SPositionFromLocation( - Point(lastXChosen, pt.y + (commentLines + 1) * vs.lineHeight), false, false, UserVirtualSpace()); + Point(lastXChosen - xOffset, pt.y + (commentLines + 1) * vs.lineHeight), false, false, UserVirtualSpace()); } if (direction < 0) { // Line wrapping may lead to a location on the same line, so @@ -4680,15 +4848,16 @@ int Editor::KeyCommand(unsigned int iMessage) { break; case SCI_CHARLEFT: if (SelectionEmpty() || sel.MoveExtends()) { - if (pdoc->IsLineEndPosition(sel.MainCaret()) && sel.RangeMain().caret.VirtualSpace()) { + if ((sel.Count() == 1) && pdoc->IsLineEndPosition(sel.MainCaret()) && sel.RangeMain().caret.VirtualSpace()) { SelectionPosition spCaret = sel.RangeMain().caret; spCaret.SetVirtualSpace(spCaret.VirtualSpace() - 1); MovePositionTo(spCaret); } else { - MovePositionTo(MovePositionSoVisible(SelectionPosition(sel.MainCaret() - 1), -1)); + MovePositionTo(MovePositionSoVisible( + SelectionPosition((sel.LimitsForRectangularElseMain().start).Position() - 1), -1)); } } else { - MovePositionTo(sel.RangeMain().Start()); + MovePositionTo(sel.LimitsForRectangularElseMain().start); } SetLastXChosen(); break; @@ -4719,10 +4888,11 @@ int Editor::KeyCommand(unsigned int iMessage) { spCaret.SetVirtualSpace(spCaret.VirtualSpace() + 1); MovePositionTo(spCaret); } else { - MovePositionTo(MovePositionSoVisible(SelectionPosition(sel.MainCaret() + 1), 1)); + MovePositionTo(MovePositionSoVisible( + SelectionPosition((sel.LimitsForRectangularElseMain().end).Position() + 1), 1)); } } else { - MovePositionTo(sel.RangeMain().End()); + MovePositionTo(sel.LimitsForRectangularElseMain().end); } SetLastXChosen(); break; @@ -4981,15 +5151,22 @@ int Editor::KeyCommand(unsigned int iMessage) { case SCI_DELWORDLEFT: { int startWord = pdoc->NextWordStart(sel.MainCaret(), -1); pdoc->DeleteChars(startWord, sel.MainCaret() - startWord); + sel.RangeMain().ClearVirtualSpace(); SetLastXChosen(); } break; case SCI_DELWORDRIGHT: { + UndoGroup ug(pdoc); + sel.RangeMain().caret = SelectionPosition( + InsertSpace(sel.RangeMain().caret.Position(), sel.RangeMain().caret.VirtualSpace())); int endWord = pdoc->NextWordStart(sel.MainCaret(), 1); pdoc->DeleteChars(sel.MainCaret(), endWord - sel.MainCaret()); } break; case SCI_DELWORDRIGHTEND: { + UndoGroup ug(pdoc); + sel.RangeMain().caret = SelectionPosition( + InsertSpace(sel.RangeMain().caret.Position(), sel.RangeMain().caret.VirtualSpace())); int endWord = pdoc->NextWordEnd(sel.MainCaret(), 1); pdoc->DeleteChars(sel.MainCaret(), endWord - sel.MainCaret()); } @@ -4998,6 +5175,7 @@ int Editor::KeyCommand(unsigned int iMessage) { int line = pdoc->LineFromPosition(sel.MainCaret()); int start = pdoc->LineStart(line); pdoc->DeleteChars(start, sel.MainCaret() - start); + sel.RangeMain().ClearVirtualSpace(); SetLastXChosen(); } break; @@ -5041,10 +5219,10 @@ int Editor::KeyCommand(unsigned int iMessage) { Duplicate(false); break; case SCI_LOWERCASE: - ChangeCaseOfSelection(false); + ChangeCaseOfSelection(cmLower); break; case SCI_UPPERCASE: - ChangeCaseOfSelection(true); + ChangeCaseOfSelection(cmUpper); break; case SCI_WORDPARTLEFT: MovePositionTo(MovePositionSoVisible(pdoc->WordPartLeft(sel.MainCaret()), -1)); @@ -5122,7 +5300,7 @@ void Editor::Indent(bool forwards) { if (lineOfAnchor == lineCurrentPos) { if (forwards) { UndoGroup ug(pdoc); - pdoc->DeleteChars(sel.Range(r).Start().Position(), sel.Range(r).Length()); + pdoc->DeleteChars(sel.Range(r).Start().Position(), sel.Range(r).Length()); caretPosition = sel.Range(r).caret.Position(); if (pdoc->GetColumn(caretPosition) <= pdoc->GetColumn(pdoc->GetLineIndentPosition(lineCurrentPos)) && pdoc->tabIndents) { @@ -5152,7 +5330,7 @@ void Editor::Indent(bool forwards) { int indentation = pdoc->GetLineIndentation(lineCurrentPos); int indentationStep = pdoc->IndentSize(); pdoc->SetLineIndentation(lineCurrentPos, indentation - indentationStep); - SetEmptySelection(pdoc->GetLineIndentPosition(lineCurrentPos)); + sel.Range(r) = SelectionRange(pdoc->GetLineIndentPosition(lineCurrentPos)); } else { int newColumn = ((pdoc->GetColumn(caretPosition) - 1) / pdoc->tabInChars) * pdoc->tabInChars; @@ -5191,6 +5369,31 @@ void Editor::Indent(bool forwards) { } } +class CaseFolderASCII : public CaseFolderTable { +public: + CaseFolderASCII() { + StandardASCII(); + } + ~CaseFolderASCII() { + } + virtual size_t Fold(char *folded, size_t sizeFolded, const char *mixed, size_t lenMixed) { + if (lenMixed > sizeFolded) { + return 0; + } else { + for (size_t i=0; i(mixed[i])]; + } + return lenMixed; + } + } +}; + + +CaseFolder *Editor::CaseFolderForEncoding() { + // Simple default that only maps ASCII upper case to lower case. + return new CaseFolderASCII(); +} + /** * Search of a text in the document, in the given range. * @return The position of the found text, -1 if not found. @@ -5202,13 +5405,15 @@ long Editor::FindText( Sci_TextToFind *ft = reinterpret_cast(lParam); int lengthFound = istrlen(ft->lpstrText); + std::auto_ptr pcf(CaseFolderForEncoding()); int pos = pdoc->FindText(ft->chrg.cpMin, ft->chrg.cpMax, ft->lpstrText, (wParam & SCFIND_MATCHCASE) != 0, (wParam & SCFIND_WHOLEWORD) != 0, (wParam & SCFIND_WORDSTART) != 0, (wParam & SCFIND_REGEXP) != 0, wParam, - &lengthFound); + &lengthFound, + pcf.get()); if (pos != -1) { ft->chrgText.cpMin = pos; ft->chrgText.cpMax = pos + lengthFound; @@ -5245,6 +5450,7 @@ long Editor::SearchText( const char *txt = reinterpret_cast(lParam); int pos; int lengthFound = istrlen(txt); + std::auto_ptr pcf(CaseFolderForEncoding()); if (iMessage == SCI_SEARCHNEXT) { pos = pdoc->FindText(searchAnchor, pdoc->Length(), txt, (wParam & SCFIND_MATCHCASE) != 0, @@ -5252,7 +5458,8 @@ long Editor::SearchText( (wParam & SCFIND_WORDSTART) != 0, (wParam & SCFIND_REGEXP) != 0, wParam, - &lengthFound); + &lengthFound, + pcf.get()); } else { pos = pdoc->FindText(searchAnchor, 0, txt, (wParam & SCFIND_MATCHCASE) != 0, @@ -5260,9 +5467,9 @@ long Editor::SearchText( (wParam & SCFIND_WORDSTART) != 0, (wParam & SCFIND_REGEXP) != 0, wParam, - &lengthFound); + &lengthFound, + pcf.get()); } - if (pos != -1) { SetSelection(pos, pos + lengthFound); } @@ -5270,19 +5477,39 @@ long Editor::SearchText( return pos; } +std::string Editor::CaseMapString(const std::string &s, int caseMapping) { + std::string ret(s); + for (size_t i=0; i= 'a' && ret[i] <= 'z') + ret[i] = static_cast(ret[i] - 'a' + 'A'); + break; + case cmLower: + if (ret[i] >= 'A' && ret[i] <= 'Z') + ret[i] = static_cast(ret[i] - 'A' + 'a'); + break; + } + } + return ret; +} + /** * Search for text in the target range of the document. * @return The position of the found text, -1 if not found. */ long Editor::SearchInTarget(const char *text, int length) { int lengthFound = length; + + std::auto_ptr pcf(CaseFolderForEncoding()); int pos = pdoc->FindText(targetStart, targetEnd, text, (searchFlags & SCFIND_MATCHCASE) != 0, (searchFlags & SCFIND_WHOLEWORD) != 0, (searchFlags & SCFIND_WORDSTART) != 0, (searchFlags & SCFIND_REGEXP) != 0, searchFlags, - &lengthFound); + &lengthFound, + pcf.get()); if (pos != -1) { targetStart = pos; targetEnd = pos + lengthFound; @@ -5340,7 +5567,7 @@ void Editor::CopySelectionRange(SelectionText *ss, bool allowLineCopy) { strncat(textWithEndl, "\r", textLen); if (pdoc->eolMode != SC_EOL_CR) strncat(textWithEndl, "\n", textLen); - ss->Set(textWithEndl, strlen(textWithEndl), + ss->Set(textWithEndl, strlen(textWithEndl) + 1, pdoc->dbcsCodePage, vs.styles[STYLE_DEFAULT].characterSet, false, true); delete []text; } @@ -5495,7 +5722,7 @@ void Editor::DropAt(SelectionPosition position, const char *value, bool moving, bool Editor::PositionInSelection(int pos) { pos = MovePositionOutsideChar(pos, sel.MainCaret() - pos); for (size_t r=0; r 1) + if (sel.Count() > 1) Redraw(); sel.Clear(); sel.selType = alt ? Selection::selRectangle : Selection::selStream; SetSelection(newPos, newPos); } } + SelectionPosition anchorCurrent = newPos; + if (shift) + anchorCurrent = sel.IsRectangular() ? + sel.Rectangular().anchor : sel.RangeMain().anchor; sel.selType = alt ? Selection::selRectangle : Selection::selStream; selectionType = selChar; originalAnchorPos = sel.MainCaret(); - sel.Rectangular() = SelectionRange(newPos); + sel.Rectangular() = SelectionRange(newPos, anchorCurrent); SetRectangularRange(); } } } lastClickTime = curTime; - lastXChosen = pt.x; + lastXChosen = pt.x + xOffset; ShowCaretAtCurrentPosition(); } @@ -5736,7 +5971,7 @@ void Editor::SetHotSpotRange(Point *pt) { } } -void Editor::GetHotSpotRange(int& hsStart_, int& hsEnd_) { +void Editor::GetHotSpotRange(int &hsStart_, int &hsEnd_) { hsStart_ = hsStart; hsEnd_ = hsEnd; } @@ -5746,7 +5981,7 @@ void Editor::ButtonMove(Point pt) { DwellEnd(true); } - SelectionPosition movePos = SPositionFromLocation(pt, false, false, + SelectionPosition movePos = SPositionFromLocation(pt, false, false, AllowVirtualSpace(virtualSpaceOptions, sel.IsRectangular())); movePos = MovePositionOutsideChar(movePos, sel.MainCaret() - movePos.Position()); @@ -5822,7 +6057,7 @@ void Editor::ButtonMove(Point pt) { Redraw(); } else if (pt.y < rcClient.top) { int lineMove = cs.DisplayFromDoc(LineFromLocation(pt)); - ScrollTo(lineMove - 5); + ScrollTo(lineMove - 2); Redraw(); } EnsureCaretVisible(false, false, true); @@ -5834,6 +6069,7 @@ void Editor::ButtonMove(Point pt) { if (vs.fixedColumnWidth > 0) { // There is a margin if (PointInSelMargin(pt)) { DisplayCursor(Window::cursorReverseArrow); + SetHotSpotRange(NULL); return; // No need to test for selection } } @@ -5852,7 +6088,7 @@ void Editor::ButtonMove(Point pt) { void Editor::ButtonUp(Point pt, unsigned int curTime, bool ctrl) { //Platform::DebugPrintf("ButtonUp %d %d\n", HaveMouseCapture(), inDragDrop); - SelectionPosition newPos = SPositionFromLocation(pt, false, false, + SelectionPosition newPos = SPositionFromLocation(pt, false, false, AllowVirtualSpace(virtualSpaceOptions, sel.IsRectangular())); newPos = MovePositionOutsideChar(newPos, sel.MainCaret() - newPos.Position()); if (inDragDrop == ddInitial) { @@ -5899,7 +6135,7 @@ void Editor::ButtonUp(Point pt, unsigned int curTime, bool ctrl) { } else { if (selectionType == selChar) { if (sel.Count() > 1) { - sel.RangeMain() = + sel.RangeMain() = SelectionRange(newPos, sel.Range(sel.Count() - 1).anchor); InvalidateSelection(sel.RangeMain(), true); } else { @@ -5911,7 +6147,7 @@ void Editor::ButtonUp(Point pt, unsigned int curTime, bool ctrl) { SetRectangularRange(); lastClickTime = curTime; lastClick = pt; - lastXChosen = pt.x; + lastXChosen = pt.x + xOffset; if (sel.selType == Selection::selStream) { SetLastXChosen(); } @@ -5987,6 +6223,48 @@ void Editor::SetFocusState(bool focusState) { } } +int Editor::PositionAfterArea(PRectangle rcArea) { + // The start of the document line after the display line after the area + // This often means that the line after a modification is restyled which helps + // detect multiline comment additions and heals single line comments + int lineAfter = topLine + (rcArea.bottom - 1) / vs.lineHeight + 1; + if (lineAfter < cs.LinesDisplayed()) + return pdoc->LineStart(cs.DocFromDisplay(lineAfter) + 1); + else + return pdoc->Length(); +} + +// Style to a position within the view. If this causes a change at end of last line then +// affects later lines so style all the viewed text. +void Editor::StyleToPositionInView(Position pos) { + int endWindow = PositionAfterArea(GetClientRectangle()); + if (pos > endWindow) + pos = endWindow; + int styleAtEnd = pdoc->StyleAt(pos-1); + pdoc->EnsureStyledTo(pos); + if ((endWindow > pos) && (styleAtEnd != pdoc->StyleAt(pos-1))) { + // Style at end of line changed so is multi-line change like starting a comment + // so require rest of window to be styled. + pdoc->EnsureStyledTo(endWindow); + } +} + +void Editor::IdleStyling() { + // Style the line after the modification as this allows modifications that change just the + // line of the modification to heal instead of propagating to the rest of the window. + StyleToPositionInView(pdoc->LineStart(pdoc->LineFromPosition(styleNeeded.upTo) + 2)); + + if (needUpdateUI) { + NotifyUpdateUI(); + needUpdateUI = false; + } + styleNeeded.Reset(); +} + +void Editor::QueueStyling(int upTo) { + styleNeeded.NeedUpTo(upTo); +} + bool Editor::PaintContains(PRectangle rc) { if (rc.Empty()) { return true; @@ -6200,6 +6478,24 @@ void Editor::EnsureLineVisible(int lineDoc, bool enforcePolicy) { } } +int Editor::GetTag(char *tagValue, int tagNumber) { + char name[3] = "\\?"; + const char *text = 0; + int length = 0; + if ((tagNumber >= 1) && (tagNumber <= 9)) { + name[1] = static_cast(tagNumber + '0'); + length = 2; + text = pdoc->SubstituteByPosition(name, &length); + } + if (tagValue) { + if (text) + memcpy(tagValue, text, length + 1); + else + *tagValue = '\0'; + } + return length; +} + int Editor::ReplaceTarget(bool replacePatterns, const char *text, int length) { UndoGroup ug(pdoc); if (length == -1) @@ -6246,11 +6542,11 @@ void Editor::AddStyledText(char *buffer, int appendLength) { size_t textLength = appendLength / 2; char *text = new char[textLength]; size_t i; - for (i = 0;i < textLength;i++) { + for (i = 0; i < textLength; i++) { text[i] = buffer[i*2]; } pdoc->InsertString(CurrentPosition(), text, textLength); - for (i = 0;i < textLength;i++) { + for (i = 0; i < textLength; i++) { text[i] = buffer[i*2+1]; } pdoc->StartStyling(CurrentPosition(), static_cast(0xff)); @@ -6331,6 +6627,8 @@ sptr_t Editor::StyleGetMessage(unsigned int iMessage, uptr_t wParam, sptr_t lPar case SCI_STYLEGETSIZE: return vs.styles[wParam].size; case SCI_STYLEGETFONT: + if (!vs.styles[wParam].fontName) + return 0; if (lParam != 0) strcpy(CharPtrFromSPtr(lParam), vs.styles[wParam].fontName); return strlen(vs.styles[wParam].fontName); @@ -6350,6 +6648,15 @@ sptr_t Editor::StyleGetMessage(unsigned int iMessage, uptr_t wParam, sptr_t lPar return 0; } +sptr_t Editor::StringResult(sptr_t lParam, const char *val) { + const int n = strlen(val); + if (lParam != 0) { + char *ptr = reinterpret_cast(lParam); + strcpy(ptr, val); + } + return n; // Not including NUL +} + sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) { //Platform::DebugPrintf("S start wnd proc %d %d %d\n",iMessage, wParam, lParam); @@ -6435,6 +6742,10 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) { case SCI_GETFIRSTVISIBLELINE: return topLine; + case SCI_SETFIRSTVISIBLELINE: + ScrollTo(wParam); + break; + case SCI_GETLINE: { // Risk of overwriting the end of the buffer int lineStart = pdoc->LineStart(wParam); int lineEnd = pdoc->LineStart(wParam + 1); @@ -6465,6 +6776,8 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) { nEnd = pdoc->Length(); if (nStart < 0) nStart = nEnd; // Remove selection + InvalidateSelection(SelectionRange(nStart, nEnd)); + sel.Clear(); sel.selType = Selection::selStream; SetSelection(nEnd, nStart); EnsureCaretVisible(); @@ -6475,7 +6788,7 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) { SelectionText selectedText; CopySelectionRange(&selectedText); if (lParam == 0) { - return selectedText.len + 1; + return selectedText.len ? selectedText.len : 1; } else { char *ptr = CharPtrFromSPtr(lParam); int iChar = 0; @@ -6567,6 +6880,9 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) { case SCI_GETSEARCHFLAGS: return searchFlags; + case SCI_GETTAG: + return GetTag(CharPtrFromSPtr(lParam), wParam); + case SCI_POSITIONBEFORE: return pdoc->MovePositionOutsideChar(wParam - 1, -1, true); @@ -6787,14 +7103,14 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) { break; case SCI_GETSELECTIONSTART: - return Platform::Minimum(sel.MainAnchor(), sel.MainCaret()); + return sel.LimitsForRectangularElseMain().start.Position(); case SCI_SETSELECTIONEND: SetSelection(wParam, Platform::Minimum(sel.MainAnchor(), wParam)); break; case SCI_GETSELECTIONEND: - return Platform::Maximum(sel.MainAnchor(), sel.MainCaret()); + return sel.LimitsForRectangularElseMain().end.Position(); case SCI_SETPRINTMAGNIFICATION: printMagnification = wParam; @@ -6867,6 +7183,14 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) { Redraw(); break; + case SCI_GETWHITESPACESIZE: + return vs.whitespaceSize; + + case SCI_SETWHITESPACESIZE: + vs.whitespaceSize = static_cast(wParam); + Redraw(); + break; + case SCI_POSITIONFROMPOINT: return PositionFromLocation(Point(wParam, lParam), false, false); @@ -6945,6 +7269,15 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) { InvalidateStyleRedraw(); break; + case SCI_SETFONTQUALITY: + vs.extraFontFlag &= ~SC_EFF_QUALITY_MASK; + vs.extraFontFlag |= (wParam & SC_EFF_QUALITY_MASK); + InvalidateStyleRedraw(); + break; + + case SCI_GETFONTQUALITY: + return (vs.extraFontFlag & SC_EFF_QUALITY_MASK); + case SCI_SETTABWIDTH: if (wParam > 0) { pdoc->tabInChars = wParam; @@ -7036,9 +7369,11 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) { return wrapState; case SCI_SETWRAPVISUALFLAGS: - wrapVisualFlags = wParam; - InvalidateStyleRedraw(); - ReconfigureScrollBars(); + if (wrapVisualFlags != static_cast(wParam)) { + wrapVisualFlags = wParam; + InvalidateStyleRedraw(); + ReconfigureScrollBars(); + } break; case SCI_GETWRAPVISUALFLAGS: @@ -7053,18 +7388,22 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) { return wrapVisualFlagsLocation; case SCI_SETWRAPSTARTINDENT: - wrapVisualStartIndent = wParam; - InvalidateStyleRedraw(); - ReconfigureScrollBars(); + if (wrapVisualStartIndent != static_cast(wParam)) { + wrapVisualStartIndent = wParam; + InvalidateStyleRedraw(); + ReconfigureScrollBars(); + } break; case SCI_GETWRAPSTARTINDENT: return wrapVisualStartIndent; case SCI_SETWRAPINDENTMODE: - wrapIndentMode = wParam; - InvalidateStyleRedraw(); - ReconfigureScrollBars(); + if (wrapIndentMode != static_cast(wParam)) { + wrapIndentMode = wParam; + InvalidateStyleRedraw(); + ReconfigureScrollBars(); + } break; case SCI_GETWRAPINDENTMODE: @@ -7405,14 +7744,14 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) { vs.showCaretLineBackground = wParam != 0; InvalidateStyleRedraw(); break; - + case SCI_GETCARETLINEVISIBLEALWAYS: return vs.showCaretLineBackgroundAlways; case SCI_SETCARETLINEVISIBLEALWAYS: vs.showCaretLineBackgroundAlways = wParam != 0; InvalidateStyleRedraw(); break; - + case SCI_GETCARETLINEBACK: return vs.caretLineBackground.desired.AsLong(); case SCI_SETCARETLINEBACK: @@ -7908,7 +8247,7 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) { } case SCI_GETLINESELSTARTPOSITION: case SCI_GETLINESELENDPOSITION: { - SelectionSegment segmentLine(SelectionPosition(pdoc->LineStart(wParam)), + SelectionSegment segmentLine(SelectionPosition(pdoc->LineStart(wParam)), SelectionPosition(pdoc->LineEnd(wParam))); for (size_t r=0; rlen; 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... first = NULL; last = NULL; @@ -195,18 +195,15 @@ void LexerLibrary::Release() { /// Return the single LexerManager instance... LexerManager *LexerManager::GetInstance() { - if(!theInstance) + if (!theInstance) theInstance = new LexerManager; return theInstance; } /// Delete any LexerManager instance... -void LexerManager::DeleteInstance() -{ - if(theInstance) { - delete theInstance; - theInstance = NULL; - } +void LexerManager::DeleteInstance() { + delete theInstance; + theInstance = NULL; } /// protected constructor - this is a singleton... @@ -219,13 +216,15 @@ LexerManager::~LexerManager() { Clear(); } -void LexerManager::Load(const char* path) -{ +void LexerManager::Load(const char *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); if (NULL != first) { last->next = lib; @@ -236,8 +235,7 @@ void LexerManager::LoadLexerLibrary(const char* module) } } -void LexerManager::Clear() -{ +void LexerManager::Clear() { if (NULL != first) { LexerLibrary *cur = first; LexerLibrary *next; @@ -257,8 +255,7 @@ void LexerManager::Clear() // //------------------------------------------ -LMMinder::~LMMinder() -{ +LMMinder::~LMMinder() { LexerManager::DeleteInstance(); } diff --git a/scintilla/src/ExternalLexer.h b/scintilla/src/ExternalLexer.h index 5f490176..60ad4a88 100644 --- a/scintilla/src/ExternalLexer.h +++ b/scintilla/src/ExternalLexer.h @@ -23,7 +23,7 @@ typedef void (EXT_LEXER_DECL *ExtLexerFunction)(unsigned int lexer, unsigned int char *words[], WindowID window, char *props); typedef void (EXT_LEXER_DECL *ExtFoldFunction)(unsigned int lexer, unsigned int startPos, int length, int initStyle, 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 void (EXT_LEXER_DECL *GetLexerNameFn)(unsigned int Index, char *name, int buflength); @@ -37,11 +37,12 @@ protected: int externalLanguage; char name[100]; public: - ExternalLexerModule(int language_, LexerFunction fnLexer_, - const char *languageName_=0, LexerFunction fnFolder_=0) : LexerModule(language_, fnLexer_, 0, fnFolder_){ + ExternalLexerModule(int language_, LexerFunction fnLexer_, + const char *languageName_=0, LexerFunction fnFolder_=0) : LexerModule(language_, fnLexer_, 0, fnFolder_) { strncpy(name, languageName_, sizeof(name)); + name[sizeof(name)-1] = '\0'; languageName = name; - }; + } virtual void Lex(unsigned int startPos, int lengthDoc, int initStyle, WordList *keywordlists[], Accessor &styler) const; virtual void Fold(unsigned int startPos, int lengthDoc, int initStyle, @@ -63,10 +64,10 @@ class LexerLibrary { LexerMinder *last; public: - LexerLibrary(const char* ModuleName); + LexerLibrary(const char *ModuleName); ~LexerLibrary(); void Release(); - + LexerLibrary *next; std::string m_sModuleName; }; @@ -75,18 +76,18 @@ public: class LexerManager { public: ~LexerManager(); - + static LexerManager *GetInstance(); static void DeleteInstance(); - - void Load(const char* path); + + void Load(const char *path); void Clear(); private: LexerManager(); static LexerManager *theInstance; - void LoadLexerLibrary(const char* module); + void LoadLexerLibrary(const char *module); LexerLibrary *first; LexerLibrary *last; }; diff --git a/scintilla/src/KeyWords.cxx b/scintilla/src/KeyWords.cxx index d06251d8..5a773149 100644 --- a/scintilla/src/KeyWords.cxx +++ b/scintilla/src/KeyWords.cxx @@ -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 // a look up table. bool wordSeparator[256]; - for (int i=0;i<256; i++) { + for (int i=0; i<256; i++) { wordSeparator[i] = false; } wordSeparator['\r'] = true; @@ -92,11 +92,11 @@ void WordList::Set(const char *s) { extern "C" int cmpString(const void *a1, const void *a2) { // 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) { - qsort(reinterpret_cast(words), len, sizeof(*words), + qsort(reinterpret_cast(words), len, sizeof(*words), cmpString); } @@ -216,7 +216,7 @@ LexerModule::LexerModule(int language_, LexerFunction fnLexer_, const char *languageName_, LexerFunction fnFolder_, - const char * const wordListDescriptions_[], + const char *const wordListDescriptions_[], int styleBits_) : language(language_), fnLexer(fnLexer_), @@ -375,6 +375,7 @@ int Scintilla_LinkLexers() { LINK_LEXER(lmLua); LINK_LEXER(lmMagikSF); LINK_LEXER(lmMake); + LINK_LEXER(lmMarkdown); LINK_LEXER(lmMatlab); LINK_LEXER(lmMETAPOST); LINK_LEXER(lmMMIXAL); @@ -384,7 +385,7 @@ int Scintilla_LinkLexers() { LINK_LEXER(lmNncrontab); LINK_LEXER(lmNsis); LINK_LEXER(lmNull); - LINK_LEXER(lmObjC); + LINK_LEXER(lmObjC); LINK_LEXER(lmOctave); LINK_LEXER(lmOpal); LINK_LEXER(lmPascal); @@ -405,7 +406,7 @@ int Scintilla_LinkLexers() { LINK_LEXER(lmREBOL); LINK_LEXER(lmRuby); LINK_LEXER(lmScriptol); - LINK_LEXER(lmSearchResult); + LINK_LEXER(lmSearchResult); LINK_LEXER(lmSmalltalk); LINK_LEXER(lmSML); LINK_LEXER(lmSorc); @@ -417,7 +418,7 @@ int Scintilla_LinkLexers() { LINK_LEXER(lmTAL); LINK_LEXER(lmTCL); LINK_LEXER(lmTeX); - LINK_LEXER(lmUserDefine); + LINK_LEXER(lmUserDefine); LINK_LEXER(lmVB); LINK_LEXER(lmVBScript); LINK_LEXER(lmVerilog); diff --git a/scintilla/src/LexAVE.cxx b/scintilla/src/LexAVE.cxx index 49ccbac8..4c1758ec 100644 --- a/scintilla/src/LexAVE.cxx +++ b/scintilla/src/LexAVE.cxx @@ -42,7 +42,7 @@ inline bool IsAWordStart(const int ch) { } inline bool isAveOperator(char ch) { - if (isalnum(ch)) + if (isascii(ch) && isalnum(ch)) return false; // '.' left out as it is used to make up numbers if (ch == '*' || ch == '/' || ch == '-' || ch == '+' || diff --git a/scintilla/src/LexBash.cxx b/scintilla/src/LexBash.cxx index caf31ec6..ec3e04af 100644 --- a/scintilla/src/LexBash.cxx +++ b/scintilla/src/LexBash.cxx @@ -248,14 +248,8 @@ static void ColouriseBashDoc(unsigned int startPos, int length, int initStyle, sc.SetState(SCE_SH_DEFAULT); break; case SCE_SH_COMMENTLINE: - if (sc.ch == '\\' && (sc.chNext == '\r' || sc.chNext == '\n')) { - // comment continuation - sc.Forward(); - if (sc.ch == '\r' && sc.chNext == '\n') { - sc.Forward(); - } - } else if (sc.atLineEnd) { - sc.ForwardSetState(SCE_SH_DEFAULT); + if (sc.atLineEnd && sc.chPrev != '\\') { + sc.SetState(SCE_SH_DEFAULT); } break; case SCE_SH_HERE_DELIM: @@ -294,23 +288,14 @@ static void ColouriseBashDoc(unsigned int startPos, int length, int initStyle, HereDoc.State = 1; } } else if (HereDoc.State == 1) { // collect the delimiter - if (HereDoc.Quoted) { // a quoted here-doc delimiter - if (sc.ch == HereDoc.Quote) { // closing quote => end of delimiter - 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 == '\\') { - // skip escape prefix - } else { - sc.SetState(SCE_SH_DEFAULT); - } + if (setHereDoc2.Contains(sc.ch) || sc.chPrev == '\\') { + HereDoc.Append(sc.ch); + } else if (HereDoc.Quoted && sc.ch == HereDoc.Quote) { // closing quote => end of delimiter + sc.ForwardSetState(SCE_SH_DEFAULT); + } else if (sc.ch == '\\') { + // skip escape prefix + } else { + sc.SetState(SCE_SH_DEFAULT); } if (HereDoc.DelimiterLength >= HERE_DELIM_MAX - 1) { // force blowup sc.SetState(SCE_SH_ERROR); diff --git a/scintilla/src/LexBullant.cxx b/scintilla/src/LexBullant.cxx index b476ee5b..437843f6 100644 --- a/scintilla/src/LexBullant.cxx +++ b/scintilla/src/LexBullant.cxx @@ -21,6 +21,7 @@ using namespace Scintilla; static int classifyWordBullant(unsigned int start, unsigned int end, WordList &keywords, Accessor &styler) { char s[100]; + s[0] = '\0'; for (unsigned int i = 0; i < end - start + 1 && i < 30; i++) { s[i] = static_cast(tolower(styler[start + i])); s[i + 1] = '\0'; @@ -111,7 +112,7 @@ static void ColouriseBullantDoc(unsigned int startPos, int length, int initStyle } blockChange=0; */ } - if (!isspace(ch)) + if (!(isascii(ch) && isspace(ch))) visibleChars++; if (styler.IsLeadByte(ch)) { diff --git a/scintilla/src/LexCOBOL.cxx b/scintilla/src/LexCOBOL.cxx index 832957aa..eee1fd40 100644 --- a/scintilla/src/LexCOBOL.cxx +++ b/scintilla/src/LexCOBOL.cxx @@ -202,7 +202,7 @@ static void ColouriseCOBOLDoc(unsigned int startPos, int length, int initStyle, } if (state == SCE_C_DEFAULT) { - if (isCOBOLwordstart(ch) || (ch == '$' && isalpha(chNext))) { + if (isCOBOLwordstart(ch) || (ch == '$' && isascii(chNext) && isalpha(chNext))) { ColourTo(styler, i-1, state); state = SCE_C_IDENTIFIER; } else if (column == 0 && ch == '*' && chNext != '*') { diff --git a/scintilla/src/LexCPP.cxx b/scintilla/src/LexCPP.cxx index 88294076..94995bc3 100644 --- a/scintilla/src/LexCPP.cxx +++ b/scintilla/src/LexCPP.cxx @@ -59,8 +59,8 @@ static void ColouriseCppDoc(unsigned int startPos, int length, int initStyle, Wo WordList &keywords4 = *keywordlists[3]; // property styling.within.preprocessor - // For C++ code, determines whether all preprocessor code is styled in the preprocessor style (0, the default) - // or only from the initial # to the end of the command word(1). + // For C++ code, determines whether all preprocessor code is styled in the preprocessor style (0, the default) + // or only from the initial # to the end of the command word(1). bool stylingWithinPreprocessor = styler.GetPropertyInt("styling.within.preprocessor") != 0; CharacterSet setOKBeforeRE(CharacterSet::setNone, "([{=,:;!%^&*|?~+-"); @@ -72,7 +72,7 @@ static void ColouriseCppDoc(unsigned int startPos, int length, int initStyle, Wo CharacterSet setWord(CharacterSet::setAlphaNum, "._", 0x80, true); // property lexer.cpp.allow.dollars - // Set to 0 to disallow the '$' character in identifiers with the cpp lexer. + // Set to 0 to disallow the '$' character in identifiers with the cpp lexer. if (styler.GetPropertyInt("lexer.cpp.allow.dollars", 1) != 0) { setWordStart.Add('$'); setWord.Add('$'); @@ -379,20 +379,20 @@ static void FoldCppDoc(unsigned int startPos, int length, int initStyle, WordList *[], Accessor &styler) { // property fold.comment - // This option enables folding multi-line comments and explicit fold points when using the C++ lexer. - // Explicit fold points allows adding extra folding by placing a //{ comment at the start and a //} - // at the end of a section that should fold. + // This option enables folding multi-line comments and explicit fold points when using the C++ lexer. + // Explicit fold points allows adding extra folding by placing a //{ comment at the start and a //} + // at the end of a section that should fold. bool foldComment = styler.GetPropertyInt("fold.comment") != 0; // property fold.preprocessor - // This option enables folding preprocessor directives when using the C++ lexer. - // Includes C#'s explicit #region and #endregion folding directives. + // This option enables folding preprocessor directives when using the C++ lexer. + // Includes C#'s explicit #region and #endregion folding directives. bool foldPreprocessor = styler.GetPropertyInt("fold.preprocessor") != 0; bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0; - // property fold.at.else - // This option enables C++ folding on a "} else {" line of an if statement. + // property fold.at.else + // This option enables C++ folding on a "} else {" line of an if statement. bool foldAtElse = styler.GetPropertyInt("fold.at.else", 0) != 0; unsigned int endPos = startPos + length; @@ -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", "Secondary keywords and identifiers", "Documentation comment keywords", "Unused", "Global classes and typedefs", 0, - }; +}; static void ColouriseCppDocSensitive(unsigned int startPos, int length, int initStyle, WordList *keywordlists[], Accessor &styler) { diff --git a/scintilla/src/LexCSS.cxx b/scintilla/src/LexCSS.cxx index 32a0068b..9e4d1d74 100644 --- a/scintilla/src/LexCSS.cxx +++ b/scintilla/src/LexCSS.cxx @@ -62,6 +62,7 @@ static void ColouriseCssDoc(unsigned int startPos, int length, int initStyle, Wo int lastState = -1; // before operator int lastStateC = -1; // before comment + int lastStateS = -1; // before single-quoted/double-quoted string int op = ' '; // last operator int opPrev = ' '; // last operator @@ -105,7 +106,7 @@ static void ColouriseCssDoc(unsigned int startPos, int length, int initStyle, Wo i--; if ((sc.currentPos - i) % 2 == 1) continue; - sc.ForwardSetState(SCE_CSS_VALUE); + sc.ForwardSetState(lastStateS); } 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); break; case '{': - if (lastState == SCE_CSS_DIRECTIVE) + if (lastState == SCE_CSS_MEDIA) 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); break; 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_EXTENDED_PSEUDOCLASS || sc.state == SCE_CSS_EXTENDED_PSEUDOELEMENT || sc.state == SCE_CSS_UNKNOWN_PSEUDOCLASS || - sc.state == SCE_CSS_IMPORTANT + sc.state == SCE_CSS_IMPORTANT || + sc.state == SCE_CSS_DIRECTIVE )) { char s[100]; 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) sc.ChangeState(SCE_CSS_VALUE); 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; sc.SetState(SCE_CSS_COMMENT); 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)); } else if (IsCssOperator(sc.ch) && (sc.state != SCE_CSS_ATTRIBUTE || 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) lastState = sc.state; diff --git a/scintilla/src/LexCaml.cxx b/scintilla/src/LexCaml.cxx index ef22dd68..194063b3 100644 --- a/scintilla/src/LexCaml.cxx +++ b/scintilla/src/LexCaml.cxx @@ -430,13 +430,11 @@ void ColouriseCamlDoc( static #endif /* BUILD_AS_EXTERNAL_LEXER */ void FoldCamlDoc( - unsigned int startPos, int length, - int initStyle, - WordList *keywordlists[], - Accessor &styler) + unsigned int, int, + int, + WordList *[], + Accessor &) { - // below useless evaluation(s) to supress "not used" warnings - startPos || length || initStyle || keywordlists[0] || styler.Length(); } static const char * const camlWordListDesc[] = { diff --git a/scintilla/src/LexConf.cxx b/scintilla/src/LexConf.cxx index d3931740..5bacae99 100644 --- a/scintilla/src/LexConf.cxx +++ b/scintilla/src/LexConf.cxx @@ -70,17 +70,17 @@ static void ColouriseConfDoc(unsigned int startPos, int length, int, WordList *k } else if( ch == '"') { state = SCE_CONF_STRING; styler.ColourTo(i,SCE_CONF_STRING); - } else if( ispunct(ch) ) { + } else if( isascii(ch) && ispunct(ch) ) { // signals an operator... // no state jump necessary for this // simple case... styler.ColourTo(i,SCE_CONF_OPERATOR); - } else if( isalpha(ch) ) { + } else if( isascii(ch) && isalpha(ch) ) { // signals the start of an identifier bufferCount = 0; buffer[bufferCount++] = static_cast(tolower(ch)); state = SCE_CONF_IDENTIFIER; - } else if( isdigit(ch) ) { + } else if( isascii(ch) && isdigit(ch) ) { // signals the start of a number bufferCount = 0; 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, // we simply go to default state // else we're still dealing with an extension... - if( isalnum(ch) || (ch == '_') || + if( (isascii(ch) && isalnum(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: // 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(tolower(ch)); } else { state = SCE_CONF_DEFAULT; @@ -154,7 +154,7 @@ static void ColouriseConfDoc(unsigned int startPos, int length, int, WordList *k case SCE_CONF_NUMBER: // stay in CONF_NUMBER state until we find a non-numeric - if( isdigit(ch) || ch == '.') { + if( (isascii(ch) && isdigit(ch)) || ch == '.') { buffer[bufferCount++] = ch; } else { state = SCE_CONF_DEFAULT; diff --git a/scintilla/src/LexCrontab.cxx b/scintilla/src/LexCrontab.cxx index 6f9ba149..29ef74e1 100644 --- a/scintilla/src/LexCrontab.cxx +++ b/scintilla/src/LexCrontab.cxx @@ -94,12 +94,12 @@ static void ColouriseNncrontabDoc(unsigned int startPos, int length, int, WordLi // signals an asterisk // no state jump necessary for this simple case... styler.ColourTo(i,SCE_NNCRONTAB_ASTERISK); - } else if( isalpha(ch) || ch == '<' ) { + } else if( (isascii(ch) && isalpha(ch)) || ch == '<' ) { // signals the start of an identifier bufferCount = 0; buffer[bufferCount++] = ch; state = SCE_NNCRONTAB_IDENTIFIER; - } else if( isdigit(ch) ) { + } else if( isascii(ch) && isdigit(ch) ) { // signals the start of a number bufferCount = 0; buffer[bufferCount++] = ch; @@ -167,7 +167,7 @@ static void ColouriseNncrontabDoc(unsigned int startPos, int length, int, WordLi case SCE_NNCRONTAB_IDENTIFIER: // 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 == '@') ) { buffer[bufferCount++] = ch; @@ -196,7 +196,7 @@ static void ColouriseNncrontabDoc(unsigned int startPos, int length, int, WordLi case SCE_NNCRONTAB_NUMBER: // stay in CONF_NUMBER state until we find a non-numeric - if( isdigit(ch) /* || ch == '.' */ ) { + if( isascii(ch) && isdigit(ch) /* || ch == '.' */ ) { buffer[bufferCount++] = ch; } else { state = SCE_NNCRONTAB_DEFAULT; diff --git a/scintilla/src/LexCsound.cxx b/scintilla/src/LexCsound.cxx index fd9d2b40..13eae88b 100644 --- a/scintilla/src/LexCsound.cxx +++ b/scintilla/src/LexCsound.cxx @@ -35,7 +35,7 @@ static inline bool IsAWordStart(const int ch) { } static inline bool IsCsoundOperator(char ch) { - if (isalnum(ch)) + if (isascii(ch) && isalnum(ch)) return false; // '.' left out as it is used to make up numbers if (ch == '*' || ch == '/' || ch == '-' || ch == '+' || diff --git a/scintilla/src/LexErlang.cxx b/scintilla/src/LexErlang.cxx index d9d58f96..43cff218 100644 --- a/scintilla/src/LexErlang.cxx +++ b/scintilla/src/LexErlang.cxx @@ -1,10 +1,12 @@ // 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 // 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 #include @@ -13,7 +15,6 @@ #include #include "Platform.h" - #include "PropSet.h" #include "Accessor.h" #include "StyleContext.h" @@ -25,502 +26,594 @@ using namespace Scintilla; #endif -/* - TODO: - o _Param should be a new lexical type -*/ - static int is_radix(int radix, int ch) { - int digit; - if ( 16 < radix || 2 > radix ) { - return 0; - } - if ( isdigit(ch) ) { - digit = ch - '0'; - } else if ( isxdigit(ch) ) { - digit = toupper(ch) - 'A' + 10; - } else { - return 0; - } - if ( digit < radix ) { - return 1; - } else { - return 0; - } + int digit; + + if (36 < radix || 2 > radix) + return 0; + + if (isdigit(ch)) { + digit = ch - '0'; + } else if (isalnum(ch)) { + digit = toupper(ch) - 'A' + 10; + } else { + return 0; + } + + return (digit < radix); } typedef enum { - STATE_NULL, - ATOM_UNQUOTED, - ATOM_QUOTED, - ATOM_FUN_NAME, - NODE_NAME_UNQUOTED, - NODE_NAME_QUOTED, - MACRO_START, - MACRO_UNQUOTED, - MACRO_QUOTED, - RECORD_START, - RECORD_UNQUOTED, - RECORD_QUOTED, - NUMERAL_START, - NUMERAL_SIGNED, - NUMERAL_RADIX_LITERAL, - NUMERAL_SPECULATIVE_MANTISSA, - NUMERAL_FLOAT_MANTISSA, - NUMERAL_FLOAT_EXPONENT, - NUMERAL_FLOAT_SIGNED_EXPONENT, - PARSE_ERROR + STATE_NULL, + COMMENT, + COMMENT_FUNCTION, + COMMENT_MODULE, + COMMENT_DOC, + COMMENT_DOC_MACRO, + ATOM_UNQUOTED, + ATOM_QUOTED, + NODE_NAME_UNQUOTED, + NODE_NAME_QUOTED, + MACRO_START, + MACRO_UNQUOTED, + MACRO_QUOTED, + RECORD_START, + RECORD_UNQUOTED, + RECORD_QUOTED, + NUMERAL_START, + NUMERAL_BASE_VALUE, + NUMERAL_FLOAT, + NUMERAL_EXPONENT, + PREPROCESSOR } atom_parse_state_t; -static void ColouriseErlangDoc(unsigned int startPos, int length, int initStyle, - WordList *keywordlists[], Accessor &styler) { +static inline bool IsAWordChar(const int ch) { + return (ch < 0x80) && (ch != ' ') && (isalnum(ch) || ch == '_'); +} - WordList &keywords = *keywordlists[0]; +static void ColouriseErlangDoc(unsigned int startPos, int length, int initStyle, + WordList *keywordlists[], Accessor &styler) { + + 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); - 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()) { - if ( STATE_NULL != parse_state ) { - switch (parse_state) { - case STATE_NULL: - sc.SetState(SCE_ERLANG_DEFAULT); - break; - case ATOM_UNQUOTED: - if ( '@' == sc.ch ){ - parse_state = NODE_NAME_UNQUOTED; - } else if ( !isalnum(sc.ch) && sc.ch != '_' ) { - char s[100]; - sc.GetCurrent(s, sizeof(s)); - if (keywords.InList(s)) { - sc.ChangeState(SCE_ERLANG_KEYWORD); - sc.SetState(SCE_ERLANG_DEFAULT); - parse_state = STATE_NULL; - } else { - if ( '/' == sc.ch ) { - parse_state = ATOM_FUN_NAME; - } else { - sc.ChangeState(SCE_ERLANG_ATOM); - sc.SetState(SCE_ERLANG_DEFAULT); - parse_state = STATE_NULL; - } - } - } - break; - case ATOM_QUOTED: - if ( '@' == sc.ch ){ - parse_state = NODE_NAME_QUOTED; - } else if ( '\'' == sc.ch && '\\' != sc.chPrev ) { - sc.ChangeState(SCE_ERLANG_ATOM); - sc.ForwardSetState(SCE_ERLANG_DEFAULT); - parse_state = STATE_NULL; - } - break; - case ATOM_FUN_NAME: - if ( !isdigit(sc.ch) ) { - sc.ChangeState(SCE_ERLANG_FUNCTION_NAME); - sc.SetState(SCE_ERLANG_DEFAULT); - parse_state = STATE_NULL; - } - break; - case NODE_NAME_QUOTED: - if ( '@' == sc.ch ) { - sc.SetState(SCE_ERLANG_DEFAULT); - parse_state = STATE_NULL; - } else if ( '\'' == sc.ch && '\\' != sc.chPrev ) { - sc.ChangeState(SCE_ERLANG_NODE_NAME); - sc.ForwardSetState(SCE_ERLANG_DEFAULT); - parse_state = STATE_NULL; - } - break; - case NODE_NAME_UNQUOTED: - if ( '@' == sc.ch ) { - sc.SetState(SCE_ERLANG_DEFAULT); - parse_state = STATE_NULL; - } else if ( !isalnum(sc.ch) && 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; - } else if (isalpha(sc.ch) && islower(sc.ch)) { - parse_state = RECORD_UNQUOTED; - } else { // error - sc.SetState(SCE_ERLANG_DEFAULT); - parse_state = STATE_NULL; - } - break; - case RECORD_QUOTED: - if ( '\'' == sc.ch && '\\' != sc.chPrev ) { - sc.ChangeState(SCE_ERLANG_RECORD); - 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.SetState(SCE_ERLANG_DEFAULT); - parse_state = STATE_NULL; - } - break; - case MACRO_START: - if ( '\'' == sc.ch ) { - parse_state = MACRO_QUOTED; - } else if (isalpha(sc.ch)) { - parse_state = MACRO_UNQUOTED; - } else { // error - sc.SetState(SCE_ERLANG_DEFAULT); - parse_state = STATE_NULL; - } - break; - case MACRO_UNQUOTED: - if ( !isalpha(sc.ch) && '_' != sc.ch ) { - sc.ChangeState(SCE_ERLANG_MACRO); - sc.SetState(SCE_ERLANG_DEFAULT); - parse_state = STATE_NULL; - } - break; - case MACRO_QUOTED: - if ( '\'' == sc.ch && '\\' != sc.chPrev ) { - sc.ChangeState(SCE_ERLANG_MACRO); - sc.ForwardSetState(SCE_ERLANG_DEFAULT); - parse_state = STATE_NULL; - } - break; - case NUMERAL_START: - if ( isdigit(sc.ch) ) { - radix_digits *= 10; - radix_digits += sc.ch - '0'; // Assuming ASCII here! - } else if ( '#' == sc.ch ) { - if ( 2 > radix_digits || 16 < radix_digits) { - sc.SetState(SCE_ERLANG_DEFAULT); - parse_state = STATE_NULL; - } else { - parse_state = NUMERAL_RADIX_LITERAL; - } - } else if ( '.' == sc.ch && isdigit(sc.chNext)) { - radix_digits = 0; - parse_state = NUMERAL_FLOAT_MANTISSA; - } else if ( 'e' == sc.ch || 'E' == sc.ch ) { - exponent_digits = 0; - parse_state = NUMERAL_FLOAT_EXPONENT; - } else { - radix_digits = 0; - sc.ChangeState(SCE_ERLANG_NUMBER); - sc.SetState(SCE_ERLANG_DEFAULT); - parse_state = STATE_NULL; - } - break; - case NUMERAL_RADIX_LITERAL: - if ( !is_radix(radix_digits,sc.ch) ) { - radix_digits = 0; - if ( !isalnum(sc.ch) ) { - sc.ChangeState(SCE_ERLANG_NUMBER); - } - sc.SetState(SCE_ERLANG_DEFAULT); - parse_state = STATE_NULL; - } - break; - case NUMERAL_FLOAT_MANTISSA: - if ( 'e' == sc.ch || 'E' == sc.ch ) { - exponent_digits = 0; - parse_state = NUMERAL_FLOAT_EXPONENT; - } else if ( !isdigit(sc.ch) ) { - sc.ChangeState(SCE_ERLANG_NUMBER); - sc.SetState(SCE_ERLANG_DEFAULT); - parse_state = STATE_NULL; - } - break; - case NUMERAL_FLOAT_EXPONENT: - if ( '-' == sc.ch || '+' == sc.ch ) { - parse_state = NUMERAL_FLOAT_SIGNED_EXPONENT; - } else if ( !isdigit(sc.ch) ) { - if ( 0 < exponent_digits ) { - sc.ChangeState(SCE_ERLANG_NUMBER); - } - sc.SetState(SCE_ERLANG_DEFAULT); - parse_state = STATE_NULL; - } else { - ++exponent_digits; - } - break; - case NUMERAL_FLOAT_SIGNED_EXPONENT: - if ( !isdigit(sc.ch) ) { - if ( 0 < exponent_digits ) { - sc.ChangeState(SCE_ERLANG_NUMBER); - } - sc.SetState(SCE_ERLANG_DEFAULT); - parse_state = STATE_NULL; - } else { - ++exponent_digits; - } - break; - case NUMERAL_SIGNED: - if ( !isdigit(sc.ch) ) { - sc.ChangeState(SCE_ERLANG_NUMBER); - sc.SetState(SCE_ERLANG_DEFAULT); - parse_state = STATE_NULL; - } else if ( '.' == sc.ch ) { - parse_state = NUMERAL_FLOAT_MANTISSA; - } - break; - case NUMERAL_SPECULATIVE_MANTISSA: - if ( !isdigit(sc.ch) ) { - sc.ChangeState(SCE_ERLANG_OPERATOR); - sc.SetState(SCE_ERLANG_DEFAULT); - parse_state = STATE_NULL; - } else { - parse_state = NUMERAL_FLOAT_MANTISSA; - } - break; - case PARSE_ERROR: - sc.SetState(SCE_ERLANG_DEFAULT); - parse_state = STATE_NULL; - break; - } - } else if (sc.state == SCE_ERLANG_OPERATOR) { - if (sc.chPrev == '.') { - if (sc.ch == '*' || sc.ch == '/' || sc.ch == '\\' || sc.ch == '^') { - sc.ForwardSetState(SCE_ERLANG_DEFAULT); - } else if (sc.ch == '\'') { - sc.ForwardSetState(SCE_ERLANG_DEFAULT); - } else { - sc.SetState(SCE_ERLANG_DEFAULT); - } - } else { - sc.SetState(SCE_ERLANG_DEFAULT); - } - } else if (sc.state == SCE_ERLANG_VARIABLE) { - 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); - } - } + int style = SCE_ERLANG_DEFAULT; + if (STATE_NULL != parse_state) { - if (sc.state == SCE_ERLANG_DEFAULT) { - if (sc.ch == '%') { - sc.SetState(SCE_ERLANG_COMMENT); - } else if (sc.ch == '\"') { - sc.SetState(SCE_ERLANG_STRING); - } else if (sc.ch == '#') { - parse_state = RECORD_START; - sc.SetState(SCE_ERLANG_UNKNOWN); - } else if (sc.ch == '?') { - parse_state = MACRO_START; - sc.SetState(SCE_ERLANG_UNKNOWN); - } else if (sc.ch == '$') { - sc.SetState(SCE_ERLANG_CHARACTER); - } else if (sc.ch == '\'') { - parse_state = ATOM_QUOTED; - sc.SetState(SCE_ERLANG_UNKNOWN); - } else if ( isdigit(sc.ch) ) { - parse_state = NUMERAL_START; - radix_digits = sc.ch - '0'; - sc.SetState(SCE_ERLANG_UNKNOWN); - } else if ( '.' == 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); - } else if (isalpha(sc.ch)) { - parse_state = ATOM_UNQUOTED; - sc.SetState(SCE_ERLANG_UNKNOWN); - } else if (isoperator(static_cast(sc.ch)) || sc.ch == '\\') { - sc.SetState(SCE_ERLANG_OPERATOR); + switch (parse_state) { + + 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); + parse_state = STATE_NULL; + } + } 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; + } else if (sc.ch == ':') { + // Searching for module name + if (sc.chNext == ' ') { + // error + sc.ChangeState(SCE_ERLANG_UNKNOWN); + parse_state = STATE_NULL; + } else { + sc.Forward(); + 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 { + style = SCE_ERLANG_ATOM; + } + + sc.ChangeState(style); + sc.SetState(SCE_ERLANG_DEFAULT); + parse_state = STATE_NULL; + } + + } break; + + case ATOM_QUOTED : { + if ( '@' == sc.ch ){ + parse_state = NODE_NAME_QUOTED; + } else if ('\'' == sc.ch && '\\' != sc.chPrev) { + sc.ChangeState(SCE_ERLANG_ATOM); + sc.ForwardSetState(SCE_ERLANG_DEFAULT); + parse_state = STATE_NULL; + } + } break; + + /* -------------------------------------------------------------- */ + /* 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); + parse_state = STATE_NULL; + } + } break; + + case NODE_NAME_QUOTED : { + if ('@' == sc.ch) { + sc.SetState(SCE_ERLANG_DEFAULT); + parse_state = STATE_NULL; + } else if ('\'' == sc.ch && '\\' != sc.chPrev) { + sc.ChangeState(SCE_ERLANG_NODE_NAME_QUOTED); + sc.ForwardSetState(SCE_ERLANG_DEFAULT); + parse_state = STATE_NULL; + } + } break; + + /* -------------------------------------------------------------- */ + /* Records -------------------------------------------------------*/ + case RECORD_START : { + if ('\'' == sc.ch) { + parse_state = RECORD_QUOTED; + } else if (isalpha(sc.ch) && islower(sc.ch)) { + parse_state = RECORD_UNQUOTED; + } else { // error + sc.SetState(SCE_ERLANG_DEFAULT); + parse_state = STATE_NULL; + } + } break; + + case RECORD_UNQUOTED : { + if (!IsAWordChar(sc.ch)) { + sc.ChangeState(SCE_ERLANG_RECORD); + sc.SetState(SCE_ERLANG_DEFAULT); + parse_state = STATE_NULL; + } + } break; + + 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; + } else if (isalpha(sc.ch)) { + parse_state = MACRO_UNQUOTED; + } else { // error + sc.SetState(SCE_ERLANG_DEFAULT); + parse_state = STATE_NULL; + } + } break; + + case MACRO_UNQUOTED : { + if (!IsAWordChar(sc.ch)) { + sc.ChangeState(SCE_ERLANG_MACRO); + sc.SetState(SCE_ERLANG_DEFAULT); + parse_state = STATE_NULL; + } + } break; + + case MACRO_QUOTED : { + if ('\'' == sc.ch && '\\' != sc.chPrev) { + sc.ChangeState(SCE_ERLANG_MACRO_QUOTED); + sc.ForwardSetState(SCE_ERLANG_DEFAULT); + parse_state = STATE_NULL; + } + } break; + + /* -------------------------------------------------------------- */ + /* Numerics ------------------------------------------------------*/ + /* Simple integer */ + case NUMERAL_START : { + if (isdigit(sc.ch)) { + radix_digits *= 10; + radix_digits += sc.ch - '0'; // Assuming ASCII here! + } else if ('#' == sc.ch) { + if (2 > radix_digits || 36 < radix_digits) { + sc.SetState(SCE_ERLANG_DEFAULT); + parse_state = STATE_NULL; + } else { + parse_state = NUMERAL_BASE_VALUE; + } + } else if ('.' == sc.ch && isdigit(sc.chNext)) { + radix_digits = 0; + parse_state = NUMERAL_FLOAT; + } else if ('e' == sc.ch || 'E' == sc.ch) { + exponent_digits = 0; + parse_state = NUMERAL_EXPONENT; + } else { + radix_digits = 0; + sc.ChangeState(SCE_ERLANG_NUMBER); + sc.SetState(SCE_ERLANG_DEFAULT); + parse_state = STATE_NULL; + } + } break; + + /* Integer in other base than 10 (x#yyy) */ + case NUMERAL_BASE_VALUE : { + if (!is_radix(radix_digits,sc.ch)) { + radix_digits = 0; + + if (!isalnum(sc.ch)) + sc.ChangeState(SCE_ERLANG_NUMBER); + + sc.SetState(SCE_ERLANG_DEFAULT); + parse_state = STATE_NULL; + } + } break; + + /* Float (x.yyy) */ + case NUMERAL_FLOAT : { + if ('e' == sc.ch || 'E' == sc.ch) { + exponent_digits = 0; + parse_state = NUMERAL_EXPONENT; + } else if (!isdigit(sc.ch)) { + sc.ChangeState(SCE_ERLANG_NUMBER); + sc.SetState(SCE_ERLANG_DEFAULT); + parse_state = STATE_NULL; + } + } break; + + /* Exponent, either integer or float (xEyy, x.yyEzzz) */ + case NUMERAL_EXPONENT : { + if (('-' == sc.ch || '+' == sc.ch) + && (isdigit(sc.chNext))) { + sc.Forward(); + } else if (!isdigit(sc.ch)) { + if (0 < exponent_digits) + sc.ChangeState(SCE_ERLANG_NUMBER); + sc.SetState(SCE_ERLANG_DEFAULT); + parse_state = STATE_NULL; + } else { + ++exponent_digits; + } + } break; + + /* -------------------------------------------------------------- */ + /* Preprocessor --------------------------------------------------*/ + 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); + parse_state = STATE_NULL; + } + } break; + + } + + } /* End of : STATE_NULL != parse_state */ + else + { + switch (sc.state) { + case SCE_ERLANG_VARIABLE : { + if (!IsAWordChar(sc.ch)) + sc.SetState(SCE_ERLANG_DEFAULT); + } break; + case SCE_ERLANG_STRING : { + if (sc.ch == '\"' && sc.chPrev != '\\') + sc.ForwardSetState(SCE_ERLANG_DEFAULT); + } break; + case SCE_ERLANG_COMMENT : { + if (sc.atLineEnd) + sc.SetState(SCE_ERLANG_DEFAULT); + } break; + case SCE_ERLANG_CHARACTER : { + if (sc.chPrev == '\\') { + sc.ForwardSetState(SCE_ERLANG_DEFAULT); + } else if (sc.ch != '\\') { + sc.ForwardSetState(SCE_ERLANG_DEFAULT); + } + } break; + case SCE_ERLANG_OPERATOR : { + if (sc.chPrev == '.') { + if (sc.ch == '*' || sc.ch == '/' || sc.ch == '\\' + || sc.ch == '^') { + sc.ForwardSetState(SCE_ERLANG_DEFAULT); + } else if (sc.ch == '\'') { + sc.ForwardSetState(SCE_ERLANG_DEFAULT); + } else { + sc.SetState(SCE_ERLANG_DEFAULT); + } + } else { + sc.SetState(SCE_ERLANG_DEFAULT); + } + } break; } } + + if (sc.state == SCE_ERLANG_DEFAULT) { + 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); + } break; + case '#' : { + parse_state = RECORD_START; + sc.SetState(SCE_ERLANG_UNKNOWN); + } break; + case '?' : { + parse_state = MACRO_START; + sc.SetState(SCE_ERLANG_UNKNOWN); + } break; + case '\'' : { + parse_state = ATOM_QUOTED; + sc.SetState(SCE_ERLANG_UNKNOWN); + } 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; + radix_digits = sc.ch - '0'; + sc.SetState(SCE_ERLANG_UNKNOWN); + } else if (isupper(sc.ch) || '_' == sc.ch) { + sc.SetState(SCE_ERLANG_VARIABLE); + } else if (isalpha(sc.ch)) { + parse_state = ATOM_UNQUOTED; + sc.SetState(SCE_ERLANG_UNKNOWN); + } else if (isoperator(static_cast(sc.ch)) + || sc.ch == '\\') { + sc.SetState(SCE_ERLANG_OPERATOR); + } + } + } + } sc.Complete(); } -static int ClassifyFoldPointErlang( - Accessor &styler, - int styleNext, - int keyword_start +static int ClassifyErlangFoldPoint( + Accessor &styler, + int styleNext, + int keyword_start ) { int lev = 0; - if ( styler.Match(keyword_start,"case") - || ( - styler.Match(keyword_start,"fun") - && SCE_ERLANG_FUNCTION_NAME != styleNext) - || styler.Match(keyword_start,"if") - || styler.Match(keyword_start,"query") - || styler.Match(keyword_start,"receive") - ) { - ++lev; - } else if ( styler.Match(keyword_start,"end") ) { - --lev; - } + if (styler.Match(keyword_start,"case") + || ( + styler.Match(keyword_start,"fun") + && (SCE_ERLANG_FUNCTION_NAME != styleNext) + ) + || styler.Match(keyword_start,"if") + || styler.Match(keyword_start,"query") + || styler.Match(keyword_start,"receive") + ) { + ++lev; + } else if (styler.Match(keyword_start,"end")) { + --lev; + } + return lev; } - static void FoldErlangDoc( - unsigned int startPos, int length, int initStyle, - WordList** /*keywordlists*/, Accessor &styler + unsigned int startPos, int length, int initStyle, + WordList** /*keywordlists*/, Accessor &styler ) { unsigned int endPos = startPos + length; - //~ int visibleChars = 0; - int lineCurrent = styler.GetLine(startPos); - int levelPrev = styler.LevelAt(lineCurrent) & SC_FOLDLEVELNUMBERMASK; - int levelCurrent = levelPrev; - char chNext = styler.SafeGetCharAt(startPos); + int currentLine = styler.GetLine(startPos); + int lev; + int previousLevel = styler.LevelAt(currentLine) & SC_FOLDLEVELNUMBERMASK; + int currentLevel = previousLevel; int styleNext = styler.StyleAt(startPos); int style = initStyle; + int stylePrev; int keyword_start = 0; - - bool fold_keywords = true; - bool fold_comments = true; - bool fold_braces = true; - bool fold_function_clauses = false; - bool fold_clauses = false; - - //int clause_level = 0; + char ch; + char chNext = styler.SafeGetCharAt(startPos); + bool atEOL; for (unsigned int i = startPos; i < endPos; i++) { - char ch = chNext; + ch = chNext; chNext = styler.SafeGetCharAt(i + 1); - int stylePrev = style; + + // Get styles + stylePrev = style; style = styleNext; 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) ) { - keyword_start = i; - } - if ( fold_keywords ) { - if ( (stylePrev == SCE_ERLANG_KEYWORD) - && (style != SCE_ERLANG_KEYWORD) - && (style != SCE_ERLANG_ATOM) - ) { - levelCurrent += ClassifyFoldPointErlang(styler,styleNext,keyword_start); - } - } + if (stylePrev != SCE_ERLANG_KEYWORD + && style == SCE_ERLANG_KEYWORD) { + keyword_start = i; + } - if ( fold_comments ) { - if (style == SCE_ERLANG_COMMENT) { - if ((ch == '%') && (chNext == '{')) { - levelCurrent++; - } else if ((ch == '%') && (chNext == '}')) { - levelCurrent--; - } - } - } + // Fold on keywords + if (stylePrev == SCE_ERLANG_KEYWORD + && style != SCE_ERLANG_KEYWORD + && style != SCE_ERLANG_ATOM + ) { + currentLevel += ClassifyErlangFoldPoint(styler, + styleNext, + keyword_start); + } - 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; - } - //~ } - } + // Fold on comments + if (style == SCE_ERLANG_COMMENT + || style == SCE_ERLANG_COMMENT_MODULE + || style == SCE_ERLANG_COMMENT_FUNCTION) { - 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 (ch == '%' && chNext == '{') { + currentLevel++; + } else if (ch == '%' && chNext == '}') { + currentLevel--; + } + } + + // Fold on braces + if (style == SCE_ERLANG_OPERATOR) { + if (ch == '{' || ch == '(' || ch == '[') { + currentLevel++; + } else if (ch == '}' || ch == ')' || ch == ']') { + currentLevel--; + } + } - if ( fold_braces ) { - if (style == SCE_ERLANG_OPERATOR) { - if ( (ch == '{') || (ch == '(') || (ch == '[') ) { - levelCurrent++; - } else if ( (ch == '}') || (ch == ')') || (ch == ']') ) { - levelCurrent--; - } - } - } if (atEOL) { - int lev = levelPrev; - //~ if (visibleChars == 0 && foldCompact) - //~ lev |= SC_FOLDLEVELWHITEFLAG; - //~ if ((levelCurrent > levelPrev) && (visibleChars > 0)) - if ((levelCurrent > levelPrev)) { + lev = previousLevel; + + if (currentLevel > previousLevel) lev |= SC_FOLDLEVELHEADERFLAG; - } - if (lev != styler.LevelAt(lineCurrent)) { - styler.SetLevel(lineCurrent, lev); - } - lineCurrent++; - levelPrev = levelCurrent; - //~ visibleChars = 0; + + if (lev != styler.LevelAt(currentLine)) + styler.SetLevel(currentLine, lev); + + currentLine++; + previousLevel = currentLevel; } - //~ if (!isspacechar(ch)) - //~ visibleChars++; } + // 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(lineCurrent, levelPrev | flagsNext); + styler.SetLevel(currentLine, + previousLevel + | (styler.LevelAt(currentLine) & ~SC_FOLDLEVELNUMBERMASK)); } static const char * const erlangWordListDesc[] = { - "Keywords", + "Erlang Reserved words", + "Erlang BIFs", + "Erlang Preprocessor", + "Erlang Module Attributes", + "Erlang Documentation", + "Erlang Documentation Macro", 0 }; LexerModule lmErlang( - SCLEX_ERLANG, - ColouriseErlangDoc, - "erlang", - FoldErlangDoc, - erlangWordListDesc); - + SCLEX_ERLANG, + ColouriseErlangDoc, + "erlang", + FoldErlangDoc, + erlangWordListDesc); diff --git a/scintilla/src/LexFlagship.cxx b/scintilla/src/LexFlagship.cxx index ddb647cf..c2bfe191 100644 --- a/scintilla/src/LexFlagship.cxx +++ b/scintilla/src/LexFlagship.cxx @@ -1,9 +1,10 @@ // Scintilla source code edit control /** @file LexFlagShip.cxx - ** Lexer for FlagShip - ** (Syntactically compatible to other XBase dialects, like dBase, Clipper, Fox etc.) + ** Lexer for Harbour and FlagShip. + ** (Syntactically compatible to other xBase dialects, like Clipper, dBase, Clip, FoxPro etc.) **/ // Copyright 2005 by Randy Butler +// Copyright 2010 by Xavi (Harbour) // Copyright 1998-2003 by Neil Hodgson // The License.txt file describes the conditions under which this software may be distributed. @@ -21,149 +22,276 @@ #include "KeyWords.h" #include "Scintilla.h" #include "SciLexer.h" +#include "CharacterSet.h" #ifdef SCI_NAMESPACE using namespace Scintilla; #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 -static inline bool IsAWordChar(int ch) { +static inline bool IsAWordChar(int ch) +{ return ch >= 0x80 || - (isalnum(ch) || ch == '.' || ch == '_'); + (isalnum(ch) || ch == '_'); } -static inline bool IsAWordStart(int ch) { - return ch >= 0x80 || - (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, - WordList *keywordlists[], Accessor &styler) { + WordList *keywordlists[], Accessor &styler) +{ - //bool FSScriptSyntax = true; WordList &keywords = *keywordlists[0]; WordList &keywords2 = *keywordlists[1]; WordList &keywords3 = *keywordlists[2]; 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 closeStringChar = 0; + int styleBeforeDCKeyword = SCE_FS_DEFAULT; + bool bEnableCode = initStyle < SCE_FS_DISABLEDCODE; StyleContext sc(startPos, length, initStyle, styler); for (; sc.More(); sc.Forward()) { - if (sc.state == SCE_FS_OPERATOR) { - sc.SetState(SCE_FS_DEFAULT); - } else if (sc.state == SCE_FS_IDENTIFIER) { - if (!IsAWordChar(sc.ch)) { - char s[100]; - sc.GetCurrentLowered(s, sizeof(s)); - if (keywords.InList(s)) { - sc.ChangeState(SCE_FS_KEYWORD); - } else if (keywords2.InList(s)) { - sc.ChangeState(SCE_FS_KEYWORD2); - } else if (keywords3.InList(s)) { - sc.ChangeState(SCE_FS_KEYWORD3); - } else if (keywords4.InList(s)) { - sc.ChangeState(SCE_FS_KEYWORD4); - }// Else, it is really an identifier... - sc.SetState(SCE_FS_DEFAULT); - } - } else if (sc.state == SCE_FS_NUMBER) { - if (!IsAWordChar(sc.ch)) { - sc.SetState(SCE_FS_DEFAULT); - } - } else if (sc.state == SCE_FS_STRING) { - // VB doubles quotes to preserve them, so just end this string - // state now as a following quote will start again - if (sc.ch == '\"') { - if (tolower(sc.chNext) == 'c') { - sc.Forward(); + // Determine if the current state should terminate. + switch (sc.state) { + 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)) { + char s[64]; + sc.GetCurrentLowered(s, sizeof(s)); + if (keywords.InList(s)) { + sc.ChangeState(bEnableCode ? SCE_FS_KEYWORD : SCE_FS_KEYWORD_C); + } else if (keywords2.InList(s)) { + sc.ChangeState(bEnableCode ? SCE_FS_KEYWORD2 : SCE_FS_KEYWORD2_C); + } else if (bEnableCode && keywords3.InList(s)) { + sc.ChangeState(SCE_FS_KEYWORD3); + } else if (bEnableCode && keywords4.InList(s)) { + sc.ChangeState(SCE_FS_KEYWORD4); + }// 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); + } + 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)) { + sc.SetState(SCE_FS_DEFAULT); + } + break; + case SCE_FS_STRING: + case SCE_FS_STRING_C: + if (sc.ch == closeStringChar) { + sc.ForwardSetState(bEnableCode ? SCE_FS_DEFAULT : SCE_FS_DEFAULT_C); + } 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); + } else if (sc.atLineEnd) { + sc.ChangeState(SCE_FS_STRINGEOL); } - sc.ForwardSetState(SCE_FS_DEFAULT); - } else if (sc.atLineEnd) { - 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. - if (sc.state == SCE_FS_DEFAULT) { - if (sc.Match('/', '*')) { // New code - sc.SetState(SCE_FS_COMMENT); - sc.Forward(); // Eat the * so it isn't used for the end of the comment - //if (sc.ch == '\'') { // Old code - // sc.SetState(SCE_FS_COMMENT); // old code - } else if (sc.Match('/', '/')) { // New code + if (sc.state == SCE_FS_DEFAULT || sc.state == SCE_FS_DEFAULT_C) { + if (bEnableCode && + (sc.MatchIgnoreCase(".and.") || sc.MatchIgnoreCase(".not."))) { + sc.SetState(SCE_FS_WORDOPERATOR); + sc.Forward(4); + } else if (bEnableCode && sc.MatchIgnoreCase(".or.")) { + 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); - } else if (sc.ch == '\"') { - sc.SetState(SCE_FS_STRING); + sc.Forward(); + } 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) { - // Preprocessor commands are alone on their line - sc.SetState(SCE_FS_PREPROCESSOR); - } else if (sc.ch == '#') { - int n = 1; - int chSeek = ' '; - while ((n < 100) && (chSeek == ' ' || chSeek == '\t')) { - chSeek = sc.GetRelative(n); - n++; + 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.atLineEnd) { + sc.SetState(bEnableCode ? SCE_FS_DEFAULT : SCE_FS_DEFAULT_C); + } else if (sc.MatchIgnoreCase("include")) { + if (stylingWithinPreprocessor) { + closeStringChar = '>'; + } + } 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); + } } - if (IsADigit(chSeek)) { + } 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); } else { 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))) { - sc.SetState(SCE_FS_NUMBER); - } else if (IsAWordStart(sc.ch) || (sc.ch == '[')) { - sc.SetState(SCE_FS_IDENTIFIER); - } else if (isoperator(static_cast(sc.ch)) || (sc.ch == '\\')) { - sc.SetState(SCE_FS_OPERATOR); + sc.SetState(bEnableCode ? SCE_FS_NUMBER : SCE_FS_NUMBER_C); + } else if (IsAWordChar(sc.ch)) { + sc.SetState(bEnableCode ? SCE_FS_IDENTIFIER : SCE_FS_IDENTIFIER_C); + } else if (isoperator(static_cast(sc.ch)) || (bEnableCode && sc.ch == '@')) { + sc.SetState(bEnableCode ? SCE_FS_OPERATOR : SCE_FS_OPERATOR_C); } } if (sc.atLineEnd) { visibleChars = 0; + closeStringChar = 0; } if (!IsASpace(sc.ch)) { visibleChars++; @@ -173,36 +301,33 @@ static void ColouriseFlagShipDoc(unsigned int startPos, int length, int initStyl } static void FoldFlagShipDoc(unsigned int startPos, int length, int, - WordList *[], Accessor &styler) { + WordList *[], Accessor &styler) +{ int endPos = startPos + length; // Backtrack to previous line in case need to fix its fold status int lineCurrent = styler.GetLine(startPos); - if (startPos > 0) { - if (lineCurrent > 0) { + if (startPos > 0 && lineCurrent > 0) { lineCurrent--; startPos = styler.LineStart(lineCurrent); - } } int spaceFlags = 0; - int indentCurrent = styler.IndentAmount(lineCurrent, &spaceFlags, IsFlagShipComment); + int indentCurrent = styler.IndentAmount(lineCurrent, &spaceFlags); char chNext = styler[startPos]; for (int i = startPos; i < endPos; i++) { char ch = chNext; 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 indentNext = styler.IndentAmount(lineCurrent + 1, &spaceFlags, IsFlagShipComment); + int indentNext = styler.IndentAmount(lineCurrent + 1, &spaceFlags); if (!(indentCurrent & SC_FOLDLEVELWHITEFLAG)) { - // Only non whitespace lines can be headers if ((indentCurrent & SC_FOLDLEVELNUMBERMASK) < (indentNext & SC_FOLDLEVELNUMBERMASK)) { lev |= SC_FOLDLEVELHEADERFLAG; } else if (indentNext & SC_FOLDLEVELWHITEFLAG) { - // Line after is blank so check the next - maybe should continue further? 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)) { lev |= SC_FOLDLEVELHEADERFLAG; } @@ -215,16 +340,13 @@ static void FoldFlagShipDoc(unsigned int startPos, int length, int, } } - static const char * const FSWordListDesc[] = { - "Keywords", - "functions", - "user2", - "user3", + "Keywords Commands", + "Std Library Functions", + "Procedure, return, exit", + "Class (oop)", + "Doxygen keywords", 0 }; LexerModule lmFlagShip(SCLEX_FLAGSHIP, ColouriseFlagShipDoc, "flagship", FoldFlagShipDoc, FSWordListDesc); - - - diff --git a/scintilla/src/LexGAP.cxx b/scintilla/src/LexGAP.cxx index bec53b7d..a477909a 100644 --- a/scintilla/src/LexGAP.cxx +++ b/scintilla/src/LexGAP.cxx @@ -26,7 +26,7 @@ using namespace Scintilla; #endif static inline bool IsGAPOperator(char ch) { - if (isalnum(ch)) return false; + if (isascii(ch) && isalnum(ch)) return false; if (ch == '+' || ch == '-' || ch == '*' || ch == '/' || ch == '^' || ch == ',' || ch == '!' || ch == '.' || ch == '=' || ch == '<' || ch == '>' || ch == '(' || diff --git a/scintilla/src/LexGen.py b/scintilla/src/LexGen.py index 82899c2b..7c60752a 100644 --- a/scintilla/src/LexGen.py +++ b/scintilla/src/LexGen.py @@ -181,7 +181,7 @@ def FindProperties(lexFile): properties = {} f = open(lexFile) for l in f.readlines(): - if "GetProperty" in l: + if "GetProperty" in l and '"' in l: l = l.strip() if not l.startswith("//"): # Drop comments propertyName = l.split("\"")[1] @@ -219,7 +219,7 @@ def ciCompare(a,b): def ciKey(a): return a.lower() - + def sortListInsensitive(l): try: # Try key function l.sort(key=ciKey) @@ -255,9 +255,9 @@ def RegenerateAll(): sortListInsensitive(documentProperties) propertiesHTML = [] for k in documentProperties: - propertiesHTML.append("\t\n\t%s\n\t%s\n\t" % + propertiesHTML.append("\t\n\t%s\n\t%s\n\t" % (k, propertyDocuments[k])) - + # Find all the SciTE properties files otherProps = ["abbrev.properties", "Embedded.properties", "SciTEGlobal.properties", "SciTE.properties"] if os.path.exists(root + "scite"): @@ -275,7 +275,6 @@ def RegenerateAll(): # extracted from the Scintilla source ZIP (typically created on # Windows). Regenerate(root + "scintilla/gtk/makefile", "#", LF, lexFiles) - Regenerate(root + "scintilla/gtk/scintilla.mak", "#", NATIVE, lexFiles) Regenerate(root + "scintilla/macosx/makefile", "#", LF, lexFiles) if os.path.exists(root + "scite"): Regenerate(root + "scite/win32/makefile", "#", NATIVE, lexFiles, propFiles) diff --git a/scintilla/src/LexHTML.cxx b/scintilla/src/LexHTML.cxx index 3bf8fa67..ac2b7695 100644 --- a/scintilla/src/LexHTML.cxx +++ b/scintilla/src/LexHTML.cxx @@ -69,6 +69,22 @@ static void GetTextSegment(Accessor &styler, unsigned int start, unsigned int en 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(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) { char s[100]; GetTextSegment(styler, start, end, s, sizeof(s)); @@ -486,6 +502,35 @@ static bool isOKBeforeRE(int 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) { return (state == SCE_HPHP_HSTRING) || @@ -558,6 +603,10 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty phpStringDelimiter[0] = '\0'; int StateToPrint = initStyle; 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 (InTagState(state)) { @@ -587,8 +636,8 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty // Default client and ASP scripting language is JavaScript lineState = eScriptJS << 8; - // property asp.default.language - // Script in ASP code is initially assumed to be in JavaScript. + // property asp.default.language + // Script in ASP code is initially assumed to be in JavaScript. // To change this to VBScript set asp.default.language to 2. Python is 3. // Don //lineState |= styler.GetPropertyInt("asp.default.language", eScriptJS) << 4; @@ -608,40 +657,49 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty if (inScriptType == eNonHtmlScript && state == SCE_H_COMMENT) { scriptLanguage = eScriptComment; } + script_type beforeLanguage = ScriptOfState(beforePreProc); - // property fold.html - // Folding is turned on or off for HTML and XML files with this option. + // property fold.html + // Folding is turned on or off for HTML and XML files with this option. // The fold option must also be on for folding to occur. const bool foldHTML = styler.GetPropertyInt("fold.html", 0) != 0; const bool fold = foldHTML && styler.GetPropertyInt("fold", 0); - // property fold.html.preprocessor - // Folding is turned on or off for scripts embedded in HTML files with this option. + // property fold.html.preprocessor + // Folding is turned on or off for scripts embedded in HTML files with this option. // The default is on. const bool foldHTMLPreprocessor = foldHTML && styler.GetPropertyInt("fold.html.preprocessor", 1); const bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0; - // property fold.hypertext.comment - // Allow folding for comments in scripts embedded in HTML. - // The default is off. + // property fold.hypertext.comment + // Allow folding for comments in scripts embedded in HTML. + // The default is off. const bool foldComment = fold && styler.GetPropertyInt("fold.hypertext.comment", 0) != 0; - // property fold.hypertext.heredoc - // Allow folding for heredocs in scripts embedded in HTML. - // The default is off. + // property fold.hypertext.heredoc + // Allow folding for heredocs in scripts embedded in HTML. + // The default is off. const bool foldHeredoc = fold && styler.GetPropertyInt("fold.hypertext.heredoc", 0) != 0; - // property html.tags.case.sensitive - // For XML and HTML, setting this property to 1 will make tags match in a case - // sensitive way which is the expected behaviour for XML and XHTML. + // property html.tags.case.sensitive + // For XML and HTML, setting this property to 1 will make tags match in a case + // sensitive way which is the expected behaviour for XML and XHTML. const bool caseSensitive = styler.GetPropertyInt("html.tags.case.sensitive", 0) != 0; - // property lexer.xml.allow.scripts - // Set to 0 to disable scripts in XML. + // property lexer.xml.allow.scripts + // Set to 0 to disable scripts in XML. 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 setTagContinue(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 levelCurrent = levelPrev; int visibleChars = 0; + int lineStartVisibleChars = 0; int chPrev = ' '; int ch = ' '; @@ -689,6 +748,8 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty if ((!IsASpace(ch) || !foldCompact) && fold) visibleChars++; + if (!IsASpace(ch)) + lineStartVisibleChars++; // decide what is the current state to print (depending of the script tag) StateToPrint = statePrintForState(state, inScriptType); @@ -757,6 +818,7 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty levelPrev = levelCurrent; } lineCurrent++; + lineStartVisibleChars = 0; styler.SetLineState(lineCurrent, ((inScriptType & 0x03) << 0) | ((tagOpened & 0x01) << 2) | @@ -766,6 +828,11 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty ((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 else if ((inScriptType == eNonHtmlScript) && (ch == '<') && (chNext == '/')) { // 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; } + // 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(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(styler.SafeGetCharAt(i)); + continue; + } + // 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); beforePreProc = state; if (inScriptType == eNonHtmlScript) @@ -916,12 +1055,72 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty 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 - else if (( - ((inScriptType == eNonHtmlPreProc) - || (inScriptType == eNonHtmlScriptPreProc)) && ( - ((scriptLanguage != eScriptNone) && stateAllowsTermination(state) && ((ch == '%') || (ch == '?'))) - ) && (chNext == '>')) || + else if ((!isMako && !isDjango && ((inScriptType == eNonHtmlPreProc) || (inScriptType == eNonHtmlScriptPreProc)) && + (((scriptLanguage != eScriptNone) && stateAllowsTermination(state))) && + (((ch == '%') || (ch == '?')) && (chNext == '>'))) || ((scriptLanguage == eScriptSGML) && (ch == '>') && (state != SCE_H_SGML_COMMENT))) { if (state == SCE_H_ASPAT) { aspScript = segIsScriptingIndicator(styler, diff --git a/scintilla/src/LexLisp.cxx b/scintilla/src/LexLisp.cxx index b12b05d3..bad298c8 100644 --- a/scintilla/src/LexLisp.cxx +++ b/scintilla/src/LexLisp.cxx @@ -139,7 +139,7 @@ static void ColouriseLispDoc(unsigned int startPos, int length, int initStyle, W } } } else if (state == SCE_LISP_MACRO_DISPATCH) { - if (!isdigit(ch)) { + if (!(isascii(ch) && isdigit(ch))) { if (ch != 'r' && ch != 'R' && (i - styler.GetStartSegment()) > 1) { state = SCE_LISP_DEFAULT; } else { diff --git a/scintilla/src/LexMMIXAL.cxx b/scintilla/src/LexMMIXAL.cxx index 64775cd7..4c809071 100644 --- a/scintilla/src/LexMMIXAL.cxx +++ b/scintilla/src/LexMMIXAL.cxx @@ -32,7 +32,7 @@ static inline bool IsAWordChar(const int ch) { } inline bool isMMIXALOperator(char ch) { - if (isalnum(ch)) + if (isascii(ch) && isalnum(ch)) return false; if (ch == '+' || ch == '-' || ch == '|' || ch == '^' || ch == '*' || ch == '/' || ch == '/' || diff --git a/scintilla/src/LexMPT.cxx b/scintilla/src/LexMPT.cxx index ed720267..9d971de1 100644 --- a/scintilla/src/LexMPT.cxx +++ b/scintilla/src/LexMPT.cxx @@ -32,7 +32,7 @@ static int GetLotLineState(std::string &line) { // Now finds the first non-blank character unsigned i; // Declares counter here to make it persistent after the for loop for (i = 0; i < line.length(); ++i) { - if (!isspace(line[i])) + if (!(isascii(line[i]) && isspace(line[i]))) break; } diff --git a/scintilla/src/LexMySQL.cxx b/scintilla/src/LexMySQL.cxx index 9fca8be0..767cdfb1 100644 --- a/scintilla/src/LexMySQL.cxx +++ b/scintilla/src/LexMySQL.cxx @@ -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 // with special curly braces syntax as foldable comments too. // 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 chNext3 = styler.SafeGetCharAt(i + 3); @@ -394,12 +394,12 @@ static void FoldMySQLDoc(unsigned int startPos, int length, int initStyle, WordL // Reserved and other keywords. if (style != stylePrev) { - bool beginFound = MatchIgnoreCase(styler, startPos, "begin"); - bool ifFound = MatchIgnoreCase(styler, startPos, "if"); - bool thenFound = MatchIgnoreCase(styler, startPos, "then"); - bool whileFound = MatchIgnoreCase(styler, startPos, "while"); - bool loopFound = MatchIgnoreCase(styler, startPos, "loop"); - bool repeatFound = MatchIgnoreCase(styler, startPos, "repeat"); + bool beginFound = MatchIgnoreCase(styler, i, "begin"); + bool ifFound = MatchIgnoreCase(styler, i, "if"); + bool thenFound = MatchIgnoreCase(styler, i, "then"); + bool whileFound = MatchIgnoreCase(styler, i, "while"); + bool loopFound = MatchIgnoreCase(styler, i, "loop"); + bool repeatFound = MatchIgnoreCase(styler, i, "repeat"); 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. } else - if (!foldOnlyBegin && MatchIgnoreCase(styler, startPos, "else")) + if (!foldOnlyBegin && MatchIgnoreCase(styler, i, "else")) { levelNext--; elseFound = true; @@ -430,7 +430,7 @@ static void FoldMySQLDoc(unsigned int startPos, int length, int initStyle, WordL if (ifFound) elseFound = false; else - if (MatchIgnoreCase(styler, startPos, "when")) + if (MatchIgnoreCase(styler, i, "when")) whenFound = true; else { @@ -445,7 +445,7 @@ static void FoldMySQLDoc(unsigned int startPos, int length, int initStyle, WordL levelNext++; } else - if (MatchIgnoreCase(styler, startPos, "end")) + if (MatchIgnoreCase(styler, i, "end")) { // Multiple "end" in a row are counted multiple times! if (endFound) diff --git a/scintilla/src/LexNsis.cxx b/scintilla/src/LexNsis.cxx index 615a01a8..37e4a188 100644 --- a/scintilla/src/LexNsis.cxx +++ b/scintilla/src/LexNsis.cxx @@ -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; 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( 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++; else if( NsisCmp(s, "!endif", bIgnoreCase) == 0 || NsisCmp(s, "!macroend", bIgnoreCase ) == 0 ) newFoldlevel--; @@ -191,16 +191,16 @@ static int classifyWordNsis(unsigned int start, unsigned int end, WordList *keyw } // 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; - 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; - 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; - 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; if( NsisCmp(s, "SectionGroup", bIgnoreCase) == 0 || NsisCmp(s, "SectionGroupEnd", bIgnoreCase) == 0 ) // Covers SectionGroup and SectionGroupEnd diff --git a/scintilla/src/LexOpal.cxx b/scintilla/src/LexOpal.cxx index 168c6fc5..4cbbeaf3 100644 --- a/scintilla/src/LexOpal.cxx +++ b/scintilla/src/LexOpal.cxx @@ -292,7 +292,7 @@ inline bool HandleInteger( unsigned int & cur, unsigned int one_too_much, Access } ch = styler.SafeGetCharAt( cur ); - if( !isdigit( ch ) ) + if( !( isascii( ch ) && isdigit( ch ) ) ) { styler.ColourTo( cur - 1, SCE_OPAL_INTEGER ); styler.StartSegment( cur ); @@ -311,7 +311,7 @@ inline bool HandleWord( unsigned int & cur, unsigned int one_too_much, Accessor { ch = styler.SafeGetCharAt( cur ); if( ( ch != '_' ) && ( ch != '-' ) && - !islower( ch ) && !isupper( ch ) && !isdigit( ch ) ) break; + !( isascii( ch ) && ( islower( ch ) || isupper( ch ) || isdigit( ch ) ) ) ) break; cur++; if( cur >= one_too_much ) @@ -487,13 +487,13 @@ static void ColouriseOpalDoc( unsigned int startPos, int length, int initStyle, default: { // Integer - if( isdigit( ch ) ) + if( isascii( ch ) && isdigit( ch ) ) { if( !HandleInteger( cur, one_too_much, styler ) ) return; } // Keyword - else if( islower( ch ) || isupper( ch ) ) + else if( isascii( ch ) && ( islower( ch ) || isupper( ch ) ) ) { if( !HandleWord( cur, one_too_much, styler, keywordlists ) ) return; diff --git a/scintilla/src/LexOthers.cxx b/scintilla/src/LexOthers.cxx index 24c148a4..c5c6ef29 100644 --- a/scintilla/src/LexOthers.cxx +++ b/scintilla/src/LexOthers.cxx @@ -37,6 +37,10 @@ static bool Is1To9(char ch) { return (ch >= '1') && (ch <= '9'); } +static bool IsAlphabetic(int ch) { + return isascii(ch) && isalpha(ch); +} + static inline bool AtEOL(Accessor &styler, unsigned int i) { return (styler[i] == '\n') || ((styler[i] == '\r') && (styler.SafeGetCharAt(i + 1) != '\n')); @@ -101,7 +105,7 @@ static void ColouriseBatchLine( } return; // 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] == ':') && ((isspacechar(lineBuffer[offset + 2])) || (((lineBuffer[offset + 2] == '\\')) && @@ -723,10 +727,10 @@ static void ColourisePropsDoc(unsigned int startPos, int length, int, WordList * unsigned int linePos = 0; unsigned int startLine = startPos; - // property lexer.props.allow.initial.spaces - // For properties files, set to 0 to style all lines that start with whitespace in the default style. - // This is not suitable for SciTE .properties files which use indentation for flow control but - // can be used for RFC2822 text where indentation is used for continuation lines. + // property lexer.props.allow.initial.spaces + // For properties files, set to 0 to style all lines that start with whitespace in the default style. + // This is not suitable for SciTE .properties files which use indentation for flow control but + // can be used for RFC2822 text where indentation is used for continuation lines. bool allowInitialSpaces = styler.GetPropertyInt("lexer.props.allow.initial.spaces", 1) != 0; for (unsigned int i = startPos; i < startPos + length; i++) { @@ -961,17 +965,17 @@ static int RecogniseErrorListLine(const char *lineBuffer, unsigned int lengthLin } else if (strstart(lineBuffer, "Warning ")) { // Borland warning message return SCE_ERR_BORLAND; - } else if (strstr(lineBuffer, "at line " ) && - (strstr(lineBuffer, "at line " ) < (lineBuffer + lengthLine)) && + } else if (strstr(lineBuffer, "at line ") && + (strstr(lineBuffer, "at line ") < (lineBuffer + lengthLine)) && strstr(lineBuffer, "file ") && (strstr(lineBuffer, "file ") < (lineBuffer + lengthLine))) { // Lua 4 error message return SCE_ERR_LUA; - } else if (strstr(lineBuffer, " at " ) && - (strstr(lineBuffer, " at " ) < (lineBuffer + lengthLine)) && + } else if (strstr(lineBuffer, " at ") && + (strstr(lineBuffer, " at ") < (lineBuffer + lengthLine)) && strstr(lineBuffer, " line ") && (strstr(lineBuffer, " line ") < (lineBuffer + lengthLine)) && - (strstr(lineBuffer, " at " ) < (strstr(lineBuffer, " line ")))) { + (strstr(lineBuffer, " at ") < (strstr(lineBuffer, " line ")))) { // perl error message return SCE_ERR_PERL; } 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. else 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] = 0; if (!CompareCaseInsensitive(word, "error") || !CompareCaseInsensitive(word, "warning") || @@ -1131,11 +1135,11 @@ static void ColouriseErrorListDoc(unsigned int startPos, int length, int, WordLi styler.StartSegment(startPos); unsigned int linePos = 0; - // property lexer.errorlist.value.separate - // For lines in the output pane that are matches from Find in Files or GCC-style - // diagnostics, style the path and line number separately from the rest of the - // line with style 21 used for the rest of the line. - // This allows matched text to be more easily distinguished from its location. + // property lexer.errorlist.value.separate + // For lines in the output pane that are matches from Find in Files or GCC-style + // diagnostics, style the path and line number separately from the rest of the + // line with style 21 used for the rest of the line. + // This allows matched text to be more easily distinguished from its location. bool valueSeparate = styler.GetPropertyInt("lexer.errorlist.value.separate", 0) != 0; for (unsigned int i = startPos; i < startPos + length; i++) { lineBuffer[linePos++] = styler[i]; @@ -1252,13 +1256,13 @@ static void ColouriseLatexDoc(unsigned int startPos, int length, int initStyle, styler.ColourTo(lengthDoc-1, state); } -static const char * const batchWordListDesc[] = { +static const char *const batchWordListDesc[] = { "Internal Commands", "External Commands", 0 }; -static const char * const emptyWordListDesc[] = { +static const char *const emptyWordListDesc[] = { 0 }; diff --git a/scintilla/src/LexPerl.cxx b/scintilla/src/LexPerl.cxx index 6fc53543..66bf34ab 100644 --- a/scintilla/src/LexPerl.cxx +++ b/scintilla/src/LexPerl.cxx @@ -1243,7 +1243,7 @@ static void FoldPerlDoc(unsigned int startPos, int length, int, WordList *[], else if (styler.Match(i, "=head")) isPodHeading = true; } else if (style == SCE_PL_DATASECTION) { - if (ch == '=' && isalpha(chNext) && levelCurrent == SC_FOLDLEVELBASE) + if (ch == '=' && isascii(chNext) && isalpha(chNext) && levelCurrent == SC_FOLDLEVELBASE) levelCurrent++; else if (styler.Match(i, "=cut") && levelCurrent > SC_FOLDLEVELBASE) levelCurrent--; diff --git a/scintilla/src/LexProgress.cxx b/scintilla/src/LexProgress.cxx index 6d5e47da..9a804c49 100644 --- a/scintilla/src/LexProgress.cxx +++ b/scintilla/src/LexProgress.cxx @@ -9,7 +9,6 @@ /** TODO: WebSpeed support in html lexer Support "end triggers" expression of the triggers phrase -change lmPS to lmProgress Support more than 6 comments levels **/ #include @@ -39,7 +38,7 @@ static inline bool IsAWordStart(int 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[], Accessor &styler) { @@ -51,7 +50,7 @@ static void Colourise4glDoc(unsigned int startPos, int length, int initStyle, Wo int visibleChars = 0; - int sentenceStartState; // true -> bit5 = 0 + int mask; 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. + if ((sc.state & 0xf) < SCE_4GL_COMMENT1) { if (sc.ch == '~') { if (sc.chNext > ' ') { // 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. - sentenceStartState = sc.state & 0x10; + mask = sc.state & 0x10; switch (sc.state & 0xf) { case SCE_4GL_OPERATOR: - sc.SetState(SCE_4GL_DEFAULT | sentenceStartState); + sc.SetState(SCE_4GL_DEFAULT | mask); break; case SCE_4GL_NUMBER: if (!(IsADigit(sc.ch))) { - sc.SetState(SCE_4GL_DEFAULT | sentenceStartState); + sc.SetState(SCE_4GL_DEFAULT | mask); } break; case SCE_4GL_IDENTIFIER: if (!IsAWordChar(sc.ch) && sc.ch != '-') { char s[1000]; 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); } else if (keywords1.InList(s)) { @@ -122,18 +123,19 @@ static void Colourise4glDoc(unsigned int startPos, int length, int initStyle, Wo case SCE_4GL_PREPROCESSOR: if (sc.atLineStart) { 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; case SCE_4GL_STRING: if (sc.ch == '\"') { - sc.ForwardSetState(SCE_4GL_DEFAULT | sentenceStartState); + sc.ForwardSetState(SCE_4GL_DEFAULT | mask); } break; case SCE_4GL_CHARACTER: if (sc.ch == '\'') { - sc.ForwardSetState(SCE_4GL_DEFAULT | sentenceStartState); + sc.ForwardSetState(SCE_4GL_DEFAULT | mask); } break; default: @@ -141,7 +143,7 @@ static void Colourise4glDoc(unsigned int startPos, int length, int initStyle, Wo if (sc.ch == '*' && sc.chNext == '/') { sc.Forward(); if ((sc.state & 0xf) == SCE_4GL_COMMENT1) { - sc.ForwardSetState(SCE_4GL_DEFAULT | sentenceStartState); + sc.ForwardSetState(SCE_4GL_DEFAULT | mask); } else 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. - sentenceStartState = sc.state & 0x10; + mask = sc.state & 0x10; if ((sc.state & 0xf) == SCE_4GL_DEFAULT) { if (IsADigit(sc.ch) || (sc.ch == '.' && IsADigit(sc.chNext))) { sc.SetState(SCE_4GL_NUMBER | ResetSentenceStart); - } else if (IsAWordStart(sc.ch) || sc.ch == '@') { - sc.SetState(SCE_4GL_IDENTIFIER | sentenceStartState); + } else if (IsAWordStart(sc.ch) || (sc.ch == '@')) { + sc.SetState(SCE_4GL_IDENTIFIER | mask); } else if (sc.ch == '/' && sc.chNext == '*') { - sc.SetState(SCE_4GL_COMMENT1 | sentenceStartState); + sc.SetState(SCE_4GL_COMMENT1 | mask); sc.Forward(); } else if (sc.ch == '\"') { 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')) { sc.SetState(sc.state & SetSentenceStart); } else if (isoperator(static_cast(sc.ch))) { - /* This code allows highlight of handles. Alas, it would cause the frase "last-event:function" - to be recognized as a BlockBegin + /* This code allows highlight of handles. Alas, it would cause the phrase "last-event:function" + to be recognized as a BlockBegin */ if (sc.ch == ':') sc.SetState(SCE_4GL_OPERATOR & SetSentenceStart); - else */ + /* else */ sc.SetState(SCE_4GL_OPERATOR | ResetSentenceStart); } } diff --git a/scintilla/src/LexPython.cxx b/scintilla/src/LexPython.cxx index 82f4aa22..815eeaec 100644 --- a/scintilla/src/LexPython.cxx +++ b/scintilla/src/LexPython.cxx @@ -36,7 +36,7 @@ static bool IsPyComment(Accessor &styler, int pos, int len) { enum literalsAllowed { litNone=0, litU=1, litB=2}; static bool IsPyStringTypeChar(int ch, literalsAllowed allowed) { - return + return ((allowed & litB) && (ch == 'b' || ch == 'B')) || ((allowed & litU) && (ch == 'u' || ch == 'U')); } @@ -136,13 +136,13 @@ static void ColourisePyDoc(unsigned int startPos, int length, int initStyle, WordList &keywords2 = *keywordlists[1]; // property tab.timmy.whinge.level - // For Python code, checks whether indenting is consistent. - // The default, 0 turns off indentation checking, - // 1 checks whether each line is potentially inconsistent with the previous line, - // 2 checks whether any space characters occur before a tab character in the indentation, - // 3 checks whether any spaces are in the indentation, and + // For Python code, checks whether indenting is consistent. + // The default, 0 turns off indentation checking, + // 1 checks whether each line is potentially inconsistent with the previous line, + // 2 checks whether any space characters occur before a tab character in the indentation, + // 3 checks whether any spaces are in the indentation, and // 4 checks for any tab characters in the indentation. - // 1 is a good level to use. + // 1 is a good level to use. const int whingeLevel = styler.GetPropertyInt("tab.timmy.whinge.level"); // property lexer.python.literals.binary @@ -158,6 +158,10 @@ static void ColourisePyDoc(unsigned int startPos, int length, int initStyle, if (styler.GetPropertyInt("lexer.python.strings.b", 1)) allowedLiterals = static_cast(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; if (initStyle == SCE_P_STRINGEOL) { initStyle = SCE_P_DEFAULT; @@ -204,7 +208,7 @@ static void ColourisePyDoc(unsigned int startPos, int length, int initStyle, } lineCurrent++; if ((sc.state == SCE_P_STRING) || (sc.state == SCE_P_CHARACTER)) { - if (inContinuedString) { + if (inContinuedString || stringsOverNewline) { inContinuedString = false; } else { sc.ChangeState(SCE_P_STRINGEOL); @@ -349,7 +353,7 @@ static void ColourisePyDoc(unsigned int startPos, int length, int initStyle, if (sc.ch == '0' && (sc.chNext == 'x' || sc.chNext == 'X')) { base_n_number = true; sc.SetState(SCE_P_NUMBER); - } else if (sc.ch == '0' && + } else if (sc.ch == '0' && (sc.chNext == 'o' || sc.chNext == 'O' || sc.chNext == 'b' || sc.chNext == 'B')) { if (base2or8Literals) { base_n_number = true; @@ -534,7 +538,7 @@ static void FoldPyDoc(unsigned int startPos, int length, int /*initStyle - unuse } // 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)) lev |= SC_FOLDLEVELHEADERFLAG; } @@ -554,7 +558,7 @@ static void FoldPyDoc(unsigned int startPos, int length, int /*initStyle - unuse //styler.SetLevel(lineCurrent, indentCurrent); } -static const char * const pythonWordListDesc[] = { +static const char *const pythonWordListDesc[] = { "Keywords", "Highlighted identifiers", 0 diff --git a/scintilla/src/LexR.cxx b/scintilla/src/LexR.cxx index 1d10af97..06c4dcd9 100644 --- a/scintilla/src/LexR.cxx +++ b/scintilla/src/LexR.cxx @@ -77,9 +77,9 @@ static void ColouriseRDoc(unsigned int startPos, int length, int initStyle, Word sc.SetState(SCE_R_DEFAULT); } } else if (sc.state == SCE_R_IDENTIFIER) { - if (!IsAWordChar(sc.ch) || (sc.ch == '.')) { + if (!IsAWordChar(sc.ch)) { char s[100]; - sc.GetCurrentLowered(s, sizeof(s)); + sc.GetCurrent(s, sizeof(s)); if (keywords.InList(s)) { sc.ChangeState(SCE_R_KWORD); } else if (keywords2.InList(s)) { diff --git a/scintilla/src/LexSML.cxx b/scintilla/src/LexSML.cxx index 871cb331..5f039fe0 100644 --- a/scintilla/src/LexSML.cxx +++ b/scintilla/src/LexSML.cxx @@ -203,13 +203,11 @@ void ColouriseSMLDoc( } void FoldSMLDoc( - unsigned int startPos, int length, - int initStyle, - WordList *keywordlists[], - Accessor &styler) + unsigned int, int, + int, + WordList *[], + Accessor &) { - //supress "not used" warnings - startPos || length || initStyle || keywordlists[0] || styler.Length(); } static const char * const SMLWordListDesc[] = { diff --git a/scintilla/src/LexSQL.cxx b/scintilla/src/LexSQL.cxx index 72dd78c8..c739e4fc 100644 --- a/scintilla/src/LexSQL.cxx +++ b/scintilla/src/LexSQL.cxx @@ -231,6 +231,10 @@ static void FoldSQLDoc(unsigned int startPos, int length, int initStyle, bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 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; int visibleChars = 0; 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) { levelNext++; - } else if (strcmp(s, "end") == 0 || - // DROP TABLE IF EXISTS or CREATE TABLE IF NOT EXISTS - strcmp(s, "exists") == 0) { + } else if ((strcmp(s, "end") == 0) || +// // DROP TABLE IF EXISTS or CREATE TABLE IF NOT EXISTS + (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; levelNext--; if (levelNext < SC_FOLDLEVELBASE) { diff --git a/scintilla/src/LexVB.cxx b/scintilla/src/LexVB.cxx index 58335a46..511d244a 100644 --- a/scintilla/src/LexVB.cxx +++ b/scintilla/src/LexVB.cxx @@ -214,6 +214,40 @@ static void ColouriseVBDoc(unsigned int startPos, int length, int initStyle, 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(); } diff --git a/scintilla/src/LexVHDL.cxx b/scintilla/src/LexVHDL.cxx index 48e10194..ff13857f 100644 --- a/scintilla/src/LexVHDL.cxx +++ b/scintilla/src/LexVHDL.cxx @@ -1,9 +1,9 @@ // Scintilla source code edit control /** @file LexVHDL.cxx ** Lexer for VHDL - ** Written by Phil Reid, + ** Written by Phil Reid, ** Based on: - ** - The Verilog Lexer by Avi Yegudin + ** - The Verilog Lexer by Avi Yegudin ** - The Fortran Lexer by Chuan-jian Shen ** - The C++ lexer by Neil Hodgson **/ @@ -126,7 +126,7 @@ static void ColouriseVHDLDoc( sc.SetState(SCE_VHDL_IDENTIFIER); } else if (sc.Match('-', '-')) { sc.SetState(SCE_VHDL_COMMENT); - sc.Forward(); + sc.Forward(); } else if (sc.Match('-', '-')) { if (sc.Match("--!")) // Nice to have a different comment style sc.SetState(SCE_VHDL_COMMENTLINEBANG); @@ -161,7 +161,7 @@ static bool IsCommentLine(int line, Accessor &styler) { static void FoldNoBoxVHDLDoc( unsigned int startPos, int length, - int initStyle, + int, Accessor &styler) { // 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 chNextNonBlank; int styleNext = styler.StyleAt(startPos); - int style = initStyle; //Platform::DebugPrintf("Line[%04d] Prev[%20s] ************************* Level[%x]\n", lineCurrent+1, prevWord, levelCurrent); /***************************************/ @@ -265,16 +264,16 @@ static void FoldNoBoxVHDLDoc( j ++ ; chNextNonBlank = styler.SafeGetCharAt(j); } - style = styleNext; + int style = styleNext; styleNext = styler.StyleAt(i + 1); bool atEOL = (ch == '\r' && chNext != '\n') || (ch == '\n'); - if (foldComment && atEOL && IsCommentLine(lineCurrent, styler)) + 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--; @@ -380,7 +379,7 @@ static void FoldNoBoxVHDLDoc( ((strcmp(s, "begin") == 0) && (strcmp(prevWord, "function") == 0)) || ((strcmp(s, "begin") == 0) && (strcmp(prevWord, "procedure") == 0))) { - levelMinCurrentBegin = levelNext - 1; + levelMinCurrentBegin = levelNext - 1; } //Platform::DebugPrintf("Line[%04d] Prev[%20s] Cur[%20s] Level[%x]\n", lineCurrent+1, prevWord, s, levelCurrent); strcpy(prevWord, s); @@ -444,34 +443,34 @@ LexerModule lmVHDL(SCLEX_VHDL, ColouriseVHDLDoc, "vhdl", FoldVHDLDoc, VHDLWordLi // Keyword: -// access after alias all architecture array assert attribute begin block body buffer bus case component -// configuration constant disconnect downto else elsif end entity exit file for function generate generic -// group guarded if impure in inertial inout is label library linkage literal loop map new next null of -// on open others out package port postponed procedure process pure range record register reject report -// return select severity shared signal subtype then to transport type unaffected units until use variable +// access after alias all architecture array assert attribute begin block body buffer bus case component +// configuration constant disconnect downto else elsif end entity exit file for function generate generic +// group guarded if impure in inertial inout is label library linkage literal loop map new next null of +// on open others out package port postponed procedure process pure range record register reject report +// return select severity shared signal subtype then to transport type unaffected units until use variable // wait when while with // // Operators: // abs and mod nand nor not or rem rol ror sla sll sra srl xnor xor // // Attributes: -// left right low high ascending image value pos val succ pred leftof rightof base range reverse_range -// length delayed stable quiet transaction event active last_event last_active last_value driving +// left right low high ascending image value pos val succ pred leftof rightof base range reverse_range +// length delayed stable quiet transaction event active last_event last_active last_value driving // driving_value simple_name path_name instance_name // // Std Functions: -// now readline read writeline write endfile resolved to_bit to_bitvector to_stdulogic to_stdlogicvector -// to_stdulogicvector to_x01 to_x01z to_UX01 rising_edge falling_edge is_x shift_left shift_right rotate_left +// now readline read writeline write endfile resolved to_bit to_bitvector to_stdulogic to_stdlogicvector +// to_stdulogicvector to_x01 to_x01z to_UX01 rising_edge falling_edge is_x shift_left shift_right rotate_left // rotate_right resize to_integer to_unsigned to_signed std_match to_01 // // Std Packages: -// std ieee work standard textio std_logic_1164 std_logic_arith std_logic_misc std_logic_signed -// std_logic_textio std_logic_unsigned numeric_bit numeric_std math_complex math_real vital_primitives +// std ieee work standard textio std_logic_1164 std_logic_arith std_logic_misc std_logic_signed +// std_logic_textio std_logic_unsigned numeric_bit numeric_std math_complex math_real vital_primitives // vital_timing // // Std Types: -// boolean bit character severity_level integer real time delay_length natural positive string bit_vector -// file_open_kind file_open_status line text side width std_ulogic std_ulogic_vector std_logic +// boolean bit character severity_level integer real time delay_length natural positive string bit_vector +// file_open_kind file_open_status line text side width std_ulogic std_ulogic_vector std_logic // std_logic_vector X01 X01Z UX01 UX01Z unsigned signed // diff --git a/scintilla/src/LexVerilog.cxx b/scintilla/src/LexVerilog.cxx index d107a771..4a94acc8 100644 --- a/scintilla/src/LexVerilog.cxx +++ b/scintilla/src/LexVerilog.cxx @@ -150,6 +150,22 @@ static bool IsStreamCommentStyle(int style) { 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 // level store to make it easy to pick up with each increment // 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--; } } + 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 ((ch == '/') && (chNext == '/')) { char chNext2 = styler.SafeGetCharAt(i + 2); diff --git a/scintilla/src/LineMarker.cxx b/scintilla/src/LineMarker.cxx index 5fe27c5a..6f4b0a98 100644 --- a/scintilla/src/LineMarker.cxx +++ b/scintilla/src/LineMarker.cxx @@ -31,7 +31,7 @@ void LineMarker::SetXPM(const char *textForm) { markType = SC_MARK_PIXMAP; } -void LineMarker::SetXPM(const char * const *linesForm) { +void LineMarker::SetXPM(const char *const *linesForm) { delete pxpm; pxpm = new XPM(linesForm); markType = SC_MARK_PIXMAP; @@ -154,7 +154,7 @@ void LineMarker::Draw(Surface *surface, PRectangle &rcWhole, Font &fontForCharac rcSmall.bottom = rc.bottom - 2; surface->RectangleDraw(rcSmall, fore.allocated, back.allocated); - } else if (markType == SC_MARK_EMPTY || markType == SC_MARK_BACKGROUND || + } else if (markType == SC_MARK_EMPTY || markType == SC_MARK_BACKGROUND || markType == SC_MARK_UNDERLINE || markType == SC_MARK_AVAILABLE) { // An invisible marker so don't draw anything diff --git a/scintilla/src/LineMarker.h b/scintilla/src/LineMarker.h index ae7f7fb4..fa0f29fa 100644 --- a/scintilla/src/LineMarker.h +++ b/scintilla/src/LineMarker.h @@ -51,7 +51,7 @@ public: } void RefreshColourPalette(Palette &pal, bool want); 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); }; diff --git a/scintilla/src/Partitioning.h b/scintilla/src/Partitioning.h index 0ec08d7d..d5b392ab 100644 --- a/scintilla/src/Partitioning.h +++ b/scintilla/src/Partitioning.h @@ -8,7 +8,7 @@ #ifndef PARTITIONING_H #define PARTITIONING_H -/// A split vector of integers with a method for adding a value to all elements +/// A split vector of integers with a method for adding a value to all elements /// in a range. /// Used by the Partitioning class. diff --git a/scintilla/src/PerLine.cxx b/scintilla/src/PerLine.cxx index 9a50e82e..1de32457 100644 --- a/scintilla/src/PerLine.cxx +++ b/scintilla/src/PerLine.cxx @@ -241,7 +241,7 @@ void LineLevels::Init() { void LineLevels::InsertLine(int line) { if (levels.Length()) { int level = SC_FOLDLEVELBASE; - if ((line > 0) && (line < levels.Length())) { + if ((line > 0) && (line < levels.Length())) { level = levels[line-1] & ~SC_FOLDLEVELWHITEFLAG; } levels.InsertValue(line, 1, level); @@ -362,6 +362,7 @@ void LineAnnotation::Init() { void LineAnnotation::InsertLine(int line) { if (annotations.Length()) { + annotations.EnsureLength(line); annotations.Insert(line, 0); } } @@ -420,7 +421,7 @@ void LineAnnotation::SetText(int line, const char *text) { delete []annotations[line]; } annotations[line] = AllocateAnnotation(strlen(text), style); - AnnotationHeader *pah = reinterpret_cast(annotations[line]); + AnnotationHeader *pah = reinterpret_cast(annotations[line]); pah->style = static_cast(style); pah->length = strlen(text); pah->lines = static_cast(NumberLines(text)); diff --git a/scintilla/src/PerLine.h b/scintilla/src/PerLine.h index 0f883585..f189508b 100644 --- a/scintilla/src/PerLine.h +++ b/scintilla/src/PerLine.h @@ -11,7 +11,7 @@ #ifdef SCI_NAMESPACE namespace Scintilla { #endif - + /** * This holds the marker identifier and the marker type to display. * MarkerHandleNumbers are members of lists. diff --git a/scintilla/src/PositionCache.cxx b/scintilla/src/PositionCache.cxx index ea13edbe..1aa66540 100644 --- a/scintilla/src/PositionCache.cxx +++ b/scintilla/src/PositionCache.cxx @@ -10,6 +10,7 @@ #include #include +#include #include #include "Platform.h" @@ -361,7 +362,8 @@ void BreakFinder::Insert(int val) { for (unsigned int j = 0; jj; k--) { selAndEdge[k] = selAndEdge[k-1]; } @@ -386,7 +388,7 @@ static int NextBadU(const char *s, int p, int len, int &trailBytes) { 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_), lineStart(lineStart_), lineEnd(lineEnd_), @@ -412,13 +414,19 @@ BreakFinder::BreakFinder(LineLayout *ll_, int lineStart_, int lineEnd_, int posL nextBreak--; } - SelectionSegment segmentLine(SelectionPosition(posLineStart), SelectionPosition(posLineStart + lineEnd)); - for (size_t r=0; rpsel->Count(); r++) { - SelectionSegment portion = ll->psel->Range(r).Intersect(segmentLine); - if (portion.start.IsValid()) - Insert(portion.start.Position() - posLineStart - 1); - if (portion.end.IsValid()) - Insert(portion.end.Position() - posLineStart - 1); + if (breakForSelection) { + SelectionPosition posStart(posLineStart); + SelectionPosition posEnd(posLineStart + lineEnd); + SelectionSegment segmentLine(posStart, posEnd); + for (size_t r=0; rpsel->Count(); r++) { + SelectionSegment portion = ll->psel->Range(r).Intersect(segmentLine); + if (!(portion.start == portion.end)) { + if (portion.start.IsValid()) + Insert(portion.start.Position() - posLineStart - 1); + if (portion.end.IsValid()) + Insert(portion.end.Position() - posLineStart - 1); + } + } } Insert(ll->edgeColumn - 1); @@ -441,7 +449,7 @@ BreakFinder::~BreakFinder() { delete []selAndEdge; } -int BreakFinder::First() { +int BreakFinder::First() const { return nextBreak; } @@ -528,7 +536,7 @@ void PositionCacheEntry::Set(unsigned int styleNumber_, const char *s_, clock = clock_; if (s_ && positions_) { positions = new short[len + (len + 1) / 2]; - for (unsigned int i=0;i(positions_[i]); } memcpy(reinterpret_cast(positions + len), s_, len); @@ -551,7 +559,7 @@ bool PositionCacheEntry::Retrieve(unsigned int styleNumber_, const char *s_, unsigned int len_, int *positions_) const { if ((styleNumber == styleNumber_) && (len == len_) && (memcmp(reinterpret_cast(positions + len), s_, len)== 0)) { - for (unsigned int i=0;i other.clock; } @@ -597,7 +605,7 @@ PositionCache::~PositionCache() { void PositionCache::Clear() { if (!allClear) { - for (size_t i=0;i 60000) { // 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. - for (size_t i=0;i(c)); } } + break; case 'w': for (c = 0; c < MAXCHR; c++) { if (iswordc(static_cast(c))) { diff --git a/scintilla/src/SVector.h b/scintilla/src/SVector.h index 5aff875e..7d1a8a8b 100644 --- a/scintilla/src/SVector.h +++ b/scintilla/src/SVector.h @@ -19,19 +19,19 @@ namespace Scintilla { */ class SVector { enum { allocSize = 4000 }; - + int *v; ///< The vector unsigned int size; ///< Number of elements allocated unsigned int len; ///< Number of elements used in vector - + /** Internally allocate more elements than the user wants * to avoid thrashing the memory allocator. */ void SizeTo(int newSize) { if (newSize < allocSize) newSize += allocSize; - else + else newSize = (newSize * 3) / 2; - int* newv = new int[newSize]; + int *newv = new int[newSize]; size = newSize; unsigned int i=0; for (; i 0) { SizeTo(other.Length()); - for (int i=0;i 0) { SizeTo(other.Length()); - for (int i=0;i #include +#include #include #include "Platform.h" @@ -56,7 +57,7 @@ ScintillaBase::ScintillaBase() { lexLanguage = SCLEX_CONTAINER; performingStyle = false; lexCurrent = 0; - for (int wl = 0;wl < numWordLists;wl++) + for (int wl = 0; wl < numWordLists; wl++) keyWordLists[wl] = new WordList; keyWordLists[numWordLists] = 0; #endif @@ -64,7 +65,7 @@ ScintillaBase::ScintillaBase() { ScintillaBase::~ScintillaBase() { #ifdef SCI_LEXER - for (int wl = 0;wl < numWordLists;wl++) + for (int wl = 0; wl < numWordLists; wl++) delete keyWordLists[wl]; #endif } @@ -202,8 +203,8 @@ int ScintillaBase::KeyCommand(unsigned int iMessage) { return Editor::KeyCommand(iMessage); } -void ScintillaBase::AutoCompleteDoubleClick(void* p) { - ScintillaBase* sci = reinterpret_cast(p); +void ScintillaBase::AutoCompleteDoubleClick(void *p) { + ScintillaBase *sci = reinterpret_cast(p); sci->AutoCompleteCompleted(); } @@ -392,6 +393,23 @@ int ScintillaBase::AutoCompleteGetCurrent() { 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) { ac.Cancel(); pt.y += vs.lineHeight; @@ -464,6 +482,8 @@ void ScintillaBase::SetLexer(uptr_t wParam) { lexCurrent = LexerModule::Find(lexLanguage); if (!lexCurrent) lexCurrent = LexerModule::Find(SCLEX_NULL); + int bits = lexCurrent ? lexCurrent->GetStyleBitsNeeded() : 5; + vs.EnsureStyle((1 << bits) - 1); } void ScintillaBase::SetLexerLanguage(const char *languageName) { @@ -473,6 +493,8 @@ void ScintillaBase::SetLexerLanguage(const char *languageName) { lexCurrent = LexerModule::Find(SCLEX_NULL); if (lexCurrent) lexLanguage = lexCurrent->GetLanguage(); + int bits = lexCurrent ? lexCurrent->GetStyleBitsNeeded() : 5; + vs.EnsureStyle((1 << bits) - 1); } 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: return AutoCompleteGetCurrent(); + case SCI_AUTOCGETCURRENTTEXT: + return AutoCompleteGetCurrentText(reinterpret_cast(lParam)); + case SCI_AUTOCSETCANCELATSTART: ac.cancelAtStartPos = wParam != 0; break; @@ -706,15 +731,8 @@ sptr_t ScintillaBase::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lPara reinterpret_cast(lParam)); break; - case SCI_GETPROPERTY: { - const char *val = props.Get(reinterpret_cast(wParam)); - const int n = strlen(val); - if (lParam != 0) { - char *ptr = reinterpret_cast(lParam); - strcpy(ptr, val); - } - return n; // Not including NUL - } + case SCI_GETPROPERTY: + return StringResult(lParam, props.Get(reinterpret_cast(wParam))); case SCI_GETPROPERTYEXPANDED: { char *val = props.Expanded(reinterpret_cast(wParam)); @@ -741,8 +759,12 @@ sptr_t ScintillaBase::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lPara SetLexerLanguage(reinterpret_cast(lParam)); break; + case SCI_GETLEXERLANGUAGE: + return StringResult(lParam, lexCurrent ? lexCurrent->languageName : ""); + case SCI_GETSTYLEBITSNEEDED: return lexCurrent ? lexCurrent->GetStyleBitsNeeded() : 5; + #endif default: diff --git a/scintilla/src/ScintillaBase.h b/scintilla/src/ScintillaBase.h index f40bc180..9355a082 100644 --- a/scintilla/src/ScintillaBase.h +++ b/scintilla/src/ScintillaBase.h @@ -16,8 +16,8 @@ namespace Scintilla { */ class ScintillaBase : public Editor { // Private so ScintillaBase objects can not be copied - ScintillaBase(const ScintillaBase &) : Editor() {} - ScintillaBase &operator=(const ScintillaBase &) { return *this; } + ScintillaBase(const ScintillaBase &); + ScintillaBase &operator=(const ScintillaBase &); protected: /** Enumeration of commands and child windows. */ @@ -43,9 +43,8 @@ protected: int listType; ///< 0 is an autocomplete list int maxListWidth; /// Maximum width of list, in average character widths - bool performingStyle; ///< Prevent reentrance - #ifdef SCI_LEXER + bool performingStyle; ///< Prevent reentrance int lexLanguage; const LexerModule *lexCurrent; PropSetSimple props; @@ -72,11 +71,12 @@ protected: void AutoCompleteCancel(); void AutoCompleteMove(int delta); int AutoCompleteGetCurrent(); + int AutoCompleteGetCurrentText(char *buffer); void AutoCompleteCharacterAdded(char ch); void AutoCompleteCharacterDeleted(); void AutoCompleteCompleted(); void AutoCompleteMoveToCurrentWord(); - static void AutoCompleteDoubleClick(void* p); + static void AutoCompleteDoubleClick(void *p); void CallTipClick(); void CallTipShow(Point pt, const char *defn); diff --git a/scintilla/src/Selection.cxx b/scintilla/src/Selection.cxx index 667940a6..d33bd022 100644 --- a/scintilla/src/Selection.cxx +++ b/scintilla/src/Selection.cxx @@ -127,7 +127,7 @@ bool SelectionRange::Trim(SelectionRange range) { } else if (start <= startRange) { // Trim end end = startRange; - } else { // + } else { // PLATFORM_ASSERT(end >= endRange); // Trim start start = endRange; @@ -179,6 +179,27 @@ SelectionRange &Selection::Rectangular() { 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 p) + start = p; + if (end < p) + end = p; + } }; struct SelectionRange { @@ -141,6 +147,11 @@ public: int MainCaret() const; int MainAnchor() const; 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 Main() const; void SetMain(size_t r); diff --git a/scintilla/src/SplitVector.h b/scintilla/src/SplitVector.h index 24cec458..306d03ec 100644 --- a/scintilla/src/SplitVector.h +++ b/scintilla/src/SplitVector.h @@ -1,6 +1,6 @@ // Scintilla source code edit control /** @file SplitVector.h - ** Main data structure for holding arrays that handle insertions + ** Main data structure for holding arrays that handle insertions ** and deletions efficiently. **/ // Copyright 1998-2007 by Neil Hodgson @@ -97,7 +97,7 @@ public: /// Retrieve the character at a particular position. /// Retrieving positions outside the range of the buffer returns 0. - /// The assertions here are disabled since calling code can be + /// The assertions here are disabled since calling code can be /// simpler if out of range access works and returns 0. T ValueAt(int position) const { if (position < part1Length) { @@ -135,7 +135,7 @@ public: } } - T& operator[](int position) const { + T &operator[](int position) const { PLATFORM_ASSERT(position >= 0 && position < lengthBody); if (position < part1Length) { return body[position]; @@ -182,14 +182,14 @@ public: } } - /// Ensure at least length elements allocated, + /// Ensure at least length elements allocated, /// appending zero valued elements if needed. void EnsureLength(int wantedLength) { if (Length() < wantedLength) { InsertValue(Length(), wantedLength - Length(), 0); } } - + /// Insert text into the buffer from an array. void InsertFromArray(int positionToInsert, const T s[], int positionFrom, int insertLength) { PLATFORM_ASSERT((positionToInsert >= 0) && (positionToInsert <= lengthBody)); @@ -238,7 +238,7 @@ public: DeleteRange(0, lengthBody); } - T* BufferPointer() { + T *BufferPointer() { RoomFor(1); GapTo(lengthBody); body[lengthBody] = 0; diff --git a/scintilla/src/Style.cxx b/scintilla/src/Style.cxx index a60f1fcb..f1f91c1e 100644 --- a/scintilla/src/Style.cxx +++ b/scintilla/src/Style.cxx @@ -92,6 +92,13 @@ void Style::Clear(ColourDesired fore_, ColourDesired back_, int size_, else font.Release(); aliasOfDefaultFont = false; + sizeZoomed = 2; + lineHeight = 2; + ascent = 1; + descent = 1; + externalLeading = 0; + aveCharWidth = 1; + spaceWidth = 1; } void Style::ClearTo(const Style &source) { @@ -126,7 +133,7 @@ bool Style::EquivalentFontTo(const Style *other) const { 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; if (sizeZoomed <= 2) // Hangs if sizeZoomed <= 1 sizeZoomed = 2; diff --git a/scintilla/src/Style.h b/scintilla/src/Style.h index b145ea82..c7e8879a 100644 --- a/scintilla/src/Style.h +++ b/scintilla/src/Style.h @@ -53,8 +53,8 @@ public: bool visible_, bool changeable_, bool hotspot_); void ClearTo(const Style &source); bool EquivalentFontTo(const Style *other) const; - void Realise(Surface &surface, int zoomLevel, Style *defaultStyle = 0, bool extraFontFlag = false); - bool IsProtected() const { return !(changeable && visible);}; + void Realise(Surface &surface, int zoomLevel, Style *defaultStyle = 0, int extraFontFlag = 0); + bool IsProtected() const { return !(changeable && visible);} }; #ifdef SCI_NAMESPACE diff --git a/scintilla/src/StyleContext.h b/scintilla/src/StyleContext.h index 72e78d94..0bb89d00 100644 --- a/scintilla/src/StyleContext.h +++ b/scintilla/src/StyleContext.h @@ -16,9 +16,7 @@ namespace Scintilla { class StyleContext { Accessor &styler; unsigned int endPos; - StyleContext& operator=(const StyleContext&) { - return *this; - } + StyleContext &operator=(const StyleContext &); void GetNextChar(unsigned int pos) { chNext = static_cast(styler.SafeGetCharAt(pos+1)); if (styler.IsLeadByte(static_cast(chNext))) { @@ -67,7 +65,7 @@ public: void Complete() { styler.ColourTo(currentPos - 1, state); } - bool More() { + bool More() const { return currentPos < endPos; } void Forward() { @@ -110,10 +108,10 @@ public: int GetRelative(int n) { return static_cast(styler.SafeGetCharAt(currentPos+n)); } - bool Match(char ch0) { + bool Match(char ch0) const { return ch == static_cast(ch0); } - bool Match(char ch0, char ch1) { + bool Match(char ch0, char ch1) const { return (ch == static_cast(ch0)) && (chNext == static_cast(ch1)); } bool Match(const char *s) { diff --git a/scintilla/src/UniConversion.cxx b/scintilla/src/UniConversion.cxx index b8be888c..e965c581 100644 --- a/scintilla/src/UniConversion.cxx +++ b/scintilla/src/UniConversion.cxx @@ -1,6 +1,6 @@ // Scintilla source code edit control /** @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 // 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'; } +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 ulen = 0; unsigned int charLen; - for (unsigned int i=0;i(s[i]); if (ch < 0x80) { charLen = 1; diff --git a/scintilla/src/UniConversion.h b/scintilla/src/UniConversion.h index 1c2b3468..222e55fc 100644 --- a/scintilla/src/UniConversion.h +++ b/scintilla/src/UniConversion.h @@ -1,12 +1,13 @@ // Scintilla source code edit control /** @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 // The License.txt file describes the conditions under which this software may be distributed. unsigned int UTF8Length(const wchar_t *uptr, unsigned int tlen); 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 UTF16FromUTF8(const char *s, unsigned int len, wchar_t *tbuf, unsigned int tlen); diff --git a/scintilla/src/ViewStyle.cxx b/scintilla/src/ViewStyle.cxx index 92700989..75527446 100644 --- a/scintilla/src/ViewStyle.cxx +++ b/scintilla/src/ViewStyle.cxx @@ -41,7 +41,7 @@ FontNames::~FontNames() { } void FontNames::Clear() { - for (int i=0;i #include -#include +#include #include #include "Platform.h" @@ -28,7 +28,7 @@ bool WindowAccessor::InternalIsLeadByte(char ch) { if (SC_CP_UTF8 == codePage) // For lexing, all characters >= 0x80 are treated the // same so none is considered a lead byte. - return false; + return false; else return Platform::IsDBCSLeadByte(codePage, ch); } @@ -75,10 +75,10 @@ int WindowAccessor::LevelAt(int line) { return Platform::SendScintilla(id, SCI_GETFOLDLEVEL, line, 0); } -int WindowAccessor::Length() { - if (lenDoc == -1) +int WindowAccessor::Length() { + if (lenDoc == -1) lenDoc = Platform::SendScintilla(id, SCI_GETTEXTLENGTH, 0, 0); - return lenDoc; + return lenDoc; } int WindowAccessor::GetLineState(int line) { @@ -129,7 +129,7 @@ void WindowAccessor::Flush() { startPos = extremePosition; lenDoc = -1; if (validLen > 0) { - Platform::SendScintillaPointer(id, SCI_SETSTYLINGEX, validLen, + Platform::SendScintillaPointer(id, SCI_SETSTYLINGEX, validLen, styleBuf); validLen = 0; } @@ -138,12 +138,12 @@ void WindowAccessor::Flush() { int WindowAccessor::IndentAmount(int line, int *flags, PFNIsCommentLeader pfnIsCommentLeader) { int end = Length(); int spaceFlags = 0; - - // Determines the indentation level of the current line and also checks for consistent + + // Determines the indentation level of the current line and also checks for consistent // indentation compared to the previous line. - // Indentation is judged consistent when the indentation whitespace of each line lines + // Indentation is judged consistent when the indentation whitespace of each line lines // the same or the indentation of one line is a prefix of the other. - + int pos = LineStart(line); char ch = (*this)[pos]; int indent = 0; @@ -170,11 +170,11 @@ int WindowAccessor::IndentAmount(int line, int *flags, PFNIsCommentLeader pfnIsC } ch = (*this)[++pos]; } - + *flags = spaceFlags; indent += SC_FOLDLEVELBASE; // 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; else return indent; diff --git a/scintilla/src/XPM.cxx b/scintilla/src/XPM.cxx index 161891eb..97d1f809 100644 --- a/scintilla/src/XPM.cxx +++ b/scintilla/src/XPM.cxx @@ -38,7 +38,7 @@ static size_t MeasureLength(const char *s) { return i; } -ColourAllocated XPM::ColourFromCode(int ch) { +ColourAllocated XPM::ColourFromCode(int ch) const { return colourCodeTable[ch]->allocated; #ifdef SLOW for (int i=0; i(italic ? 1 : 0); lf.lfCharSet = static_cast(characterSet); + lf.lfQuality = Win32MapFontQuality(extraFontFlag); 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 * 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 size ^ (characterSet << 10) ^ + ((extraFontFlag & SC_EFF_QUALITY_MASK) << 9) ^ (bold ? 0x10000000 : 0) ^ (italic ? 0x20000000 : 0) ^ faceName[0]; @@ -208,33 +232,34 @@ class FontCached : Font { int usage; LOGFONTA lf; 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() {} - 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(); static FontCached *first; 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_); }; 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) { - SetLogFont(lf, faceName_, characterSet_, size_, bold_, italic_); - hash = HashFont(faceName_, characterSet_, size_, bold_, italic_); + SetLogFont(lf, faceName_, characterSet_, size_, bold_, italic_, extraFontFlag_); + hash = HashFont(faceName_, characterSet_, size_, bold_, italic_, extraFontFlag_); fid = ::CreateFontIndirectA(&lf); 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 (lf.lfHeight == -(abs(size_))) && (lf.lfWeight == (bold_ ? FW_BOLD : FW_NORMAL)) && (lf.lfItalic == static_cast(italic_ ? 1 : 0)) && (lf.lfCharSet == characterSet_) && + (lf.lfQuality == Win32MapFontQuality(extraFontFlag_)) && 0 == strcmp(lf.lfFaceName,faceName_); } @@ -244,19 +269,19 @@ void FontCached::Release() { 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; ::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) { if ((cur->hash == hashFind) && - cur->SameAs(faceName_, characterSet_, size_, bold_, italic_)) { + cur->SameAs(faceName_, characterSet_, size_, bold_, italic_, extraFontFlag_)) { cur->usage++; ret = cur->fid; } } if (ret == 0) { - FontCached *fc = new FontCached(faceName_, characterSet_, size_, bold_, italic_); + FontCached *fc = new FontCached(faceName_, characterSet_, size_, bold_, italic_, extraFontFlag_); if (fc) { fc->next = first; first = fc; @@ -296,14 +321,15 @@ Font::~Font() { #define FONTS_CACHED void Font::Create(const char *faceName, int characterSet, int size, - bool bold, bool italic, bool) { + bool bold, bool italic, int extraFontFlag) { Release(); #ifndef FONTS_CACHED LOGFONT lf; - SetLogFont(lf, faceName, characterSet, size, bold, italic); + SetLogFont(lf, faceName, characterSet, size, bold, italic, extraFontFlag); fid = ::CreateFontIndirect(&lf); #else - fid = FontCached::FindOrCreate(faceName, characterSet, size, bold, italic); + if (faceName) + fid = FontCached::FindOrCreate(faceName, characterSet, size, bold, italic, extraFontFlag); #endif } @@ -346,8 +372,8 @@ class SurfaceImpl : public Surface { void SetFont(Font &font_); // Private so SurfaceImpl objects can not be copied - SurfaceImpl(const SurfaceImpl &) : Surface() {} - SurfaceImpl &operator=(const SurfaceImpl &) { return *this; } + SurfaceImpl(const SurfaceImpl &); + SurfaceImpl &operator=(const SurfaceImpl &); public: 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 #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, ColourAllocated outline, int alphaOutline, int /* flags*/ ) { if (AlphaBlendFn && rc.Width() > 0) { @@ -606,18 +644,17 @@ void SurfaceImpl::AlphaRectangle(PRectangle rc, int cornerSize, ColourAllocated HBITMAP hbmOld = SelectBitmap(hMemDC, hbmMem); - byte pixVal[4] = {0}; - DWORD valEmpty = *(reinterpret_cast(pixVal)); - pixVal[0] = static_cast(GetBValue(fill.AsLong()) * alphaFill / 255); - pixVal[1] = static_cast(GetGValue(fill.AsLong()) * alphaFill / 255); - pixVal[2] = static_cast(GetRValue(fill.AsLong()) * alphaFill / 255); - pixVal[3] = static_cast(alphaFill); - DWORD valFill = *(reinterpret_cast(pixVal)); - pixVal[0] = static_cast(GetBValue(outline.AsLong()) * alphaOutline / 255); - pixVal[1] = static_cast(GetGValue(outline.AsLong()) * alphaOutline / 255); - pixVal[2] = static_cast(GetRValue(outline.AsLong()) * alphaOutline / 255); - pixVal[3] = static_cast(alphaOutline); - DWORD valOutline = *(reinterpret_cast(pixVal)); + DWORD valEmpty = dwordFromBGRA(0,0,0,0); + DWORD valFill = dwordFromBGRA( + static_cast(GetBValue(fill.AsLong()) * alphaFill / 255), + static_cast(GetGValue(fill.AsLong()) * alphaFill / 255), + static_cast(GetRValue(fill.AsLong()) * alphaFill / 255), + static_cast(alphaFill)); + DWORD valOutline = dwordFromBGRA( + static_cast(GetBValue(outline.AsLong()) * alphaOutline / 255), + static_cast(GetGValue(outline.AsLong()) * alphaOutline / 255), + static_cast(GetRValue(outline.AsLong()) * alphaOutline / 255), + static_cast(alphaOutline)); DWORD *pixels = reinterpret_cast(image); for (int y=0; y(lParam); - *reinterpret_cast(&minMax->ptMaxTrackSize) = MaxTrackSize(); - *reinterpret_cast(&minMax->ptMinTrackSize) = MinTrackSize(); + minMax->ptMaxTrackSize = MaxTrackSize(); + minMax->ptMinTrackSize = MinTrackSize(); } break; @@ -2089,8 +2128,13 @@ public: // Use GetProcAddress to get a pointer to the relevant function. virtual Function FindFunction(const char *name) { if (h != NULL) { - return static_cast( - (void *)(::GetProcAddress(h, name))); + // C++ standard doesn't like casts betwen function pointers and void pointers so use a union + union { + FARPROC fp; + Function f; + } fnConv; + fnConv.fp = ::GetProcAddress(h, name); + return fnConv.f; } else return NULL; } diff --git a/scintilla/win32/ScintRes.rc b/scintilla/win32/ScintRes.rc index 03b2bcd0..24d39b7d 100644 --- a/scintilla/win32/ScintRes.rc +++ b/scintilla/win32/ScintRes.rc @@ -1,5 +1,5 @@ // Resource file for Scintilla -// Copyright 1998-2007 by Neil Hodgson +// Copyright 1998-2010 by Neil Hodgson // The License.txt file describes the conditions under which this software may be distributed. #ifndef __BORLANDC__ @@ -9,8 +9,8 @@ #include "PlatformRes.h" VS_VERSION_INFO VERSIONINFO -FILEVERSION 2, 0, 1, 0 -PRODUCTVERSION 2, 0, 1, 0 +FILEVERSION 2, 1, 2, 0 +PRODUCTVERSION 2, 1, 2, 0 FILEFLAGSMASK 0x3fL FILEFLAGS 0 FILEOS VOS_NT_WINDOWS32 @@ -27,12 +27,12 @@ BEGIN BEGIN VALUE "CompanyName", "Neil Hodgson neilh@scintilla.org\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 "LegalCopyright", "Copyright 1998-2009 by Neil Hodgson\0" + VALUE "LegalCopyright", "Copyright 1998-2010 by Neil Hodgson\0" VALUE "OriginalFilename", "Scintilla.DLL\0" VALUE "ProductName", "Scintilla\0" - VALUE "ProductVersion", "2.01\0" + VALUE "ProductVersion", "2.12\0" END END END diff --git a/scintilla/win32/ScintillaWin.cxx b/scintilla/win32/ScintillaWin.cxx index 8704b475..da405eb5 100644 --- a/scintilla/win32/ScintillaWin.cxx +++ b/scintilla/win32/ScintillaWin.cxx @@ -93,11 +93,7 @@ extern bool IsNT(); extern void Platform_Initialise(void *hInstance); extern void Platform_Finalise(); -/** TOTAL_CONTROL ifdef surrounds code that will only work when ScintillaWin - * is derived from ScintillaBase (all features) rather than directly from Editor - * (lightweight editor). - */ -#define TOTAL_CONTROL +typedef BOOL (WINAPI *TrackMouseEventSig)(LPTRACKMOUSEEVENT); // 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 +typedef void VFunction(void); + /** */ class FormatEnumerator { public: - void **vtbl; + VFunction **vtbl; int ref; int pos; CLIPFORMAT formats[2]; @@ -126,7 +124,7 @@ public: */ class DropSource { public: - void **vtbl; + VFunction **vtbl; ScintillaWin *sci; DropSource(); }; @@ -135,7 +133,7 @@ public: */ class DataObject { public: - void **vtbl; + VFunction **vtbl; ScintillaWin *sci; DataObject(); }; @@ -144,7 +142,7 @@ public: */ class DropTarget { public: - void **vtbl; + VFunction **vtbl; ScintillaWin *sci; DropTarget(); }; @@ -157,6 +155,8 @@ class ScintillaWin : bool lastKeyDownConsumed; bool capturedMouse; + bool trackedMouseLeave; + TrackMouseEventSig TrackMouseEventFn; unsigned int linesPerScroll; ///< Intellimouse support int wheelDelta; ///< Wheel delta from roll @@ -176,9 +176,9 @@ class ScintillaWin : static HINSTANCE hInstance; ScintillaWin(HWND hwnd); - ScintillaWin(const ScintillaWin &) : ScintillaBase() {} + ScintillaWin(const ScintillaWin &); virtual ~ScintillaWin(); - ScintillaWin &operator=(const ScintillaWin &) { return *this; } + ScintillaWin &operator=(const ScintillaWin &); virtual void Initialise(); virtual void Finalise(); @@ -197,12 +197,14 @@ class ScintillaWin : virtual void StartDrag(); sptr_t WndPaint(uptr_t wParam); sptr_t HandleComposition(uptr_t wParam, sptr_t lParam); + UINT CodePageOfDocument(); virtual bool ValidCodePage(int codePage) const; virtual sptr_t DefWndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam); virtual bool SetIdle(bool on); virtual void SetTicking(bool on); virtual void SetMouseCapture(bool on); virtual bool HaveMouseCapture(); + virtual void SetTrackMouseLeaveEvent(bool on); virtual bool PaintContains(PRectangle rc); virtual void ScrollText(int linesToMove); virtual void UpdateSystemCaret(); @@ -214,6 +216,8 @@ class ScintillaWin : virtual int GetCtrlID(); virtual void NotifyParent(SCNotification scn); 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 CopyAllowLine(); virtual bool CanPaste(); @@ -264,12 +268,6 @@ public: /// Implement important part of IDataObject 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 Unregister(); @@ -298,6 +296,9 @@ ScintillaWin::ScintillaWin(HWND hwnd) { lastKeyDownConsumed = false; capturedMouse = false; + trackedMouseLeave = false; + TrackMouseEventFn = 0; + linesPerScroll = 0; 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 // it just so this internal feature works. 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() { @@ -483,7 +496,7 @@ LRESULT ScintillaWin::WndPaint(uptr_t wParam) { hRgnUpdate = 0; } - if(!IsOcxCtrl) + if (!IsOcxCtrl) ::EndPaint(MainHWND(), pps); if (paintState == paintAbandoned) { // 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) { + 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 } } }; BOOL bci = ::TranslateCharsetInfo((DWORD*)characterSet, &ci, TCI_SRCCHARSET); @@ -588,6 +605,10 @@ static UINT CodePageFromCharSet(DWORD characterSet, UINT documentCodePage) { 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) { try { //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; case WM_COMMAND: -#ifdef TOTAL_CONTROL Command(LoWord(wParam)); -#endif break; case WM_PAINT: @@ -685,7 +704,7 @@ sptr_t ScintillaWin::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam case SC_WIN_IDLE: // wParam=dwTickCountInitial, or 0 to initialize. lParam=bSkipUserInputTest 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()) { // User input was given priority above, but all events do get a turn. Other // messages, notifications, etc. will get interleaved with the idle messages. @@ -729,15 +748,21 @@ sptr_t ScintillaWin::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam ::SetFocus(MainHWND()); } break; - - case WM_MBUTTONDOWN: + + case WM_MBUTTONDOWN: ::SetFocus(MainHWND()); break; - + case WM_MOUSEMOVE: + SetTrackMouseLeaveEvent(true); ButtonMove(Point::FromLong(lParam)); break; + case WM_MOUSELEAVE: + SetTrackMouseLeaveEvent(false); + MouseLeave(); + return ::DefWindowProc(MainHWND(), iMessage, wParam, lParam); + case WM_LBUTTONUP: ButtonUp(Point::FromLong(lParam), ::GetMessageTime(), @@ -784,8 +809,7 @@ sptr_t ScintillaWin::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam UTF8FromUTF16(wcs, 1, utfval, len); AddCharUTF(utfval, len); } else { - UINT cpDest = CodePageFromCharSet( - vs.styles[STYLE_DEFAULT].characterSet, pdoc->dbcsCodePage); + UINT cpDest = CodePageOfDocument(); char inBufferCP[20]; int size = ::WideCharToMultiByte(cpDest, 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 wCT = reinterpret_cast(ct.wCallTip.GetID()); if (!wParam || - !(::IsChild(wThis,wOther) || (wOther == wCT))) { + !(::IsChild(wThis, wOther) || (wOther == wCT))) { SetFocusState(false); DestroySystemCaret(); } @@ -905,7 +929,6 @@ sptr_t ScintillaWin::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam } case WM_CONTEXTMENU: -#ifdef TOTAL_CONTROL if (displayPopupMenu) { Point pt = Point::FromLong(lParam); 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); return 0; } -#endif return ::DefWindowProc(MainHWND(), iMessage, wParam, lParam); case WM_INPUTLANGCHANGE: @@ -1032,14 +1054,14 @@ sptr_t ScintillaWin::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam #ifdef SCI_LEXER case SCI_LOADLEXERLIBRARY: - LexerManager::GetInstance()->Load(reinterpret_cast(lParam)); + LexerManager::GetInstance()->Load(reinterpret_cast(lParam)); break; #endif default: return ScintillaBase::WndProc(iMessage, wParam, lParam); } - } catch (std::bad_alloc&) { + } catch (std::bad_alloc &) { errorStatus = SC_STATUS_BADALLOC; } catch (...) { errorStatus = SC_STATUS_FAILURE; @@ -1105,6 +1127,17 @@ bool ScintillaWin::HaveMouseCapture() { //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 contains = true; 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 void ScintillaWin::ChangeScrollPos(int barType, int pos) { SCROLLINFO sci = { - sizeof(sci),0,0,0,0,0,0 + sizeof(sci), 0, 0, 0, 0, 0, 0 }; sci.fMask = SIF_POS; GetScrollInfo(barType, &sci); @@ -1180,7 +1213,7 @@ void ScintillaWin::SetHorizontalScrollPos() { bool ScintillaWin::ModifyScrollBars(int nMax, int nPage) { bool modified = false; SCROLLINFO sci = { - sizeof(sci),0,0,0,0,0,0 + sizeof(sci), 0, 0, 0, 0, 0, 0 }; sci.fMask = SIF_PAGE | SIF_RANGE; GetScrollInfo(SB_VERT, &sci); @@ -1264,6 +1297,153 @@ void ScintillaWin::NotifyDoubleClick(Point pt, bool shift, bool ctrl, bool alt) 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 utf16Mixed; + std::vector 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(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(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 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 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 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() { //Platform::DebugPrintf("Copy\n"); if (!sel.Empty()) { @@ -1320,7 +1500,7 @@ public: void SetClip(UINT uFormat) { ::SetClipboardData(uFormat, Unlock()); } - operator bool() { + operator bool() const { return ptr != 0; } SIZE_T Size() { @@ -1351,10 +1531,7 @@ void ScintillaWin::InsertPasteText(const char *text, int len, SelectionPosition SetEmptySelection(sel.MainCaret() + len); } } else { - selStart = SelectionPosition(InsertSpace(selStart.Position(), selStart.VirtualSpace())); - if (pdoc->InsertString(selStart.Position(), text, len)) { - SetEmptySelection(selStart.Position() + len); - } + InsertPaste(selStart, text, len); } delete []convertedText; } @@ -1366,7 +1543,9 @@ void ScintillaWin::Paste() { UndoGroup ug(pdoc); bool isLine = SelectionEmpty() && (::IsClipboardFormatAvailable(cfLineSelect) != 0); 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; // Always use CF_UNICODETEXT if available @@ -1385,8 +1564,7 @@ void ScintillaWin::Paste() { } else { // CF_UNICODETEXT available, but not in Unicode mode // Convert from Unicode to current Scintilla code page - UINT cpDest = CodePageFromCharSet( - vs.styles[STYLE_DEFAULT].characterSet, pdoc->dbcsCodePage); + UINT cpDest = CodePageOfDocument(); len = ::WideCharToMultiByte(cpDest, 0, uptr, -1, NULL, 0, NULL, NULL) - 1; // subtract 0 terminator putf = new char[len + 1]; @@ -1443,7 +1621,6 @@ void ScintillaWin::Paste() { } void ScintillaWin::CreateCallTipWindow(PRectangle) { -#ifdef TOTAL_CONTROL if (!ct.wCallTip.Created()) { ct.wCallTip = ::CreateWindow(callClassName, TEXT("ACallTip"), WS_POPUP, 100, 100, 150, 20, @@ -1452,11 +1629,9 @@ void ScintillaWin::CreateCallTipWindow(PRectangle) { this); ct.wDraw = ct.wCallTip; } -#endif } void ScintillaWin::AddToPopUp(const char *label, int cmd, bool enabled) { -#ifdef TOTAL_CONTROL HMENU hmenuPopup = reinterpret_cast(popup.GetID()); if (!label[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); else ::AppendMenuA(hmenuPopup, MF_STRING | MF_DISABLED | MF_GRAYED, cmd, label); -#endif } void ScintillaWin::ClaimSelection() { // 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 STDMETHODIMP_(ULONG)FormatEnumerator_AddRef(FormatEnumerator *fe); @@ -1563,14 +1708,14 @@ STDMETHODIMP FormatEnumerator_Clone(FormatEnumerator *fe, IEnumFORMATETC **ppenu reinterpret_cast(ppenum)); } -static void *vtFormatEnumerator[] = { - (void *)(FormatEnumerator_QueryInterface), - (void *)(FormatEnumerator_AddRef), - (void *)(FormatEnumerator_Release), - (void *)(FormatEnumerator_Next), - (void *)(FormatEnumerator_Skip), - (void *)(FormatEnumerator_Reset), - (void *)(FormatEnumerator_Clone) +static VFunction *vtFormatEnumerator[] = { + (VFunction *)(FormatEnumerator_QueryInterface), + (VFunction *)(FormatEnumerator_AddRef), + (VFunction *)(FormatEnumerator_Release), + (VFunction *)(FormatEnumerator_Next), + (VFunction *)(FormatEnumerator_Skip), + (VFunction *)(FormatEnumerator_Reset), + (VFunction *)(FormatEnumerator_Clone) }; 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... pos = pos_; formatsLen = formatsLen_; - for (int i=0;i(ppEnum)); - } catch (std::bad_alloc&) { + } catch (std::bad_alloc &) { pd->sci->errorStatus = SC_STATUS_BADALLOC; return E_OUTOFMEMORY; } catch (...) { @@ -1725,19 +1870,19 @@ STDMETHODIMP DataObject_EnumDAdvise(DataObject *, IEnumSTATDATA **) { return E_FAIL; } -static void *vtDataObject[] = { - (void *)(DataObject_QueryInterface), - (void *)(DataObject_AddRef), - (void *)(DataObject_Release), - (void *)(DataObject_GetData), - (void *)(DataObject_GetDataHere), - (void *)(DataObject_QueryGetData), - (void *)(DataObject_GetCanonicalFormatEtc), - (void *)(DataObject_SetData), - (void *)(DataObject_EnumFormatEtc), - (void *)(DataObject_DAdvise), - (void *)(DataObject_DUnadvise), - (void *)(DataObject_EnumDAdvise) +static VFunction *vtDataObject[] = { + (VFunction *)(DataObject_QueryInterface), + (VFunction *)(DataObject_AddRef), + (VFunction *)(DataObject_Release), + (VFunction *)(DataObject_GetData), + (VFunction *)(DataObject_GetDataHere), + (VFunction *)(DataObject_QueryGetData), + (VFunction *)(DataObject_GetCanonicalFormatEtc), + (VFunction *)(DataObject_SetData), + (VFunction *)(DataObject_EnumFormatEtc), + (VFunction *)(DataObject_DAdvise), + (VFunction *)(DataObject_DUnadvise), + (VFunction *)(DataObject_EnumDAdvise) }; DataObject::DataObject() { @@ -1793,14 +1938,14 @@ STDMETHODIMP DropTarget_Drop(DropTarget *dt, LPDATAOBJECT pIDataSource, DWORD gr return E_FAIL; } -static void *vtDropTarget[] = { - (void *)(DropTarget_QueryInterface), - (void *)(DropTarget_AddRef), - (void *)(DropTarget_Release), - (void *)(DropTarget_DragEnter), - (void *)(DropTarget_DragOver), - (void *)(DropTarget_DragLeave), - (void *)(DropTarget_Drop) +static VFunction *vtDropTarget[] = { + (VFunction *)(DropTarget_QueryInterface), + (VFunction *)(DropTarget_AddRef), + (VFunction *)(DropTarget_Release), + (VFunction *)(DropTarget_DragEnter), + (VFunction *)(DropTarget_DragOver), + (VFunction *)(DropTarget_DragLeave), + (VFunction *)(DropTarget_Drop) }; DropTarget::DropTarget() { @@ -1831,7 +1976,7 @@ void ScintillaWin::ImeStartComposition() { // Since the style creation code has been made platform independent, // The logfont for the IME is recreated here. 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; if (sizeZoomed <= 2) // Hangs if sizeZoomed <= 1 sizeZoomed = 2; @@ -1867,7 +2012,7 @@ void ScintillaWin::AddCharBytes(char b0, char b1) { int inputCodePage = InputCodePage(); if (inputCodePage && IsUnicodeMode()) { - char utfval[4]="\0\0\0"; + char utfval[4] = "\0\0\0"; char ansiChars[3]; wchar_t wcs[2]; 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 UINT cpSrc = CodePageFromCharSet( 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) { ::MultiByteToWideChar(cpSrc, 0, selectedText.s, selectedText.len, - static_cast(uniText.ptr), selectedText.len); + static_cast(uniText.ptr), uLen); } } @@ -2194,7 +2340,7 @@ STDMETHODIMP ScintillaWin::Drop(LPDATAOBJECT pIDataSource, DWORD grfKeyState, SetDragPosition(SelectionPosition(invalidPosition)); - STGMEDIUM medium={0,{0},0}; + STGMEDIUM medium = {0, {0}, 0}; char *data = 0; bool dataAllocated = false; @@ -2216,8 +2362,7 @@ STDMETHODIMP ScintillaWin::Drop(LPDATAOBJECT pIDataSource, DWORD grfKeyState, // Default Scintilla behavior in Unicode mode // CF_UNICODETEXT available, but not in Unicode mode // Convert from Unicode to current Scintilla code page - UINT cpDest = CodePageFromCharSet( - vs.styles[STYLE_DEFAULT].characterSet, pdoc->dbcsCodePage); + UINT cpDest = CodePageOfDocument(); int tlen = ::WideCharToMultiByte(cpDest, 0, udata, -1, NULL, 0, NULL, NULL) - 1; // subtract 0 terminator 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) { //Platform::DebugPrintf("Bad data format: 0x%x\n", hres); return hr; @@ -2246,7 +2401,7 @@ STDMETHODIMP ScintillaWin::Drop(LPDATAOBJECT pIDataSource, DWORD grfKeyState, POINT rpt = {pt.x, pt.y}; ::ScreenToClient(MainHWND(), &rpt); - SelectionPosition movePos = SPositionFromLocation(Point(rpt.x, rpt.y), false, false, UserVirtualSpace()); + SelectionPosition movePos = SPositionFromLocation(Point(rpt.x, rpt.y), false, false, UserVirtualSpace()); DropAt(movePos, data, *pdwEffect == DROPEFFECT_MOVE, hrRectangular == S_OK); @@ -2376,7 +2531,7 @@ bool ScintillaWin::Unregister() { bool ScintillaWin::HasCaretSizeChanged() { if ( ( (0 != vs.caretWidth) && (sysCaretWidth != vs.caretWidth) ) - || (0 != vs.lineHeight) && (sysCaretHeight != vs.lineHeight) + || ((0 != vs.lineHeight) && (sysCaretHeight != vs.lineHeight)) ) { return true; } @@ -2477,7 +2632,7 @@ sptr_t PASCAL ScintillaWin::CTWndProc( sciThis->CallTipClick(); return 0; } else if (iMessage == WM_SETCURSOR) { - ::SetCursor(::LoadCursor(NULL,IDC_ARROW)); + ::SetCursor(::LoadCursor(NULL, IDC_ARROW)); return 0; } else if (iMessage == WM_NCHITTEST) { return HTCAPTION; @@ -2520,7 +2675,7 @@ sptr_t PASCAL ScintillaWin::SWndProc( sci = new ScintillaWin(hWnd); SetWindowPointer(hWnd, sci); return sci->WndProc(iMessage, wParam, lParam); - } + } } catch (...) { } return ::DefWindowProc(hWnd, iMessage, wParam, lParam); @@ -2541,7 +2696,7 @@ sptr_t PASCAL ScintillaWin::SWndProc( // This function is externally visible so it can be called from container when building statically. // Must be called once only. -bool Scintilla_RegisterClasses(void *hInstance) { +int Scintilla_RegisterClasses(void *hInstance) { Platform_Initialise(hInstance); bool result = ScintillaWin::Register(reinterpret_cast(hInstance)); #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. -bool Scintilla_ReleaseResources() { +int Scintilla_ReleaseResources() { bool result = ScintillaWin::Unregister(); Platform_Finalise(); return result; diff --git a/scintilla/win32/makefile b/scintilla/win32/makefile index 683e1afb..d9e5dcbe 100644 --- a/scintilla/win32/makefile +++ b/scintilla/win32/makefile @@ -1,10 +1,8 @@ # Make file for Scintilla on Windows -# Copyright 1998-2003 by Neil Hodgson +# Copyright 1998-2010 by Neil Hodgson # The License.txt file describes the conditions under which this software may be distributed. -# This makefile assumes the mingw32 version of GCC 2.95.3 is used and changes will +# This makefile assumes the mingw32 version of GCC 3.x or 4.x is used and changes will # be needed to use other compilers. -# The -fvtable-thunks option is required for older (2.9*) versions of gcc but can be removed -# safely if using a newer version which may display warning messages. .SUFFIXES: .cxx CC = g++ @@ -15,21 +13,13 @@ COMPONENT = ../bin/Scintilla.dll LEXCOMPONENT = ../bin/SciLexer.dll LEXLIB = Lexers.a -ifndef NOTHUNKS -gversion = $(word 1,$(subst ., ,$(shell g++ --version))) -ifeq ($(gversion),2) -THUNKFLAGS=-fvtable-thunks -endif -endif - vpath %.h ../src ../include vpath %.cxx ../src LDFLAGS=-mwindows -lstdc++ -limm32 -lole32 -luuid -mno-cygwin # Add -MMD to get dependencies -#CXXFLAGS = -g -pg -pedantic -Os -fno-exceptions -fvtable-thunks -fno-rtti INCLUDEDIRS=-I ../include -I ../src -CXXBASEFLAGS=-Wall -Wno-missing-braces -Wno-char-subscripts -pedantic $(INCLUDEDIRS) $(THUNKFLAGS) -fno-rtti -mno-cygwin +CXXBASEFLAGS=-Wall -Wno-missing-braces -Wno-char-subscripts -Wno-strict-overflow -pedantic $(INCLUDEDIRS) -fno-rtti -mno-cygwin ifdef DEBUG CXXFLAGS=-DDEBUG -g $(CXXBASEFLAGS) @@ -57,12 +47,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 \ 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 \ -LexLout.o LexLua.o LexMagik.o LexMatlab.o LexMetapost.o LexMMIXAL.o LexMPT.o \ -LexMSSQL.o LexMySQL.o LexNimrod.o LexNsis.o LexOpal.o LexOthers.o LexPascal.o \ -LexPB.o LexPerl.o LexPLM.o LexPOV.o LexPowerPro.o LexPowerShell.o \ -LexProgress.o LexPS.o LexPython.o LexR.o LexRebol.o LexRuby.o LexScriptol.o \ -LexSmalltalk.o LexSML.o LexSorcus.o LexSpecman.o LexSpice.o LexSQL.o LexTACL.o \ -LexTADS3.o LexTAL.o LexTCL.o LexTeX.o LexVB.o LexVerilog.o LexVHDL.o LexYAML.o +LexLout.o LexLua.o LexMagik.o LexMarkdown.o LexMatlab.o LexMetapost.o \ +LexMMIXAL.o LexMPT.o LexMSSQL.o LexMySQL.o LexNimrod.o LexNsis.o LexOpal.o \ +LexOthers.o LexPascal.o LexPB.o LexPerl.o LexPLM.o LexPOV.o LexPowerPro.o \ +LexPowerShell.o LexProgress.o LexPS.o LexPython.o LexR.o LexRebol.o LexRuby.o \ +LexScriptol.o LexSmalltalk.o LexSML.o LexSorcus.o LexSpecman.o LexSpice.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 SOBJS = ScintillaWin.o ScintillaBase.o Editor.o CharClassify.o Decoration.o \ diff --git a/scintilla/win32/scintilla.mak b/scintilla/win32/scintilla.mak index 37aab0d0..5c412fdc 100644 --- a/scintilla/win32/scintilla.mak +++ b/scintilla/win32/scintilla.mak @@ -40,7 +40,7 @@ CXXFLAGS=-Zi -TP -W4 -EHsc -Zc:forScope -Zc:wchar_t -D_CRT_SECURE_NO_DEPRECATE=1 CXXDEBUG=-Od -MTd -DDEBUG CXXNDEBUG=-O1 -MT -DNDEBUG -GL NAME=-Fo -LDFLAGS=-OPT:NOWIN98 -OPT:REF -LTCG -DEBUG +LDFLAGS=-OPT:REF -LTCG -DEBUG LDDEBUG= LIBS=KERNEL32.lib USER32.lib GDI32.lib IMM32.lib OLE32.LIB NOLOGO=-nologo @@ -153,6 +153,7 @@ LEXOBJS=\ $(DIR_O)\LexLout.obj \ $(DIR_O)\LexLua.obj \ $(DIR_O)\LexMagik.obj \ + $(DIR_O)\LexMarkdown.obj \ $(DIR_O)\LexMatlab.obj \ $(DIR_O)\LexMetapost.obj \ $(DIR_O)\LexMMIXAL.obj \ @@ -393,6 +394,8 @@ $(DIR_O)\LexLua.obj: ..\src\LexLua.cxx $(LEX_HEADERS) $(DIR_O)\LexMagik.obj: ..\src\LexMagik.cxx $(LEX_HEADERS) +$(DIR_O)\LexMarkdown.obj: ..\src\LexMarkdown.cxx $(LEX_HEADERS) + $(DIR_O)\LexMatlab.obj: ..\src\LexMatlab.cxx $(LEX_HEADERS) $(DIR_O)\LexMetapost.obj: ..\src\LexMetapost.cxx $(LEX_HEADERS) diff --git a/scintilla/win32/scintilla_vc6.mak b/scintilla/win32/scintilla_vc6.mak index 7e0e6dae..7f9939f9 100644 --- a/scintilla/win32/scintilla_vc6.mak +++ b/scintilla/win32/scintilla_vc6.mak @@ -155,6 +155,7 @@ LEXOBJS=\ $(DIR_O)\LexLout.obj \ $(DIR_O)\LexLua.obj \ $(DIR_O)\LexMagik.obj \ + $(DIR_O)\LexMarkdown.obj \ $(DIR_O)\LexMatlab.obj \ $(DIR_O)\LexMetapost.obj \ $(DIR_O)\LexMMIXAL.obj \ @@ -395,6 +396,8 @@ $(DIR_O)\LexLua.obj: ..\src\LexLua.cxx $(LEX_HEADERS) $(DIR_O)\LexMagik.obj: ..\src\LexMagik.cxx $(LEX_HEADERS) +$(DIR_O)\LexMarkdown.obj: ..\src\LexMarkdown.cxx $(LEX_HEADERS) + $(DIR_O)\LexMatlab.obj: ..\src\LexMatlab.cxx $(LEX_HEADERS) $(DIR_O)\LexMetapost.obj: ..\src\LexMetapost.cxx $(LEX_HEADERS)