Updated to version 1.40 of Scintilla
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@12050 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -72,6 +72,7 @@
|
|||||||
#define wxSTC_MARK_CIRCLEPLUSCONNECTED 19
|
#define wxSTC_MARK_CIRCLEPLUSCONNECTED 19
|
||||||
#define wxSTC_MARK_CIRCLEMINUS 20
|
#define wxSTC_MARK_CIRCLEMINUS 20
|
||||||
#define wxSTC_MARK_CIRCLEMINUSCONNECTED 21
|
#define wxSTC_MARK_CIRCLEMINUSCONNECTED 21
|
||||||
|
#define wxSTC_MARK_CHARACTER 10000
|
||||||
|
|
||||||
// Markers used for outlining column
|
// Markers used for outlining column
|
||||||
#define wxSTC_MARKNUM_FOLDEREND 25
|
#define wxSTC_MARKNUM_FOLDEREND 25
|
||||||
@@ -83,12 +84,16 @@
|
|||||||
#define wxSTC_MARKNUM_FOLDEROPEN 31
|
#define wxSTC_MARKNUM_FOLDEROPEN 31
|
||||||
#define wxSTC_MARGIN_SYMBOL 0
|
#define wxSTC_MARGIN_SYMBOL 0
|
||||||
#define wxSTC_MARGIN_NUMBER 1
|
#define wxSTC_MARGIN_NUMBER 1
|
||||||
|
|
||||||
|
// Styles in range 32..37 are predefined for parts of the UI and are not used as normal styles.
|
||||||
|
// Styles 38 and 39 are for future use.
|
||||||
#define wxSTC_STYLE_DEFAULT 32
|
#define wxSTC_STYLE_DEFAULT 32
|
||||||
#define wxSTC_STYLE_LINENUMBER 33
|
#define wxSTC_STYLE_LINENUMBER 33
|
||||||
#define wxSTC_STYLE_BRACELIGHT 34
|
#define wxSTC_STYLE_BRACELIGHT 34
|
||||||
#define wxSTC_STYLE_BRACEBAD 35
|
#define wxSTC_STYLE_BRACEBAD 35
|
||||||
#define wxSTC_STYLE_CONTROLCHAR 36
|
#define wxSTC_STYLE_CONTROLCHAR 36
|
||||||
#define wxSTC_STYLE_INDENTGUIDE 37
|
#define wxSTC_STYLE_INDENTGUIDE 37
|
||||||
|
#define wxSTC_STYLE_LASTPREDEFINED 39
|
||||||
#define wxSTC_STYLE_MAX 127
|
#define wxSTC_STYLE_MAX 127
|
||||||
|
|
||||||
// Character set identifiers are used in StyleSetCharacterSet.
|
// Character set identifiers are used in StyleSetCharacterSet.
|
||||||
@@ -295,6 +300,7 @@
|
|||||||
#define wxSTC_LEX_EIFFEL 23
|
#define wxSTC_LEX_EIFFEL 23
|
||||||
#define wxSTC_LEX_EIFFELKW 24
|
#define wxSTC_LEX_EIFFELKW 24
|
||||||
#define wxSTC_LEX_TCL 25
|
#define wxSTC_LEX_TCL 25
|
||||||
|
#define wxSTC_LEX_NNCRONTAB 26
|
||||||
|
|
||||||
// When a lexer specifies its language as SCLEX_AUTOMATIC it receives a
|
// When a lexer specifies its language as SCLEX_AUTOMATIC it receives a
|
||||||
// value assigned in sequence from SCLEX_AUTOMATIC+1.
|
// value assigned in sequence from SCLEX_AUTOMATIC+1.
|
||||||
@@ -334,6 +340,8 @@
|
|||||||
#define wxSTC_C_REGEX 14
|
#define wxSTC_C_REGEX 14
|
||||||
#define wxSTC_C_COMMENTLINEDOC 15
|
#define wxSTC_C_COMMENTLINEDOC 15
|
||||||
#define wxSTC_C_WORD2 16
|
#define wxSTC_C_WORD2 16
|
||||||
|
#define wxSTC_C_COMMENTDOCKEYWORD 17
|
||||||
|
#define wxSTC_C_COMMENTDOCKEYWORDERROR 18
|
||||||
|
|
||||||
// Lexical states for SCLEX_HTML, SCLEX_XML
|
// Lexical states for SCLEX_HTML, SCLEX_XML
|
||||||
#define wxSTC_H_DEFAULT 0
|
#define wxSTC_H_DEFAULT 0
|
||||||
@@ -365,7 +373,17 @@
|
|||||||
#define wxSTC_H_XCCOMMENT 20
|
#define wxSTC_H_XCCOMMENT 20
|
||||||
|
|
||||||
// SGML
|
// SGML
|
||||||
#define wxSTC_H_SGML 21
|
#define wxSTC_H_SGML_DEFAULT 21
|
||||||
|
#define wxSTC_H_SGML_COMMAND 22
|
||||||
|
#define wxSTC_H_SGML_1ST_PARAM 23
|
||||||
|
#define wxSTC_H_SGML_DOUBLESTRING 24
|
||||||
|
#define wxSTC_H_SGML_SIMPLESTRING 25
|
||||||
|
#define wxSTC_H_SGML_ERROR 26
|
||||||
|
#define wxSTC_H_SGML_SPECIAL 27
|
||||||
|
#define wxSTC_H_SGML_ENTITY 28
|
||||||
|
#define wxSTC_H_SGML_COMMENT 29
|
||||||
|
#define wxSTC_H_SGML_1ST_PARAM_COMMENT 30
|
||||||
|
#define wxSTC_H_SGML_BLOCK_DEFAULT 31
|
||||||
|
|
||||||
// Embedded Javascript
|
// Embedded Javascript
|
||||||
#define wxSTC_HJ_START 40
|
#define wxSTC_HJ_START 40
|
||||||
@@ -604,6 +622,19 @@
|
|||||||
#define wxSTC_EIFFEL_IDENTIFIER 7
|
#define wxSTC_EIFFEL_IDENTIFIER 7
|
||||||
#define wxSTC_EIFFEL_STRINGEOL 8
|
#define wxSTC_EIFFEL_STRINGEOL 8
|
||||||
|
|
||||||
|
// Lexical states for the SCLEX_NNCRONTAB (nnCron crontab Lexer)
|
||||||
|
#define wxSTC_NNCRONTAB_DEFAULT 0
|
||||||
|
#define wxSTC_NNCRONTAB_COMMENT 1
|
||||||
|
#define wxSTC_NNCRONTAB_TASK 2
|
||||||
|
#define wxSTC_NNCRONTAB_SECTION 3
|
||||||
|
#define wxSTC_NNCRONTAB_KEYWORD 4
|
||||||
|
#define wxSTC_NNCRONTAB_MODIFIER 5
|
||||||
|
#define wxSTC_NNCRONTAB_ASTERISK 6
|
||||||
|
#define wxSTC_NNCRONTAB_NUMBER 7
|
||||||
|
#define wxSTC_NNCRONTAB_STRING 8
|
||||||
|
#define wxSTC_NNCRONTAB_ENVIRONMENT 9
|
||||||
|
#define wxSTC_NNCRONTAB_IDENTIFIER 10
|
||||||
|
|
||||||
// END of generated section
|
// END of generated section
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
// Others
|
// Others
|
||||||
@@ -1223,10 +1254,12 @@ public:
|
|||||||
int GetTargetEnd();
|
int GetTargetEnd();
|
||||||
|
|
||||||
// Replace the target text with the argument text.
|
// Replace the target text with the argument text.
|
||||||
|
// Text is counted so it can contain nulls.
|
||||||
// Returns the length of the replacement text.
|
// Returns the length of the replacement text.
|
||||||
int ReplaceTarget(const wxString& text);
|
int ReplaceTarget(const wxString& text);
|
||||||
|
|
||||||
// Replace the target text with the argument text after \d processing.
|
// Replace the target text with the argument text after \d processing.
|
||||||
|
// Text is counted so it can contain nulls.
|
||||||
// Looks for \d where d is between 1 and 9 and replaces these with the strings
|
// Looks for \d where d is between 1 and 9 and replaces these with the strings
|
||||||
// matched in the last search operation which were surrounded by \( and \).
|
// matched in the last search operation which were surrounded by \( and \).
|
||||||
// Returns the length of the replacement text including any change
|
// Returns the length of the replacement text including any change
|
||||||
@@ -1234,7 +1267,7 @@ public:
|
|||||||
int ReplaceTargetRE(const wxString& text);
|
int ReplaceTargetRE(const wxString& text);
|
||||||
|
|
||||||
// Search for a counted string in the target and set the target to the found
|
// Search for a counted string in the target and set the target to the found
|
||||||
// range.
|
// range. Text is counted so it can contain nulls.
|
||||||
// Returns length of range or -1 for failure in which case target is not moved.
|
// Returns length of range or -1 for failure in which case target is not moved.
|
||||||
int SearchInTarget(const wxString& text);
|
int SearchInTarget(const wxString& text);
|
||||||
|
|
||||||
|
@@ -37,6 +37,7 @@ OBJECTS=PlatWX.o ScintillaWX.o stc.o \
|
|||||||
LexAda.o \
|
LexAda.o \
|
||||||
LexCPP.o \
|
LexCPP.o \
|
||||||
LexConf.o \
|
LexConf.o \
|
||||||
|
LexCrontab.o \
|
||||||
LexEiffel.o \
|
LexEiffel.o \
|
||||||
LexHTML.o \
|
LexHTML.o \
|
||||||
LexLisp.o \
|
LexLisp.o \
|
||||||
@@ -53,6 +54,7 @@ OBJECTS=PlatWX.o ScintillaWX.o stc.o \
|
|||||||
RESearch.o \
|
RESearch.o \
|
||||||
ScintillaBase.o \
|
ScintillaBase.o \
|
||||||
Style.o \
|
Style.o \
|
||||||
|
StyleContext.o \
|
||||||
UniConversion.o \
|
UniConversion.o \
|
||||||
ViewStyle.o \
|
ViewStyle.o \
|
||||||
WindowAccessor.o \
|
WindowAccessor.o \
|
||||||
|
@@ -531,24 +531,20 @@ ListBox::~ListBox() {
|
|||||||
|
|
||||||
void ListBox::Create(Window &parent, int ctrlID) {
|
void ListBox::Create(Window &parent, int ctrlID) {
|
||||||
id = new wxSTCListBox(parent.id, ctrlID);
|
id = new wxSTCListBox(parent.id, ctrlID);
|
||||||
// id = new wxListBox(parent.id, ctrlID, wxDefaultPosition, wxDefaultSize,
|
|
||||||
// 0, NULL, wxLB_SINGLE | wxLB_SORT | wxSIMPLE_BORDER);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ListBox::SetVisibleRows(int rows) {
|
void ListBox::SetVisibleRows(int rows) {
|
||||||
desiredVisibleRows = rows;
|
desiredVisibleRows = rows;
|
||||||
printf("SetVisibleRows: %d\n", rows);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
PRectangle ListBox::GetDesiredRect() {
|
PRectangle ListBox::GetDesiredRect() {
|
||||||
wxSize sz = ((wxListBox*)id)->GetBestSize();
|
wxSize sz = ((wxListBox*)id)->GetBestSize();
|
||||||
printf("GetDesiredRect: %d, %d\n", sz.x, sz.y);
|
|
||||||
PRectangle rc;
|
PRectangle rc;
|
||||||
rc.top = 0;
|
rc.top = 0;
|
||||||
rc.left = 0;
|
rc.left = 0;
|
||||||
if (sz.x > 400)
|
if (sz.x > 400)
|
||||||
sz.x = 400;
|
sz.x = 400;
|
||||||
if (sz.y > 150)
|
if (sz.y > 150) // TODO: Use desiredVisibleRows??
|
||||||
sz.y = 150;
|
sz.y = 150;
|
||||||
rc.right = sz.x;
|
rc.right = sz.x;
|
||||||
rc.bottom = sz.y;
|
rc.bottom = sz.y;
|
||||||
@@ -592,13 +588,7 @@ int ListBox::GetSelection() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int ListBox::Find(const char *prefix) {
|
int ListBox::Find(const char *prefix) {
|
||||||
if (prefix) {
|
// No longer used
|
||||||
for (int x=0; x < ((wxListBox*)id)->GetCount(); x++) {
|
|
||||||
wxString text = ((wxListBox*)id)->GetString(x);
|
|
||||||
if (text.StartsWith(prefix))
|
|
||||||
return x;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -122,9 +122,10 @@ void ScintillaWX::Finalise() {
|
|||||||
|
|
||||||
void ScintillaWX::StartDrag() {
|
void ScintillaWX::StartDrag() {
|
||||||
wxDropSource source(wMain.GetID());
|
wxDropSource source(wMain.GetID());
|
||||||
wxTextDataObject data(dragChars);
|
wxTextDataObject data(wxString(drag.s, drag.len));
|
||||||
wxDragResult result;
|
wxDragResult result;
|
||||||
|
|
||||||
|
dropWentOutside = true;
|
||||||
source.SetData(data);
|
source.SetData(data);
|
||||||
result = source.DoDragDrop(TRUE);
|
result = source.DoDragDrop(TRUE);
|
||||||
if (result == wxDragMove && dropWentOutside)
|
if (result == wxDragMove && dropWentOutside)
|
||||||
@@ -217,9 +218,10 @@ void ScintillaWX::NotifyParent(SCNotification scn) {
|
|||||||
|
|
||||||
void ScintillaWX::Copy() {
|
void ScintillaWX::Copy() {
|
||||||
if (currentPos != anchor) {
|
if (currentPos != anchor) {
|
||||||
char* text = CopySelectionRange();
|
SelectionText st;
|
||||||
|
CopySelectionRange(&st);
|
||||||
wxTheClipboard->Open();
|
wxTheClipboard->Open();
|
||||||
wxTheClipboard->SetData(new wxTextDataObject(text));
|
wxTheClipboard->SetData(new wxTextDataObject(wxString(st.s, st.len)));
|
||||||
wxTheClipboard->Close();
|
wxTheClipboard->Close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -494,14 +496,15 @@ bool ScintillaWX::DoDropText(long x, long y, const wxString& data) {
|
|||||||
|
|
||||||
|
|
||||||
wxDragResult ScintillaWX::DoDragEnter(wxCoord x, wxCoord y, wxDragResult def) {
|
wxDragResult ScintillaWX::DoDragEnter(wxCoord x, wxCoord y, wxDragResult def) {
|
||||||
return def;
|
dragResult = def;
|
||||||
|
return dragResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
wxDragResult ScintillaWX::DoDragOver(wxCoord x, wxCoord y, wxDragResult def) {
|
wxDragResult ScintillaWX::DoDragOver(wxCoord x, wxCoord y, wxDragResult def) {
|
||||||
SetDragPosition(PositionFromLocation(Point(x, y)));
|
SetDragPosition(PositionFromLocation(Point(x, y)));
|
||||||
dragResult = def;
|
dragResult = def;
|
||||||
return def;
|
return dragResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -32,19 +32,28 @@ OBJECTS = \
|
|||||||
Indicator.obj \
|
Indicator.obj \
|
||||||
KeyMap.obj \
|
KeyMap.obj \
|
||||||
KeyWords.obj \
|
KeyWords.obj \
|
||||||
|
LexAVE.obj \
|
||||||
|
LexAda.obj \
|
||||||
LexCPP.obj \
|
LexCPP.obj \
|
||||||
|
LexConf.obj \
|
||||||
|
LexCrontab.obj \
|
||||||
|
LexEiffel.obj \
|
||||||
LexHTML.obj \
|
LexHTML.obj \
|
||||||
|
LexLisp.obj \
|
||||||
LexLua.obj \
|
LexLua.obj \
|
||||||
LexOthers.obj \
|
LexOthers.obj \
|
||||||
|
LexPascal.obj \
|
||||||
LexPerl.obj \
|
LexPerl.obj \
|
||||||
LexPython.obj \
|
LexPython.obj \
|
||||||
|
LexRuby.obj \
|
||||||
LexSQL.obj \
|
LexSQL.obj \
|
||||||
LexVB.obj \
|
LexVB.obj \
|
||||||
LineMarker.obj \
|
LineMarker.obj \
|
||||||
PosRegExp.obj \
|
|
||||||
PropSet.obj \
|
PropSet.obj \
|
||||||
|
RESearch.obj \
|
||||||
ScintillaBase.obj \
|
ScintillaBase.obj \
|
||||||
Style.obj \
|
Style.obj \
|
||||||
|
StyleContext.obj \
|
||||||
UniConversion.obj \
|
UniConversion.obj \
|
||||||
ViewStyle.obj \
|
ViewStyle.obj \
|
||||||
WindowAccessor.obj \
|
WindowAccessor.obj \
|
||||||
|
@@ -13,29 +13,39 @@ OBJECTS = \
|
|||||||
$(S)/AutoComplete.$(OBJSUFF) \
|
$(S)/AutoComplete.$(OBJSUFF) \
|
||||||
$(S)/CallTip.$(OBJSUFF) \
|
$(S)/CallTip.$(OBJSUFF) \
|
||||||
$(S)/CellBuffer.$(OBJSUFF) \
|
$(S)/CellBuffer.$(OBJSUFF) \
|
||||||
$(S)/ContractionState.$(OBJSUFF)\
|
$(S)/ContractionState.$(OBJSUFF) \
|
||||||
$(S)/Document.$(OBJSUFF) \
|
$(S)/Document.$(OBJSUFF) \
|
||||||
|
$(S)/DocumentAccessor.$(OBJSUFF) \
|
||||||
$(S)/Editor.$(OBJSUFF) \
|
$(S)/Editor.$(OBJSUFF) \
|
||||||
$(S)/Indicator.$(OBJSUFF) \
|
$(S)/Indicator.$(OBJSUFF) \
|
||||||
$(S)/KeyMap.$(OBJSUFF) \
|
$(S)/KeyMap.$(OBJSUFF) \
|
||||||
$(S)/KeyWords.$(OBJSUFF) \
|
$(S)/KeyWords.$(OBJSUFF) \
|
||||||
$(S)/LineMarker.$(OBJSUFF) \
|
$(S)/LexAVE.$(OBJSUFF) \
|
||||||
$(S)/PropSet.$(OBJSUFF) \
|
$(S)/LexAda.$(OBJSUFF) \
|
||||||
$(S)/ScintillaBase.$(OBJSUFF) \
|
|
||||||
$(S)/Style.$(OBJSUFF) \
|
|
||||||
$(S)/ViewStyle.$(OBJSUFF) \
|
|
||||||
$(S)/LexCPP.$(OBJSUFF) \
|
$(S)/LexCPP.$(OBJSUFF) \
|
||||||
|
$(S)/LexConf.$(OBJSUFF) \
|
||||||
|
$(S)/LexCrontab.$(OBJSUFF) \
|
||||||
|
$(S)/LexEiffel.$(OBJSUFF) \
|
||||||
$(S)/LexHTML.$(OBJSUFF) \
|
$(S)/LexHTML.$(OBJSUFF) \
|
||||||
|
$(S)/LexLisp.$(OBJSUFF) \
|
||||||
$(S)/LexLua.$(OBJSUFF) \
|
$(S)/LexLua.$(OBJSUFF) \
|
||||||
$(S)/LexOthers.$(OBJSUFF) \
|
$(S)/LexOthers.$(OBJSUFF) \
|
||||||
|
$(S)/LexPascal.$(OBJSUFF) \
|
||||||
$(S)/LexPerl.$(OBJSUFF) \
|
$(S)/LexPerl.$(OBJSUFF) \
|
||||||
$(S)/LexPython.$(OBJSUFF) \
|
$(S)/LexPython.$(OBJSUFF) \
|
||||||
|
$(S)/LexRuby.$(OBJSUFF) \
|
||||||
$(S)/LexSQL.$(OBJSUFF) \
|
$(S)/LexSQL.$(OBJSUFF) \
|
||||||
$(S)/LexVB.$(OBJSUFF) \
|
$(S)/LexVB.$(OBJSUFF) \
|
||||||
$(S)/DocumentAccessor.$(OBJSUFF)\
|
$(S)/LineMarker.$(OBJSUFF) \
|
||||||
|
$(S)/PropSet.$(OBJSUFF) \
|
||||||
|
$(S)/RESearch.$(OBJSUFF) \
|
||||||
|
$(S)/ScintillaBase.$(OBJSUFF) \
|
||||||
|
$(S)/Style.$(OBJSUFF) \
|
||||||
|
$(S)/StyleContext.$(OBJSUFF) \
|
||||||
$(S)/UniConversion.$(OBJSUFF) \
|
$(S)/UniConversion.$(OBJSUFF) \
|
||||||
|
$(S)/ViewStyle.$(OBJSUFF) \
|
||||||
$(S)/WindowAccessor.$(OBJSUFF) \
|
$(S)/WindowAccessor.$(OBJSUFF) \
|
||||||
$(S)/PosRegExp.$(OBJSUFF) \
|
\
|
||||||
PlatWX.$(OBJSUFF) \
|
PlatWX.$(OBJSUFF) \
|
||||||
ScintillaWX.$(OBJSUFF) \
|
ScintillaWX.$(OBJSUFF) \
|
||||||
stc.$(OBJSUFF)
|
stc.$(OBJSUFF)
|
||||||
|
@@ -18,26 +18,18 @@ OBJECTS = \
|
|||||||
$(D)\AutoComplete.obj \
|
$(D)\AutoComplete.obj \
|
||||||
$(D)\CallTip.obj \
|
$(D)\CallTip.obj \
|
||||||
$(D)\CellBuffer.obj \
|
$(D)\CellBuffer.obj \
|
||||||
$(D)\ContractionState.obj\
|
$(D)\ContractionState.obj \
|
||||||
$(D)\Document.obj \
|
$(D)\Document.obj \
|
||||||
$(D)\DocumentAccessor.obj\
|
$(D)\DocumentAccessor.obj \
|
||||||
$(D)\Editor.obj \
|
$(D)\Editor.obj \
|
||||||
$(D)\Indicator.obj \
|
$(D)\Indicator.obj \
|
||||||
$(D)\KeyMap.obj \
|
$(D)\KeyMap.obj \
|
||||||
$(D)\KeyWords.obj \
|
$(D)\KeyWords.obj \
|
||||||
$(D)\LineMarker.obj \
|
|
||||||
$(D)\PropSet.obj \
|
|
||||||
$(D)\RESearch.obj \
|
|
||||||
$(D)\ScintillaBase.obj \
|
|
||||||
$(D)\Style.obj \
|
|
||||||
$(D)\UniConversion.obj \
|
|
||||||
$(D)\ViewStyle.obj \
|
|
||||||
$(D)\WindowAccessor.obj \
|
|
||||||
\
|
|
||||||
$(D)\LexAda.obj \
|
|
||||||
$(D)\LexAVE.obj \
|
$(D)\LexAVE.obj \
|
||||||
$(D)\LexConf.obj \
|
$(D)\LexAda.obj \
|
||||||
$(D)\LexCPP.obj \
|
$(D)\LexCPP.obj \
|
||||||
|
$(D)\LexConf.obj \
|
||||||
|
$(D)\LexCrontab.obj \
|
||||||
$(D)\LexEiffel.obj \
|
$(D)\LexEiffel.obj \
|
||||||
$(D)\LexHTML.obj \
|
$(D)\LexHTML.obj \
|
||||||
$(D)\LexLisp.obj \
|
$(D)\LexLisp.obj \
|
||||||
@@ -49,6 +41,15 @@ OBJECTS = \
|
|||||||
$(D)\LexRuby.obj \
|
$(D)\LexRuby.obj \
|
||||||
$(D)\LexSQL.obj \
|
$(D)\LexSQL.obj \
|
||||||
$(D)\LexVB.obj \
|
$(D)\LexVB.obj \
|
||||||
|
$(D)\LineMarker.obj \
|
||||||
|
$(D)\PropSet.obj \
|
||||||
|
$(D)\RESearch.obj \
|
||||||
|
$(D)\ScintillaBase.obj \
|
||||||
|
$(D)\Style.obj \
|
||||||
|
$(D)\StyleContext.obj \
|
||||||
|
$(D)\UniConversion.obj \
|
||||||
|
$(D)\ViewStyle.obj \
|
||||||
|
$(D)\WindowAccessor.obj \
|
||||||
\
|
\
|
||||||
$(D)\PlatWX.obj \
|
$(D)\PlatWX.obj \
|
||||||
$(D)\ScintillaWX.obj \
|
$(D)\ScintillaWX.obj \
|
||||||
|
@@ -3,5 +3,5 @@ scintilla/include directories from the Scintilla/SCiTE source
|
|||||||
distribution. All other code needed to implement Scintilla on top of
|
distribution. All other code needed to implement Scintilla on top of
|
||||||
wxWindows is located in the directory above this one.
|
wxWindows is located in the directory above this one.
|
||||||
|
|
||||||
The current version of the Scintilla code is 1.39
|
The current version of the Scintilla code is 1.40
|
||||||
|
|
||||||
|
@@ -40,6 +40,7 @@
|
|||||||
#define SCLEX_EIFFEL 23
|
#define SCLEX_EIFFEL 23
|
||||||
#define SCLEX_EIFFELKW 24
|
#define SCLEX_EIFFELKW 24
|
||||||
#define SCLEX_TCL 25
|
#define SCLEX_TCL 25
|
||||||
|
#define SCLEX_NNCRONTAB 26
|
||||||
#define SCLEX_AUTOMATIC 1000
|
#define SCLEX_AUTOMATIC 1000
|
||||||
#define SCE_P_DEFAULT 0
|
#define SCE_P_DEFAULT 0
|
||||||
#define SCE_P_COMMENTLINE 1
|
#define SCE_P_COMMENTLINE 1
|
||||||
@@ -72,6 +73,8 @@
|
|||||||
#define SCE_C_REGEX 14
|
#define SCE_C_REGEX 14
|
||||||
#define SCE_C_COMMENTLINEDOC 15
|
#define SCE_C_COMMENTLINEDOC 15
|
||||||
#define SCE_C_WORD2 16
|
#define SCE_C_WORD2 16
|
||||||
|
#define SCE_C_COMMENTDOCKEYWORD 17
|
||||||
|
#define SCE_C_COMMENTDOCKEYWORDERROR 18
|
||||||
#define SCE_H_DEFAULT 0
|
#define SCE_H_DEFAULT 0
|
||||||
#define SCE_H_TAG 1
|
#define SCE_H_TAG 1
|
||||||
#define SCE_H_TAGUNKNOWN 2
|
#define SCE_H_TAGUNKNOWN 2
|
||||||
@@ -93,7 +96,17 @@
|
|||||||
#define SCE_H_QUESTION 18
|
#define SCE_H_QUESTION 18
|
||||||
#define SCE_H_VALUE 19
|
#define SCE_H_VALUE 19
|
||||||
#define SCE_H_XCCOMMENT 20
|
#define SCE_H_XCCOMMENT 20
|
||||||
#define SCE_H_SGML 21
|
#define SCE_H_SGML_DEFAULT 21
|
||||||
|
#define SCE_H_SGML_COMMAND 22
|
||||||
|
#define SCE_H_SGML_1ST_PARAM 23
|
||||||
|
#define SCE_H_SGML_DOUBLESTRING 24
|
||||||
|
#define SCE_H_SGML_SIMPLESTRING 25
|
||||||
|
#define SCE_H_SGML_ERROR 26
|
||||||
|
#define SCE_H_SGML_SPECIAL 27
|
||||||
|
#define SCE_H_SGML_ENTITY 28
|
||||||
|
#define SCE_H_SGML_COMMENT 29
|
||||||
|
#define SCE_H_SGML_1ST_PARAM_COMMENT 30
|
||||||
|
#define SCE_H_SGML_BLOCK_DEFAULT 31
|
||||||
#define SCE_HJ_START 40
|
#define SCE_HJ_START 40
|
||||||
#define SCE_HJ_DEFAULT 41
|
#define SCE_HJ_DEFAULT 41
|
||||||
#define SCE_HJ_COMMENT 42
|
#define SCE_HJ_COMMENT 42
|
||||||
@@ -295,6 +308,17 @@
|
|||||||
#define SCE_EIFFEL_OPERATOR 6
|
#define SCE_EIFFEL_OPERATOR 6
|
||||||
#define SCE_EIFFEL_IDENTIFIER 7
|
#define SCE_EIFFEL_IDENTIFIER 7
|
||||||
#define SCE_EIFFEL_STRINGEOL 8
|
#define SCE_EIFFEL_STRINGEOL 8
|
||||||
|
#define SCE_NNCRONTAB_DEFAULT 0
|
||||||
|
#define SCE_NNCRONTAB_COMMENT 1
|
||||||
|
#define SCE_NNCRONTAB_TASK 2
|
||||||
|
#define SCE_NNCRONTAB_SECTION 3
|
||||||
|
#define SCE_NNCRONTAB_KEYWORD 4
|
||||||
|
#define SCE_NNCRONTAB_MODIFIER 5
|
||||||
|
#define SCE_NNCRONTAB_ASTERISK 6
|
||||||
|
#define SCE_NNCRONTAB_NUMBER 7
|
||||||
|
#define SCE_NNCRONTAB_STRING 8
|
||||||
|
#define SCE_NNCRONTAB_ENVIRONMENT 9
|
||||||
|
#define SCE_NNCRONTAB_IDENTIFIER 10
|
||||||
//--Autogenerated -- end of section automatically generated from Scintilla.iface
|
//--Autogenerated -- end of section automatically generated from Scintilla.iface
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@@ -11,9 +11,6 @@
|
|||||||
#ifndef SCINTILLA_H
|
#ifndef SCINTILLA_H
|
||||||
#define SCINTILLA_H
|
#define SCINTILLA_H
|
||||||
|
|
||||||
// Compile-time configuration options
|
|
||||||
#define MACRO_SUPPORT 1 // Comment out to remove macro hooks
|
|
||||||
|
|
||||||
#if PLAT_WIN
|
#if PLAT_WIN
|
||||||
#ifdef STATIC_BUILD
|
#ifdef STATIC_BUILD
|
||||||
void Scintilla_RegisterClasses(HINSTANCE hInstance);
|
void Scintilla_RegisterClasses(HINSTANCE hInstance);
|
||||||
@@ -102,6 +99,7 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,
|
|||||||
#define SC_MARK_CIRCLEPLUSCONNECTED 19
|
#define SC_MARK_CIRCLEPLUSCONNECTED 19
|
||||||
#define SC_MARK_CIRCLEMINUS 20
|
#define SC_MARK_CIRCLEMINUS 20
|
||||||
#define SC_MARK_CIRCLEMINUSCONNECTED 21
|
#define SC_MARK_CIRCLEMINUSCONNECTED 21
|
||||||
|
#define SC_MARK_CHARACTER 10000
|
||||||
#define SC_MARKNUM_FOLDEREND 25
|
#define SC_MARKNUM_FOLDEREND 25
|
||||||
#define SC_MARKNUM_FOLDEROPENMID 26
|
#define SC_MARKNUM_FOLDEROPENMID 26
|
||||||
#define SC_MARKNUM_FOLDERMIDTAIL 27
|
#define SC_MARKNUM_FOLDERMIDTAIL 27
|
||||||
@@ -134,6 +132,7 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,
|
|||||||
#define STYLE_BRACEBAD 35
|
#define STYLE_BRACEBAD 35
|
||||||
#define STYLE_CONTROLCHAR 36
|
#define STYLE_CONTROLCHAR 36
|
||||||
#define STYLE_INDENTGUIDE 37
|
#define STYLE_INDENTGUIDE 37
|
||||||
|
#define STYLE_LASTPREDEFINED 39
|
||||||
#define STYLE_MAX 127
|
#define STYLE_MAX 127
|
||||||
#define SC_CHARSET_ANSI 0
|
#define SC_CHARSET_ANSI 0
|
||||||
#define SC_CHARSET_DEFAULT 1
|
#define SC_CHARSET_DEFAULT 1
|
||||||
@@ -507,12 +506,6 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,
|
|||||||
#define SCN_DWELLEND 2017
|
#define SCN_DWELLEND 2017
|
||||||
//--Autogenerated -- end of section automatically generated from Scintilla.iface
|
//--Autogenerated -- end of section automatically generated from Scintilla.iface
|
||||||
|
|
||||||
// Optional module for macro recording
|
|
||||||
#ifdef MACRO_SUPPORT
|
|
||||||
typedef void (tMacroRecorder)(unsigned int iMessage, unsigned long wParam,
|
|
||||||
long lParam, void *userData);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// These structures are defined to be exactly the same shape as the Win32
|
// These structures are defined to be exactly the same shape as the Win32
|
||||||
// CHARRANGE, TEXTRANGE, FINDTEXTEX, FORMATRANGE, and NMHDR structs.
|
// CHARRANGE, TEXTRANGE, FINDTEXTEX, FORMATRANGE, and NMHDR structs.
|
||||||
// So older code that treats Scintilla as a RichEdit will work.
|
// So older code that treats Scintilla as a RichEdit will work.
|
||||||
@@ -566,11 +559,9 @@ struct SCNotification {
|
|||||||
const char *text; // SCN_MODIFIED
|
const char *text; // SCN_MODIFIED
|
||||||
int length; // SCN_MODIFIED
|
int length; // SCN_MODIFIED
|
||||||
int linesAdded; // SCN_MODIFIED
|
int linesAdded; // SCN_MODIFIED
|
||||||
#ifdef MACRO_SUPPORT
|
|
||||||
int message; // SCN_MACRORECORD
|
int message; // SCN_MACRORECORD
|
||||||
uptr_t wParam; // SCN_MACRORECORD
|
uptr_t wParam; // SCN_MACRORECORD
|
||||||
sptr_t lParam; // SCN_MACRORECORD
|
sptr_t lParam; // SCN_MACRORECORD
|
||||||
#endif
|
|
||||||
int line; // SCN_MODIFIED
|
int line; // SCN_MODIFIED
|
||||||
int foldLevelNow; // SCN_MODIFIED
|
int foldLevelNow; // SCN_MODIFIED
|
||||||
int foldLevelPrev; // SCN_MODIFIED
|
int foldLevelPrev; // SCN_MODIFIED
|
||||||
|
@@ -229,6 +229,8 @@ val SC_MARK_CIRCLEPLUSCONNECTED=19
|
|||||||
val SC_MARK_CIRCLEMINUS=20
|
val SC_MARK_CIRCLEMINUS=20
|
||||||
val SC_MARK_CIRCLEMINUSCONNECTED=21
|
val SC_MARK_CIRCLEMINUSCONNECTED=21
|
||||||
|
|
||||||
|
val SC_MARK_CHARACTER=10000
|
||||||
|
|
||||||
# Markers used for outlining column
|
# Markers used for outlining column
|
||||||
val SC_MARKNUM_FOLDEREND=25
|
val SC_MARKNUM_FOLDEREND=25
|
||||||
val SC_MARKNUM_FOLDEROPENMID=26
|
val SC_MARKNUM_FOLDEROPENMID=26
|
||||||
@@ -292,12 +294,15 @@ set void SetMarginSensitiveN=2246(int margin, bool sensitive)
|
|||||||
# Retrieve the mouse click sensitivity of a margin.
|
# Retrieve the mouse click sensitivity of a margin.
|
||||||
get bool GetMarginSensitiveN=2247(int margin,)
|
get bool GetMarginSensitiveN=2247(int margin,)
|
||||||
|
|
||||||
|
# Styles in range 32..37 are predefined for parts of the UI and are not used as normal styles.
|
||||||
|
# Styles 38 and 39 are for future use.
|
||||||
val STYLE_DEFAULT=32
|
val STYLE_DEFAULT=32
|
||||||
val STYLE_LINENUMBER=33
|
val STYLE_LINENUMBER=33
|
||||||
val STYLE_BRACELIGHT=34
|
val STYLE_BRACELIGHT=34
|
||||||
val STYLE_BRACEBAD=35
|
val STYLE_BRACEBAD=35
|
||||||
val STYLE_CONTROLCHAR=36
|
val STYLE_CONTROLCHAR=36
|
||||||
val STYLE_INDENTGUIDE=37
|
val STYLE_INDENTGUIDE=37
|
||||||
|
val STYLE_LASTPREDEFINED=39
|
||||||
val STYLE_MAX=127
|
val STYLE_MAX=127
|
||||||
|
|
||||||
# Character set identifiers are used in StyleSetCharacterSet.
|
# Character set identifiers are used in StyleSetCharacterSet.
|
||||||
@@ -759,10 +764,12 @@ set void SetTargetEnd=2192(position pos,)
|
|||||||
get position GetTargetEnd=2193(,)
|
get position GetTargetEnd=2193(,)
|
||||||
|
|
||||||
# Replace the target text with the argument text.
|
# Replace the target text with the argument text.
|
||||||
|
# Text is counted so it can contain nulls.
|
||||||
# Returns the length of the replacement text.
|
# Returns the length of the replacement text.
|
||||||
fun int ReplaceTarget=2194(int length, string text)
|
fun int ReplaceTarget=2194(int length, string text)
|
||||||
|
|
||||||
# Replace the target text with the argument text after \d processing.
|
# Replace the target text with the argument text after \d processing.
|
||||||
|
# Text is counted so it can contain nulls.
|
||||||
# Looks for \d where d is between 1 and 9 and replaces these with the strings
|
# Looks for \d where d is between 1 and 9 and replaces these with the strings
|
||||||
# matched in the last search operation which were surrounded by \( and \).
|
# matched in the last search operation which were surrounded by \( and \).
|
||||||
# Returns the length of the replacement text including any change
|
# Returns the length of the replacement text including any change
|
||||||
@@ -770,7 +777,7 @@ fun int ReplaceTarget=2194(int length, string text)
|
|||||||
fun int ReplaceTargetRE=2195(int length, string text)
|
fun int ReplaceTargetRE=2195(int length, string text)
|
||||||
|
|
||||||
# Search for a counted string in the target and set the target to the found
|
# Search for a counted string in the target and set the target to the found
|
||||||
# range.
|
# range. Text is counted so it can contain nulls.
|
||||||
# Returns length of range or -1 for failure in which case target is not moved.
|
# Returns length of range or -1 for failure in which case target is not moved.
|
||||||
fun int SearchInTarget=2197(int length, string text)
|
fun int SearchInTarget=2197(int length, string text)
|
||||||
|
|
||||||
@@ -1265,6 +1272,7 @@ val SCLEX_RUBY=22
|
|||||||
val SCLEX_EIFFEL=23
|
val SCLEX_EIFFEL=23
|
||||||
val SCLEX_EIFFELKW=24
|
val SCLEX_EIFFELKW=24
|
||||||
val SCLEX_TCL=25
|
val SCLEX_TCL=25
|
||||||
|
val SCLEX_NNCRONTAB=26
|
||||||
# When a lexer specifies its language as SCLEX_AUTOMATIC it receives a
|
# When a lexer specifies its language as SCLEX_AUTOMATIC it receives a
|
||||||
# value assigned in sequence from SCLEX_AUTOMATIC+1.
|
# value assigned in sequence from SCLEX_AUTOMATIC+1.
|
||||||
val SCLEX_AUTOMATIC=1000
|
val SCLEX_AUTOMATIC=1000
|
||||||
@@ -1301,6 +1309,8 @@ val SCE_C_VERBATIM=13
|
|||||||
val SCE_C_REGEX=14
|
val SCE_C_REGEX=14
|
||||||
val SCE_C_COMMENTLINEDOC=15
|
val SCE_C_COMMENTLINEDOC=15
|
||||||
val SCE_C_WORD2=16
|
val SCE_C_WORD2=16
|
||||||
|
val SCE_C_COMMENTDOCKEYWORD=17
|
||||||
|
val SCE_C_COMMENTDOCKEYWORDERROR=18
|
||||||
# Lexical states for SCLEX_HTML, SCLEX_XML
|
# Lexical states for SCLEX_HTML, SCLEX_XML
|
||||||
val SCE_H_DEFAULT=0
|
val SCE_H_DEFAULT=0
|
||||||
val SCE_H_TAG=1
|
val SCE_H_TAG=1
|
||||||
@@ -1327,7 +1337,17 @@ val SCE_H_VALUE=19
|
|||||||
# X-Code
|
# X-Code
|
||||||
val SCE_H_XCCOMMENT=20
|
val SCE_H_XCCOMMENT=20
|
||||||
# SGML
|
# SGML
|
||||||
val SCE_H_SGML=21
|
val SCE_H_SGML_DEFAULT=21
|
||||||
|
val SCE_H_SGML_COMMAND=22
|
||||||
|
val SCE_H_SGML_1ST_PARAM=23
|
||||||
|
val SCE_H_SGML_DOUBLESTRING=24
|
||||||
|
val SCE_H_SGML_SIMPLESTRING=25
|
||||||
|
val SCE_H_SGML_ERROR=26
|
||||||
|
val SCE_H_SGML_SPECIAL=27
|
||||||
|
val SCE_H_SGML_ENTITY=28
|
||||||
|
val SCE_H_SGML_COMMENT=29
|
||||||
|
val SCE_H_SGML_1ST_PARAM_COMMENT=30
|
||||||
|
val SCE_H_SGML_BLOCK_DEFAULT=31
|
||||||
# Embedded Javascript
|
# Embedded Javascript
|
||||||
val SCE_HJ_START=40
|
val SCE_HJ_START=40
|
||||||
val SCE_HJ_DEFAULT=41
|
val SCE_HJ_DEFAULT=41
|
||||||
@@ -1547,6 +1567,18 @@ val SCE_EIFFEL_CHARACTER=5
|
|||||||
val SCE_EIFFEL_OPERATOR=6
|
val SCE_EIFFEL_OPERATOR=6
|
||||||
val SCE_EIFFEL_IDENTIFIER=7
|
val SCE_EIFFEL_IDENTIFIER=7
|
||||||
val SCE_EIFFEL_STRINGEOL=8
|
val SCE_EIFFEL_STRINGEOL=8
|
||||||
|
# Lexical states for the SCLEX_NNCRONTAB (nnCron crontab Lexer)
|
||||||
|
val SCE_NNCRONTAB_DEFAULT=0
|
||||||
|
val SCE_NNCRONTAB_COMMENT=1
|
||||||
|
val SCE_NNCRONTAB_TASK=2
|
||||||
|
val SCE_NNCRONTAB_SECTION=3
|
||||||
|
val SCE_NNCRONTAB_KEYWORD=4
|
||||||
|
val SCE_NNCRONTAB_MODIFIER=5
|
||||||
|
val SCE_NNCRONTAB_ASTERISK=6
|
||||||
|
val SCE_NNCRONTAB_NUMBER=7
|
||||||
|
val SCE_NNCRONTAB_STRING=8
|
||||||
|
val SCE_NNCRONTAB_ENVIRONMENT=9
|
||||||
|
val SCE_NNCRONTAB_IDENTIFIER=10
|
||||||
|
|
||||||
# Events
|
# Events
|
||||||
|
|
||||||
@@ -1574,171 +1606,3 @@ evt void DwellStart=2016(int position)
|
|||||||
evt void DwellEnd=2017(int position)
|
evt void DwellEnd=2017(int position)
|
||||||
|
|
||||||
cat Deprecated
|
cat Deprecated
|
||||||
|
|
||||||
val SCFIND_DOWN=1
|
|
||||||
|
|
||||||
################################################
|
|
||||||
# From WinDefs.h
|
|
||||||
|
|
||||||
# ***** DEPRECATED from here to end of file ******
|
|
||||||
|
|
||||||
# Will a paste succeed?
|
|
||||||
fun bool EM_CanPaste=1074(,)
|
|
||||||
|
|
||||||
# Are there any undoable actions in the undo history.
|
|
||||||
fun bool EM_CanUndo=198(,)
|
|
||||||
|
|
||||||
# Find the position and line from a point within the window.
|
|
||||||
fun int EM_CharFromPos=215(,point pt)
|
|
||||||
|
|
||||||
# Delete the undo history.
|
|
||||||
fun void EM_EmptyUndoBuffer=205(,)
|
|
||||||
|
|
||||||
# Retrieve the selection range.
|
|
||||||
fun void EM_ExGetSel=1076(,charrangeresult cr)
|
|
||||||
|
|
||||||
# Retrieve the line number of a position in the document.
|
|
||||||
get int EM_ExLineFromChar=1078(,position pos)
|
|
||||||
|
|
||||||
# Select a range of text.
|
|
||||||
fun void EM_ExSetSel=1079(,charrange cr)
|
|
||||||
|
|
||||||
# Find some text in the document.
|
|
||||||
fun position EM_FindText=1080(int flags, findtext ft)
|
|
||||||
|
|
||||||
# Find some text in the document. Returns range of found text in ft argument.
|
|
||||||
fun position EM_FindTextEx=1103(int flags, findtextex ft)
|
|
||||||
|
|
||||||
# On Windows will draw the document into a display context such as a printer.
|
|
||||||
fun void EM_FormatRange=1081(bool draw, formatrange fr)
|
|
||||||
|
|
||||||
# Retrieve the line at the top of the display.
|
|
||||||
get int EM_GetFirstVisibleLine=206(,)
|
|
||||||
|
|
||||||
# Retrieve the contents of a line.
|
|
||||||
# Returns the length of the line.
|
|
||||||
fun int EM_GetLine=196(int line, countedstring text)
|
|
||||||
|
|
||||||
# Returns the number of lines in the document. There is always at least one.
|
|
||||||
fun int EM_GetLineCount=186(,)
|
|
||||||
|
|
||||||
# Returns the size in pixels of left and right margins packed into one integer.
|
|
||||||
# The left margin is in the low half and the right margin in the high half.
|
|
||||||
fun int EM_GetMargins=212(,)
|
|
||||||
|
|
||||||
# Is the document different from when it was last saved?
|
|
||||||
get bool EM_GetModify=184(,)
|
|
||||||
|
|
||||||
# Get the area used to display the document.
|
|
||||||
fun void EM_GetRect=178(,rectangle r)
|
|
||||||
|
|
||||||
# Return the selection packed into one integer with the start of the selection
|
|
||||||
# in the low half and the end in the high half.
|
|
||||||
fun int EM_GetSel=176(,)
|
|
||||||
|
|
||||||
# Retrieve the selected text.
|
|
||||||
# Return the length of the text.
|
|
||||||
fun int EM_GetSelText=1086(,stringresult text)
|
|
||||||
|
|
||||||
# Retrieve a range of text.
|
|
||||||
# Return the length of the text.
|
|
||||||
fun int EM_GetTextRange=1099(, textrange tr)
|
|
||||||
|
|
||||||
# Draw the selection in normal style or with selection highlighted.
|
|
||||||
fun void EM_HideSelection=1087(bool normal,)
|
|
||||||
|
|
||||||
# Retrieve the line of a position.
|
|
||||||
fun int EM_LineFromChar=201(position pos,)
|
|
||||||
|
|
||||||
# Retrieve the position at the start of a line.
|
|
||||||
fun position EM_LineIndex=187(int line,)
|
|
||||||
|
|
||||||
# Retrieve the number of characters on a line not including end of line characters.
|
|
||||||
fun int EM_LineLength=193(int line,)
|
|
||||||
|
|
||||||
# Scroll horizontally and vertically.
|
|
||||||
fun void EM_LineScroll=182(int columns, int lines)
|
|
||||||
|
|
||||||
# Retrieve the point in the window where a position is displayed.
|
|
||||||
fun void EM_PosFromChar=214(pointresult pt, position pos)
|
|
||||||
|
|
||||||
# Replace the selected text with the argument text.
|
|
||||||
fun void EM_ReplaceSel=194(, string text)
|
|
||||||
|
|
||||||
# Ensure the caret is visible.
|
|
||||||
fun void EM_ScrollCaret=183(,)
|
|
||||||
|
|
||||||
# Returns SEL_EMPTY if selection contains no characters, otherwise SEL_TEXT.
|
|
||||||
fun void EM_SelectionType=1090(,)
|
|
||||||
|
|
||||||
# Set the width of the left and right margins
|
|
||||||
fun void EM_SetMargins=211(int flags, int values)
|
|
||||||
|
|
||||||
# Set to read only or read write.
|
|
||||||
set void EM_SetReadOnly=207(bool readOnly,)
|
|
||||||
|
|
||||||
# Select the range of text from start to end.
|
|
||||||
fun void EM_SetSel=177(position start, position end)
|
|
||||||
|
|
||||||
# Undo one action in the undo history.
|
|
||||||
fun void EM_Undo=199(,)
|
|
||||||
|
|
||||||
# Null operation.
|
|
||||||
fun void WM_Null=0(,)
|
|
||||||
|
|
||||||
# Clear the selection.
|
|
||||||
fun void WM_Clear=771(,)
|
|
||||||
|
|
||||||
fun void WM_Command=273(,)
|
|
||||||
|
|
||||||
# Copy the selection to the clipboard.
|
|
||||||
fun void WM_Copy=769(,)
|
|
||||||
|
|
||||||
# Cut the selection to the clipboard.
|
|
||||||
fun void WM_Cut=768(,)
|
|
||||||
|
|
||||||
# Retrieve all the text in the document.
|
|
||||||
# Returns number of characters retrieved.
|
|
||||||
fun int WM_GetText=13(int length, stringresult text)
|
|
||||||
|
|
||||||
# Retrieve the number of characters in the document.
|
|
||||||
fun int WM_GetTextLength=14(,)
|
|
||||||
|
|
||||||
# Notification back to container
|
|
||||||
fun void WM_Notify=78(int id, int stuff)
|
|
||||||
|
|
||||||
# Paste the contents of the clipboard into the document replacing the selection.
|
|
||||||
fun void WM_Paste=770(,)
|
|
||||||
|
|
||||||
# Replace the contents of the document with the argument text.
|
|
||||||
fun void WM_SetText=12(, string text)
|
|
||||||
|
|
||||||
# Undo one action in the undo history.
|
|
||||||
fun void WM_Undo=772(,)
|
|
||||||
|
|
||||||
# Notification codes
|
|
||||||
val EN_CHANGE=768
|
|
||||||
val EN_KILLFOCUS=512
|
|
||||||
val EN_SETFOCUS=256
|
|
||||||
|
|
||||||
# Flags for setting margins.
|
|
||||||
val EC_LEFTMARGIN=1
|
|
||||||
val EC_RIGHTMARGIN=2
|
|
||||||
val EC_USEFONTINFO=0xffff
|
|
||||||
|
|
||||||
# Selection type.
|
|
||||||
val SEL_EMPTY=0
|
|
||||||
val SEL_TEXT=1
|
|
||||||
|
|
||||||
# Find replace mask constants
|
|
||||||
val FR_MATCHCASE=0x4
|
|
||||||
val FR_WHOLEWORD=0x2
|
|
||||||
val FR_DOWN=0x1
|
|
||||||
|
|
||||||
# Key modifier flag.
|
|
||||||
val SHIFT_PRESSED=1
|
|
||||||
val LEFT_CTRL_PRESSED=2
|
|
||||||
val LEFT_ALT_PRESSED=4
|
|
||||||
|
|
||||||
#events
|
|
||||||
evt void EN_Change=768(void)
|
|
||||||
|
@@ -11,17 +11,6 @@
|
|||||||
|
|
||||||
#if PLAT_GTK
|
#if PLAT_GTK
|
||||||
|
|
||||||
#ifndef SCINTILLA_H
|
|
||||||
#ifdef _MSC_VER
|
|
||||||
#pragma message(__FILE__ "(1) : warning : Scintilla.h should be included before ScintillaWidget.h")
|
|
||||||
#pragma message("This will be required in the next version of Scintilla")
|
|
||||||
#else
|
|
||||||
#warning Scintilla.h should be included before ScintillaWidget.h
|
|
||||||
#warning This will be required in the next version of Scintilla
|
|
||||||
#endif
|
|
||||||
#include "Scintilla.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
@@ -1,197 +0,0 @@
|
|||||||
// Scintilla source code edit control
|
|
||||||
/** @file WinDefs.h
|
|
||||||
** The subset of definitions from Windows needed by Scintilla for GTK+.
|
|
||||||
**/
|
|
||||||
// Copyright 1998-2001 by Neil Hodgson <neilh@scintilla.org>
|
|
||||||
// The License.txt file describes the conditions under which this software may be distributed.
|
|
||||||
|
|
||||||
#ifndef WINDEFS_H
|
|
||||||
#define WINDEFS_H
|
|
||||||
|
|
||||||
/* Running GTK version on win32 */
|
|
||||||
#if PLAT_GTK_WIN32
|
|
||||||
#include "Windows.h"
|
|
||||||
#include "Richedit.h"
|
|
||||||
|
|
||||||
/* Name conflicts */
|
|
||||||
#undef DrawText
|
|
||||||
#undef FindText
|
|
||||||
#else
|
|
||||||
|
|
||||||
#define WORD short
|
|
||||||
#define WPARAM unsigned long
|
|
||||||
#define LPARAM long
|
|
||||||
#define LRESULT long
|
|
||||||
#define DWORD long
|
|
||||||
|
|
||||||
#define UINT unsigned int
|
|
||||||
#define LPSTR char *
|
|
||||||
#define LONG long
|
|
||||||
|
|
||||||
//#if 0
|
|
||||||
/* RTF control */
|
|
||||||
#define EM_CANPASTE (1074)
|
|
||||||
#define EM_CANUNDO (198)
|
|
||||||
#define EM_CHARFROMPOS (215)
|
|
||||||
#define EM_EMPTYUNDOBUFFER (205)
|
|
||||||
#define EM_EXGETSEL (1076)
|
|
||||||
#define EM_EXLINEFROMCHAR (1078)
|
|
||||||
#define EM_EXSETSEL (1079)
|
|
||||||
#define EM_FINDTEXT (1080)
|
|
||||||
#define EM_FINDTEXTEX (1103)
|
|
||||||
#define EM_FORMATRANGE (1081)
|
|
||||||
#define EM_GETFIRSTVISIBLELINE (206)
|
|
||||||
#define EM_GETLINE (196)
|
|
||||||
#define EM_GETLINECOUNT (186)
|
|
||||||
#define EM_GETMARGINS (212)
|
|
||||||
#define EM_GETMODIFY (184)
|
|
||||||
#define EM_GETRECT (178)
|
|
||||||
#define EM_GETSEL (176)
|
|
||||||
#define EM_GETSELTEXT (1086)
|
|
||||||
#define EM_GETTEXTRANGE (1099)
|
|
||||||
#define EM_HIDESELECTION (1087)
|
|
||||||
#define EM_LINEFROMCHAR (201)
|
|
||||||
#define EM_LINEINDEX (187)
|
|
||||||
#define EM_LINELENGTH (193)
|
|
||||||
#define EM_LINESCROLL (182)
|
|
||||||
#define EM_POSFROMCHAR (214)
|
|
||||||
#define EM_REPLACESEL (194)
|
|
||||||
#define EM_SCROLLCARET (183)
|
|
||||||
#define EM_SELECTIONTYPE (1090)
|
|
||||||
#define EM_SETMARGINS (211)
|
|
||||||
#define EM_SETREADONLY (207)
|
|
||||||
#define EM_SETSEL (177)
|
|
||||||
#define EM_UNDO (199)
|
|
||||||
|
|
||||||
#define WM_NULL (0)
|
|
||||||
#define WM_CLEAR (771)
|
|
||||||
#define WM_COPY (769)
|
|
||||||
#define WM_CUT (768)
|
|
||||||
#define WM_GETTEXT (13)
|
|
||||||
#define WM_GETTEXTLENGTH (14)
|
|
||||||
#define WM_PASTE (770)
|
|
||||||
#define WM_SETTEXT (12)
|
|
||||||
#define WM_UNDO (772)
|
|
||||||
|
|
||||||
#define EN_CHANGE (768)
|
|
||||||
#define EN_KILLFOCUS (512)
|
|
||||||
#define EN_SETFOCUS (256)
|
|
||||||
|
|
||||||
#define EC_LEFTMARGIN 1
|
|
||||||
#define EC_RIGHTMARGIN 2
|
|
||||||
#define EC_USEFONTINFO 0xffff
|
|
||||||
|
|
||||||
//#endif
|
|
||||||
|
|
||||||
#if 0
|
|
||||||
#if PLAT_GTK
|
|
||||||
#define VK_DOWN GDK_Down
|
|
||||||
#define VK_UP GDK_Up
|
|
||||||
#define VK_LEFT GDK_Left
|
|
||||||
#define VK_RIGHT GDK_Right
|
|
||||||
#define VK_HOME GDK_Home
|
|
||||||
#define VK_END GDK_End
|
|
||||||
#define VK_PRIOR GDK_Page_Up
|
|
||||||
#define VK_NEXT GDK_Page_Down
|
|
||||||
#define VK_DELETE GDK_Delete
|
|
||||||
#define VK_INSERT GDK_Insert
|
|
||||||
#define VK_ESCAPE GDK_Escape
|
|
||||||
#define VK_BACK GDK_BackSpace
|
|
||||||
#define VK_TAB GDK_Tab
|
|
||||||
#define VK_RETURN GDK_Return
|
|
||||||
#define VK_ADD GDK_KP_Add
|
|
||||||
#define VK_SUBTRACT GDK_KP_Subtract
|
|
||||||
#define VK_DIVIDE GDK_KP_Divide
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if PLAT_WX
|
|
||||||
#define VK_DOWN WXK_DOWN
|
|
||||||
#define VK_UP WXK_UP
|
|
||||||
#define VK_LEFT WXK_LEFT
|
|
||||||
#define VK_RIGHT WXK_RIGHT
|
|
||||||
#define VK_HOME WXK_HOME
|
|
||||||
#define VK_END WXK_END
|
|
||||||
#define VK_PRIOR WXK_PRIOR
|
|
||||||
#define VK_NEXT WXK_NEXT
|
|
||||||
#define VK_DELETE WXK_DELETE
|
|
||||||
#define VK_INSERT WXK_INSERT
|
|
||||||
#define VK_ESCAPE WXK_ESCAPE
|
|
||||||
#define VK_BACK WXK_BACK
|
|
||||||
#define VK_TAB WXK_TAB
|
|
||||||
#define VK_RETURN WXK_RETURN
|
|
||||||
#define VK_ADD WXK_ADD
|
|
||||||
#define VK_SUBTRACT WXK_SUBTRACT
|
|
||||||
//TODO:
|
|
||||||
#define VK_DIVIDE WXK_DIVIDE
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define SHIFT_PRESSED 1
|
|
||||||
#define LEFT_CTRL_PRESSED 2
|
|
||||||
#define LEFT_ALT_PRESSED 4
|
|
||||||
|
|
||||||
// Are these needed any more
|
|
||||||
#define LPSTR char *
|
|
||||||
#define LONG long
|
|
||||||
#define LPDWORD (long *)
|
|
||||||
|
|
||||||
/* SELCHANGE structure */
|
|
||||||
#define SEL_EMPTY (0)
|
|
||||||
#define SEL_TEXT (1)
|
|
||||||
#define SEL_OBJECT (2)
|
|
||||||
#define SEL_MULTICHAR (4)
|
|
||||||
#define SEL_MULTIOBJECT (8)
|
|
||||||
|
|
||||||
struct RECT {
|
|
||||||
LONG left;
|
|
||||||
LONG top;
|
|
||||||
LONG right;
|
|
||||||
LONG bottom;
|
|
||||||
};
|
|
||||||
|
|
||||||
/* FINDREPLACE structure */
|
|
||||||
|
|
||||||
#define FR_MATCHCASE (0x4)
|
|
||||||
#define FR_WHOLEWORD (0x2)
|
|
||||||
#define FR_DOWN (0x1)
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if 0
|
|
||||||
struct CHARRANGE {
|
|
||||||
LONG cpMin;
|
|
||||||
LONG cpMax;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct TEXTRANGE {
|
|
||||||
CHARRANGE chrg;
|
|
||||||
LPSTR lpstrText;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct FINDTEXTEX {
|
|
||||||
CHARRANGE chrg;
|
|
||||||
LPSTR lpstrText;
|
|
||||||
CHARRANGE chrgText;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct NMHDR {
|
|
||||||
WindowID hwndFrom;
|
|
||||||
UINT idFrom;
|
|
||||||
UINT code;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct FORMATRANGE {
|
|
||||||
SurfaceID hdc;
|
|
||||||
SurfaceID hdcTarget;
|
|
||||||
RECT rc;
|
|
||||||
RECT rcPage;
|
|
||||||
CHARRANGE chrg;
|
|
||||||
};
|
|
||||||
#endif
|
|
||||||
|
|
||||||
//#define MAKELONG(a, b) ((a) | ((b) << 16))
|
|
||||||
//#define LOWORD(x) (x & 0xffff)
|
|
||||||
//#define HIWORD(x) (x >> 16)
|
|
||||||
|
|
||||||
#endif /* !_MSC_VER */
|
|
||||||
|
|
||||||
#endif
|
|
@@ -357,8 +357,10 @@ void Document::ModifiedAt(int pos) {
|
|||||||
|
|
||||||
// Unlike Undo, Redo, and InsertStyledString, the pos argument is a cell number not a char number
|
// Unlike Undo, Redo, and InsertStyledString, the pos argument is a cell number not a char number
|
||||||
void Document::DeleteChars(int pos, int len) {
|
void Document::DeleteChars(int pos, int len) {
|
||||||
|
if (len == 0)
|
||||||
|
return;
|
||||||
if ((pos + len) > Length())
|
if ((pos + len) > Length())
|
||||||
return ;
|
return;
|
||||||
if (cb.IsReadOnly() && enteredReadOnlyCount == 0) {
|
if (cb.IsReadOnly() && enteredReadOnlyCount == 0) {
|
||||||
enteredReadOnlyCount++;
|
enteredReadOnlyCount++;
|
||||||
NotifyModifyAttempt();
|
NotifyModifyAttempt();
|
||||||
|
@@ -14,10 +14,6 @@
|
|||||||
|
|
||||||
#include "Scintilla.h"
|
#include "Scintilla.h"
|
||||||
|
|
||||||
#if PLAT_WX || PLAT_GTK
|
|
||||||
#include "WinDefs.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "ContractionState.h"
|
#include "ContractionState.h"
|
||||||
#include "SVector.h"
|
#include "SVector.h"
|
||||||
#include "CellBuffer.h"
|
#include "CellBuffer.h"
|
||||||
@@ -58,7 +54,6 @@ Editor::Editor() {
|
|||||||
dwelling = false;
|
dwelling = false;
|
||||||
ptMouseLast.x = 0;
|
ptMouseLast.x = 0;
|
||||||
ptMouseLast.y = 0;
|
ptMouseLast.y = 0;
|
||||||
firstExpose = true;
|
|
||||||
inDragDrop = false;
|
inDragDrop = false;
|
||||||
dropWentOutside = false;
|
dropWentOutside = false;
|
||||||
posDrag = invalidPosition;
|
posDrag = invalidPosition;
|
||||||
@@ -69,9 +64,6 @@ Editor::Editor() {
|
|||||||
lineAnchor = 0;
|
lineAnchor = 0;
|
||||||
originalAnchorPos = 0;
|
originalAnchorPos = 0;
|
||||||
|
|
||||||
dragChars = 0;
|
|
||||||
lenDrag = 0;
|
|
||||||
dragIsRectangle = false;
|
|
||||||
selType = selStream;
|
selType = selStream;
|
||||||
xStartSelect = 0;
|
xStartSelect = 0;
|
||||||
xEndSelect = 0;
|
xEndSelect = 0;
|
||||||
@@ -85,9 +77,6 @@ Editor::Editor() {
|
|||||||
|
|
||||||
searchAnchor = 0;
|
searchAnchor = 0;
|
||||||
|
|
||||||
ucWheelScrollLines = 0;
|
|
||||||
cWheelDelta = 0; //wheel delta from roll
|
|
||||||
|
|
||||||
xOffset = 0;
|
xOffset = 0;
|
||||||
xCaretMargin = 50;
|
xCaretMargin = 50;
|
||||||
horizontalScrollBarVisible = true;
|
horizontalScrollBarVisible = true;
|
||||||
@@ -114,15 +103,11 @@ Editor::Editor() {
|
|||||||
|
|
||||||
modEventMask = SC_MODEVENTMASKALL;
|
modEventMask = SC_MODEVENTMASKALL;
|
||||||
|
|
||||||
displayPopupMenu = true;
|
|
||||||
|
|
||||||
pdoc = new Document();
|
pdoc = new Document();
|
||||||
pdoc ->AddRef();
|
pdoc ->AddRef();
|
||||||
pdoc->AddWatcher(this, 0);
|
pdoc->AddWatcher(this, 0);
|
||||||
|
|
||||||
#ifdef MACRO_SUPPORT
|
recordingMacro = false;
|
||||||
recordingMacro = 0;
|
|
||||||
#endif
|
|
||||||
foldFlags = 0;
|
foldFlags = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -131,10 +116,6 @@ Editor::~Editor() {
|
|||||||
pdoc->Release();
|
pdoc->Release();
|
||||||
pdoc = 0;
|
pdoc = 0;
|
||||||
DropGraphics();
|
DropGraphics();
|
||||||
|
|
||||||
delete []dragChars;
|
|
||||||
dragChars = 0;
|
|
||||||
lenDrag = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Editor::Finalise() {
|
void Editor::Finalise() {
|
||||||
@@ -874,7 +855,7 @@ void Editor::PaintSelMargin(Surface *surfWindow, PRectangle &rc) {
|
|||||||
if (marks) {
|
if (marks) {
|
||||||
for (int markBit = 0; (markBit < 32) && marks; markBit++) {
|
for (int markBit = 0; (markBit < 32) && marks; markBit++) {
|
||||||
if (marks & 1) {
|
if (marks & 1) {
|
||||||
vs.markers[markBit].Draw(surface, rcMarker);
|
vs.markers[markBit].Draw(surface, rcMarker, vs.styles[STYLE_LINENUMBER].font);
|
||||||
}
|
}
|
||||||
marks >>= 1;
|
marks >>= 1;
|
||||||
}
|
}
|
||||||
@@ -1917,14 +1898,12 @@ void Editor::NotifyChar(int ch) {
|
|||||||
scn.nmhdr.code = SCN_CHARADDED;
|
scn.nmhdr.code = SCN_CHARADDED;
|
||||||
scn.ch = ch;
|
scn.ch = ch;
|
||||||
NotifyParent(scn);
|
NotifyParent(scn);
|
||||||
#ifdef MACRO_SUPPORT
|
|
||||||
if (recordingMacro) {
|
if (recordingMacro) {
|
||||||
char txt[2];
|
char txt[2];
|
||||||
txt[0] = static_cast<char>(ch);
|
txt[0] = static_cast<char>(ch);
|
||||||
txt[1] = '\0';
|
txt[1] = '\0';
|
||||||
NotifyMacroRecord(SCI_REPLACESEL, 0, reinterpret_cast<long>(txt));
|
NotifyMacroRecord(SCI_REPLACESEL, 0, reinterpret_cast<long>(txt));
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Editor::NotifySavePoint(bool isSavePoint) {
|
void Editor::NotifySavePoint(bool isSavePoint) {
|
||||||
@@ -2150,7 +2129,6 @@ void Editor::NotifyDeleted(Document *, void *) {
|
|||||||
/* Do nothing */
|
/* Do nothing */
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef MACRO_SUPPORT
|
|
||||||
void Editor::NotifyMacroRecord(unsigned int iMessage, unsigned long wParam, long lParam) {
|
void Editor::NotifyMacroRecord(unsigned int iMessage, unsigned long wParam, long lParam) {
|
||||||
|
|
||||||
// Enumerates all macroable messages
|
// Enumerates all macroable messages
|
||||||
@@ -2159,10 +2137,6 @@ void Editor::NotifyMacroRecord(unsigned int iMessage, unsigned long wParam, long
|
|||||||
case SCI_COPY:
|
case SCI_COPY:
|
||||||
case SCI_PASTE:
|
case SCI_PASTE:
|
||||||
case SCI_CLEAR:
|
case SCI_CLEAR:
|
||||||
case WM_CUT:
|
|
||||||
case WM_COPY:
|
|
||||||
case WM_PASTE:
|
|
||||||
case WM_CLEAR:
|
|
||||||
case SCI_REPLACESEL:
|
case SCI_REPLACESEL:
|
||||||
case SCI_ADDTEXT:
|
case SCI_ADDTEXT:
|
||||||
case SCI_INSERTTEXT:
|
case SCI_INSERTTEXT:
|
||||||
@@ -2236,7 +2210,6 @@ void Editor::NotifyMacroRecord(unsigned int iMessage, unsigned long wParam, long
|
|||||||
scn.lParam = lParam;
|
scn.lParam = lParam;
|
||||||
NotifyParent(scn);
|
NotifyParent(scn);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
// Force scroll and keep position relative to top of window
|
// Force scroll and keep position relative to top of window
|
||||||
void Editor::PageMove(int direction, bool extend) {
|
void Editor::PageMove(int direction, bool extend) {
|
||||||
@@ -2674,7 +2647,6 @@ void Editor::Indent(bool forwards) {
|
|||||||
* @return The position of the found text, -1 if not found.
|
* @return The position of the found text, -1 if not found.
|
||||||
*/
|
*/
|
||||||
long Editor::FindText(
|
long Editor::FindText(
|
||||||
unsigned int iMessage, ///< Can be @c EM_FINDTEXT or @c EM_FINDTEXTEX or @c SCI_FINDTEXT.
|
|
||||||
unsigned long wParam, ///< Search modes : @c SCFIND_MATCHCASE, @c SCFIND_WHOLEWORD,
|
unsigned long wParam, ///< Search modes : @c SCFIND_MATCHCASE, @c SCFIND_WHOLEWORD,
|
||||||
///< @c SCFIND_WORDSTART or @c SCFIND_REGEXP.
|
///< @c SCFIND_WORDSTART or @c SCFIND_REGEXP.
|
||||||
long lParam) { ///< @c TextToFind structure: The text to search for in the given range.
|
long lParam) { ///< @c TextToFind structure: The text to search for in the given range.
|
||||||
@@ -2688,11 +2660,9 @@ long Editor::FindText(
|
|||||||
wParam & SCFIND_REGEXP,
|
wParam & SCFIND_REGEXP,
|
||||||
&lengthFound);
|
&lengthFound);
|
||||||
if (pos != -1) {
|
if (pos != -1) {
|
||||||
if (iMessage != EM_FINDTEXT) {
|
|
||||||
ft->chrgText.cpMin = pos;
|
ft->chrgText.cpMin = pos;
|
||||||
ft->chrgText.cpMax = pos + lengthFound;
|
ft->chrgText.cpMax = pos + lengthFound;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return pos;
|
return pos;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2800,33 +2770,23 @@ char *Editor::CopyRange(int start, int end) {
|
|||||||
return text;
|
return text;
|
||||||
}
|
}
|
||||||
|
|
||||||
int Editor::SelectionRangeLength() {
|
void Editor::CopySelectionRange(SelectionText *ss) {
|
||||||
if (selType == selRectangle) {
|
|
||||||
int lineStart = pdoc->LineFromPosition(SelectionStart());
|
|
||||||
int lineEnd = pdoc->LineFromPosition(SelectionEnd());
|
|
||||||
int totalSize = 0;
|
|
||||||
for (int line = lineStart; line <= lineEnd; line++) {
|
|
||||||
totalSize += SelectionEnd(line) - SelectionStart(line) + 1;
|
|
||||||
if (pdoc->eolMode == SC_EOL_CRLF)
|
|
||||||
totalSize++;
|
|
||||||
}
|
|
||||||
return totalSize;
|
|
||||||
} else {
|
|
||||||
return SelectionEnd() - SelectionStart();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
char *Editor::CopySelectionRange() {
|
|
||||||
if (selType == selRectangle) {
|
|
||||||
char *text = 0;
|
char *text = 0;
|
||||||
|
int size = 0;
|
||||||
|
if (selType == selRectangle) {
|
||||||
int lineStart = pdoc->LineFromPosition(SelectionStart());
|
int lineStart = pdoc->LineFromPosition(SelectionStart());
|
||||||
int lineEnd = pdoc->LineFromPosition(SelectionEnd());
|
int lineEnd = pdoc->LineFromPosition(SelectionEnd());
|
||||||
int totalSize = SelectionRangeLength();
|
int line;
|
||||||
if (totalSize > 0) {
|
for (line = lineStart; line <= lineEnd; line++) {
|
||||||
text = new char[totalSize + 1];
|
size += SelectionEnd(line) - SelectionStart(line) + 1;
|
||||||
|
if (pdoc->eolMode == SC_EOL_CRLF)
|
||||||
|
size++;
|
||||||
|
}
|
||||||
|
if (size > 0) {
|
||||||
|
text = new char[size + 1];
|
||||||
if (text) {
|
if (text) {
|
||||||
int j = 0;
|
int j = 0;
|
||||||
for (int line = lineStart; line <= lineEnd; line++) {
|
for (line = lineStart; line <= lineEnd; line++) {
|
||||||
for (int i = SelectionStart(line);i < SelectionEnd(line);i++) {
|
for (int i = SelectionStart(line);i < SelectionEnd(line);i++) {
|
||||||
text[j++] = pdoc->CharAt(i);
|
text[j++] = pdoc->CharAt(i);
|
||||||
}
|
}
|
||||||
@@ -2835,24 +2795,14 @@ char *Editor::CopySelectionRange() {
|
|||||||
if (pdoc->eolMode != SC_EOL_CR)
|
if (pdoc->eolMode != SC_EOL_CR)
|
||||||
text[j++] = '\n';
|
text[j++] = '\n';
|
||||||
}
|
}
|
||||||
text[totalSize] = '\0';
|
text[size] = '\0';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return text;
|
|
||||||
} else {
|
} else {
|
||||||
return CopyRange(SelectionStart(), SelectionEnd());
|
size = SelectionEnd() - SelectionStart();
|
||||||
}
|
text = CopyRange(SelectionStart(), SelectionEnd());
|
||||||
}
|
|
||||||
|
|
||||||
void Editor::CopySelectionIntoDrag() {
|
|
||||||
delete []dragChars;
|
|
||||||
dragChars = 0;
|
|
||||||
lenDrag = SelectionRangeLength();
|
|
||||||
dragChars = CopySelectionRange();
|
|
||||||
dragIsRectangle = selType == selRectangle;
|
|
||||||
if (!dragChars) {
|
|
||||||
lenDrag = 0;
|
|
||||||
}
|
}
|
||||||
|
ss->Set(text, size, selType == selRectangle);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Editor::SetDragPosition(int newPos) {
|
void Editor::SetDragPosition(int newPos) {
|
||||||
@@ -2882,8 +2832,6 @@ void Editor::StartDrag() {
|
|||||||
//DisplayCursor(Window::cursorArrow);
|
//DisplayCursor(Window::cursorArrow);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void Editor::DropAt(int position, const char *value, bool moving, bool rectangular) {
|
void Editor::DropAt(int position, const char *value, bool moving, bool rectangular) {
|
||||||
//Platform::DebugPrintf("DropAt %d\n", inDragDrop);
|
//Platform::DebugPrintf("DropAt %d\n", inDragDrop);
|
||||||
if (inDragDrop)
|
if (inDragDrop)
|
||||||
@@ -3115,7 +3063,7 @@ void Editor::ButtonDown(Point pt, unsigned int curTime, bool shift, bool ctrl, b
|
|||||||
if (inDragDrop) {
|
if (inDragDrop) {
|
||||||
SetMouseCapture(false);
|
SetMouseCapture(false);
|
||||||
SetDragPosition(newPos);
|
SetDragPosition(newPos);
|
||||||
CopySelectionIntoDrag();
|
CopySelectionRange(&drag);
|
||||||
StartDrag();
|
StartDrag();
|
||||||
} else {
|
} else {
|
||||||
xStartSelect = pt.x - vs.fixedColumnWidth + xOffset;
|
xStartSelect = pt.x - vs.fixedColumnWidth + xOffset;
|
||||||
@@ -3220,25 +3168,23 @@ void Editor::ButtonUp(Point pt, unsigned int curTime, bool ctrl) {
|
|||||||
int selStart = SelectionStart();
|
int selStart = SelectionStart();
|
||||||
int selEnd = SelectionEnd();
|
int selEnd = SelectionEnd();
|
||||||
if (selStart < selEnd) {
|
if (selStart < selEnd) {
|
||||||
if (dragChars && lenDrag) {
|
if (drag.len) {
|
||||||
if (ctrl) {
|
if (ctrl) {
|
||||||
pdoc->InsertString(newPos, dragChars, lenDrag);
|
pdoc->InsertString(newPos, drag.s, drag.len);
|
||||||
SetSelection(newPos, newPos + lenDrag);
|
SetSelection(newPos, newPos + drag.len);
|
||||||
} else if (newPos < selStart) {
|
} else if (newPos < selStart) {
|
||||||
pdoc->DeleteChars(selStart, lenDrag);
|
pdoc->DeleteChars(selStart, drag.len);
|
||||||
pdoc->InsertString(newPos, dragChars, lenDrag);
|
pdoc->InsertString(newPos, drag.s, drag.len);
|
||||||
SetSelection(newPos, newPos + lenDrag);
|
SetSelection(newPos, newPos + drag.len);
|
||||||
} else if (newPos > selEnd) {
|
} else if (newPos > selEnd) {
|
||||||
pdoc->DeleteChars(selStart, lenDrag);
|
pdoc->DeleteChars(selStart, drag.len);
|
||||||
newPos -= lenDrag;
|
newPos -= drag.len;
|
||||||
pdoc->InsertString(newPos, dragChars, lenDrag);
|
pdoc->InsertString(newPos, drag.s, drag.len);
|
||||||
SetSelection(newPos, newPos + lenDrag);
|
SetSelection(newPos, newPos + drag.len);
|
||||||
} else {
|
} else {
|
||||||
SetEmptySelection(newPos);
|
SetEmptySelection(newPos);
|
||||||
}
|
}
|
||||||
delete []dragChars;
|
drag.Set(0, 0);
|
||||||
dragChars = 0;
|
|
||||||
lenDrag = 0;
|
|
||||||
}
|
}
|
||||||
selectionType = selChar;
|
selectionType = selChar;
|
||||||
}
|
}
|
||||||
@@ -3545,14 +3491,11 @@ 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);
|
//Platform::DebugPrintf("S start wnd proc %d %d %d\n",iMessage, wParam, lParam);
|
||||||
|
|
||||||
// Optional macro recording hook
|
// Optional macro recording hook
|
||||||
#ifdef MACRO_SUPPORT
|
|
||||||
if (recordingMacro)
|
if (recordingMacro)
|
||||||
NotifyMacroRecord(iMessage, wParam, lParam);
|
NotifyMacroRecord(iMessage, wParam, lParam);
|
||||||
#endif
|
|
||||||
|
|
||||||
switch (iMessage) {
|
switch (iMessage) {
|
||||||
|
|
||||||
case WM_GETTEXT:
|
|
||||||
case SCI_GETTEXT:
|
case SCI_GETTEXT:
|
||||||
{
|
{
|
||||||
if (lParam == 0)
|
if (lParam == 0)
|
||||||
@@ -3565,7 +3508,6 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) {
|
|||||||
return iChar;
|
return iChar;
|
||||||
}
|
}
|
||||||
|
|
||||||
case WM_SETTEXT:
|
|
||||||
case SCI_SETTEXT:
|
case SCI_SETTEXT:
|
||||||
{
|
{
|
||||||
if (lParam == 0)
|
if (lParam == 0)
|
||||||
@@ -3576,130 +3518,45 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) {
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
case WM_GETTEXTLENGTH:
|
|
||||||
case SCI_GETTEXTLENGTH:
|
case SCI_GETTEXTLENGTH:
|
||||||
return pdoc->Length();
|
return pdoc->Length();
|
||||||
|
|
||||||
case WM_CUT:
|
|
||||||
case SCI_CUT:
|
case SCI_CUT:
|
||||||
Cut();
|
Cut();
|
||||||
SetLastXChosen();
|
SetLastXChosen();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WM_COPY:
|
|
||||||
case SCI_COPY:
|
case SCI_COPY:
|
||||||
Copy();
|
Copy();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WM_PASTE:
|
|
||||||
case SCI_PASTE:
|
case SCI_PASTE:
|
||||||
Paste();
|
Paste();
|
||||||
SetLastXChosen();
|
SetLastXChosen();
|
||||||
EnsureCaretVisible();
|
EnsureCaretVisible();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WM_CLEAR:
|
|
||||||
case SCI_CLEAR:
|
case SCI_CLEAR:
|
||||||
Clear();
|
Clear();
|
||||||
SetLastXChosen();
|
SetLastXChosen();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WM_UNDO:
|
|
||||||
case SCI_UNDO:
|
case SCI_UNDO:
|
||||||
Undo();
|
Undo();
|
||||||
SetLastXChosen();
|
SetLastXChosen();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
// Edit control messages
|
|
||||||
|
|
||||||
// Not supported (no-ops):
|
|
||||||
// EM_GETWORDBREAKPROC
|
|
||||||
// EM_GETWORDBREAKPROCEX
|
|
||||||
// EM_SETWORDBREAKPROC
|
|
||||||
// EM_SETWORDBREAKPROCEX
|
|
||||||
// EM_GETWORDWRAPMODE
|
|
||||||
// EM_SETWORDWRAPMODE
|
|
||||||
// EM_LIMITTEXT
|
|
||||||
// EM_EXLIMITTEXT
|
|
||||||
// EM_SETRECT
|
|
||||||
// EM_SETRECTNP
|
|
||||||
// EM_FMTLINES
|
|
||||||
// EM_GETHANDLE
|
|
||||||
// EM_SETHANDLE
|
|
||||||
// EM_GETPASSWORDCHAR
|
|
||||||
// EM_SETPASSWORDCHAR
|
|
||||||
// EM_SETTABSTOPS
|
|
||||||
// EM_FINDWORDBREAK
|
|
||||||
// EM_GETCHARFORMAT
|
|
||||||
// EM_SETCHARFORMAT
|
|
||||||
// EM_GETOLEINTERFACE
|
|
||||||
// EM_SETOLEINTERFACE
|
|
||||||
// EM_SETOLECALLBACK
|
|
||||||
// EM_GETPARAFORMAT
|
|
||||||
// EM_SETPARAFORMAT
|
|
||||||
// EM_PASTESPECIAL
|
|
||||||
// EM_REQUESTRESIZE
|
|
||||||
// EM_GETBKGNDCOLOR
|
|
||||||
// EM_SETBKGNDCOLOR
|
|
||||||
// EM_STREAMIN
|
|
||||||
// EM_STREAMOUT
|
|
||||||
// EM_GETIMECOLOR
|
|
||||||
// EM_SETIMECOLOR
|
|
||||||
// EM_GETIMEOPTIONS
|
|
||||||
// EM_SETIMEOPTIONS
|
|
||||||
// EM_GETOPTIONS
|
|
||||||
// EM_SETOPTIONS
|
|
||||||
// EM_GETPUNCTUATION
|
|
||||||
// EM_SETPUNCTUATION
|
|
||||||
// EM_GETTHUMB
|
|
||||||
// EM_SETTARGETDEVICE
|
|
||||||
|
|
||||||
// Not supported but should be:
|
|
||||||
// EM_GETEVENTMASK
|
|
||||||
// EM_SETEVENTMASK
|
|
||||||
// For printing:
|
|
||||||
// EM_DISPLAYBAND
|
|
||||||
|
|
||||||
case EM_CANUNDO:
|
|
||||||
case SCI_CANUNDO:
|
case SCI_CANUNDO:
|
||||||
return pdoc->CanUndo() ? TRUE : FALSE;
|
return pdoc->CanUndo() ? TRUE : FALSE;
|
||||||
|
|
||||||
case EM_UNDO:
|
|
||||||
Undo();
|
|
||||||
SetLastXChosen();
|
|
||||||
break;
|
|
||||||
|
|
||||||
case EM_EMPTYUNDOBUFFER:
|
|
||||||
case SCI_EMPTYUNDOBUFFER:
|
case SCI_EMPTYUNDOBUFFER:
|
||||||
pdoc->DeleteUndoHistory();
|
pdoc->DeleteUndoHistory();
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
case EM_GETFIRSTVISIBLELINE:
|
|
||||||
case SCI_GETFIRSTVISIBLELINE:
|
case SCI_GETFIRSTVISIBLELINE:
|
||||||
return topLine;
|
return topLine;
|
||||||
|
|
||||||
case EM_GETLINE: {
|
case SCI_GETLINE: { // Risk of overwriting the end of the buffer
|
||||||
if (lParam == 0) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
char *ptr = reinterpret_cast<char *>(lParam);
|
|
||||||
short *pBufSize = reinterpret_cast<short *>(lParam);
|
|
||||||
short bufSize = *pBufSize;
|
|
||||||
ptr[0] = '\0'; // If no characters copied, have to put a NUL into buffer
|
|
||||||
if (static_cast<int>(wParam) > pdoc->LinesTotal()) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
int lineStart = pdoc->LineStart(wParam);
|
|
||||||
int lineEnd = pdoc->LineStart(wParam + 1);
|
|
||||||
// The first word of the buffer is the size, in TCHARs, of the buffer
|
|
||||||
int iPlace = 0;
|
|
||||||
for (int iChar = lineStart; iChar < lineEnd && iPlace < bufSize; iChar++) {
|
|
||||||
ptr[iPlace++] = pdoc->CharAt(iChar);
|
|
||||||
}
|
|
||||||
return iPlace;
|
|
||||||
}
|
|
||||||
|
|
||||||
case SCI_GETLINE: { // Simpler than EM_GETLINE, but with risk of overwriting the end of the buffer
|
|
||||||
if (lParam == 0) {
|
if (lParam == 0) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -3713,42 +3570,15 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) {
|
|||||||
return iPlace;
|
return iPlace;
|
||||||
}
|
}
|
||||||
|
|
||||||
case EM_GETLINECOUNT:
|
|
||||||
case SCI_GETLINECOUNT:
|
case SCI_GETLINECOUNT:
|
||||||
if (pdoc->LinesTotal() == 0)
|
if (pdoc->LinesTotal() == 0)
|
||||||
return 1;
|
return 1;
|
||||||
else
|
else
|
||||||
return pdoc->LinesTotal();
|
return pdoc->LinesTotal();
|
||||||
|
|
||||||
case EM_GETMODIFY:
|
|
||||||
case SCI_GETMODIFY:
|
case SCI_GETMODIFY:
|
||||||
return !pdoc->IsSavePoint();
|
return !pdoc->IsSavePoint();
|
||||||
|
|
||||||
case EM_GETRECT:
|
|
||||||
if (lParam == 0)
|
|
||||||
return 0;
|
|
||||||
*(reinterpret_cast<PRectangle *>(lParam)) = GetClientRectangle();
|
|
||||||
break;
|
|
||||||
|
|
||||||
case EM_GETSEL:
|
|
||||||
if (wParam)
|
|
||||||
*reinterpret_cast<int *>(wParam) = SelectionStart();
|
|
||||||
if (lParam)
|
|
||||||
*reinterpret_cast<int *>(lParam) = SelectionEnd();
|
|
||||||
return Platform::LongFromTwoShorts(
|
|
||||||
static_cast<short>(SelectionStart()),
|
|
||||||
static_cast<short>(SelectionEnd()));
|
|
||||||
|
|
||||||
case EM_EXGETSEL: {
|
|
||||||
if (lParam == 0)
|
|
||||||
return 0;
|
|
||||||
CharacterRange *pCR = reinterpret_cast<CharacterRange *>(lParam);
|
|
||||||
pCR->cpMin = SelectionStart();
|
|
||||||
pCR->cpMax = SelectionEnd();
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case EM_SETSEL:
|
|
||||||
case SCI_SETSEL: {
|
case SCI_SETSEL: {
|
||||||
int nStart = static_cast<int>(wParam);
|
int nStart = static_cast<int>(wParam);
|
||||||
int nEnd = static_cast<int>(lParam);
|
int nEnd = static_cast<int>(lParam);
|
||||||
@@ -3762,55 +3592,28 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) {
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case EM_EXSETSEL: {
|
|
||||||
if (lParam == 0)
|
|
||||||
return 0;
|
|
||||||
CharacterRange *pCR = reinterpret_cast<CharacterRange *>(lParam);
|
|
||||||
selType = selStream;
|
|
||||||
if (pCR->cpMax == -1) {
|
|
||||||
SetSelection(pCR->cpMin, pdoc->Length());
|
|
||||||
} else {
|
|
||||||
SetSelection(pCR->cpMin, pCR->cpMax);
|
|
||||||
}
|
|
||||||
EnsureCaretVisible();
|
|
||||||
return pdoc->LineFromPosition(SelectionStart());
|
|
||||||
}
|
|
||||||
|
|
||||||
case EM_GETSELTEXT:
|
|
||||||
case SCI_GETSELTEXT: {
|
case SCI_GETSELTEXT: {
|
||||||
if (lParam == 0)
|
if (lParam == 0)
|
||||||
return 0;
|
return 0;
|
||||||
|
SelectionText selectedText;
|
||||||
|
CopySelectionRange(&selectedText);
|
||||||
char *ptr = reinterpret_cast<char *>(lParam);
|
char *ptr = reinterpret_cast<char *>(lParam);
|
||||||
int selSize = SelectionRangeLength();
|
|
||||||
char *text = CopySelectionRange();
|
|
||||||
int iChar = 0;
|
int iChar = 0;
|
||||||
if (text) {
|
if (selectedText.len) {
|
||||||
for (; iChar < selSize; iChar++)
|
for (; iChar < selectedText.len; iChar++)
|
||||||
ptr[iChar] = text[iChar];
|
ptr[iChar] = selectedText.s[iChar];
|
||||||
ptr[iChar] = '\0';
|
ptr[iChar] = '\0';
|
||||||
delete []text;
|
|
||||||
} else {
|
} else {
|
||||||
ptr[0] = '\0';
|
ptr[0] = '\0';
|
||||||
}
|
}
|
||||||
return iChar;
|
return iChar;
|
||||||
}
|
}
|
||||||
|
|
||||||
case EM_LINEFROMCHAR:
|
|
||||||
if (static_cast<int>(wParam) < 0)
|
|
||||||
wParam = SelectionStart();
|
|
||||||
return pdoc->LineFromPosition(wParam);
|
|
||||||
|
|
||||||
case EM_EXLINEFROMCHAR:
|
|
||||||
if (static_cast<int>(lParam) < 0)
|
|
||||||
lParam = SelectionStart(); // Not specified, but probably OK
|
|
||||||
return pdoc->LineFromPosition(lParam);
|
|
||||||
|
|
||||||
case SCI_LINEFROMPOSITION:
|
case SCI_LINEFROMPOSITION:
|
||||||
if (static_cast<int>(wParam) < 0)
|
if (static_cast<int>(wParam) < 0)
|
||||||
return 0;
|
return 0;
|
||||||
return pdoc->LineFromPosition(wParam);
|
return pdoc->LineFromPosition(wParam);
|
||||||
|
|
||||||
case EM_LINEINDEX:
|
|
||||||
case SCI_POSITIONFROMLINE:
|
case SCI_POSITIONFROMLINE:
|
||||||
if (static_cast<int>(wParam) < 0)
|
if (static_cast<int>(wParam) < 0)
|
||||||
wParam = pdoc->LineFromPosition(SelectionStart());
|
wParam = pdoc->LineFromPosition(SelectionStart());
|
||||||
@@ -3822,20 +3625,6 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) {
|
|||||||
// return -1;
|
// return -1;
|
||||||
return pdoc->LineStart(wParam);
|
return pdoc->LineStart(wParam);
|
||||||
|
|
||||||
case EM_LINELENGTH: {
|
|
||||||
if (static_cast<int>(wParam) < 0) // Who use this anyway?
|
|
||||||
return 0; // Should be... Too complex to describe here, see MS specs!
|
|
||||||
if (static_cast<int>(wParam) > pdoc->Length()) // Useful test, anyway...
|
|
||||||
return 0;
|
|
||||||
int line = pdoc->LineFromPosition(wParam);
|
|
||||||
int charsOnLine = 0;
|
|
||||||
for (int pos = pdoc->LineStart(line); pos < pdoc->LineStart(line + 1); pos++) {
|
|
||||||
if ((pdoc->CharAt(pos) != '\r') && (pdoc->CharAt(pos) != '\n'))
|
|
||||||
charsOnLine++;
|
|
||||||
}
|
|
||||||
return charsOnLine;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Replacement of the old Scintilla interpretation of EM_LINELENGTH
|
// Replacement of the old Scintilla interpretation of EM_LINELENGTH
|
||||||
case SCI_LINELENGTH:
|
case SCI_LINELENGTH:
|
||||||
if ((static_cast<int>(wParam) < 0) ||
|
if ((static_cast<int>(wParam) < 0) ||
|
||||||
@@ -3843,7 +3632,6 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) {
|
|||||||
return 0;
|
return 0;
|
||||||
return pdoc->LineStart(wParam + 1) - pdoc->LineStart(wParam);
|
return pdoc->LineStart(wParam + 1) - pdoc->LineStart(wParam);
|
||||||
|
|
||||||
case EM_REPLACESEL:
|
|
||||||
case SCI_REPLACESEL: {
|
case SCI_REPLACESEL: {
|
||||||
if (lParam == 0)
|
if (lParam == 0)
|
||||||
return 0;
|
return 0;
|
||||||
@@ -3890,18 +3678,15 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) {
|
|||||||
case SCI_GETSEARCHFLAGS:
|
case SCI_GETSEARCHFLAGS:
|
||||||
return searchFlags;
|
return searchFlags;
|
||||||
|
|
||||||
case EM_LINESCROLL:
|
|
||||||
case SCI_LINESCROLL:
|
case SCI_LINESCROLL:
|
||||||
ScrollTo(topLine + lParam);
|
ScrollTo(topLine + lParam);
|
||||||
HorizontalScrollTo(xOffset + wParam * vs.spaceWidth);
|
HorizontalScrollTo(xOffset + wParam * vs.spaceWidth);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
case EM_SCROLLCARET:
|
|
||||||
case SCI_SCROLLCARET:
|
case SCI_SCROLLCARET:
|
||||||
EnsureCaretVisible();
|
EnsureCaretVisible();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case EM_SETREADONLY:
|
|
||||||
case SCI_SETREADONLY:
|
case SCI_SETREADONLY:
|
||||||
pdoc->SetReadOnly(wParam);
|
pdoc->SetReadOnly(wParam);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
@@ -3909,33 +3694,9 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) {
|
|||||||
case SCI_GETREADONLY:
|
case SCI_GETREADONLY:
|
||||||
return pdoc->IsReadOnly();
|
return pdoc->IsReadOnly();
|
||||||
|
|
||||||
case EM_CANPASTE:
|
|
||||||
case SCI_CANPASTE:
|
case SCI_CANPASTE:
|
||||||
return CanPaste();
|
return CanPaste();
|
||||||
|
|
||||||
case EM_CHARFROMPOS: {
|
|
||||||
if (lParam == 0)
|
|
||||||
return 0;
|
|
||||||
Point *ppt = reinterpret_cast<Point *>(lParam);
|
|
||||||
int pos = PositionFromLocation(*ppt);
|
|
||||||
int line = pdoc->LineFromPosition(pos);
|
|
||||||
return Platform::LongFromTwoShorts(
|
|
||||||
static_cast<short>(pos), static_cast < short > (line));
|
|
||||||
}
|
|
||||||
|
|
||||||
case EM_POSFROMCHAR: {
|
|
||||||
// The MS specs for this have changed 3 times: using the RichEdit 3 version
|
|
||||||
if (wParam == 0)
|
|
||||||
return 0;
|
|
||||||
Point *ppt = reinterpret_cast<Point *>(wParam);
|
|
||||||
if (lParam < 0) {
|
|
||||||
*ppt = Point(0, 0);
|
|
||||||
} else {
|
|
||||||
*ppt = LocationFromPosition(lParam);
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
case SCI_POINTXFROMPOSITION:
|
case SCI_POINTXFROMPOSITION:
|
||||||
if (lParam < 0) {
|
if (lParam < 0) {
|
||||||
return 0;
|
return 0;
|
||||||
@@ -3952,14 +3713,9 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) {
|
|||||||
return pt.y;
|
return pt.y;
|
||||||
}
|
}
|
||||||
|
|
||||||
case EM_FINDTEXT:
|
|
||||||
return FindText(iMessage, wParam, lParam);
|
|
||||||
|
|
||||||
case EM_FINDTEXTEX:
|
|
||||||
case SCI_FINDTEXT:
|
case SCI_FINDTEXT:
|
||||||
return FindText(iMessage, wParam, lParam);
|
return FindText(wParam, lParam);
|
||||||
|
|
||||||
case EM_GETTEXTRANGE:
|
|
||||||
case SCI_GETTEXTRANGE: {
|
case SCI_GETTEXTRANGE: {
|
||||||
if (lParam == 0)
|
if (lParam == 0)
|
||||||
return 0;
|
return 0;
|
||||||
@@ -3974,53 +3730,20 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) {
|
|||||||
return len; // Not including NUL
|
return len; // Not including NUL
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case SCI_HIDESELECTION:
|
||||||
|
|
||||||
case EM_SELECTIONTYPE:
|
|
||||||
#ifdef SEL_EMPTY
|
|
||||||
if (currentPos == anchor)
|
|
||||||
return SEL_EMPTY;
|
|
||||||
else
|
|
||||||
return SEL_TEXT;
|
|
||||||
#else
|
|
||||||
return 0;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
case EM_HIDESELECTION:
|
|
||||||
hideSelection = wParam;
|
hideSelection = wParam;
|
||||||
Redraw();
|
Redraw();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case EM_FORMATRANGE:
|
|
||||||
case SCI_FORMATRANGE:
|
case SCI_FORMATRANGE:
|
||||||
return FormatRange(wParam, reinterpret_cast<RangeToFormat *>(lParam));
|
return FormatRange(wParam, reinterpret_cast<RangeToFormat *>(lParam));
|
||||||
|
|
||||||
case EM_GETMARGINS:
|
|
||||||
return Platform::LongFromTwoShorts(static_cast<short>(vs.leftMarginWidth),
|
|
||||||
static_cast<short>(vs.rightMarginWidth));
|
|
||||||
|
|
||||||
case SCI_GETMARGINLEFT:
|
case SCI_GETMARGINLEFT:
|
||||||
return vs.leftMarginWidth;
|
return vs.leftMarginWidth;
|
||||||
|
|
||||||
case SCI_GETMARGINRIGHT:
|
case SCI_GETMARGINRIGHT:
|
||||||
return vs.rightMarginWidth;
|
return vs.rightMarginWidth;
|
||||||
|
|
||||||
case EM_SETMARGINS:
|
|
||||||
#ifdef EC_LEFTMARGIN
|
|
||||||
if (wParam & EC_LEFTMARGIN) {
|
|
||||||
vs.leftMarginWidth = Platform::LowShortFromLong(lParam);
|
|
||||||
}
|
|
||||||
if (wParam & EC_RIGHTMARGIN) {
|
|
||||||
vs.rightMarginWidth = Platform::HighShortFromLong(lParam);
|
|
||||||
}
|
|
||||||
if (wParam == EC_USEFONTINFO) {
|
|
||||||
vs.leftMarginWidth = vs.aveCharWidth / 2;
|
|
||||||
vs.rightMarginWidth = vs.aveCharWidth / 2;
|
|
||||||
}
|
|
||||||
InvalidateStyleRedraw();
|
|
||||||
#endif
|
|
||||||
break;
|
|
||||||
|
|
||||||
case SCI_SETMARGINLEFT:
|
case SCI_SETMARGINLEFT:
|
||||||
vs.leftMarginWidth = lParam;
|
vs.leftMarginWidth = lParam;
|
||||||
InvalidateStyleRedraw();
|
InvalidateStyleRedraw();
|
||||||
@@ -4667,10 +4390,6 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) {
|
|||||||
case SCI_LINESONSCREEN:
|
case SCI_LINESONSCREEN:
|
||||||
return LinesOnScreen();
|
return LinesOnScreen();
|
||||||
|
|
||||||
case SCI_USEPOPUP:
|
|
||||||
displayPopupMenu = wParam;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case SCI_SETSELFORE:
|
case SCI_SETSELFORE:
|
||||||
vs.selforeset = wParam;
|
vs.selforeset = wParam;
|
||||||
vs.selforeground.desired = Colour(lParam);
|
vs.selforeground.desired = Colour(lParam);
|
||||||
@@ -4711,7 +4430,7 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) {
|
|||||||
|
|
||||||
case SCI_CLEARCMDKEY:
|
case SCI_CLEARCMDKEY:
|
||||||
kmap.AssignCmdKey(Platform::LowShortFromLong(wParam),
|
kmap.AssignCmdKey(Platform::LowShortFromLong(wParam),
|
||||||
Platform::HighShortFromLong(wParam), WM_NULL);
|
Platform::HighShortFromLong(wParam), SCI_NULL);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SCI_CLEARALLCMDKEYS:
|
case SCI_CLEARALLCMDKEYS:
|
||||||
@@ -4915,15 +4634,13 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) {
|
|||||||
case SCI_GETCURSOR:
|
case SCI_GETCURSOR:
|
||||||
return cursorMode;
|
return cursorMode;
|
||||||
|
|
||||||
#ifdef MACRO_SUPPORT
|
|
||||||
case SCI_STARTRECORD:
|
case SCI_STARTRECORD:
|
||||||
recordingMacro = 1;
|
recordingMacro = true;
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
case SCI_STOPRECORD:
|
case SCI_STOPRECORD:
|
||||||
recordingMacro = 0;
|
recordingMacro = false;
|
||||||
return 0;
|
return 0;
|
||||||
#endif
|
|
||||||
|
|
||||||
case SCI_MOVECARETINSIDEVIEW:
|
case SCI_MOVECARETINSIDEVIEW:
|
||||||
MoveCaretInsideView();
|
MoveCaretInsideView();
|
||||||
|
@@ -50,6 +50,26 @@ public:
|
|||||||
int positions[maxLineLength+1];
|
int positions[maxLineLength+1];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class SelectionText {
|
||||||
|
public:
|
||||||
|
char *s;
|
||||||
|
int len;
|
||||||
|
bool rectangular;
|
||||||
|
SelectionText() : s(0), len(0), rectangular(false) {}
|
||||||
|
~SelectionText() {
|
||||||
|
Set(0, 0);
|
||||||
|
}
|
||||||
|
void Set(char *s_, int len_, bool rectangular_=false) {
|
||||||
|
delete []s;
|
||||||
|
s = s_;
|
||||||
|
if (s)
|
||||||
|
len = len_;
|
||||||
|
else
|
||||||
|
len = 0;
|
||||||
|
rectangular = rectangular_;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*/
|
*/
|
||||||
class Editor : public DocWatcher {
|
class Editor : public DocWatcher {
|
||||||
@@ -68,6 +88,7 @@ protected: // ScintillaBase subclass needs access to much of Editor
|
|||||||
bool stylesValid;
|
bool stylesValid;
|
||||||
ViewStyle vs;
|
ViewStyle vs;
|
||||||
Palette palette;
|
Palette palette;
|
||||||
|
|
||||||
int printMagnification;
|
int printMagnification;
|
||||||
int printColourMode;
|
int printColourMode;
|
||||||
int cursorMode;
|
int cursorMode;
|
||||||
@@ -91,9 +112,6 @@ protected: // ScintillaBase subclass needs access to much of Editor
|
|||||||
Surface pixmapSelPattern;
|
Surface pixmapSelPattern;
|
||||||
Surface pixmapIndentGuide;
|
Surface pixmapIndentGuide;
|
||||||
Surface pixmapIndentGuideHighlight;
|
Surface pixmapIndentGuideHighlight;
|
||||||
// Intellimouse support - currently only implemented for Windows
|
|
||||||
unsigned int ucWheelScrollLines;
|
|
||||||
int cWheelDelta; ///< Wheel delta from roll
|
|
||||||
|
|
||||||
KeyMap kmap;
|
KeyMap kmap;
|
||||||
|
|
||||||
@@ -109,7 +127,6 @@ protected: // ScintillaBase subclass needs access to much of Editor
|
|||||||
bool dwelling;
|
bool dwelling;
|
||||||
enum { selChar, selWord, selLine } selectionType;
|
enum { selChar, selWord, selLine } selectionType;
|
||||||
Point ptMouseLast;
|
Point ptMouseLast;
|
||||||
bool firstExpose;
|
|
||||||
bool inDragDrop;
|
bool inDragDrop;
|
||||||
bool dropWentOutside;
|
bool dropWentOutside;
|
||||||
int posDrag;
|
int posDrag;
|
||||||
@@ -138,9 +155,7 @@ protected: // ScintillaBase subclass needs access to much of Editor
|
|||||||
|
|
||||||
int modEventMask;
|
int modEventMask;
|
||||||
|
|
||||||
char *dragChars;
|
SelectionText drag;
|
||||||
int lenDrag;
|
|
||||||
bool dragIsRectangle;
|
|
||||||
enum { selStream, selRectangle, selRectangleFixed } selType;
|
enum { selStream, selRectangle, selRectangleFixed } selType;
|
||||||
int xStartSelect;
|
int xStartSelect;
|
||||||
int xEndSelect;
|
int xEndSelect;
|
||||||
@@ -154,11 +169,7 @@ protected: // ScintillaBase subclass needs access to much of Editor
|
|||||||
|
|
||||||
int searchAnchor;
|
int searchAnchor;
|
||||||
|
|
||||||
int displayPopupMenu;
|
bool recordingMacro;
|
||||||
|
|
||||||
#ifdef MACRO_SUPPORT
|
|
||||||
int recordingMacro;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
int foldFlags;
|
int foldFlags;
|
||||||
ContractionState cs;
|
ContractionState cs;
|
||||||
@@ -270,11 +281,7 @@ protected: // ScintillaBase subclass needs access to much of Editor
|
|||||||
void NotifyModified(Document *document, DocModification mh, void *userData);
|
void NotifyModified(Document *document, DocModification mh, void *userData);
|
||||||
void NotifyDeleted(Document *document, void *userData);
|
void NotifyDeleted(Document *document, void *userData);
|
||||||
void NotifyStyleNeeded(Document *doc, void *userData, int endPos);
|
void NotifyStyleNeeded(Document *doc, void *userData, int endPos);
|
||||||
|
|
||||||
|
|
||||||
#ifdef MACRO_SUPPORT
|
|
||||||
void NotifyMacroRecord(unsigned int iMessage, unsigned long wParam, long lParam);
|
void NotifyMacroRecord(unsigned int iMessage, unsigned long wParam, long lParam);
|
||||||
#endif
|
|
||||||
|
|
||||||
void PageMove(int direction, bool extend=false);
|
void PageMove(int direction, bool extend=false);
|
||||||
void ChangeCaseOfSelection(bool makeUpperCase);
|
void ChangeCaseOfSelection(bool makeUpperCase);
|
||||||
@@ -289,16 +296,14 @@ protected: // ScintillaBase subclass needs access to much of Editor
|
|||||||
|
|
||||||
void Indent(bool forwards);
|
void Indent(bool forwards);
|
||||||
|
|
||||||
long FindText(unsigned int iMessage, unsigned long wParam, long lParam);
|
long FindText(unsigned long wParam, long lParam);
|
||||||
void SearchAnchor();
|
void SearchAnchor();
|
||||||
long SearchText(unsigned int iMessage, unsigned long wParam, long lParam);
|
long SearchText(unsigned int iMessage, unsigned long wParam, long lParam);
|
||||||
long SearchInTarget(const char *text, int length);
|
long SearchInTarget(const char *text, int length);
|
||||||
void GoToLine(int lineNo);
|
void GoToLine(int lineNo);
|
||||||
|
|
||||||
char *CopyRange(int start, int end);
|
char *CopyRange(int start, int end);
|
||||||
int SelectionRangeLength();
|
void CopySelectionRange(SelectionText *ss);
|
||||||
char *CopySelectionRange();
|
|
||||||
void CopySelectionIntoDrag();
|
|
||||||
void SetDragPosition(int newPos);
|
void SetDragPosition(int newPos);
|
||||||
void DisplayCursor(Window::Cursor c);
|
void DisplayCursor(Window::Cursor c);
|
||||||
virtual void StartDrag();
|
virtual void StartDrag();
|
||||||
|
@@ -108,22 +108,26 @@ LexerModule lmNull(SCLEX_NULL, ColouriseNullDoc, "null");
|
|||||||
int wxForceScintillaLexers(void) {
|
int wxForceScintillaLexers(void) {
|
||||||
extern LexerModule lmAda;
|
extern LexerModule lmAda;
|
||||||
extern LexerModule lmAVE;
|
extern LexerModule lmAVE;
|
||||||
extern LexerModule lmConf;
|
|
||||||
extern LexerModule lmDiff;
|
|
||||||
extern LexerModule lmLatex;
|
|
||||||
extern LexerModule lmPascal;
|
|
||||||
extern LexerModule lmCPP;
|
|
||||||
extern LexerModule lmHTML;
|
|
||||||
extern LexerModule lmXML;
|
|
||||||
extern LexerModule lmProps;
|
|
||||||
extern LexerModule lmErrorList;
|
|
||||||
extern LexerModule lmMake;
|
|
||||||
extern LexerModule lmBatch;
|
extern LexerModule lmBatch;
|
||||||
|
extern LexerModule lmConf;
|
||||||
|
extern LexerModule lmCPP;
|
||||||
|
extern LexerModule lmDiff;
|
||||||
|
extern LexerModule lmEiffel;
|
||||||
|
extern LexerModule lmEiffelkw;
|
||||||
|
extern LexerModule lmErrorList;
|
||||||
|
extern LexerModule lmHTML;
|
||||||
|
extern LexerModule lmLatex;
|
||||||
|
extern LexerModule lmLISP;
|
||||||
|
extern LexerModule lmLua;
|
||||||
|
extern LexerModule lmMake;
|
||||||
|
extern LexerModule lmPascal;
|
||||||
extern LexerModule lmPerl;
|
extern LexerModule lmPerl;
|
||||||
|
extern LexerModule lmProps;
|
||||||
extern LexerModule lmPython;
|
extern LexerModule lmPython;
|
||||||
|
extern LexerModule lmRuby;
|
||||||
extern LexerModule lmSQL;
|
extern LexerModule lmSQL;
|
||||||
extern LexerModule lmVB;
|
extern LexerModule lmVB;
|
||||||
extern LexerModule lmRuby;
|
extern LexerModule lmXML;
|
||||||
|
|
||||||
if (
|
if (
|
||||||
&lmAda
|
&lmAda
|
||||||
@@ -144,6 +148,11 @@ int wxForceScintillaLexers(void) {
|
|||||||
&& &lmSQL
|
&& &lmSQL
|
||||||
&& &lmVB
|
&& &lmVB
|
||||||
&& &lmRuby
|
&& &lmRuby
|
||||||
|
&& &lmEiffel
|
||||||
|
&& &lmEiffelkw
|
||||||
|
&& &lmLISP
|
||||||
|
&& &lmLua
|
||||||
|
&& &lmNull
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
return 1;
|
return 1;
|
||||||
|
@@ -15,317 +15,255 @@
|
|||||||
|
|
||||||
#include "PropSet.h"
|
#include "PropSet.h"
|
||||||
#include "Accessor.h"
|
#include "Accessor.h"
|
||||||
|
#include "StyleContext.h"
|
||||||
#include "KeyWords.h"
|
#include "KeyWords.h"
|
||||||
#include "Scintilla.h"
|
#include "Scintilla.h"
|
||||||
#include "SciLexer.h"
|
#include "SciLexer.h"
|
||||||
|
|
||||||
static bool IsOKBeforeRE(int ch) {
|
static bool IsOKBeforeRE(const int ch) {
|
||||||
return (ch == '(') || (ch == '=') || (ch == ',');
|
return (ch == '(') || (ch == '=') || (ch == ',');
|
||||||
}
|
}
|
||||||
|
|
||||||
static void getRange(unsigned int start,
|
inline bool IsAWordChar(const int ch) {
|
||||||
unsigned int end,
|
|
||||||
Accessor &styler,
|
|
||||||
char *s,
|
|
||||||
unsigned int len) {
|
|
||||||
unsigned int i = 0;
|
|
||||||
while ((i < end - start + 1) && (i < len-1)) {
|
|
||||||
s[i] = styler[start + i];
|
|
||||||
i++;
|
|
||||||
}
|
|
||||||
s[i] = '\0';
|
|
||||||
}
|
|
||||||
|
|
||||||
inline bool IsASpace(int ch) {
|
|
||||||
return (ch == ' ') || ((ch >= 0x09) && (ch <= 0x0d));
|
|
||||||
}
|
|
||||||
|
|
||||||
inline bool IsAWordChar(int ch) {
|
|
||||||
return (ch < 0x80) && (isalnum(ch) || ch == '.' || ch == '_');
|
return (ch < 0x80) && (isalnum(ch) || ch == '.' || ch == '_');
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool IsAWordStart(int ch) {
|
inline bool IsAWordStart(const int ch) {
|
||||||
return (ch < 0x80) && (isalnum(ch) || ch == '_');
|
return (ch < 0x80) && (isalnum(ch) || ch == '_');
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool IsADigit(int ch) {
|
inline bool IsADoxygenChar(const int ch) {
|
||||||
return (ch >= '0') && (ch <= '9');
|
return (islower(ch) || ch == '$' || ch == '@' ||
|
||||||
|
ch == '\\' || ch == '&' || ch == '<' ||
|
||||||
|
ch == '>' || ch == '#' || ch == '{' ||
|
||||||
|
ch == '}' || ch == '[' || ch == ']');
|
||||||
}
|
}
|
||||||
|
|
||||||
// All languages handled so far can treat all characters >= 0x80 as one class
|
inline bool IsStateComment(const int state) {
|
||||||
// which just continues the current token or starts an identifier if in default.
|
return ((state == SCE_C_COMMENT) ||
|
||||||
// DBCS treated specially as the second character can be < 0x80 and hence
|
(state == SCE_C_COMMENTLINE) ||
|
||||||
// syntactically significant. UTF-8 avoids this as all trail bytes are >= 0x80
|
(state == SCE_C_COMMENTDOC) ||
|
||||||
class ColouriseContext {
|
(state == SCE_C_COMMENTDOCKEYWORD) ||
|
||||||
Accessor &styler;
|
(state == SCE_C_COMMENTDOCKEYWORDERROR));
|
||||||
int lengthDoc;
|
}
|
||||||
int currentPos;
|
|
||||||
ColouriseContext& operator=(const ColouriseContext&) {
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
public:
|
|
||||||
bool atEOL;
|
|
||||||
int state;
|
|
||||||
int chPrev;
|
|
||||||
int ch;
|
|
||||||
int chNext;
|
|
||||||
|
|
||||||
ColouriseContext(unsigned int startPos, int length,
|
inline bool IsStateString(const int state) {
|
||||||
int initStyle, Accessor &styler_) :
|
return ((state == SCE_C_STRING) || (state == SCE_C_VERBATIM));
|
||||||
styler(styler_),
|
}
|
||||||
lengthDoc(startPos + length),
|
|
||||||
currentPos(startPos),
|
|
||||||
atEOL(false),
|
|
||||||
state(initStyle),
|
|
||||||
chPrev(0),
|
|
||||||
ch(0),
|
|
||||||
chNext(0) {
|
|
||||||
styler.StartAt(startPos);
|
|
||||||
styler.StartSegment(startPos);
|
|
||||||
int pos = currentPos;
|
|
||||||
ch = static_cast<unsigned char>(styler.SafeGetCharAt(pos));
|
|
||||||
if (styler.IsLeadByte(static_cast<char>(ch))) {
|
|
||||||
pos++;
|
|
||||||
ch = ch << 8;
|
|
||||||
ch |= static_cast<unsigned char>(styler.SafeGetCharAt(pos));
|
|
||||||
}
|
|
||||||
chNext = static_cast<unsigned char>(styler.SafeGetCharAt(pos+1));
|
|
||||||
if (styler.IsLeadByte(static_cast<char>(chNext))) {
|
|
||||||
chNext = chNext << 8;
|
|
||||||
chNext |= static_cast<unsigned char>(styler.SafeGetCharAt(pos+2));
|
|
||||||
}
|
|
||||||
atEOL = (ch == '\r' && chNext != '\n') || (ch == '\n');
|
|
||||||
}
|
|
||||||
void Complete() {
|
|
||||||
styler.ColourTo(currentPos - 1, state);
|
|
||||||
}
|
|
||||||
bool More() {
|
|
||||||
return currentPos <= lengthDoc;
|
|
||||||
}
|
|
||||||
void Forward() {
|
|
||||||
// A lot of this is repeated from the constructor - TODO: merge code
|
|
||||||
chPrev = ch;
|
|
||||||
currentPos++;
|
|
||||||
if (ch >= 0x100)
|
|
||||||
currentPos++;
|
|
||||||
ch = chNext;
|
|
||||||
chNext = static_cast<unsigned char>(styler.SafeGetCharAt(currentPos+1));
|
|
||||||
if (styler.IsLeadByte(static_cast<char>(chNext))) {
|
|
||||||
chNext = chNext << 8;
|
|
||||||
chNext |= static_cast<unsigned char>(styler.SafeGetCharAt(currentPos + 2));
|
|
||||||
}
|
|
||||||
// Trigger on CR only (Mac style) or either on LF from CR+LF (Dos/Win) or on LF alone (Unix)
|
|
||||||
// Avoid triggering two times on Dos/Win
|
|
||||||
// End of line
|
|
||||||
atEOL = (ch == '\r' && chNext != '\n') || (ch == '\n');
|
|
||||||
}
|
|
||||||
void ChangeState(int state_) {
|
|
||||||
state = state_;
|
|
||||||
}
|
|
||||||
void SetState(int state_) {
|
|
||||||
styler.ColourTo(currentPos - 1, state);
|
|
||||||
state = state_;
|
|
||||||
}
|
|
||||||
void ForwardSetState(int state_) {
|
|
||||||
Forward();
|
|
||||||
styler.ColourTo(currentPos - 1, state);
|
|
||||||
state = state_;
|
|
||||||
}
|
|
||||||
void GetCurrent(char *s, int len) {
|
|
||||||
getRange(styler.GetStartSegment(), currentPos - 1, styler, s, len);
|
|
||||||
}
|
|
||||||
int LengthCurrent() {
|
|
||||||
return currentPos - styler.GetStartSegment();
|
|
||||||
}
|
|
||||||
bool Match(char ch0) {
|
|
||||||
return ch == ch0;
|
|
||||||
}
|
|
||||||
bool Match(char ch0, char ch1) {
|
|
||||||
return (ch == ch0) && (chNext == ch1);
|
|
||||||
}
|
|
||||||
bool Match(const char *s) {
|
|
||||||
if (ch != *s)
|
|
||||||
return false;
|
|
||||||
s++;
|
|
||||||
if (chNext != *s)
|
|
||||||
return false;
|
|
||||||
s++;
|
|
||||||
for (int n=2; *s; n++) {
|
|
||||||
if (*s != styler.SafeGetCharAt(currentPos+n))
|
|
||||||
return false;
|
|
||||||
s++;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
static void ColouriseCppDoc(unsigned int startPos, int length, int initStyle, WordList *keywordlists[],
|
static void ColouriseCppDoc(unsigned int startPos, int length, int initStyle, WordList *keywordlists[],
|
||||||
Accessor &styler) {
|
Accessor &styler) {
|
||||||
|
|
||||||
WordList &keywords = *keywordlists[0];
|
WordList &keywords = *keywordlists[0];
|
||||||
WordList &keywords2 = *keywordlists[1];
|
WordList &keywords2 = *keywordlists[1];
|
||||||
|
WordList &keywords3 = *keywordlists[2];
|
||||||
|
|
||||||
bool stylingWithinPreprocessor = styler.GetPropertyInt("styling.within.preprocessor");
|
bool stylingWithinPreprocessor = styler.GetPropertyInt("styling.within.preprocessor");
|
||||||
|
|
||||||
if (initStyle == SCE_C_STRINGEOL) // Does not leak onto next line
|
// Do not leak onto next line
|
||||||
|
if (initStyle == SCE_C_STRINGEOL)
|
||||||
initStyle = SCE_C_DEFAULT;
|
initStyle = SCE_C_DEFAULT;
|
||||||
|
|
||||||
int chPrevNonWhite = ' ';
|
int chPrevNonWhite = ' ';
|
||||||
int visibleChars = 0;
|
int visibleChars = 0;
|
||||||
|
int noDocChars = 0;
|
||||||
bool lastWordWasUUID = false;
|
bool lastWordWasUUID = false;
|
||||||
|
|
||||||
ColouriseContext cc(startPos, length, initStyle, styler);
|
StyleContext sc(startPos, length, initStyle, styler);
|
||||||
|
|
||||||
for (; cc.More(); cc.Forward()) {
|
for (; sc.More(); sc.Forward()) {
|
||||||
|
|
||||||
if (cc.state == SCE_C_STRINGEOL) {
|
// Handle line continuation generically.
|
||||||
if (cc.atEOL) {
|
if (sc.ch == '\\') {
|
||||||
cc.SetState(SCE_C_DEFAULT);
|
if (sc.Match("\\\n")) {
|
||||||
|
sc.Forward();
|
||||||
|
sc.Forward();
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
} else if (cc.state == SCE_C_OPERATOR) {
|
if (sc.Match("\\\r\n")) {
|
||||||
cc.SetState(SCE_C_DEFAULT);
|
sc.Forward();
|
||||||
} else if (cc.state == SCE_C_NUMBER) {
|
sc.Forward();
|
||||||
if (!IsAWordChar(cc.ch)) {
|
sc.Forward();
|
||||||
cc.SetState(SCE_C_DEFAULT);
|
continue;
|
||||||
}
|
}
|
||||||
} else if (cc.state == SCE_C_IDENTIFIER) {
|
}
|
||||||
if (!IsAWordChar(cc.ch) || (cc.ch == '.')) {
|
|
||||||
|
// Determine if the current state should terminate.
|
||||||
|
if (sc.state == SCE_C_OPERATOR) {
|
||||||
|
sc.SetState(SCE_C_DEFAULT);
|
||||||
|
} else if (sc.state == SCE_C_NUMBER) {
|
||||||
|
if (!IsAWordChar(sc.ch)) {
|
||||||
|
sc.SetState(SCE_C_DEFAULT);
|
||||||
|
}
|
||||||
|
} else if (sc.state == SCE_C_IDENTIFIER) {
|
||||||
|
if (!IsAWordChar(sc.ch) || (sc.ch == '.')) {
|
||||||
char s[100];
|
char s[100];
|
||||||
cc.GetCurrent(s, sizeof(s));
|
sc.GetCurrent(s, sizeof(s));
|
||||||
if (keywords.InList(s)) {
|
if (keywords.InList(s)) {
|
||||||
lastWordWasUUID = strcmp(s, "uuid") == 0;
|
lastWordWasUUID = strcmp(s, "uuid") == 0;
|
||||||
cc.ChangeState(SCE_C_WORD);
|
sc.ChangeState(SCE_C_WORD);
|
||||||
} else if (keywords2.InList(s)) {
|
} else if (keywords2.InList(s)) {
|
||||||
cc.ChangeState(SCE_C_WORD2);
|
sc.ChangeState(SCE_C_WORD2);
|
||||||
}
|
}
|
||||||
cc.SetState(SCE_C_DEFAULT);
|
sc.SetState(SCE_C_DEFAULT);
|
||||||
}
|
}
|
||||||
} if (cc.state == SCE_C_PREPROCESSOR) {
|
} else if (sc.state == SCE_C_PREPROCESSOR) {
|
||||||
if (stylingWithinPreprocessor) {
|
if (stylingWithinPreprocessor) {
|
||||||
if (IsASpace(cc.ch)) {
|
if (IsASpace(sc.ch)) {
|
||||||
cc.SetState(SCE_C_DEFAULT);
|
sc.SetState(SCE_C_DEFAULT);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (cc.atEOL && (cc.chPrev != '\\')) {
|
if (sc.atLineEnd) {
|
||||||
cc.SetState(SCE_C_DEFAULT);
|
sc.SetState(SCE_C_DEFAULT);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (cc.state == SCE_C_COMMENT) {
|
} else if (sc.state == SCE_C_COMMENT) {
|
||||||
if (cc.Match('*', '/')) {
|
if (sc.Match('*', '/')) {
|
||||||
cc.Forward();
|
sc.Forward();
|
||||||
cc.ForwardSetState(SCE_C_DEFAULT);
|
sc.ForwardSetState(SCE_C_DEFAULT);
|
||||||
}
|
}
|
||||||
} else if (cc.state == SCE_C_COMMENTDOC) {
|
} else if (sc.state == SCE_C_COMMENTDOC) {
|
||||||
if (cc.Match('*', '/')) {
|
if (sc.Match('*', '/')) {
|
||||||
cc.Forward();
|
sc.Forward();
|
||||||
cc.ForwardSetState(SCE_C_DEFAULT);
|
sc.ForwardSetState(SCE_C_DEFAULT);
|
||||||
|
} else if ((sc.ch == '@' || sc.ch == '\\') && (noDocChars == 0)) {
|
||||||
|
sc.SetState(SCE_C_COMMENTDOCKEYWORD);
|
||||||
|
} else if (sc.atLineEnd) {
|
||||||
|
noDocChars = 0;
|
||||||
|
} else if (!isspace(sc.ch) && (sc.ch != '*')) {
|
||||||
|
noDocChars++;
|
||||||
}
|
}
|
||||||
} else if (cc.state == SCE_C_COMMENTLINE || cc.state == SCE_C_COMMENTLINEDOC) {
|
} else if (sc.state == SCE_C_COMMENTLINE || sc.state == SCE_C_COMMENTLINEDOC) {
|
||||||
if (cc.ch == '\r' || cc.ch == '\n') {
|
if (sc.atLineEnd) {
|
||||||
cc.SetState(SCE_C_DEFAULT);
|
sc.SetState(SCE_C_DEFAULT);
|
||||||
|
visibleChars = 0;
|
||||||
}
|
}
|
||||||
} else if (cc.state == SCE_C_STRING) {
|
} else if (sc.state == SCE_C_COMMENTDOCKEYWORD) {
|
||||||
if (cc.ch == '\\') {
|
if (sc.Match('*', '/')) {
|
||||||
if (cc.chNext == '\"' || cc.chNext == '\'' || cc.chNext == '\\') {
|
sc.ChangeState(SCE_C_COMMENTDOCKEYWORDERROR);
|
||||||
cc.Forward();
|
sc.Forward();
|
||||||
|
sc.ForwardSetState(SCE_C_DEFAULT);
|
||||||
|
} else if (!IsADoxygenChar(sc.ch)) {
|
||||||
|
char s[100];
|
||||||
|
sc.GetCurrent(s, sizeof(s));
|
||||||
|
if (!isspace(sc.ch) || !keywords3.InList(s+1)) {
|
||||||
|
sc.ChangeState(SCE_C_COMMENTDOCKEYWORDERROR);
|
||||||
}
|
}
|
||||||
} else if (cc.ch == '\"') {
|
sc.SetState(SCE_C_COMMENTDOC);
|
||||||
cc.ForwardSetState(SCE_C_DEFAULT);
|
|
||||||
} else if ((cc.atEOL) && (cc.chPrev != '\\')) {
|
|
||||||
cc.ChangeState(SCE_C_STRINGEOL);
|
|
||||||
}
|
}
|
||||||
} else if (cc.state == SCE_C_CHARACTER) {
|
} else if (sc.state == SCE_C_STRING) {
|
||||||
if ((cc.ch == '\r' || cc.ch == '\n') && (cc.chPrev != '\\')) {
|
if (sc.ch == '\\') {
|
||||||
cc.ChangeState(SCE_C_STRINGEOL);
|
if (sc.chNext == '\"' || sc.chNext == '\'' || sc.chNext == '\\') {
|
||||||
} else if (cc.ch == '\\') {
|
sc.Forward();
|
||||||
if (cc.chNext == '\"' || cc.chNext == '\'' || cc.chNext == '\\') {
|
|
||||||
cc.Forward();
|
|
||||||
}
|
}
|
||||||
} else if (cc.ch == '\'') {
|
} else if (sc.ch == '\"') {
|
||||||
cc.ForwardSetState(SCE_C_DEFAULT);
|
sc.ForwardSetState(SCE_C_DEFAULT);
|
||||||
|
} else if (sc.atLineEnd) {
|
||||||
|
sc.ChangeState(SCE_C_STRINGEOL);
|
||||||
|
sc.ForwardSetState(SCE_C_DEFAULT);
|
||||||
|
visibleChars = 0;
|
||||||
}
|
}
|
||||||
} else if (cc.state == SCE_C_REGEX) {
|
} else if (sc.state == SCE_C_CHARACTER) {
|
||||||
if (cc.ch == '\r' || cc.ch == '\n' || cc.ch == '/') {
|
if (sc.atLineEnd) {
|
||||||
cc.ForwardSetState(SCE_C_DEFAULT);
|
sc.ChangeState(SCE_C_STRINGEOL);
|
||||||
} else if (cc.ch == '\\') {
|
sc.ForwardSetState(SCE_C_DEFAULT);
|
||||||
|
visibleChars = 0;
|
||||||
|
} else if (sc.ch == '\\') {
|
||||||
|
if (sc.chNext == '\"' || sc.chNext == '\'' || sc.chNext == '\\') {
|
||||||
|
sc.Forward();
|
||||||
|
}
|
||||||
|
} else if (sc.ch == '\'') {
|
||||||
|
sc.ForwardSetState(SCE_C_DEFAULT);
|
||||||
|
}
|
||||||
|
} else if (sc.state == SCE_C_REGEX) {
|
||||||
|
if (sc.ch == '\r' || sc.ch == '\n' || sc.ch == '/') {
|
||||||
|
sc.ForwardSetState(SCE_C_DEFAULT);
|
||||||
|
} else if (sc.ch == '\\') {
|
||||||
// Gobble up the quoted character
|
// Gobble up the quoted character
|
||||||
if (cc.chNext == '\\' || cc.chNext == '/') {
|
if (sc.chNext == '\\' || sc.chNext == '/') {
|
||||||
cc.Forward();
|
sc.Forward();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (cc.state == SCE_C_VERBATIM) {
|
} else if (sc.state == SCE_C_VERBATIM) {
|
||||||
if (cc.ch == '\"') {
|
if (sc.ch == '\"') {
|
||||||
if (cc.chNext == '\"') {
|
if (sc.chNext == '\"') {
|
||||||
cc.Forward();
|
sc.Forward();
|
||||||
} else {
|
} else {
|
||||||
cc.ForwardSetState(SCE_C_DEFAULT);
|
sc.ForwardSetState(SCE_C_DEFAULT);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (cc.state == SCE_C_UUID) {
|
} else if (sc.state == SCE_C_UUID) {
|
||||||
if (cc.ch == '\r' || cc.ch == '\n' || cc.ch == ')') {
|
if (sc.ch == '\r' || sc.ch == '\n' || sc.ch == ')') {
|
||||||
cc.SetState(SCE_C_DEFAULT);
|
sc.SetState(SCE_C_DEFAULT);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cc.state == SCE_C_DEFAULT) {
|
// Determine if a new state should be entered.
|
||||||
if (cc.Match('@', '\"')) {
|
if (sc.state == SCE_C_DEFAULT) {
|
||||||
cc.SetState(SCE_C_VERBATIM);
|
if (sc.Match('@', '\"')) {
|
||||||
cc.Forward();
|
sc.SetState(SCE_C_VERBATIM);
|
||||||
} else if (IsADigit(cc.ch) || (cc.ch == '.' && IsADigit(cc.chNext))) {
|
sc.Forward();
|
||||||
|
} else if (IsADigit(sc.ch) || (sc.ch == '.' && IsADigit(sc.chNext))) {
|
||||||
if (lastWordWasUUID) {
|
if (lastWordWasUUID) {
|
||||||
cc.SetState(SCE_C_UUID);
|
sc.SetState(SCE_C_UUID);
|
||||||
lastWordWasUUID = false;
|
lastWordWasUUID = false;
|
||||||
} else {
|
} else {
|
||||||
cc.SetState(SCE_C_NUMBER);
|
sc.SetState(SCE_C_NUMBER);
|
||||||
}
|
}
|
||||||
} else if (IsAWordStart(cc.ch) || (cc.ch == '@')) {
|
} else if (IsAWordStart(sc.ch) || (sc.ch == '@')) {
|
||||||
if (lastWordWasUUID) {
|
if (lastWordWasUUID) {
|
||||||
cc.SetState(SCE_C_UUID);
|
sc.SetState(SCE_C_UUID);
|
||||||
lastWordWasUUID = false;
|
lastWordWasUUID = false;
|
||||||
} else {
|
} else {
|
||||||
cc.SetState(SCE_C_IDENTIFIER);
|
sc.SetState(SCE_C_IDENTIFIER);
|
||||||
}
|
}
|
||||||
} else if (cc.Match('/', '*')) {
|
} else if (sc.Match('/', '*')) {
|
||||||
if (cc.Match("/**") || cc.Match("/*!")) // Support of Qt/Doxygen doc. style
|
if (sc.Match("/**") || sc.Match("/*!")) { // Support of Qt/Doxygen doc. style
|
||||||
cc.SetState(SCE_C_COMMENTDOC);
|
noDocChars = 0;
|
||||||
|
sc.SetState(SCE_C_COMMENTDOC);
|
||||||
|
} else {
|
||||||
|
sc.SetState(SCE_C_COMMENT);
|
||||||
|
}
|
||||||
|
sc.Forward(); // Eat the * so it isn't used for the end of the comment
|
||||||
|
} else if (sc.Match('/', '/')) {
|
||||||
|
if (sc.Match("///") || sc.Match("//!")) // Support of Qt/Doxygen doc. style
|
||||||
|
sc.SetState(SCE_C_COMMENTLINEDOC);
|
||||||
else
|
else
|
||||||
cc.SetState(SCE_C_COMMENT);
|
sc.SetState(SCE_C_COMMENTLINE);
|
||||||
cc.Forward(); // Eat the * so it isn't used for the end of the comment
|
} else if (sc.ch == '/' && IsOKBeforeRE(chPrevNonWhite)) {
|
||||||
} else if (cc.Match('/', '/')) {
|
sc.SetState(SCE_C_REGEX);
|
||||||
if (cc.Match("///") || cc.Match("//!")) // Support of Qt/Doxygen doc. style
|
} else if (sc.ch == '\"') {
|
||||||
cc.SetState(SCE_C_COMMENTLINEDOC);
|
sc.SetState(SCE_C_STRING);
|
||||||
else
|
} else if (sc.ch == '\'') {
|
||||||
cc.SetState(SCE_C_COMMENTLINE);
|
sc.SetState(SCE_C_CHARACTER);
|
||||||
} else if (cc.ch == '/' && IsOKBeforeRE(chPrevNonWhite)) {
|
} else if (sc.ch == '#' && visibleChars == 0) {
|
||||||
cc.SetState(SCE_C_REGEX);
|
|
||||||
} else if (cc.ch == '\"') {
|
|
||||||
cc.SetState(SCE_C_STRING);
|
|
||||||
} else if (cc.ch == '\'') {
|
|
||||||
cc.SetState(SCE_C_CHARACTER);
|
|
||||||
} else if (cc.ch == '#' && visibleChars == 0) {
|
|
||||||
// Preprocessor commands are alone on their line
|
// Preprocessor commands are alone on their line
|
||||||
cc.SetState(SCE_C_PREPROCESSOR);
|
sc.SetState(SCE_C_PREPROCESSOR);
|
||||||
// Skip whitespace between # and preprocessor word
|
// Skip whitespace between # and preprocessor word
|
||||||
do {
|
do {
|
||||||
cc.Forward();
|
sc.Forward();
|
||||||
} while (IsASpace(cc.ch) && cc.More());
|
} while ((sc.ch == ' ') && (sc.ch == '\t') && sc.More());
|
||||||
} else if (isoperator(static_cast<char>(cc.ch))) {
|
if (sc.atLineEnd) {
|
||||||
cc.SetState(SCE_C_OPERATOR);
|
sc.SetState(SCE_C_DEFAULT);
|
||||||
|
}
|
||||||
|
} else if (isoperator(static_cast<char>(sc.ch))) {
|
||||||
|
sc.SetState(SCE_C_OPERATOR);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (cc.atEOL) {
|
|
||||||
|
if (sc.atLineEnd) {
|
||||||
// Reset states to begining of colourise so no surprises
|
// Reset states to begining of colourise so no surprises
|
||||||
// if different sets of lines lexed.
|
// if different sets of lines lexed.
|
||||||
chPrevNonWhite = ' ';
|
chPrevNonWhite = ' ';
|
||||||
visibleChars = 0;
|
visibleChars = 0;
|
||||||
lastWordWasUUID = false;
|
lastWordWasUUID = false;
|
||||||
}
|
}
|
||||||
if (!IsASpace(cc.ch)) {
|
if (!IsASpace(sc.ch)) {
|
||||||
chPrevNonWhite = cc.ch;
|
chPrevNonWhite = sc.ch;
|
||||||
visibleChars++;
|
visibleChars++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
cc.Complete();
|
sc.Complete();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void FoldCppDoc(unsigned int startPos, int length, int initStyle, WordList *[],
|
static void FoldCppDoc(unsigned int startPos, int length, int initStyle, WordList *[],
|
||||||
|
204
contrib/src/stc/scintilla/src/LexCrontab.cxx
Normal file
204
contrib/src/stc/scintilla/src/LexCrontab.cxx
Normal file
@@ -0,0 +1,204 @@
|
|||||||
|
// Scintilla source code edit control
|
||||||
|
/** @file LexCrontab.cxx
|
||||||
|
** Lexer to use with extended crontab files used by a powerful
|
||||||
|
** Windows scheduler/event monitor/automation manager nnCron.
|
||||||
|
** (http://nemtsev.virtualave.net/)
|
||||||
|
**/
|
||||||
|
// Copyright 1998-2001 by Neil Hodgson <neilh@scintilla.org>
|
||||||
|
// The License.txt file describes the conditions under which this software may be distributed.
|
||||||
|
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <ctype.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdarg.h>
|
||||||
|
|
||||||
|
#include "Platform.h"
|
||||||
|
|
||||||
|
#include "PropSet.h"
|
||||||
|
#include "Accessor.h"
|
||||||
|
#include "KeyWords.h"
|
||||||
|
#include "Scintilla.h"
|
||||||
|
#include "SciLexer.h"
|
||||||
|
|
||||||
|
static void ColouriseNncrontabDoc(unsigned int startPos, int length, int, WordList
|
||||||
|
*keywordLists[], Accessor &styler)
|
||||||
|
{
|
||||||
|
int state = SCE_NNCRONTAB_DEFAULT;
|
||||||
|
char chNext = styler[startPos];
|
||||||
|
int lengthDoc = startPos + length;
|
||||||
|
// create a buffer large enough to take the largest chunk...
|
||||||
|
char *buffer = new char[length];
|
||||||
|
int bufferCount = 0;
|
||||||
|
// used when highliting environment variables inside quoted string:
|
||||||
|
bool insideString = false;
|
||||||
|
|
||||||
|
// this assumes that we have 3 keyword list in conf.properties
|
||||||
|
WordList §ion = *keywordLists[0];
|
||||||
|
WordList &keyword = *keywordLists[1];
|
||||||
|
WordList &modifier = *keywordLists[2];
|
||||||
|
|
||||||
|
// go through all provided text segment
|
||||||
|
// using the hand-written state machine shown below
|
||||||
|
styler.StartAt(startPos);
|
||||||
|
styler.StartSegment(startPos);
|
||||||
|
for (int i = startPos; i < lengthDoc; i++) {
|
||||||
|
char ch = chNext;
|
||||||
|
chNext = styler.SafeGetCharAt(i + 1);
|
||||||
|
|
||||||
|
if (styler.IsLeadByte(ch)) {
|
||||||
|
chNext = styler.SafeGetCharAt(i + 2);
|
||||||
|
i++;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
switch(state) {
|
||||||
|
case SCE_NNCRONTAB_DEFAULT:
|
||||||
|
if( ch == '\n' || ch == '\r' || ch == '\t' || ch == ' ') {
|
||||||
|
// whitespace is simply ignored here...
|
||||||
|
styler.ColourTo(i,SCE_NNCRONTAB_DEFAULT);
|
||||||
|
break;
|
||||||
|
} else if( ch == '#' && styler.SafeGetCharAt(i+1) == '(') {
|
||||||
|
// signals the start of a task...
|
||||||
|
state = SCE_NNCRONTAB_TASK;
|
||||||
|
styler.ColourTo(i,SCE_NNCRONTAB_TASK);
|
||||||
|
}
|
||||||
|
else if( ch == '\\' && styler.SafeGetCharAt(i+1) == ' ') {
|
||||||
|
// signals the start of an extended comment...
|
||||||
|
state = SCE_NNCRONTAB_COMMENT;
|
||||||
|
styler.ColourTo(i,SCE_NNCRONTAB_COMMENT);
|
||||||
|
} else if( ch == '#' ) {
|
||||||
|
// signals the start of a plain comment...
|
||||||
|
state = SCE_NNCRONTAB_COMMENT;
|
||||||
|
styler.ColourTo(i,SCE_NNCRONTAB_COMMENT);
|
||||||
|
} else if( ch == ')' && styler.SafeGetCharAt(i+1) == '#') {
|
||||||
|
// signals the end of a task...
|
||||||
|
state = SCE_NNCRONTAB_TASK;
|
||||||
|
styler.ColourTo(i,SCE_NNCRONTAB_TASK);
|
||||||
|
} else if( ch == '"') {
|
||||||
|
state = SCE_NNCRONTAB_STRING;
|
||||||
|
styler.ColourTo(i,SCE_NNCRONTAB_STRING);
|
||||||
|
} else if( ch == '%') {
|
||||||
|
// signals environment variables
|
||||||
|
state = SCE_NNCRONTAB_ENVIRONMENT;
|
||||||
|
styler.ColourTo(i,SCE_NNCRONTAB_ENVIRONMENT);
|
||||||
|
} else if( ch == '*' ) {
|
||||||
|
// signals an asterisk
|
||||||
|
// no state jump necessary for this simple case...
|
||||||
|
styler.ColourTo(i,SCE_NNCRONTAB_ASTERISK);
|
||||||
|
} else if( isalpha(ch) || ch == '<' ) {
|
||||||
|
// signals the start of an identifier
|
||||||
|
bufferCount = 0;
|
||||||
|
buffer[bufferCount++] = ch;
|
||||||
|
state = SCE_NNCRONTAB_IDENTIFIER;
|
||||||
|
} else if( isdigit(ch) ) {
|
||||||
|
// signals the start of a number
|
||||||
|
bufferCount = 0;
|
||||||
|
buffer[bufferCount++] = ch;
|
||||||
|
state = SCE_NNCRONTAB_NUMBER;
|
||||||
|
} else {
|
||||||
|
// style it the default style..
|
||||||
|
styler.ColourTo(i,SCE_NNCRONTAB_DEFAULT);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case SCE_NNCRONTAB_COMMENT:
|
||||||
|
// if we find a newline here,
|
||||||
|
// we simply go to default state
|
||||||
|
// else continue to work on it...
|
||||||
|
if( ch == '\n' || ch == '\r' ) {
|
||||||
|
state = SCE_NNCRONTAB_DEFAULT;
|
||||||
|
} else {
|
||||||
|
styler.ColourTo(i,SCE_NNCRONTAB_COMMENT);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case SCE_NNCRONTAB_TASK:
|
||||||
|
// if we find a newline here,
|
||||||
|
// we simply go to default state
|
||||||
|
// else continue to work on it...
|
||||||
|
if( ch == '\n' || ch == '\r' ) {
|
||||||
|
state = SCE_NNCRONTAB_DEFAULT;
|
||||||
|
} else {
|
||||||
|
styler.ColourTo(i,SCE_NNCRONTAB_TASK);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case SCE_NNCRONTAB_STRING:
|
||||||
|
if( ch == '%' ) {
|
||||||
|
state = SCE_NNCRONTAB_ENVIRONMENT;
|
||||||
|
insideString = true;
|
||||||
|
styler.ColourTo(i-1,SCE_NNCRONTAB_STRING);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
// if we find the end of a string char, we simply go to default state
|
||||||
|
// else we're still dealing with an string...
|
||||||
|
if( (ch == '"' && styler.SafeGetCharAt(i-1)!='\\') ||
|
||||||
|
(ch == '\n') || (ch == '\r') ) {
|
||||||
|
state = SCE_NNCRONTAB_DEFAULT;
|
||||||
|
}
|
||||||
|
styler.ColourTo(i,SCE_NNCRONTAB_STRING);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case SCE_NNCRONTAB_ENVIRONMENT:
|
||||||
|
// if we find the end of a string char, we simply go to default state
|
||||||
|
// else we're still dealing with an string...
|
||||||
|
if( ch == '%' && insideString ) {
|
||||||
|
state = SCE_NNCRONTAB_STRING;
|
||||||
|
insideString = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if( (ch == '%' && styler.SafeGetCharAt(i-1)!='\\')
|
||||||
|
|| (ch == '\n') || (ch == '\r') ) {
|
||||||
|
state = SCE_NNCRONTAB_DEFAULT;
|
||||||
|
styler.ColourTo(i,SCE_NNCRONTAB_ENVIRONMENT);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
styler.ColourTo(i+1,SCE_NNCRONTAB_ENVIRONMENT);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case SCE_NNCRONTAB_IDENTIFIER:
|
||||||
|
// stay in CONF_IDENTIFIER state until we find a non-alphanumeric
|
||||||
|
if( isalnum(ch) || (ch == '_') || (ch == '-') || (ch == '/') ||
|
||||||
|
(ch == '$') || (ch == '.') || (ch == '<') || (ch == '>') ) {
|
||||||
|
buffer[bufferCount++] = ch;
|
||||||
|
} else {
|
||||||
|
state = SCE_NNCRONTAB_DEFAULT;
|
||||||
|
buffer[bufferCount] = '\0';
|
||||||
|
|
||||||
|
// check if the buffer contains a keyword,
|
||||||
|
// and highlight it if it is a keyword...
|
||||||
|
if(section.InList(buffer)) {
|
||||||
|
styler.ColourTo(i,SCE_NNCRONTAB_SECTION );
|
||||||
|
} else if(keyword.InList(buffer)) {
|
||||||
|
styler.ColourTo(i-1,SCE_NNCRONTAB_KEYWORD );
|
||||||
|
} // else if(strchr(buffer,'/') || strchr(buffer,'.')) {
|
||||||
|
// styler.ColourTo(i-1,SCE_NNCRONTAB_EXTENSION);
|
||||||
|
// }
|
||||||
|
else if(modifier.InList(buffer)) {
|
||||||
|
styler.ColourTo(i-1,SCE_NNCRONTAB_MODIFIER );
|
||||||
|
} else {
|
||||||
|
styler.ColourTo(i-1,SCE_NNCRONTAB_DEFAULT);
|
||||||
|
}
|
||||||
|
// push back the faulty character
|
||||||
|
chNext = styler[i--];
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case SCE_NNCRONTAB_NUMBER:
|
||||||
|
// stay in CONF_NUMBER state until we find a non-numeric
|
||||||
|
if( isdigit(ch) /* || ch == '.' */ ) {
|
||||||
|
buffer[bufferCount++] = ch;
|
||||||
|
} else {
|
||||||
|
state = SCE_NNCRONTAB_DEFAULT;
|
||||||
|
buffer[bufferCount] = '\0';
|
||||||
|
// Colourize here... (normal number)
|
||||||
|
styler.ColourTo(i-1,SCE_NNCRONTAB_NUMBER);
|
||||||
|
// push back a character
|
||||||
|
chNext = styler[i--];
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
LexerModule lmNncrontab(SCLEX_NNCRONTAB, ColouriseNncrontabDoc, "nncrontab");
|
@@ -16,6 +16,7 @@
|
|||||||
|
|
||||||
#include "PropSet.h"
|
#include "PropSet.h"
|
||||||
#include "Accessor.h"
|
#include "Accessor.h"
|
||||||
|
#include "StyleContext.h"
|
||||||
#include "KeyWords.h"
|
#include "KeyWords.h"
|
||||||
#include "Scintilla.h"
|
#include "Scintilla.h"
|
||||||
#include "SciLexer.h"
|
#include "SciLexer.h"
|
||||||
@@ -31,23 +32,6 @@ inline bool isEiffelOperator(unsigned int ch) {
|
|||||||
ch == '!' || ch == '@' || ch == '?';
|
ch == '!' || ch == '@' || ch == '?';
|
||||||
}
|
}
|
||||||
|
|
||||||
static void getRangeLowered(unsigned int start,
|
|
||||||
unsigned int end,
|
|
||||||
Accessor &styler,
|
|
||||||
char *s,
|
|
||||||
unsigned int len) {
|
|
||||||
unsigned int i = 0;
|
|
||||||
while ((i < end - start + 1) && (i < len-1)) {
|
|
||||||
s[i] = static_cast<char>(tolower(styler[start + i]));
|
|
||||||
i++;
|
|
||||||
}
|
|
||||||
s[i] = '\0';
|
|
||||||
}
|
|
||||||
|
|
||||||
inline bool IsASpace(unsigned int ch) {
|
|
||||||
return (ch == ' ') || ((ch >= 0x09) && (ch <= 0x0d));
|
|
||||||
}
|
|
||||||
|
|
||||||
inline bool IsAWordChar(unsigned int ch) {
|
inline bool IsAWordChar(unsigned int ch) {
|
||||||
return (ch < 0x80) && (isalnum(ch) || ch == '.' || ch == '_');
|
return (ch < 0x80) && (isalnum(ch) || ch == '.' || ch == '_');
|
||||||
}
|
}
|
||||||
@@ -56,81 +40,6 @@ inline bool IsAWordStart(unsigned int ch) {
|
|||||||
return (ch < 0x80) && (isalnum(ch) || ch == '_');
|
return (ch < 0x80) && (isalnum(ch) || ch == '_');
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool IsADigit(unsigned int ch) {
|
|
||||||
return (ch >= '0') && (ch <= '9');
|
|
||||||
}
|
|
||||||
|
|
||||||
// All languages handled so far can treat all characters >= 0x80 as one class
|
|
||||||
// which just continues the current token or starts an identifier if in default.
|
|
||||||
// DBCS treated specially as the second character can be < 0x80 and hence
|
|
||||||
// syntactically significant. UTF-8 avoids this as all trail bytes are >= 0x80
|
|
||||||
class xColouriseContext {
|
|
||||||
Accessor &styler;
|
|
||||||
int lengthDoc;
|
|
||||||
int currentPos;
|
|
||||||
xColouriseContext& operator=(const xColouriseContext&) {
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
public:
|
|
||||||
int state;
|
|
||||||
unsigned int chPrev;
|
|
||||||
unsigned int ch;
|
|
||||||
unsigned int chNext;
|
|
||||||
|
|
||||||
xColouriseContext(unsigned int startPos, int length,
|
|
||||||
int initStyle, Accessor &styler_) :
|
|
||||||
styler(styler_),
|
|
||||||
lengthDoc(startPos + length),
|
|
||||||
currentPos(startPos),
|
|
||||||
state(initStyle),
|
|
||||||
chPrev(0),
|
|
||||||
ch(0),
|
|
||||||
chNext(0) {
|
|
||||||
styler.StartAt(startPos);
|
|
||||||
styler.StartSegment(startPos);
|
|
||||||
int pos = currentPos;
|
|
||||||
ch = static_cast<unsigned char>(styler.SafeGetCharAt(pos));
|
|
||||||
if (styler.IsLeadByte(static_cast<char>(ch))) {
|
|
||||||
pos++;
|
|
||||||
ch = ch << 8;
|
|
||||||
ch |= static_cast<unsigned char>(styler.SafeGetCharAt(pos));
|
|
||||||
}
|
|
||||||
chNext = static_cast<unsigned char>(styler.SafeGetCharAt(pos+1));
|
|
||||||
if (styler.IsLeadByte(static_cast<char>(chNext))) {
|
|
||||||
chNext = chNext << 8;
|
|
||||||
chNext |= static_cast<unsigned char>(styler.SafeGetCharAt(pos+2));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
void Complete() {
|
|
||||||
styler.ColourTo(currentPos - 1, state);
|
|
||||||
}
|
|
||||||
bool More() {
|
|
||||||
return currentPos <= lengthDoc;
|
|
||||||
}
|
|
||||||
void Forward() {
|
|
||||||
chPrev = ch;
|
|
||||||
currentPos++;
|
|
||||||
if (ch >= 0x100)
|
|
||||||
currentPos++;
|
|
||||||
ch = chNext;
|
|
||||||
chNext = static_cast<unsigned char>(styler.SafeGetCharAt(currentPos+1));
|
|
||||||
if (styler.IsLeadByte(static_cast<char>(chNext))) {
|
|
||||||
chNext = chNext << 8;
|
|
||||||
chNext |= static_cast<unsigned char>(styler.SafeGetCharAt(currentPos + 2));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
void ChangeState(int state_) {
|
|
||||||
state = state_;
|
|
||||||
}
|
|
||||||
void SetState(int state_) {
|
|
||||||
styler.ColourTo(currentPos - 1, state);
|
|
||||||
state = state_;
|
|
||||||
}
|
|
||||||
void GetCurrentLowered(char *s, int len) {
|
|
||||||
getRangeLowered(styler.GetStartSegment(), currentPos - 1, styler, s, len);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
static void ColouriseEiffelDoc(unsigned int startPos,
|
static void ColouriseEiffelDoc(unsigned int startPos,
|
||||||
int length,
|
int length,
|
||||||
int initStyle,
|
int initStyle,
|
||||||
@@ -139,68 +48,68 @@ static void ColouriseEiffelDoc(unsigned int startPos,
|
|||||||
|
|
||||||
WordList &keywords = *keywordlists[0];
|
WordList &keywords = *keywordlists[0];
|
||||||
|
|
||||||
xColouriseContext lc(startPos, length, initStyle, styler);
|
StyleContext sc(startPos, length, initStyle, styler);
|
||||||
|
|
||||||
for (; lc.More(); lc.Forward()) {
|
for (; sc.More(); sc.Forward()) {
|
||||||
|
|
||||||
if (lc.state == SCE_EIFFEL_STRINGEOL) {
|
if (sc.state == SCE_EIFFEL_STRINGEOL) {
|
||||||
if (lc.ch != '\r' && lc.ch != '\n') {
|
if (sc.ch != '\r' && sc.ch != '\n') {
|
||||||
lc.SetState(SCE_EIFFEL_DEFAULT);
|
sc.SetState(SCE_EIFFEL_DEFAULT);
|
||||||
}
|
}
|
||||||
} else if (lc.state == SCE_EIFFEL_OPERATOR) {
|
} else if (sc.state == SCE_EIFFEL_OPERATOR) {
|
||||||
lc.SetState(SCE_EIFFEL_DEFAULT);
|
sc.SetState(SCE_EIFFEL_DEFAULT);
|
||||||
} else if (lc.state == SCE_EIFFEL_WORD) {
|
} else if (sc.state == SCE_EIFFEL_WORD) {
|
||||||
if (!IsAWordChar(lc.ch)) {
|
if (!IsAWordChar(sc.ch)) {
|
||||||
char s[100];
|
char s[100];
|
||||||
lc.GetCurrentLowered(s, sizeof(s));
|
sc.GetCurrentLowered(s, sizeof(s));
|
||||||
if (!keywords.InList(s)) {
|
if (!keywords.InList(s)) {
|
||||||
lc.ChangeState(SCE_EIFFEL_IDENTIFIER);
|
sc.ChangeState(SCE_EIFFEL_IDENTIFIER);
|
||||||
}
|
}
|
||||||
lc.SetState(SCE_EIFFEL_DEFAULT);
|
sc.SetState(SCE_EIFFEL_DEFAULT);
|
||||||
}
|
}
|
||||||
} else if (lc.state == SCE_EIFFEL_NUMBER) {
|
} else if (sc.state == SCE_EIFFEL_NUMBER) {
|
||||||
if (!IsAWordChar(lc.ch)) {
|
if (!IsAWordChar(sc.ch)) {
|
||||||
lc.SetState(SCE_EIFFEL_DEFAULT);
|
sc.SetState(SCE_EIFFEL_DEFAULT);
|
||||||
}
|
}
|
||||||
} else if (lc.state == SCE_EIFFEL_COMMENTLINE) {
|
} else if (sc.state == SCE_EIFFEL_COMMENTLINE) {
|
||||||
if (lc.ch == '\r' || lc.ch == '\n') {
|
if (sc.ch == '\r' || sc.ch == '\n') {
|
||||||
lc.SetState(SCE_EIFFEL_DEFAULT);
|
sc.SetState(SCE_EIFFEL_DEFAULT);
|
||||||
}
|
}
|
||||||
} else if (lc.state == SCE_EIFFEL_STRING) {
|
} else if (sc.state == SCE_EIFFEL_STRING) {
|
||||||
if (lc.ch == '%') {
|
if (sc.ch == '%') {
|
||||||
lc.Forward();
|
sc.Forward();
|
||||||
} else if (lc.ch == '\"') {
|
} else if (sc.ch == '\"') {
|
||||||
lc.Forward();
|
sc.Forward();
|
||||||
lc.SetState(SCE_EIFFEL_DEFAULT);
|
sc.SetState(SCE_EIFFEL_DEFAULT);
|
||||||
}
|
}
|
||||||
} else if (lc.state == SCE_EIFFEL_CHARACTER) {
|
} else if (sc.state == SCE_EIFFEL_CHARACTER) {
|
||||||
if (lc.ch == '\r' || lc.ch == '\n') {
|
if (sc.ch == '\r' || sc.ch == '\n') {
|
||||||
lc.SetState(SCE_EIFFEL_STRINGEOL);
|
sc.SetState(SCE_EIFFEL_STRINGEOL);
|
||||||
} else if (lc.ch == '%') {
|
} else if (sc.ch == '%') {
|
||||||
lc.Forward();
|
sc.Forward();
|
||||||
} else if (lc.ch == '\'') {
|
} else if (sc.ch == '\'') {
|
||||||
lc.Forward();
|
sc.Forward();
|
||||||
lc.SetState(SCE_EIFFEL_DEFAULT);
|
sc.SetState(SCE_EIFFEL_DEFAULT);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (lc.state == SCE_EIFFEL_DEFAULT) {
|
if (sc.state == SCE_EIFFEL_DEFAULT) {
|
||||||
if (lc.ch == '-' && lc.chNext == '-') {
|
if (sc.ch == '-' && sc.chNext == '-') {
|
||||||
lc.SetState(SCE_EIFFEL_COMMENTLINE);
|
sc.SetState(SCE_EIFFEL_COMMENTLINE);
|
||||||
} else if (lc.ch == '\"') {
|
} else if (sc.ch == '\"') {
|
||||||
lc.SetState(SCE_EIFFEL_STRING);
|
sc.SetState(SCE_EIFFEL_STRING);
|
||||||
} else if (lc.ch == '\'') {
|
} else if (sc.ch == '\'') {
|
||||||
lc.SetState(SCE_EIFFEL_CHARACTER);
|
sc.SetState(SCE_EIFFEL_CHARACTER);
|
||||||
} else if (IsADigit(lc.ch) || (lc.ch == '.')) {
|
} else if (IsADigit(sc.ch) || (sc.ch == '.')) {
|
||||||
lc.SetState(SCE_EIFFEL_NUMBER);
|
sc.SetState(SCE_EIFFEL_NUMBER);
|
||||||
} else if (IsAWordStart(lc.ch)) {
|
} else if (IsAWordStart(sc.ch)) {
|
||||||
lc.SetState(SCE_EIFFEL_WORD);
|
sc.SetState(SCE_EIFFEL_WORD);
|
||||||
} else if (isEiffelOperator(lc.ch)) {
|
} else if (isEiffelOperator(sc.ch)) {
|
||||||
lc.SetState(SCE_EIFFEL_OPERATOR);
|
sc.SetState(SCE_EIFFEL_OPERATOR);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
lc.Complete();
|
sc.Complete();
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool IsEiffelComment(Accessor &styler, int pos, int len) {
|
static bool IsEiffelComment(Accessor &styler, int pos, int len) {
|
||||||
|
@@ -23,16 +23,16 @@
|
|||||||
#define SCE_HA_VBS (SCE_HBA_START - SCE_HB_START)
|
#define SCE_HA_VBS (SCE_HBA_START - SCE_HB_START)
|
||||||
#define SCE_HA_PYTHON (SCE_HPA_START - SCE_HP_START)
|
#define SCE_HA_PYTHON (SCE_HPA_START - SCE_HP_START)
|
||||||
|
|
||||||
enum { eScriptNone = 0, eScriptJS, eScriptVBS, eScriptPython, eScriptPHP, eScriptXML };
|
enum { eScriptNone = 0, eScriptJS, eScriptVBS, eScriptPython, eScriptPHP, eScriptXML, eScriptSGML, eScriptSGMLblock };
|
||||||
enum { eHtml = 0, eNonHtmlScript, eNonHtmlPreProc, eNonHtmlScriptPreProc };
|
enum { eHtml = 0, eNonHtmlScript, eNonHtmlPreProc, eNonHtmlScriptPreProc };
|
||||||
|
|
||||||
static int segIsScriptingIndicator(Accessor &styler, unsigned int start, unsigned int end, int prevValue) {
|
static int segIsScriptingIndicator(Accessor &styler, unsigned int start, unsigned int end, int prevValue) {
|
||||||
char s[30 + 1];
|
char s[30 + 1];
|
||||||
s[0] = '\0';
|
unsigned int i = 0;
|
||||||
for (unsigned int i = 0; i < end - start + 1 && i < 30; i++) {
|
for (; i < end - start + 1 && i < 30; i++) {
|
||||||
s[i] = static_cast<char>(tolower(styler[start + i]));
|
s[i] = static_cast<char>(tolower(styler[start + i]));
|
||||||
s[i + 1] = '\0';
|
|
||||||
}
|
}
|
||||||
|
s[i] = '\0';
|
||||||
//Platform::DebugPrintf("Scripting indicator [%s]\n", s);
|
//Platform::DebugPrintf("Scripting indicator [%s]\n", s);
|
||||||
if (strstr(s, "src")) // External script
|
if (strstr(s, "src")) // External script
|
||||||
return eScriptNone;
|
return eScriptNone;
|
||||||
@@ -55,11 +55,11 @@ static int segIsScriptingIndicator(Accessor &styler, unsigned int start, unsigne
|
|||||||
static int PrintScriptingIndicatorOffset(Accessor &styler, unsigned int start, unsigned int end) {
|
static int PrintScriptingIndicatorOffset(Accessor &styler, unsigned int start, unsigned int end) {
|
||||||
int iResult = 0;
|
int iResult = 0;
|
||||||
char s[30 + 1];
|
char s[30 + 1];
|
||||||
s[0] = '\0';
|
unsigned int i = 0;
|
||||||
for (unsigned int i = 0; i < end - start + 1 && i < 30; i++) {
|
for (; i < end - start + 1 && i < 30; i++) {
|
||||||
s[i] = static_cast<char>(tolower(styler[start + i]));
|
s[i] = static_cast<char>(tolower(styler[start + i]));
|
||||||
s[i + 1] = '\0';
|
|
||||||
}
|
}
|
||||||
|
s[i] = '\0';
|
||||||
if (0 == strncmp(s, "php", 3)) {
|
if (0 == strncmp(s, "php", 3)) {
|
||||||
iResult = 3;
|
iResult = 3;
|
||||||
}
|
}
|
||||||
@@ -68,22 +68,21 @@ static int PrintScriptingIndicatorOffset(Accessor &styler, unsigned int start, u
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int ScriptOfState(int state) {
|
static int ScriptOfState(int state) {
|
||||||
int scriptLanguage;
|
|
||||||
|
|
||||||
if ((state >= SCE_HP_START) && (state <= SCE_HP_IDENTIFIER)) {
|
if ((state >= SCE_HP_START) && (state <= SCE_HP_IDENTIFIER)) {
|
||||||
scriptLanguage = eScriptPython;
|
return eScriptPython;
|
||||||
} else if ((state >= SCE_HB_START) && (state <= SCE_HB_STRINGEOL)) {
|
} else if ((state >= SCE_HB_START) && (state <= SCE_HB_STRINGEOL)) {
|
||||||
scriptLanguage = eScriptVBS;
|
return eScriptVBS;
|
||||||
} else if ((state >= SCE_HJ_START) && (state <= SCE_HJ_REGEX)) {
|
} else if ((state >= SCE_HJ_START) && (state <= SCE_HJ_REGEX)) {
|
||||||
scriptLanguage = eScriptJS;
|
return eScriptJS;
|
||||||
} else if ((state >= SCE_HPHP_DEFAULT) && (state <= SCE_HPHP_COMMENTLINE)) {
|
} else if ((state >= SCE_HPHP_DEFAULT) && (state <= SCE_HPHP_COMMENTLINE)) {
|
||||||
scriptLanguage = eScriptPHP;
|
return eScriptPHP;
|
||||||
|
} else if ((state >= SCE_H_SGML_DEFAULT) && (state <= SCE_H_SGML_BLOCK_DEFAULT)) {
|
||||||
|
return eScriptSGML;
|
||||||
|
} else if (state == SCE_H_SGML_BLOCK_DEFAULT) {
|
||||||
|
return eScriptSGMLblock;
|
||||||
} else {
|
} else {
|
||||||
// scriptLanguage = defaultScript;
|
return eScriptNone;
|
||||||
scriptLanguage = eScriptNone;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return scriptLanguage;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int statePrintForState(int state, int inScriptType) {
|
static int statePrintForState(int state, int inScriptType) {
|
||||||
@@ -174,11 +173,11 @@ static void classifyAttribHTML(unsigned int start, unsigned int end, WordList &k
|
|||||||
chAttr = SCE_H_NUMBER;
|
chAttr = SCE_H_NUMBER;
|
||||||
} else {
|
} else {
|
||||||
char s[30 + 1];
|
char s[30 + 1];
|
||||||
s[0] = '\0';
|
unsigned int i = 0;
|
||||||
for (unsigned int i = 0; i < end - start + 1 && i < 30; i++) {
|
for (; i < end - start + 1 && i < 30; i++) {
|
||||||
s[i] = static_cast<char>(tolower(styler[start + i]));
|
s[i] = static_cast<char>(tolower(styler[start + i]));
|
||||||
s[i + 1] = '\0';
|
|
||||||
}
|
}
|
||||||
|
s[i] = '\0';
|
||||||
if (keywords.InList(s))
|
if (keywords.InList(s))
|
||||||
chAttr = SCE_H_ATTRIBUTE;
|
chAttr = SCE_H_ATTRIBUTE;
|
||||||
}
|
}
|
||||||
@@ -195,18 +194,14 @@ static int classifyTagHTML(unsigned int start, unsigned int end,
|
|||||||
unsigned int i = 0;
|
unsigned int i = 0;
|
||||||
for (unsigned int cPos = start; cPos <= end && i < 30; cPos++) {
|
for (unsigned int cPos = start; cPos <= end && i < 30; cPos++) {
|
||||||
char ch = styler[cPos];
|
char ch = styler[cPos];
|
||||||
if (ch != '<')
|
if ((ch != '<') && (ch != '/'))
|
||||||
s[i++] = static_cast<char>(tolower(ch));
|
s[i++] = static_cast<char>(tolower(ch));
|
||||||
}
|
}
|
||||||
s[i] = '\0';
|
s[i] = '\0';
|
||||||
bool isScript = false;
|
bool isScript = false;
|
||||||
char chAttr = SCE_H_TAGUNKNOWN;
|
char chAttr = SCE_H_TAGUNKNOWN;
|
||||||
if (s[0] == '!' && s[1] == '-' && s[2] == '-') { //Comment
|
if (s[0] == '!') {
|
||||||
chAttr = SCE_H_COMMENT;
|
chAttr = SCE_H_SGML_DEFAULT;
|
||||||
} else if (strcmp(s, "![cdata[") == 0) { // In lower case because already converted
|
|
||||||
chAttr = SCE_H_CDATA;
|
|
||||||
} else if (s[0] == '!') {
|
|
||||||
chAttr = SCE_H_SGML;
|
|
||||||
} else if (s[0] == '/') { // Closing tag
|
} else if (s[0] == '/') { // Closing tag
|
||||||
if (keywords.InList(s + 1))
|
if (keywords.InList(s + 1))
|
||||||
chAttr = SCE_H_TAG;
|
chAttr = SCE_H_TAG;
|
||||||
@@ -231,10 +226,11 @@ static void classifyWordHTJS(unsigned int start, unsigned int end,
|
|||||||
chAttr = SCE_HJ_NUMBER;
|
chAttr = SCE_HJ_NUMBER;
|
||||||
else {
|
else {
|
||||||
char s[30 + 1];
|
char s[30 + 1];
|
||||||
for (unsigned int i = 0; i < end - start + 1 && i < 30; i++) {
|
unsigned int i = 0;
|
||||||
|
for (; i < end - start + 1 && i < 30; i++) {
|
||||||
s[i] = styler[start + i];
|
s[i] = styler[start + i];
|
||||||
s[i + 1] = '\0';
|
|
||||||
}
|
}
|
||||||
|
s[i] = '\0';
|
||||||
if (keywords.InList(s))
|
if (keywords.InList(s))
|
||||||
chAttr = SCE_HJ_KEYWORD;
|
chAttr = SCE_HJ_KEYWORD;
|
||||||
}
|
}
|
||||||
@@ -248,10 +244,11 @@ static int classifyWordHTVB(unsigned int start, unsigned int end, WordList &keyw
|
|||||||
chAttr = SCE_HB_NUMBER;
|
chAttr = SCE_HB_NUMBER;
|
||||||
else {
|
else {
|
||||||
char s[30 + 1];
|
char s[30 + 1];
|
||||||
for (unsigned int i = 0; i < end - start + 1 && i < 30; i++) {
|
unsigned int i = 0;
|
||||||
|
for (; i < end - start + 1 && i < 30; i++) {
|
||||||
s[i] = static_cast<char>(tolower(styler[start + i]));
|
s[i] = static_cast<char>(tolower(styler[start + i]));
|
||||||
s[i + 1] = '\0';
|
|
||||||
}
|
}
|
||||||
|
s[i] = '\0';
|
||||||
if (keywords.InList(s)) {
|
if (keywords.InList(s)) {
|
||||||
chAttr = SCE_HB_WORD;
|
chAttr = SCE_HB_WORD;
|
||||||
if (strcmp(s, "rem") == 0)
|
if (strcmp(s, "rem") == 0)
|
||||||
@@ -268,10 +265,11 @@ static int classifyWordHTVB(unsigned int start, unsigned int end, WordList &keyw
|
|||||||
static void classifyWordHTPy(unsigned int start, unsigned int end, WordList &keywords, Accessor &styler, char *prevWord, int inScriptType) {
|
static void classifyWordHTPy(unsigned int start, unsigned int end, WordList &keywords, Accessor &styler, char *prevWord, int inScriptType) {
|
||||||
bool wordIsNumber = isdigit(styler[start]);
|
bool wordIsNumber = isdigit(styler[start]);
|
||||||
char s[30 + 1];
|
char s[30 + 1];
|
||||||
for (unsigned int i = 0; i < end - start + 1 && i < 30; i++) {
|
unsigned int i = 0;
|
||||||
|
for (; i < end - start + 1 && i < 30; i++) {
|
||||||
s[i] = styler[start + i];
|
s[i] = styler[start + i];
|
||||||
s[i + 1] = '\0';
|
|
||||||
}
|
}
|
||||||
|
s[i] = '\0';
|
||||||
char chAttr = SCE_HP_IDENTIFIER;
|
char chAttr = SCE_HP_IDENTIFIER;
|
||||||
if (0 == strcmp(prevWord, "class"))
|
if (0 == strcmp(prevWord, "class"))
|
||||||
chAttr = SCE_HP_CLASSNAME;
|
chAttr = SCE_HP_CLASSNAME;
|
||||||
@@ -294,16 +292,37 @@ static void classifyWordHTPHP(unsigned int start, unsigned int end, WordList &ke
|
|||||||
chAttr = SCE_HPHP_NUMBER;
|
chAttr = SCE_HPHP_NUMBER;
|
||||||
else {
|
else {
|
||||||
char s[30 + 1];
|
char s[30 + 1];
|
||||||
for (unsigned int i = 0; i < end - start + 1 && i < 30; i++) {
|
unsigned int i = 0;
|
||||||
|
for (; i < end - start + 1 && i < 30; i++) {
|
||||||
s[i] = styler[start + i];
|
s[i] = styler[start + i];
|
||||||
s[i + 1] = '\0';
|
|
||||||
}
|
}
|
||||||
|
s[i] = '\0';
|
||||||
if (keywords.InList(s))
|
if (keywords.InList(s))
|
||||||
chAttr = SCE_HPHP_WORD;
|
chAttr = SCE_HPHP_WORD;
|
||||||
}
|
}
|
||||||
styler.ColourTo(end, chAttr);
|
styler.ColourTo(end, chAttr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bool isWordHSGML(unsigned int start, unsigned int end, WordList &keywords, Accessor &styler) {
|
||||||
|
char s[30 + 1];
|
||||||
|
unsigned int i = 0;
|
||||||
|
for (; i < end - start + 1 && i < 30; i++) {
|
||||||
|
s[i] = styler[start + i];
|
||||||
|
}
|
||||||
|
s[i] = '\0';
|
||||||
|
return keywords.InList(s);
|
||||||
|
}
|
||||||
|
|
||||||
|
static bool isWordCdata(unsigned int start, unsigned int end, Accessor &styler) {
|
||||||
|
char s[30 + 1];
|
||||||
|
unsigned int i = 0;
|
||||||
|
for (; i < end - start + 1 && i < 30; i++) {
|
||||||
|
s[i] = styler[start + i];
|
||||||
|
}
|
||||||
|
s[i] = '\0';
|
||||||
|
return (0 == strcmp(s, "[CDATA["));
|
||||||
|
}
|
||||||
|
|
||||||
// Return the first state to reach when entering a scripting language
|
// Return the first state to reach when entering a scripting language
|
||||||
static int StateForScript(int scriptLanguage) {
|
static int StateForScript(int scriptLanguage) {
|
||||||
int Result;
|
int Result;
|
||||||
@@ -320,6 +339,9 @@ static int StateForScript(int scriptLanguage) {
|
|||||||
case eScriptXML:
|
case eScriptXML:
|
||||||
Result = SCE_H_TAGUNKNOWN;
|
Result = SCE_H_TAGUNKNOWN;
|
||||||
break;
|
break;
|
||||||
|
case eScriptSGML:
|
||||||
|
Result = SCE_H_SGML_DEFAULT;
|
||||||
|
break;
|
||||||
default :
|
default :
|
||||||
Result = SCE_HJ_START;
|
Result = SCE_HJ_START;
|
||||||
break;
|
break;
|
||||||
@@ -331,6 +353,10 @@ inline bool ishtmlwordchar(char ch) {
|
|||||||
return isalnum(ch) || ch == '.' || ch == '-' || ch == '_' || ch == ':' || ch == '!' || ch == '#';
|
return isalnum(ch) || ch == '.' || ch == '-' || ch == '_' || ch == ':' || ch == '!' || ch == '#';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline bool issgmlwordchar(char ch) {
|
||||||
|
return isalnum(ch) || ch == '.' || ch == '_' || ch == ':' || ch == '!' || ch == '#' || ch == '[';
|
||||||
|
}
|
||||||
|
|
||||||
static bool InTagState(int state) {
|
static bool InTagState(int state) {
|
||||||
return state == SCE_H_TAG || state == SCE_H_TAGUNKNOWN ||
|
return state == SCE_H_TAG || state == SCE_H_TAGUNKNOWN ||
|
||||||
state == SCE_H_SCRIPT ||
|
state == SCE_H_SCRIPT ||
|
||||||
@@ -339,6 +365,10 @@ static bool InTagState(int state) {
|
|||||||
state == SCE_H_DOUBLESTRING || state == SCE_H_SINGLESTRING;
|
state == SCE_H_DOUBLESTRING || state == SCE_H_SINGLESTRING;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bool IsCommentState(const int state) {
|
||||||
|
return state == SCE_H_COMMENT || state == SCE_H_SGML_COMMENT;
|
||||||
|
}
|
||||||
|
|
||||||
static bool isLineEnd(char ch) {
|
static bool isLineEnd(char ch) {
|
||||||
return ch == '\r' || ch == '\n';
|
return ch == '\r' || ch == '\n';
|
||||||
}
|
}
|
||||||
@@ -356,15 +386,15 @@ static bool isPHPStringState(int state) {
|
|||||||
|
|
||||||
static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initStyle, WordList *keywordlists[],
|
static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initStyle, WordList *keywordlists[],
|
||||||
Accessor &styler) {
|
Accessor &styler) {
|
||||||
|
|
||||||
WordList &keywords = *keywordlists[0];
|
WordList &keywords = *keywordlists[0];
|
||||||
WordList &keywords2 = *keywordlists[1];
|
WordList &keywords2 = *keywordlists[1];
|
||||||
WordList &keywords3 = *keywordlists[2];
|
WordList &keywords3 = *keywordlists[2];
|
||||||
WordList &keywords4 = *keywordlists[3];
|
WordList &keywords4 = *keywordlists[3];
|
||||||
WordList &keywords5 = *keywordlists[4];
|
WordList &keywords5 = *keywordlists[4];
|
||||||
|
WordList &keywords6 = *keywordlists[5]; // SGML (DTD) keywords
|
||||||
|
|
||||||
// Lexer for HTML requires more lexical states (7 bits worth) than most lexers
|
// Lexer for HTML requires more lexical states (7 bits worth) than most lexers
|
||||||
styler.StartAt(startPos, 127);
|
styler.StartAt(startPos, STYLE_MAX);
|
||||||
char prevWord[200];
|
char prevWord[200];
|
||||||
prevWord[0] = '\0';
|
prevWord[0] = '\0';
|
||||||
int StateToPrint = initStyle;
|
int StateToPrint = initStyle;
|
||||||
@@ -378,45 +408,47 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
|
|||||||
}
|
}
|
||||||
state = SCE_H_DEFAULT;
|
state = SCE_H_DEFAULT;
|
||||||
}
|
}
|
||||||
styler.StartAt(startPos, 127);
|
styler.StartAt(startPos, STYLE_MAX);
|
||||||
|
|
||||||
int lineState = eScriptVBS;
|
|
||||||
int lineCurrent = styler.GetLine(startPos);
|
int lineCurrent = styler.GetLine(startPos);
|
||||||
if (lineCurrent > 0)
|
int lineState;
|
||||||
|
if (lineCurrent > 0) {
|
||||||
lineState = styler.GetLineState(lineCurrent);
|
lineState = styler.GetLineState(lineCurrent);
|
||||||
|
} else {
|
||||||
|
// Default client and ASP scripting language is JavaScript
|
||||||
|
lineState = eScriptJS << 8;
|
||||||
|
lineState |= styler.GetPropertyInt("asp.default.language", eScriptJS) << 4;
|
||||||
|
}
|
||||||
int inScriptType = (lineState >> 0) & 0x03; // 2 bits of scripting type
|
int inScriptType = (lineState >> 0) & 0x03; // 2 bits of scripting type
|
||||||
bool tagOpened = (lineState >> 2) & 0x01; // 1 bit to know if we are in an opened tag
|
bool tagOpened = (lineState >> 2) & 0x01; // 1 bit to know if we are in an opened tag
|
||||||
bool tagClosing = (lineState >> 3) & 0x01; // 1 bit to know if we are in a closing tag
|
bool tagClosing = (lineState >> 3) & 0x01; // 1 bit to know if we are in a closing tag
|
||||||
int defaultScript = (lineState >> 4) & 0x0F; // 4 bits of script name
|
int aspScript = (lineState >> 4) & 0x0F; // 4 bits of script name
|
||||||
int beforePreProc = (lineState >> 8) & 0xFF; // 8 bits of state
|
int clientScript = (lineState >> 8) & 0x0F; // 4 bits of script name
|
||||||
|
int beforePreProc = (lineState >> 12) & 0xFF; // 8 bits of state
|
||||||
|
|
||||||
int scriptLanguage = ScriptOfState(state);
|
int scriptLanguage = ScriptOfState(state);
|
||||||
|
|
||||||
bool fold = styler.GetPropertyInt("fold");
|
const bool foldHTML = styler.GetPropertyInt("fold.html", 0);
|
||||||
bool foldHTML = styler.GetPropertyInt("fold.html",0);
|
const bool fold = foldHTML && styler.GetPropertyInt("fold");
|
||||||
bool foldCompact = styler.GetPropertyInt("fold.compact",1);
|
const bool foldCompact = styler.GetPropertyInt("fold.compact", 1);
|
||||||
|
|
||||||
fold = foldHTML && fold;
|
|
||||||
|
|
||||||
int levelPrev = styler.LevelAt(lineCurrent) & SC_FOLDLEVELNUMBERMASK;
|
int levelPrev = styler.LevelAt(lineCurrent) & SC_FOLDLEVELNUMBERMASK;
|
||||||
int levelCurrent = levelPrev;
|
int levelCurrent = levelPrev;
|
||||||
int visibleChars;
|
int visibleChars = 0;
|
||||||
|
|
||||||
visibleChars = 0;
|
|
||||||
|
|
||||||
char chPrev = ' ';
|
char chPrev = ' ';
|
||||||
char ch = ' ';
|
char ch = ' ';
|
||||||
char chPrevNonWhite = ' ';
|
char chPrevNonWhite = ' ';
|
||||||
styler.StartSegment(startPos);
|
styler.StartSegment(startPos);
|
||||||
int lengthDoc = startPos + length;
|
const int lengthDoc = startPos + length;
|
||||||
for (int i = startPos; i < lengthDoc; i++) {
|
for (int i = startPos; i < lengthDoc; i++) {
|
||||||
char chPrev2 = chPrev;
|
const char chPrev2 = chPrev;
|
||||||
chPrev = ch;
|
chPrev = ch;
|
||||||
if (ch != ' ' && ch != '\t')
|
if (ch != ' ' && ch != '\t')
|
||||||
chPrevNonWhite = ch;
|
chPrevNonWhite = ch;
|
||||||
ch = styler[i];
|
ch = styler[i];
|
||||||
char chNext = styler.SafeGetCharAt(i + 1);
|
char chNext = styler.SafeGetCharAt(i + 1);
|
||||||
char chNext2 = styler.SafeGetCharAt(i + 2);
|
const char chNext2 = styler.SafeGetCharAt(i + 2);
|
||||||
|
|
||||||
// Handle DBCS codepages
|
// Handle DBCS codepages
|
||||||
if (styler.IsLeadByte(ch)) {
|
if (styler.IsLeadByte(ch)) {
|
||||||
@@ -451,18 +483,21 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
|
|||||||
} else if ((ch == '\n') && !((chNext == '\r') && (chNext2 == '\n')) && (chNext != '\n')) {
|
} else if ((ch == '\n') && !((chNext == '\r') && (chNext2 == '\n')) && (chNext != '\n')) {
|
||||||
// check if the number of tabs is lower than the level
|
// check if the number of tabs is lower than the level
|
||||||
int Findlevel = (levelCurrent & ~SC_FOLDLEVELBASE) * 8;
|
int Findlevel = (levelCurrent & ~SC_FOLDLEVELBASE) * 8;
|
||||||
for (int j = 0;Findlevel > 0;j++) {
|
for (int j = 0; Findlevel > 0; j++) {
|
||||||
char chTmp = styler.SafeGetCharAt(i + j + 1);
|
char chTmp = styler.SafeGetCharAt(i + j + 1);
|
||||||
if (chTmp == '\t') {
|
if (chTmp == '\t') {
|
||||||
Findlevel -= 8;
|
Findlevel -= 8;
|
||||||
} else if (chTmp == ' ') {
|
} else if (chTmp == ' ') {
|
||||||
Findlevel--;
|
Findlevel--;
|
||||||
} else break;
|
} else {
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Findlevel > 0) {
|
if (Findlevel > 0) {
|
||||||
levelCurrent -= Findlevel / 8;
|
levelCurrent -= Findlevel / 8;
|
||||||
if (Findlevel % 8) levelCurrent--;
|
if (Findlevel % 8)
|
||||||
|
levelCurrent--;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -490,8 +525,9 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
|
|||||||
((inScriptType & 0x03) << 0) |
|
((inScriptType & 0x03) << 0) |
|
||||||
((tagOpened & 0x01) << 2) |
|
((tagOpened & 0x01) << 2) |
|
||||||
((tagClosing & 0x01) << 3) |
|
((tagClosing & 0x01) << 3) |
|
||||||
((defaultScript & 0x0F) << 4) |
|
((aspScript & 0x0F) << 4) |
|
||||||
((beforePreProc & 0xFF) << 8));
|
((clientScript & 0x0F) << 8) |
|
||||||
|
((beforePreProc & 0xFF) << 12));
|
||||||
}
|
}
|
||||||
|
|
||||||
// generic end of script processing
|
// generic end of script processing
|
||||||
@@ -514,14 +550,15 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
|
|||||||
case SCE_HP_TRIPLEDOUBLE:
|
case SCE_HP_TRIPLEDOUBLE:
|
||||||
break;
|
break;
|
||||||
default :
|
default :
|
||||||
// maybe we should check here if it's a tag and if it's SCRIPT
|
// closing tag of the script (it's a closing HTML tag anyway)
|
||||||
styler.ColourTo(i - 1, StateToPrint);
|
styler.ColourTo(i - 1, StateToPrint);
|
||||||
state = SCE_H_TAGUNKNOWN;
|
state = SCE_H_TAGUNKNOWN;
|
||||||
inScriptType = eHtml;
|
inScriptType = eHtml;
|
||||||
scriptLanguage = eScriptNone;
|
scriptLanguage = eScriptNone;
|
||||||
|
clientScript = eScriptJS;
|
||||||
i += 2;
|
i += 2;
|
||||||
// unfold closing script
|
visibleChars += 2;
|
||||||
levelCurrent--;
|
tagClosing = true;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -537,6 +574,7 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
|
|||||||
beforePreProc = state;
|
beforePreProc = state;
|
||||||
scriptLanguage = segIsScriptingIndicator(styler, styler.GetStartSegment() + 2, i + 10, eScriptPHP);
|
scriptLanguage = segIsScriptingIndicator(styler, styler.GetStartSegment() + 2, i + 10, eScriptPHP);
|
||||||
i++;
|
i++;
|
||||||
|
visibleChars++;
|
||||||
i += PrintScriptingIndicatorOffset(styler, styler.GetStartSegment() + 2, i + 10);
|
i += PrintScriptingIndicatorOffset(styler, styler.GetStartSegment() + 2, i + 10);
|
||||||
if (scriptLanguage == eScriptXML)
|
if (scriptLanguage == eScriptXML)
|
||||||
styler.ColourTo(i, SCE_H_XMLSTART);
|
styler.ColourTo(i, SCE_H_XMLSTART);
|
||||||
@@ -567,6 +605,7 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
|
|||||||
|
|
||||||
if (chNext2 == '@') {
|
if (chNext2 == '@') {
|
||||||
i += 2; // place as if it was the second next char treated
|
i += 2; // place as if it was the second next char treated
|
||||||
|
visibleChars += 2;
|
||||||
state = SCE_H_ASPAT;
|
state = SCE_H_ASPAT;
|
||||||
} else if ((chNext2 == '-') && (styler.SafeGetCharAt(i + 3) == '-')) {
|
} else if ((chNext2 == '-') && (styler.SafeGetCharAt(i + 3) == '-')) {
|
||||||
styler.ColourTo(i + 3, SCE_H_ASP);
|
styler.ColourTo(i + 3, SCE_H_ASP);
|
||||||
@@ -576,11 +615,13 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
|
|||||||
} else {
|
} else {
|
||||||
if (chNext2 == '=') {
|
if (chNext2 == '=') {
|
||||||
i += 2; // place as if it was the second next char treated
|
i += 2; // place as if it was the second next char treated
|
||||||
|
visibleChars += 2;
|
||||||
} else {
|
} else {
|
||||||
i++; // place as if it was the next char treated
|
i++; // place as if it was the next char treated
|
||||||
|
visibleChars++;
|
||||||
}
|
}
|
||||||
|
|
||||||
state = StateForScript(defaultScript);
|
state = StateForScript(aspScript);
|
||||||
}
|
}
|
||||||
scriptLanguage = eScriptVBS;
|
scriptLanguage = eScriptVBS;
|
||||||
styler.ColourTo(i, SCE_H_ASP);
|
styler.ColourTo(i, SCE_H_ASP);
|
||||||
@@ -591,17 +632,42 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/////////////////////////////////////
|
||||||
|
// handle the start of SGML language (DTD)
|
||||||
|
else if (((scriptLanguage == eScriptNone) || (scriptLanguage == eScriptXML)) &&
|
||||||
|
(chPrev == '<') &&
|
||||||
|
(ch == '!') &&
|
||||||
|
(StateToPrint != SCE_H_CDATA) && (!IsCommentState(StateToPrint))) {
|
||||||
|
beforePreProc = state;
|
||||||
|
styler.ColourTo(i - 2, StateToPrint);
|
||||||
|
if ((chNext == '-') && (chNext2 == '-')) {
|
||||||
|
state = SCE_H_COMMENT; // wait for a pending command
|
||||||
|
}
|
||||||
|
else if (isWordCdata(i + 1, i + 7, styler)) {
|
||||||
|
state = SCE_H_CDATA;
|
||||||
|
} else {
|
||||||
|
styler.ColourTo(i, SCE_H_SGML_DEFAULT); // <! is default
|
||||||
|
scriptLanguage = eScriptSGML;
|
||||||
|
state = SCE_H_SGML_COMMAND; // wait for a pending command
|
||||||
|
}
|
||||||
|
// fold whole tag (-- when closing the tag)
|
||||||
|
|
||||||
|
levelCurrent++;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
// handle the end of a pre-processor = Non-HTML
|
// handle the end of a pre-processor = Non-HTML
|
||||||
else if (
|
else if ((
|
||||||
((inScriptType == eNonHtmlPreProc)
|
((inScriptType == eNonHtmlPreProc)
|
||||||
|| (inScriptType == eNonHtmlScriptPreProc)) && (
|
|| (inScriptType == eNonHtmlScriptPreProc)) && (
|
||||||
((scriptLanguage == eScriptPHP) && (ch == '?') && !isPHPStringState(state) && (state != SCE_HPHP_COMMENT)) ||
|
((scriptLanguage == eScriptPHP) && (ch == '?') && !isPHPStringState(state) && (state != SCE_HPHP_COMMENT)) ||
|
||||||
((scriptLanguage != eScriptNone) && !isStringState(state) &&
|
((scriptLanguage != eScriptNone) && !isStringState(state) &&
|
||||||
(ch == '%'))
|
(ch == '%'))
|
||||||
) && (chNext == '>')) {
|
) && (chNext == '>')) ||
|
||||||
|
((scriptLanguage == eScriptSGML) && (ch == '>') && (state != SCE_H_SGML_COMMENT))) {
|
||||||
if (state == SCE_H_ASPAT) {
|
if (state == SCE_H_ASPAT) {
|
||||||
defaultScript = segIsScriptingIndicator(styler,
|
aspScript = segIsScriptingIndicator(styler,
|
||||||
styler.GetStartSegment(), i - 1, defaultScript);
|
styler.GetStartSegment(), i - 1, aspScript);
|
||||||
}
|
}
|
||||||
// Bounce out of any ASP mode
|
// Bounce out of any ASP mode
|
||||||
switch (state) {
|
switch (state) {
|
||||||
@@ -624,11 +690,16 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
|
|||||||
styler.ColourTo(i - 1, StateToPrint);
|
styler.ColourTo(i - 1, StateToPrint);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
if (scriptLanguage != eScriptSGML) {
|
||||||
i++;
|
i++;
|
||||||
|
visibleChars++;
|
||||||
|
}
|
||||||
if (ch == '%')
|
if (ch == '%')
|
||||||
styler.ColourTo(i, SCE_H_ASP);
|
styler.ColourTo(i, SCE_H_ASP);
|
||||||
else if (scriptLanguage == eScriptXML)
|
else if (scriptLanguage == eScriptXML)
|
||||||
styler.ColourTo(i, SCE_H_XMLEND);
|
styler.ColourTo(i, SCE_H_XMLEND);
|
||||||
|
else if (scriptLanguage == eScriptSGML)
|
||||||
|
styler.ColourTo(i, SCE_H_SGML_DEFAULT);
|
||||||
else
|
else
|
||||||
styler.ColourTo(i, SCE_H_QUESTION);
|
styler.ColourTo(i, SCE_H_QUESTION);
|
||||||
state = beforePreProc;
|
state = beforePreProc;
|
||||||
@@ -648,47 +719,156 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
|
|||||||
if (ch == '<') {
|
if (ch == '<') {
|
||||||
// in HTML, fold on tag open and unfold on tag close
|
// in HTML, fold on tag open and unfold on tag close
|
||||||
tagOpened = true;
|
tagOpened = true;
|
||||||
if (chNext == '/') {
|
tagClosing = (chNext == '/');
|
||||||
tagClosing = true;
|
|
||||||
} else {
|
|
||||||
tagClosing = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
styler.ColourTo(i - 1, StateToPrint);
|
styler.ColourTo(i - 1, StateToPrint);
|
||||||
if (chNext == '!' && chNext2 == '-' && styler.SafeGetCharAt(i + 3) == '-') {
|
if (chNext != '!')
|
||||||
// should be better
|
|
||||||
i += 3;
|
|
||||||
levelCurrent++;
|
|
||||||
state = SCE_H_COMMENT;
|
|
||||||
} else
|
|
||||||
state = SCE_H_TAGUNKNOWN;
|
state = SCE_H_TAGUNKNOWN;
|
||||||
} else if (ch == '&') {
|
} else if (ch == '&') {
|
||||||
styler.ColourTo(i - 1, SCE_H_DEFAULT);
|
styler.ColourTo(i - 1, SCE_H_DEFAULT);
|
||||||
state = SCE_H_ENTITY;
|
state = SCE_H_ENTITY;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case SCE_H_COMMENT:
|
case SCE_H_SGML_DEFAULT:
|
||||||
if ((ch == '>') && (chPrev == '-') && (chPrev2 == '-')) {
|
if (scriptLanguage == eScriptSGMLblock)
|
||||||
// unfold HTML comment
|
StateToPrint = SCE_H_SGML_BLOCK_DEFAULT;
|
||||||
levelCurrent--;
|
|
||||||
|
if (ch == '\"') {
|
||||||
|
styler.ColourTo(i - 1, StateToPrint);
|
||||||
|
state = SCE_H_SGML_DOUBLESTRING;
|
||||||
|
} else if (ch == '\'') {
|
||||||
|
styler.ColourTo(i - 1, StateToPrint);
|
||||||
|
state = SCE_H_SGML_SIMPLESTRING;
|
||||||
|
} else if ((ch == '-') && (chPrev == '-')) {
|
||||||
|
styler.ColourTo(i - 2, StateToPrint);
|
||||||
|
state = SCE_H_SGML_COMMENT;
|
||||||
|
} else if (isalpha(ch) && (chPrev == '%')) {
|
||||||
|
styler.ColourTo(i - 2, StateToPrint);
|
||||||
|
state = SCE_H_SGML_ENTITY;
|
||||||
|
} else if (ch == '#') {
|
||||||
|
styler.ColourTo(i - 1, StateToPrint);
|
||||||
|
state = SCE_H_SGML_SPECIAL;
|
||||||
|
} else if (ch == '[') {
|
||||||
|
styler.ColourTo(i - 1, StateToPrint);
|
||||||
|
scriptLanguage = eScriptSGMLblock;
|
||||||
|
} else if (ch == ']') {
|
||||||
|
if (scriptLanguage == eScriptSGMLblock) {
|
||||||
styler.ColourTo(i, StateToPrint);
|
styler.ColourTo(i, StateToPrint);
|
||||||
state = SCE_H_DEFAULT;
|
scriptLanguage = eScriptSGML;
|
||||||
tagOpened = false;
|
} else {
|
||||||
|
styler.ColourTo(i - 1, StateToPrint);
|
||||||
|
styler.ColourTo(i, SCE_H_SGML_ERROR);
|
||||||
|
}
|
||||||
|
} else if (scriptLanguage == eScriptSGMLblock) {
|
||||||
|
if ((ch == '!') && (chPrev == '<')) {
|
||||||
|
styler.ColourTo(i - 2, StateToPrint);
|
||||||
|
styler.ColourTo(i, SCE_H_SGML_DEFAULT);
|
||||||
|
state = SCE_H_SGML_COMMAND;
|
||||||
|
} else if (ch == '>') {
|
||||||
|
styler.ColourTo(i - 1, StateToPrint);
|
||||||
|
styler.ColourTo(i, SCE_H_SGML_DEFAULT);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case SCE_H_SGML_COMMAND:
|
||||||
|
if ((ch == '-') && (chPrev == '-')) {
|
||||||
|
styler.ColourTo(i - 2, StateToPrint);
|
||||||
|
state = SCE_H_SGML_COMMENT;
|
||||||
|
} else if (!issgmlwordchar(ch)) {
|
||||||
|
if (isWordHSGML(styler.GetStartSegment(), i - 1, keywords6, styler)) {
|
||||||
|
styler.ColourTo(i - 1, StateToPrint);
|
||||||
|
state = SCE_H_SGML_1ST_PARAM;
|
||||||
|
} else {
|
||||||
|
state = SCE_H_SGML_ERROR;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case SCE_H_SGML_1ST_PARAM:
|
||||||
|
// wait for the beginning of the word
|
||||||
|
if ((ch == '-') && (chPrev == '-')) {
|
||||||
|
if (scriptLanguage == eScriptSGMLblock) {
|
||||||
|
styler.ColourTo(i - 2, SCE_H_SGML_BLOCK_DEFAULT);
|
||||||
|
} else {
|
||||||
|
styler.ColourTo(i - 2, SCE_H_SGML_DEFAULT);
|
||||||
|
}
|
||||||
|
state = SCE_H_SGML_1ST_PARAM_COMMENT;
|
||||||
|
} else if (issgmlwordchar(ch)) {
|
||||||
|
if (scriptLanguage == eScriptSGMLblock) {
|
||||||
|
styler.ColourTo(i - 1, SCE_H_SGML_BLOCK_DEFAULT);
|
||||||
|
} else {
|
||||||
|
styler.ColourTo(i - 1, SCE_H_SGML_DEFAULT);
|
||||||
|
}
|
||||||
|
// find the length of the word
|
||||||
|
int size = 1;
|
||||||
|
while (ishtmlwordchar(styler.SafeGetCharAt(i + size)))
|
||||||
|
size++;
|
||||||
|
styler.ColourTo(i + size - 1, StateToPrint);
|
||||||
|
i += size - 1;
|
||||||
|
visibleChars += size - 1;
|
||||||
|
ch = styler.SafeGetCharAt(i);
|
||||||
|
state = SCE_H_SGML_DEFAULT;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case SCE_H_SGML_ERROR:
|
||||||
|
if ((ch == '-') && (chPrev == '-')) {
|
||||||
|
styler.ColourTo(i - 2, StateToPrint);
|
||||||
|
state = SCE_H_SGML_COMMENT;
|
||||||
|
}
|
||||||
|
case SCE_H_SGML_DOUBLESTRING:
|
||||||
|
if (ch == '\"') {
|
||||||
|
styler.ColourTo(i, StateToPrint);
|
||||||
|
state = SCE_H_SGML_DEFAULT;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case SCE_H_SGML_SIMPLESTRING:
|
||||||
|
if (ch == '\'') {
|
||||||
|
styler.ColourTo(i, StateToPrint);
|
||||||
|
state = SCE_H_SGML_DEFAULT;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case SCE_H_SGML_COMMENT:
|
||||||
|
if ((ch == '-') && (chPrev == '-')) {
|
||||||
|
styler.ColourTo(i, StateToPrint);
|
||||||
|
state = SCE_H_SGML_DEFAULT;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case SCE_H_CDATA:
|
case SCE_H_CDATA:
|
||||||
if ((ch == '>') && (chPrev == ']') && (chPrev2 == ']')) {
|
if ((chPrev2 == ']') && (chPrev == ']') && (ch == '>')) {
|
||||||
styler.ColourTo(i, StateToPrint);
|
styler.ColourTo(i, StateToPrint);
|
||||||
state = SCE_H_DEFAULT;
|
state = SCE_H_DEFAULT;
|
||||||
tagOpened = false;
|
levelCurrent--;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case SCE_H_SGML:
|
case SCE_H_COMMENT:
|
||||||
if (ch == '>') {
|
if ((chPrev2 == '-') && (chPrev == '-') && (ch == '>')) {
|
||||||
levelCurrent--;
|
|
||||||
styler.ColourTo(i, StateToPrint);
|
styler.ColourTo(i, StateToPrint);
|
||||||
state = SCE_H_DEFAULT;
|
state = SCE_H_DEFAULT;
|
||||||
tagOpened = false;
|
levelCurrent--;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case SCE_H_SGML_1ST_PARAM_COMMENT:
|
||||||
|
if ((ch == '-') && (chPrev == '-')) {
|
||||||
|
styler.ColourTo(i, SCE_H_SGML_COMMENT);
|
||||||
|
state = SCE_H_SGML_1ST_PARAM;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case SCE_H_SGML_SPECIAL:
|
||||||
|
if (!isupper(ch)) {
|
||||||
|
styler.ColourTo(i - 1, StateToPrint);
|
||||||
|
if (isalnum(ch)) {
|
||||||
|
state = SCE_H_SGML_ERROR;
|
||||||
|
} else {
|
||||||
|
state = SCE_H_SGML_DEFAULT;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case SCE_H_SGML_ENTITY:
|
||||||
|
if (ch == ';') {
|
||||||
|
styler.ColourTo(i, StateToPrint);
|
||||||
|
state = SCE_H_SGML_DEFAULT;
|
||||||
|
} else if (!isalnum(ch) && ch != '-' && ch != '.') {
|
||||||
|
styler.ColourTo(i, SCE_H_SGML_ERROR);
|
||||||
|
state = SCE_H_SGML_DEFAULT;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case SCE_H_ENTITY:
|
case SCE_H_ENTITY:
|
||||||
@@ -705,9 +885,14 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
|
|||||||
if (!ishtmlwordchar(ch) && !((ch == '/') && (chPrev == '<')) && ch != '[') {
|
if (!ishtmlwordchar(ch) && !((ch == '/') && (chPrev == '<')) && ch != '[') {
|
||||||
int eClass = classifyTagHTML(styler.GetStartSegment(), i - 1, keywords, styler);
|
int eClass = classifyTagHTML(styler.GetStartSegment(), i - 1, keywords, styler);
|
||||||
if (eClass == SCE_H_SCRIPT) {
|
if (eClass == SCE_H_SCRIPT) {
|
||||||
|
if (!tagClosing) {
|
||||||
inScriptType = eNonHtmlScript;
|
inScriptType = eNonHtmlScript;
|
||||||
scriptLanguage = defaultScript;
|
scriptLanguage = clientScript;
|
||||||
eClass = SCE_H_TAG;
|
eClass = SCE_H_TAG;
|
||||||
|
} else {
|
||||||
|
scriptLanguage = eScriptNone;
|
||||||
|
eClass = SCE_H_TAG;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (ch == '>') {
|
if (ch == '>') {
|
||||||
styler.ColourTo(i, eClass);
|
styler.ColourTo(i, eClass);
|
||||||
@@ -717,10 +902,11 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
|
|||||||
state = SCE_H_DEFAULT;
|
state = SCE_H_DEFAULT;
|
||||||
}
|
}
|
||||||
tagOpened = false;
|
tagOpened = false;
|
||||||
if (tagClosing)
|
if (tagClosing) {
|
||||||
levelCurrent--;
|
levelCurrent--;
|
||||||
else
|
} else {
|
||||||
levelCurrent++;
|
levelCurrent++;
|
||||||
|
}
|
||||||
tagClosing = false;
|
tagClosing = false;
|
||||||
} else if (ch == '/' && chNext == '>') {
|
} else if (ch == '/' && chNext == '>') {
|
||||||
if (eClass == SCE_H_TAGUNKNOWN) {
|
if (eClass == SCE_H_TAGUNKNOWN) {
|
||||||
@@ -735,10 +921,8 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
|
|||||||
tagOpened = false;
|
tagOpened = false;
|
||||||
} else {
|
} else {
|
||||||
if (eClass != SCE_H_TAGUNKNOWN) {
|
if (eClass != SCE_H_TAGUNKNOWN) {
|
||||||
if (eClass == SCE_H_CDATA) {
|
if (eClass == SCE_H_SGML_DEFAULT) {
|
||||||
state = SCE_H_CDATA;
|
state = SCE_H_SGML_DEFAULT;
|
||||||
} else if (eClass == SCE_H_SGML) {
|
|
||||||
state = SCE_H_SGML;
|
|
||||||
} else {
|
} else {
|
||||||
state = SCE_H_OTHER;
|
state = SCE_H_OTHER;
|
||||||
}
|
}
|
||||||
@@ -750,7 +934,8 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
|
|||||||
if (!ishtmlwordchar(ch) && ch != '/' && ch != '-') {
|
if (!ishtmlwordchar(ch) && ch != '/' && ch != '-') {
|
||||||
if (inScriptType == eNonHtmlScript) {
|
if (inScriptType == eNonHtmlScript) {
|
||||||
int scriptLanguagePrev = scriptLanguage;
|
int scriptLanguagePrev = scriptLanguage;
|
||||||
scriptLanguage = segIsScriptingIndicator(styler, styler.GetStartSegment(), i - 1, scriptLanguage);
|
clientScript = segIsScriptingIndicator(styler, styler.GetStartSegment(), i - 1, scriptLanguage);
|
||||||
|
scriptLanguage = clientScript;
|
||||||
if ((scriptLanguagePrev != scriptLanguage) && (scriptLanguage == eScriptNone))
|
if ((scriptLanguagePrev != scriptLanguage) && (scriptLanguage == eScriptNone))
|
||||||
inScriptType = eHtml;
|
inScriptType = eHtml;
|
||||||
}
|
}
|
||||||
@@ -1218,7 +1403,7 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
|
|||||||
if (!isdigit(ch)) {
|
if (!isdigit(ch)) {
|
||||||
styler.ColourTo(i - 1, SCE_HPHP_NUMBER);
|
styler.ColourTo(i - 1, SCE_HPHP_NUMBER);
|
||||||
if (isoperator(ch))
|
if (isoperator(ch))
|
||||||
state =SCE_HPHP_OPERATOR;
|
state = SCE_HPHP_OPERATOR;
|
||||||
else
|
else
|
||||||
state = SCE_HPHP_DEFAULT;
|
state = SCE_HPHP_DEFAULT;
|
||||||
}
|
}
|
||||||
@@ -1227,7 +1412,7 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
|
|||||||
if (!iswordstart(ch)) {
|
if (!iswordstart(ch)) {
|
||||||
styler.ColourTo(i - 1, SCE_HPHP_VARIABLE);
|
styler.ColourTo(i - 1, SCE_HPHP_VARIABLE);
|
||||||
if (isoperator(ch))
|
if (isoperator(ch))
|
||||||
state =SCE_HPHP_OPERATOR;
|
state = SCE_HPHP_OPERATOR;
|
||||||
else
|
else
|
||||||
state = SCE_HPHP_DEFAULT;
|
state = SCE_HPHP_DEFAULT;
|
||||||
}
|
}
|
||||||
@@ -1249,7 +1434,7 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
|
|||||||
// skip the next char
|
// skip the next char
|
||||||
i++;
|
i++;
|
||||||
} else if (ch == '$') {
|
} else if (ch == '$') {
|
||||||
styler.ColourTo(i-1, StateToPrint);
|
styler.ColourTo(i - 1, StateToPrint);
|
||||||
state = SCE_HPHP_HSTRING_VARIABLE;
|
state = SCE_HPHP_HSTRING_VARIABLE;
|
||||||
} else if (ch == '\"') {
|
} else if (ch == '\"') {
|
||||||
styler.ColourTo(i, StateToPrint);
|
styler.ColourTo(i, StateToPrint);
|
||||||
@@ -1267,7 +1452,7 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
|
|||||||
break;
|
break;
|
||||||
case SCE_HPHP_HSTRING_VARIABLE:
|
case SCE_HPHP_HSTRING_VARIABLE:
|
||||||
if (!iswordstart(ch)) {
|
if (!iswordstart(ch)) {
|
||||||
styler.ColourTo(i-1, StateToPrint);
|
styler.ColourTo(i - 1, StateToPrint);
|
||||||
i--; // strange but it works
|
i--; // strange but it works
|
||||||
state = SCE_HPHP_HSTRING;
|
state = SCE_HPHP_HSTRING;
|
||||||
}
|
}
|
||||||
@@ -1304,6 +1489,7 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
|
|||||||
|
|
||||||
// Some of the above terminated their lexeme but since the same character starts
|
// Some of the above terminated their lexeme but since the same character starts
|
||||||
// the same class again, only reenter if non empty segment.
|
// the same class again, only reenter if non empty segment.
|
||||||
|
|
||||||
bool nonEmptySegment = i >= static_cast<int>(styler.GetStartSegment());
|
bool nonEmptySegment = i >= static_cast<int>(styler.GetStartSegment());
|
||||||
if (state == SCE_HB_DEFAULT) { // One of the above succeeded
|
if (state == SCE_HB_DEFAULT) { // One of the above succeeded
|
||||||
if ((ch == '\"') && (nonEmptySegment)) {
|
if ((ch == '\"') && (nonEmptySegment)) {
|
||||||
@@ -1357,4 +1543,3 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
|
|||||||
|
|
||||||
LexerModule lmHTML(SCLEX_HTML, ColouriseHyperTextDoc, "hypertext");
|
LexerModule lmHTML(SCLEX_HTML, ColouriseHyperTextDoc, "hypertext");
|
||||||
LexerModule lmXML(SCLEX_XML, ColouriseHyperTextDoc, "xml");
|
LexerModule lmXML(SCLEX_XML, ColouriseHyperTextDoc, "xml");
|
||||||
|
|
||||||
|
@@ -15,70 +15,18 @@
|
|||||||
|
|
||||||
#include "PropSet.h"
|
#include "PropSet.h"
|
||||||
#include "Accessor.h"
|
#include "Accessor.h"
|
||||||
|
#include "StyleContext.h"
|
||||||
#include "KeyWords.h"
|
#include "KeyWords.h"
|
||||||
#include "Scintilla.h"
|
#include "Scintilla.h"
|
||||||
#include "SciLexer.h"
|
#include "SciLexer.h"
|
||||||
|
|
||||||
/* Returns true if the "as" word that begins at start follows an import statement */
|
enum kwType { kwOther, kwClass, kwDef, kwImport };
|
||||||
static bool IsImportAs(unsigned int start, Accessor &styler) {
|
|
||||||
unsigned int i;
|
|
||||||
unsigned int j;
|
|
||||||
char s[10];
|
|
||||||
|
|
||||||
/* Find any import before start but after any statement terminator or quote */
|
|
||||||
i = start;
|
|
||||||
while (i > 0) {
|
|
||||||
char ch = styler[i - 1];
|
|
||||||
|
|
||||||
if (ch == '\n' || ch == '\r' || ch == ';' || ch == '\'' || ch == '"' || ch == '`')
|
|
||||||
break;
|
|
||||||
if (ch == 't' && i > 5) {
|
|
||||||
for (j = 0; j < 6; j++)
|
|
||||||
s[j] = styler[(i - 6) + j];
|
|
||||||
s[j] = '\0';
|
|
||||||
if (strcmp(s, "import") == 0)
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
i--;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void ClassifyWordPy(unsigned int start, unsigned int end, WordList &keywords, Accessor &styler, char *prevWord) {
|
|
||||||
char s[100];
|
|
||||||
bool wordIsNumber = isdigit(styler[start]);
|
|
||||||
for (unsigned int i = 0; i < end - start + 1 && i < 30; i++) {
|
|
||||||
s[i] = styler[start + i];
|
|
||||||
s[i + 1] = '\0';
|
|
||||||
}
|
|
||||||
char chAttr = SCE_P_IDENTIFIER;
|
|
||||||
if (0 == strcmp(prevWord, "class"))
|
|
||||||
chAttr = SCE_P_CLASSNAME;
|
|
||||||
else if (0 == strcmp(prevWord, "def"))
|
|
||||||
chAttr = SCE_P_DEFNAME;
|
|
||||||
else if (wordIsNumber)
|
|
||||||
chAttr = SCE_P_NUMBER;
|
|
||||||
else if (keywords.InList(s))
|
|
||||||
chAttr = SCE_P_WORD;
|
|
||||||
else if (strcmp(s, "as") == 0 && IsImportAs(start, styler))
|
|
||||||
chAttr = SCE_P_WORD;
|
|
||||||
// make sure that dot-qualifiers inside the word are lexed correct
|
|
||||||
else for (unsigned int i = 0; i < end - start + 1; i++) {
|
|
||||||
if (styler[start + i] == '.') {
|
|
||||||
styler.ColourTo(start + i - 1, chAttr);
|
|
||||||
styler.ColourTo(start + i, SCE_P_OPERATOR);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
styler.ColourTo(end, chAttr);
|
|
||||||
strcpy(prevWord, s);
|
|
||||||
}
|
|
||||||
|
|
||||||
static bool IsPyComment(Accessor &styler, int pos, int len) {
|
static bool IsPyComment(Accessor &styler, int pos, int len) {
|
||||||
return len>0 && styler[pos]=='#';
|
return len>0 && styler[pos]=='#';
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool IsPyStringStart(char ch, char chNext, char chNext2) {
|
static bool IsPyStringStart(int ch, int chNext, int chNext2) {
|
||||||
if (ch == '\'' || ch == '"')
|
if (ch == '\'' || ch == '"')
|
||||||
return true;
|
return true;
|
||||||
if (ch == 'u' || ch == 'U') {
|
if (ch == 'u' || ch == 'U') {
|
||||||
@@ -93,10 +41,6 @@ static bool IsPyStringStart(char ch, char chNext, char chNext2) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool IsPyWordStart(char ch, char chNext, char chNext2) {
|
|
||||||
return (iswordchar(ch) && !IsPyStringStart(ch, chNext, chNext2));
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Return the state to use for the string starting at i; *nextIndex will be set to the first index following the quote(s) */
|
/* Return the state to use for the string starting at i; *nextIndex will be set to the first index following the quote(s) */
|
||||||
static int GetPyStringState(Accessor &styler, int i, int *nextIndex) {
|
static int GetPyStringState(Accessor &styler, int i, int *nextIndex) {
|
||||||
char ch = styler.SafeGetCharAt(i);
|
char ch = styler.SafeGetCharAt(i);
|
||||||
@@ -139,10 +83,18 @@ static int GetPyStringState(Accessor &styler, int i, int *nextIndex) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline bool IsAWordChar(int ch) {
|
||||||
|
return (ch < 0x80) && (isalnum(ch) || ch == '.' || ch == '_');
|
||||||
|
}
|
||||||
|
|
||||||
|
inline bool IsAWordStart(int ch) {
|
||||||
|
return (ch < 0x80) && (isalnum(ch) || ch == '_');
|
||||||
|
}
|
||||||
|
|
||||||
static void ColourisePyDoc(unsigned int startPos, int length, int initStyle,
|
static void ColourisePyDoc(unsigned int startPos, int length, int initStyle,
|
||||||
WordList *keywordlists[], Accessor &styler) {
|
WordList *keywordlists[], Accessor &styler) {
|
||||||
|
|
||||||
int lengthDoc = startPos + length;
|
int endPos = startPos + length;
|
||||||
|
|
||||||
// Backtrack to previous line in case need to fix its tab whinging
|
// Backtrack to previous line in case need to fix its tab whinging
|
||||||
int lineCurrent = styler.GetLine(startPos);
|
int lineCurrent = styler.GetLine(startPos);
|
||||||
@@ -156,32 +108,27 @@ static void ColourisePyDoc(unsigned int startPos, int length, int initStyle,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Python uses a different mask because bad indentation is marked by oring with 32
|
|
||||||
styler.StartAt(startPos, 127);
|
|
||||||
|
|
||||||
WordList &keywords = *keywordlists[0];
|
WordList &keywords = *keywordlists[0];
|
||||||
|
|
||||||
int whingeLevel = styler.GetPropertyInt("tab.timmy.whinge.level");
|
const int whingeLevel = styler.GetPropertyInt("tab.timmy.whinge.level");
|
||||||
char prevWord[200];
|
|
||||||
prevWord[0] = '\0';
|
|
||||||
if (length == 0)
|
|
||||||
return ;
|
|
||||||
|
|
||||||
int state = initStyle & 31;
|
initStyle = initStyle & 31;
|
||||||
|
if (initStyle == SCE_P_STRINGEOL) {
|
||||||
|
initStyle = SCE_P_DEFAULT;
|
||||||
|
}
|
||||||
|
|
||||||
int nextIndex = 0;
|
kwType kwLast = kwOther;
|
||||||
char chPrev = ' ';
|
|
||||||
char chPrev2 = ' ';
|
|
||||||
char chNext = styler[startPos];
|
|
||||||
styler.StartSegment(startPos);
|
|
||||||
bool atStartLine = true;
|
|
||||||
int spaceFlags = 0;
|
int spaceFlags = 0;
|
||||||
styler.IndentAmount(lineCurrent, &spaceFlags, IsPyComment);
|
styler.IndentAmount(lineCurrent, &spaceFlags, IsPyComment);
|
||||||
for (int i = startPos; i < lengthDoc; i++) {
|
|
||||||
|
|
||||||
if (atStartLine) {
|
// Python uses a different mask because bad indentation is marked by oring with 32
|
||||||
char chBad = static_cast<char>(64);
|
StyleContext sc(startPos, endPos-startPos, initStyle, styler, 0x7f);
|
||||||
char chGood = static_cast<char>(0);
|
|
||||||
|
for (; sc.More(); sc.Forward()) {
|
||||||
|
|
||||||
|
if (sc.atLineStart) {
|
||||||
|
const char chBad = static_cast<char>(64);
|
||||||
|
const char chGood = static_cast<char>(0);
|
||||||
char chFlags = chGood;
|
char chFlags = chGood;
|
||||||
if (whingeLevel == 1) {
|
if (whingeLevel == 1) {
|
||||||
chFlags = (spaceFlags & wsInconsistent) ? chBad : chGood;
|
chFlags = (spaceFlags & wsInconsistent) ? chBad : chGood;
|
||||||
@@ -192,132 +139,117 @@ static void ColourisePyDoc(unsigned int startPos, int length, int initStyle,
|
|||||||
} else if (whingeLevel == 4) {
|
} else if (whingeLevel == 4) {
|
||||||
chFlags = (spaceFlags & wsTab) ? chBad : chGood;
|
chFlags = (spaceFlags & wsTab) ? chBad : chGood;
|
||||||
}
|
}
|
||||||
styler.SetFlags(chFlags, static_cast<char>(state));
|
styler.SetFlags(chFlags, static_cast<char>(sc.state));
|
||||||
atStartLine = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
char ch = chNext;
|
if (sc.atLineEnd) {
|
||||||
chNext = styler.SafeGetCharAt(i + 1);
|
if ((sc.state == SCE_P_DEFAULT) ||
|
||||||
char chNext2 = styler.SafeGetCharAt(i + 2);
|
(sc.state == SCE_P_TRIPLE) ||
|
||||||
|
(sc.state == SCE_P_TRIPLEDOUBLE)) {
|
||||||
if ((ch == '\r' && chNext != '\n') || (ch == '\n') || (i == lengthDoc)) {
|
|
||||||
if ((state == SCE_P_DEFAULT) || (state == SCE_P_TRIPLE) || (state == SCE_P_TRIPLEDOUBLE)) {
|
|
||||||
// Perform colourisation of white space and triple quoted strings at end of each line to allow
|
// Perform colourisation of white space and triple quoted strings at end of each line to allow
|
||||||
// tab marking to work inside white space and triple quoted strings
|
// tab marking to work inside white space and triple quoted strings
|
||||||
styler.ColourTo(i, state);
|
sc.ForwardSetState(sc.state);
|
||||||
}
|
}
|
||||||
lineCurrent++;
|
lineCurrent++;
|
||||||
styler.IndentAmount(lineCurrent, &spaceFlags, IsPyComment);
|
styler.IndentAmount(lineCurrent, &spaceFlags, IsPyComment);
|
||||||
atStartLine = true;
|
if ((sc.state == SCE_P_STRING) || (sc.state == SCE_P_CHARACTER)) {
|
||||||
|
sc.ChangeState(SCE_P_STRINGEOL);
|
||||||
|
sc.ForwardSetState(SCE_P_DEFAULT);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (styler.IsLeadByte(ch)) {
|
// Check for a state end
|
||||||
chNext = styler.SafeGetCharAt(i + 2);
|
if (sc.state == SCE_P_OPERATOR) {
|
||||||
chPrev = ' ';
|
kwLast = kwOther;
|
||||||
chPrev2 = ' ';
|
sc.SetState(SCE_C_DEFAULT);
|
||||||
i += 1;
|
} else if (sc.state == SCE_P_NUMBER) {
|
||||||
continue;
|
if (!IsAWordChar(sc.ch)) {
|
||||||
|
sc.SetState(SCE_P_DEFAULT);
|
||||||
|
}
|
||||||
|
} else if (sc.state == SCE_P_WORD) {
|
||||||
|
if ((sc.ch == '.') || (!IsAWordChar(sc.ch))) {
|
||||||
|
char s[100];
|
||||||
|
sc.GetCurrent(s, sizeof(s));
|
||||||
|
int style = SCE_P_IDENTIFIER;
|
||||||
|
if ((kwLast == kwImport) && (strcmp(s, "as") == 0)) {
|
||||||
|
style = SCE_P_WORD;
|
||||||
|
} else if (keywords.InList(s)) {
|
||||||
|
style = SCE_P_WORD;
|
||||||
|
} else if (kwLast == kwClass) {
|
||||||
|
style = SCE_P_CLASSNAME;
|
||||||
|
} else if (kwLast == kwDef) {
|
||||||
|
style = SCE_P_DEFNAME;
|
||||||
|
}
|
||||||
|
sc.ChangeState(style);
|
||||||
|
sc.SetState(SCE_P_DEFAULT);
|
||||||
|
if (style == SCE_P_WORD) {
|
||||||
|
if (0 == strcmp(s, "class"))
|
||||||
|
kwLast = kwClass;
|
||||||
|
else if (0 == strcmp(s, "def"))
|
||||||
|
kwLast = kwDef;
|
||||||
|
else if (0 == strcmp(s, "import"))
|
||||||
|
kwLast = kwImport;
|
||||||
|
else
|
||||||
|
kwLast = kwOther;
|
||||||
|
} else if (style == SCE_P_CLASSNAME) {
|
||||||
|
kwLast = kwOther;
|
||||||
|
} else if (style == SCE_P_DEFNAME) {
|
||||||
|
kwLast = kwOther;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if ((sc.state == SCE_P_COMMENTLINE) || (sc.state == SCE_P_COMMENTBLOCK)) {
|
||||||
|
if (sc.ch == '\r' || sc.ch == '\n') {
|
||||||
|
sc.SetState(SCE_P_DEFAULT);
|
||||||
|
}
|
||||||
|
} else if ((sc.state == SCE_P_STRING) || (sc.state == SCE_P_CHARACTER)) {
|
||||||
|
if (sc.ch == '\\') {
|
||||||
|
if ((sc.chNext == '\r') && (sc.GetRelative(2) == '\n')) {
|
||||||
|
sc.Forward();
|
||||||
|
}
|
||||||
|
sc.Forward();
|
||||||
|
} else if ((sc.state == SCE_P_STRING) && (sc.ch == '\"')) {
|
||||||
|
sc.ForwardSetState(SCE_P_DEFAULT);
|
||||||
|
} else if ((sc.state == SCE_P_CHARACTER) && (sc.ch == '\'')) {
|
||||||
|
sc.ForwardSetState(SCE_P_DEFAULT);
|
||||||
|
}
|
||||||
|
} else if (sc.state == SCE_P_TRIPLE) {
|
||||||
|
if (sc.ch == '\\') {
|
||||||
|
sc.Forward();
|
||||||
|
} else if (sc.Match("\'\'\'")) {
|
||||||
|
sc.Forward();
|
||||||
|
sc.Forward();
|
||||||
|
sc.ForwardSetState(SCE_P_DEFAULT);
|
||||||
|
}
|
||||||
|
} else if (sc.state == SCE_P_TRIPLEDOUBLE) {
|
||||||
|
if (sc.ch == '\\') {
|
||||||
|
sc.Forward();
|
||||||
|
} else if (sc.Match("\"\"\"")) {
|
||||||
|
sc.Forward();
|
||||||
|
sc.Forward();
|
||||||
|
sc.ForwardSetState(SCE_P_DEFAULT);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (state == SCE_P_STRINGEOL) {
|
// Check for a new state starting character
|
||||||
if (ch != '\r' && ch != '\n') {
|
if (sc.state == SCE_P_DEFAULT) {
|
||||||
styler.ColourTo(i - 1, state);
|
if (isascii(sc.ch) && isoperator(static_cast<char>(sc.ch)) || sc.ch == '`') {
|
||||||
state = SCE_P_DEFAULT;
|
sc.SetState(SCE_P_OPERATOR);
|
||||||
|
} else if (sc.ch == '#') {
|
||||||
|
sc.SetState(sc.chNext == '#' ? SCE_P_COMMENTBLOCK : SCE_P_COMMENTLINE);
|
||||||
|
} else if (IsADigit(sc.ch) || (sc.ch == '.' && IsADigit(sc.chNext))) {
|
||||||
|
sc.SetState(SCE_P_NUMBER);
|
||||||
|
} else if (IsPyStringStart(sc.ch, sc.chNext, sc.GetRelative(2))) {
|
||||||
|
int nextIndex = 0;
|
||||||
|
sc.SetState(GetPyStringState(styler, sc.currentPos, &nextIndex));
|
||||||
|
while (nextIndex > (sc.currentPos+1)) {
|
||||||
|
sc.Forward();
|
||||||
}
|
}
|
||||||
}
|
} else if (IsAWordStart(sc.ch)) {
|
||||||
if (state == SCE_P_DEFAULT) {
|
sc.SetState(SCE_P_WORD);
|
||||||
if (IsPyWordStart(ch, chNext, chNext2)) {
|
|
||||||
styler.ColourTo(i - 1, state);
|
|
||||||
state = SCE_P_WORD;
|
|
||||||
} else if (ch == '#') {
|
|
||||||
styler.ColourTo(i - 1, state);
|
|
||||||
state = chNext == '#' ? SCE_P_COMMENTBLOCK : SCE_P_COMMENTLINE;
|
|
||||||
} else if (IsPyStringStart(ch, chNext, chNext2)) {
|
|
||||||
styler.ColourTo(i - 1, state);
|
|
||||||
state = GetPyStringState(styler, i, &nextIndex);
|
|
||||||
if (nextIndex != i + 1) {
|
|
||||||
i = nextIndex - 1;
|
|
||||||
ch = ' ';
|
|
||||||
chPrev = ' ';
|
|
||||||
chNext = styler.SafeGetCharAt(i + 1);
|
|
||||||
}
|
|
||||||
} else if (isoperator(ch)) {
|
|
||||||
styler.ColourTo(i - 1, state);
|
|
||||||
styler.ColourTo(i, SCE_P_OPERATOR);
|
|
||||||
}
|
|
||||||
} else if (state == SCE_P_WORD) {
|
|
||||||
if (!iswordchar(ch)) {
|
|
||||||
ClassifyWordPy(styler.GetStartSegment(), i - 1, keywords, styler, prevWord);
|
|
||||||
state = SCE_P_DEFAULT;
|
|
||||||
if (ch == '#') {
|
|
||||||
state = chNext == '#' ? SCE_P_COMMENTBLOCK : SCE_P_COMMENTLINE;
|
|
||||||
} else if (IsPyStringStart(ch, chNext, chNext2)) {
|
|
||||||
styler.ColourTo(i - 1, state);
|
|
||||||
state = GetPyStringState(styler, i, &nextIndex);
|
|
||||||
if (nextIndex != i + 1) {
|
|
||||||
i = nextIndex - 1;
|
|
||||||
ch = ' ';
|
|
||||||
chPrev = ' ';
|
|
||||||
chNext = styler.SafeGetCharAt(i + 1);
|
|
||||||
}
|
|
||||||
} else if (isoperator(ch)) {
|
|
||||||
styler.ColourTo(i, SCE_P_OPERATOR);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (state == SCE_P_COMMENTLINE || state == SCE_P_COMMENTBLOCK) {
|
|
||||||
if (ch == '\r' || ch == '\n') {
|
|
||||||
styler.ColourTo(i - 1, state);
|
|
||||||
state = SCE_P_DEFAULT;
|
|
||||||
}
|
|
||||||
} else if (state == SCE_P_STRING) {
|
|
||||||
if ((ch == '\r' || ch == '\n') && (chPrev != '\\')) {
|
|
||||||
styler.ColourTo(i - 1, state);
|
|
||||||
state = SCE_P_STRINGEOL;
|
|
||||||
} else if (ch == '\\') {
|
|
||||||
if (chNext == '\"' || chNext == '\'' || chNext == '\\') {
|
|
||||||
i++;
|
|
||||||
ch = chNext;
|
|
||||||
chNext = styler.SafeGetCharAt(i + 1);
|
|
||||||
}
|
|
||||||
} else if (ch == '\"') {
|
|
||||||
styler.ColourTo(i, state);
|
|
||||||
state = SCE_P_DEFAULT;
|
|
||||||
}
|
|
||||||
} else if (state == SCE_P_CHARACTER) {
|
|
||||||
if ((ch == '\r' || ch == '\n') && (chPrev != '\\')) {
|
|
||||||
styler.ColourTo(i - 1, state);
|
|
||||||
state = SCE_P_STRINGEOL;
|
|
||||||
} else if (ch == '\\') {
|
|
||||||
if (chNext == '\"' || chNext == '\'' || chNext == '\\') {
|
|
||||||
i++;
|
|
||||||
ch = chNext;
|
|
||||||
chNext = styler.SafeGetCharAt(i + 1);
|
|
||||||
}
|
|
||||||
} else if (ch == '\'') {
|
|
||||||
styler.ColourTo(i, state);
|
|
||||||
state = SCE_P_DEFAULT;
|
|
||||||
}
|
|
||||||
} else if (state == SCE_P_TRIPLE) {
|
|
||||||
if (ch == '\'' && chPrev == '\'' && chPrev2 == '\'') {
|
|
||||||
styler.ColourTo(i, state);
|
|
||||||
state = SCE_P_DEFAULT;
|
|
||||||
}
|
|
||||||
} else if (state == SCE_P_TRIPLEDOUBLE) {
|
|
||||||
if (ch == '\"' && chPrev == '\"' && chPrev2 == '\"') {
|
|
||||||
styler.ColourTo(i, state);
|
|
||||||
state = SCE_P_DEFAULT;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
chPrev2 = chPrev;
|
sc.Complete();
|
||||||
chPrev = ch;
|
|
||||||
}
|
|
||||||
if (state == SCE_P_WORD) {
|
|
||||||
ClassifyWordPy(styler.GetStartSegment(), lengthDoc, keywords, styler, prevWord);
|
|
||||||
} else {
|
|
||||||
styler.ColourTo(lengthDoc, state);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool IsCommentLine(int line, Accessor &styler) {
|
static bool IsCommentLine(int line, Accessor &styler) {
|
||||||
@@ -338,13 +270,14 @@ static bool IsQuoteLine(int line, Accessor &styler) {
|
|||||||
return ((style == SCE_P_TRIPLE) || (style== SCE_P_TRIPLEDOUBLE));
|
return ((style == SCE_P_TRIPLE) || (style== SCE_P_TRIPLEDOUBLE));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void FoldPyDoc(unsigned int startPos, int length, int /*initStyle - unused*/,
|
static void FoldPyDoc(unsigned int startPos, int length, int /*initStyle - unused*/,
|
||||||
WordList *[], Accessor &styler) {
|
WordList *[], Accessor &styler) {
|
||||||
int maxPos = startPos + length;
|
const int maxPos = startPos + length;
|
||||||
int maxLines = styler.GetLine(maxPos-1);
|
const int maxLines = styler.GetLine(maxPos-1); // Requested last line
|
||||||
|
const int docLines = styler.GetLine(styler.Length() - 1); // Available last line
|
||||||
bool foldComment = styler.GetPropertyInt("fold.comment.python");
|
const bool foldComment = styler.GetPropertyInt("fold.comment.python");
|
||||||
bool foldQuotes = styler.GetPropertyInt("fold.quotes.python");
|
const bool foldQuotes = styler.GetPropertyInt("fold.quotes.python");
|
||||||
|
|
||||||
// Backtrack to previous non-blank line so we can determine indent level
|
// Backtrack to previous non-blank line so we can determine indent level
|
||||||
// for any white space lines (needed esp. within triple quoted strings)
|
// for any white space lines (needed esp. within triple quoted strings)
|
||||||
@@ -363,8 +296,8 @@ static void FoldPyDoc(unsigned int startPos, int length, int /*initStyle - unuse
|
|||||||
}
|
}
|
||||||
int indentCurrentLevel = indentCurrent & SC_FOLDLEVELNUMBERMASK;
|
int indentCurrentLevel = indentCurrent & SC_FOLDLEVELNUMBERMASK;
|
||||||
|
|
||||||
|
// Set up initial loop state
|
||||||
startPos = styler.LineStart(lineCurrent);
|
startPos = styler.LineStart(lineCurrent);
|
||||||
// Set up initial state
|
|
||||||
int prev_state = SCE_P_DEFAULT & 31;
|
int prev_state = SCE_P_DEFAULT & 31;
|
||||||
if (lineCurrent >= 1)
|
if (lineCurrent >= 1)
|
||||||
prev_state = styler.StyleAt(startPos-1) & 31;
|
prev_state = styler.StyleAt(startPos-1) & 31;
|
||||||
@@ -374,21 +307,27 @@ static void FoldPyDoc(unsigned int startPos, int length, int /*initStyle - unuse
|
|||||||
prevComment = foldComment && IsCommentLine(lineCurrent - 1, styler);
|
prevComment = foldComment && IsCommentLine(lineCurrent - 1, styler);
|
||||||
|
|
||||||
// Process all characters to end of requested range or end of any triple quote
|
// Process all characters to end of requested range or end of any triple quote
|
||||||
// or comment that hangs over the end of the range
|
// or comment that hangs over the end of the range. Cap processing in all cases
|
||||||
while ((lineCurrent <= maxLines) || prevQuote || prevComment) {
|
// to end of document (in case of unclosed quote or comment at end).
|
||||||
|
while ((lineCurrent <= docLines) && ((lineCurrent <= maxLines) || prevQuote || prevComment)) {
|
||||||
|
|
||||||
// Gather info
|
// Gather info
|
||||||
int lev = indentCurrent;
|
int lev = indentCurrent;
|
||||||
int lineNext = lineCurrent + 1;
|
int lineNext = lineCurrent + 1;
|
||||||
|
int indentNext = indentCurrent;
|
||||||
|
int quote = false;
|
||||||
|
if (lineNext <= docLines) {
|
||||||
|
// Information about next line is only available if not at end of document
|
||||||
|
indentNext = styler.IndentAmount(lineNext, &spaceFlags, NULL);
|
||||||
int style = styler.StyleAt(styler.LineStart(lineNext)) & 31;
|
int style = styler.StyleAt(styler.LineStart(lineNext)) & 31;
|
||||||
int indentNext = styler.IndentAmount(lineNext, &spaceFlags, NULL);
|
quote = foldQuotes && ((style == SCE_P_TRIPLE) || (style== SCE_P_TRIPLEDOUBLE));
|
||||||
int quote = foldQuotes && ((style == SCE_P_TRIPLE) || (style== SCE_P_TRIPLEDOUBLE));
|
}
|
||||||
int quote_start = (quote && !prevQuote);
|
const int quote_start = (quote && !prevQuote);
|
||||||
int quote_continue = (quote && prevQuote);
|
const int quote_continue = (quote && prevQuote);
|
||||||
int comment = foldComment && IsCommentLine(lineCurrent, styler);
|
const int comment = foldComment && IsCommentLine(lineCurrent, styler);
|
||||||
int comment_start = (comment && !prevComment &&
|
const int comment_start = (comment && !prevComment && (lineNext <= docLines) &&
|
||||||
IsCommentLine(lineNext, styler) && (lev > SC_FOLDLEVELBASE));
|
IsCommentLine(lineNext, styler) && (lev > SC_FOLDLEVELBASE));
|
||||||
int comment_continue = (comment && prevComment);
|
const int comment_continue = (comment && prevComment);
|
||||||
if ((!quote || !prevQuote) && !comment)
|
if ((!quote || !prevQuote) && !comment)
|
||||||
indentCurrentLevel = indentCurrent & SC_FOLDLEVELNUMBERMASK;
|
indentCurrentLevel = indentCurrent & SC_FOLDLEVELNUMBERMASK;
|
||||||
if (quote)
|
if (quote)
|
||||||
@@ -411,22 +350,35 @@ static void FoldPyDoc(unsigned int startPos, int length, int /*initStyle - unuse
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Skip past any blank lines for next indent level info; we skip also comments
|
// Skip past any blank lines for next indent level info; we skip also comments
|
||||||
// starting in column 0 which effectively folds them into surrounding code
|
// starting in column 0 which effectively folds them into surrounding code rather
|
||||||
// rather than screwing up folding. Then set indent level on the lines
|
// than screwing up folding.
|
||||||
// we skipped to be same as maximum of current and next indent. This approach
|
const int saveIndentNext = indentNext;
|
||||||
// does a reasonable job of collapsing white space into surrounding code
|
|
||||||
// without getting confused by white space at the start of an indented level.
|
|
||||||
while (!quote &&
|
while (!quote &&
|
||||||
((indentNext & SC_FOLDLEVELWHITEFLAG) || styler[styler.LineStart(lineNext)] == '#') &&
|
(lineNext < docLines) &&
|
||||||
(lineNext < maxLines)) {
|
((indentNext & SC_FOLDLEVELWHITEFLAG) ||
|
||||||
int level = Platform::Maximum(indentCurrent, indentNext);
|
(lineNext <= docLines && styler[styler.LineStart(lineNext)] == '#'))) {
|
||||||
if (indentNext & SC_FOLDLEVELWHITEFLAG)
|
|
||||||
level = SC_FOLDLEVELWHITEFLAG | indentCurrentLevel;
|
|
||||||
styler.SetLevel(lineNext, level);
|
|
||||||
lineNext++;
|
lineNext++;
|
||||||
indentNext = styler.IndentAmount(lineNext, &spaceFlags, NULL);
|
indentNext = styler.IndentAmount(lineNext, &spaceFlags, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Next compute max indent level of current line and next non-blank line.
|
||||||
|
// This is the level to which we set all the intervening blank or comment lines.
|
||||||
|
const int skip_level = Platform::Maximum(indentCurrentLevel,
|
||||||
|
indentNext & SC_FOLDLEVELNUMBERMASK);
|
||||||
|
|
||||||
|
// Now set all the indent levels on the lines we skipped
|
||||||
|
int skipLine = lineCurrent + 1;
|
||||||
|
int skipIndentNext = saveIndentNext;
|
||||||
|
while (skipLine < lineNext) {
|
||||||
|
int skipLineLevel = skip_level;
|
||||||
|
if (skipIndentNext & SC_FOLDLEVELWHITEFLAG)
|
||||||
|
skipLineLevel = SC_FOLDLEVELWHITEFLAG | skipLineLevel;
|
||||||
|
styler.SetLevel(skipLine, skipLineLevel);
|
||||||
|
skipLine++;
|
||||||
|
skipIndentNext = styler.IndentAmount(skipLine, &spaceFlags, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
// Set fold header on non-quote/non-comment line
|
// Set fold header on non-quote/non-comment line
|
||||||
if (!quote && !comment && !(indentCurrent & SC_FOLDLEVELWHITEFLAG) ) {
|
if (!quote && !comment && !(indentCurrent & SC_FOLDLEVELWHITEFLAG) ) {
|
||||||
if ((indentCurrent & SC_FOLDLEVELNUMBERMASK) < (indentNext & SC_FOLDLEVELNUMBERMASK))
|
if ((indentCurrent & SC_FOLDLEVELNUMBERMASK) < (indentNext & SC_FOLDLEVELNUMBERMASK))
|
||||||
@@ -443,8 +395,9 @@ static void FoldPyDoc(unsigned int startPos, int length, int /*initStyle - unuse
|
|||||||
lineCurrent = lineNext;
|
lineCurrent = lineNext;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Make sure last line indent level is set too
|
// NOTE: Cannot set level of last line here because indentCurrent doesn't have
|
||||||
styler.SetLevel(lineCurrent, indentCurrent);
|
// header flag set; the loop above is crafted to take care of this case!
|
||||||
|
//styler.SetLevel(lineCurrent, indentCurrent);
|
||||||
}
|
}
|
||||||
|
|
||||||
LexerModule lmPython(SCLEX_PYTHON, ColourisePyDoc, "python", FoldPyDoc);
|
LexerModule lmPython(SCLEX_PYTHON, ColourisePyDoc, "python", FoldPyDoc);
|
||||||
|
@@ -40,7 +40,7 @@ static void DrawMinus(Surface *surface, int centreX, int centreY, int armSize, C
|
|||||||
surface->FillRectangle(rcH, fore);
|
surface->FillRectangle(rcH, fore);
|
||||||
}
|
}
|
||||||
|
|
||||||
void LineMarker::Draw(Surface *surface, PRectangle &rcWhole) {
|
void LineMarker::Draw(Surface *surface, PRectangle &rcWhole, Font &fontForCharacter) {
|
||||||
// Restrict most shapes a bit
|
// Restrict most shapes a bit
|
||||||
PRectangle rc = rcWhole;
|
PRectangle rc = rcWhole;
|
||||||
rc.top++;
|
rc.top++;
|
||||||
@@ -230,6 +230,15 @@ void LineMarker::Draw(Surface *surface, PRectangle &rcWhole) {
|
|||||||
surface->MoveTo(centreX, rcWhole.top);
|
surface->MoveTo(centreX, rcWhole.top);
|
||||||
surface->LineTo(centreX, centreY - blobSize);
|
surface->LineTo(centreX, centreY - blobSize);
|
||||||
|
|
||||||
|
} else if (markType >= SC_MARK_CHARACTER) {
|
||||||
|
char character[1];
|
||||||
|
character[0] = static_cast<char>(markType - SC_MARK_CHARACTER);
|
||||||
|
int width = surface->WidthText(fontForCharacter, character, 1);
|
||||||
|
rc.left += (rc.Width() - width) / 2;
|
||||||
|
rc.right = rc.left + width;
|
||||||
|
surface->DrawTextClipped(rc, fontForCharacter, rc.bottom - 2,
|
||||||
|
character, 1, fore.allocated, back.allocated);
|
||||||
|
|
||||||
} else { // SC_MARK_SHORTARROW
|
} else { // SC_MARK_SHORTARROW
|
||||||
Point pts[] = {
|
Point pts[] = {
|
||||||
Point(centreX, centreY + dimOn2),
|
Point(centreX, centreY + dimOn2),
|
||||||
|
@@ -20,7 +20,7 @@ public:
|
|||||||
fore = Colour(0,0,0);
|
fore = Colour(0,0,0);
|
||||||
back = Colour(0xff,0xff,0xff);
|
back = Colour(0xff,0xff,0xff);
|
||||||
}
|
}
|
||||||
void Draw(Surface *surface, PRectangle &rc);
|
void Draw(Surface *surface, PRectangle &rc, Font &fontForCharacter);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@@ -30,9 +30,8 @@
|
|||||||
* Modification history:
|
* Modification history:
|
||||||
*
|
*
|
||||||
* $Log$
|
* $Log$
|
||||||
* Revision 1.1 2001/09/01 03:05:24 RD
|
* Revision 1.2 2001/10/18 01:24:58 RD
|
||||||
* Upgraded to version 1.39 of Scintilla, and upated wxStyledTextCtrl
|
* Updated to version 1.40 of Scintilla
|
||||||
* accordingly.
|
|
||||||
*
|
*
|
||||||
* Revision 1.6 2001/04/29 13:32:10 nyamatongwe
|
* Revision 1.6 2001/04/29 13:32:10 nyamatongwe
|
||||||
* Addition of new target methods - versions of ReplaceTarget that take counted
|
* Addition of new target methods - versions of ReplaceTarget that take counted
|
||||||
|
@@ -35,6 +35,7 @@
|
|||||||
#include "ScintillaBase.h"
|
#include "ScintillaBase.h"
|
||||||
|
|
||||||
ScintillaBase::ScintillaBase() {
|
ScintillaBase::ScintillaBase() {
|
||||||
|
displayPopupMenu = true;
|
||||||
listType = 0;
|
listType = 0;
|
||||||
#ifdef SCI_LEXER
|
#ifdef SCI_LEXER
|
||||||
lexLanguage = SCLEX_CONTAINER;
|
lexLanguage = SCLEX_CONTAINER;
|
||||||
@@ -514,6 +515,10 @@ sptr_t ScintillaBase::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lPara
|
|||||||
InvalidateStyleRedraw();
|
InvalidateStyleRedraw();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case SCI_USEPOPUP:
|
||||||
|
displayPopupMenu = wParam;
|
||||||
|
break;
|
||||||
|
|
||||||
#ifdef SCI_LEXER
|
#ifdef SCI_LEXER
|
||||||
case SCI_SETLEXER:
|
case SCI_SETLEXER:
|
||||||
SetLexer(wParam);
|
SetLexer(wParam);
|
||||||
|
@@ -30,6 +30,7 @@ protected:
|
|||||||
idcmdSelectAll=16
|
idcmdSelectAll=16
|
||||||
};
|
};
|
||||||
|
|
||||||
|
bool displayPopupMenu;
|
||||||
Menu popup;
|
Menu popup;
|
||||||
AutoComplete ac;
|
AutoComplete ac;
|
||||||
|
|
||||||
@@ -42,7 +43,7 @@ protected:
|
|||||||
int lexLanguage;
|
int lexLanguage;
|
||||||
LexerModule *lexCurrent;
|
LexerModule *lexCurrent;
|
||||||
PropSet props;
|
PropSet props;
|
||||||
enum {numWordLists=5};
|
enum {numWordLists=6};
|
||||||
WordList *keyWordLists[numWordLists+1];
|
WordList *keyWordLists[numWordLists+1];
|
||||||
void SetLexer(uptr_t wParam);
|
void SetLexer(uptr_t wParam);
|
||||||
void SetLexerLanguage(const char *languageName);
|
void SetLexerLanguage(const char *languageName);
|
||||||
|
51
contrib/src/stc/scintilla/src/StyleContext.cxx
Normal file
51
contrib/src/stc/scintilla/src/StyleContext.cxx
Normal file
@@ -0,0 +1,51 @@
|
|||||||
|
// Scintilla source code edit control
|
||||||
|
/** @file StyleContext.cxx
|
||||||
|
** Lexer infrastructure.
|
||||||
|
**/
|
||||||
|
// Copyright 1998-2001 by Neil Hodgson <neilh@scintilla.org>
|
||||||
|
// This file is in the public domain.
|
||||||
|
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <ctype.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
#include "Platform.h"
|
||||||
|
|
||||||
|
#include "PropSet.h"
|
||||||
|
#include "Accessor.h"
|
||||||
|
#include "StyleContext.h"
|
||||||
|
|
||||||
|
static void getRange(unsigned int start,
|
||||||
|
unsigned int end,
|
||||||
|
Accessor &styler,
|
||||||
|
char *s,
|
||||||
|
unsigned int len) {
|
||||||
|
unsigned int i = 0;
|
||||||
|
while ((i < end - start + 1) && (i < len-1)) {
|
||||||
|
s[i] = styler[start + i];
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
s[i] = '\0';
|
||||||
|
}
|
||||||
|
|
||||||
|
void StyleContext::GetCurrent(char *s, int len) {
|
||||||
|
getRange(styler.GetStartSegment(), currentPos - 1, styler, s, len);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void getRangeLowered(unsigned int start,
|
||||||
|
unsigned int end,
|
||||||
|
Accessor &styler,
|
||||||
|
char *s,
|
||||||
|
unsigned int len) {
|
||||||
|
unsigned int i = 0;
|
||||||
|
while ((i < end - start + 1) && (i < len-1)) {
|
||||||
|
s[i] = static_cast<char>(tolower(styler[start + i]));
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
s[i] = '\0';
|
||||||
|
}
|
||||||
|
|
||||||
|
void StyleContext::GetCurrentLowered(char *s, int len) {
|
||||||
|
getRangeLowered(styler.GetStartSegment(), currentPos - 1, styler, s, len);
|
||||||
|
}
|
127
contrib/src/stc/scintilla/src/StyleContext.h
Normal file
127
contrib/src/stc/scintilla/src/StyleContext.h
Normal file
@@ -0,0 +1,127 @@
|
|||||||
|
// Scintilla source code edit control
|
||||||
|
/** @file StyleContext.cxx
|
||||||
|
** Lexer infrastructure.
|
||||||
|
**/
|
||||||
|
// Copyright 1998-2001 by Neil Hodgson <neilh@scintilla.org>
|
||||||
|
// This file is in the public domain.
|
||||||
|
|
||||||
|
// All languages handled so far can treat all characters >= 0x80 as one class
|
||||||
|
// which just continues the current token or starts an identifier if in default.
|
||||||
|
// DBCS treated specially as the second character can be < 0x80 and hence
|
||||||
|
// syntactically significant. UTF-8 avoids this as all trail bytes are >= 0x80
|
||||||
|
class StyleContext {
|
||||||
|
Accessor &styler;
|
||||||
|
int endPos;
|
||||||
|
StyleContext& operator=(const StyleContext&) {
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
public:
|
||||||
|
int currentPos;
|
||||||
|
bool atLineStart;
|
||||||
|
bool atLineEnd;
|
||||||
|
int state;
|
||||||
|
int chPrev;
|
||||||
|
int ch;
|
||||||
|
int chNext;
|
||||||
|
|
||||||
|
StyleContext(unsigned int startPos, int length,
|
||||||
|
int initStyle, Accessor &styler_, char chMask=31) :
|
||||||
|
styler(styler_),
|
||||||
|
endPos(startPos + length),
|
||||||
|
currentPos(startPos),
|
||||||
|
atLineStart(true),
|
||||||
|
atLineEnd(false),
|
||||||
|
state(initStyle),
|
||||||
|
chPrev(0),
|
||||||
|
ch(0),
|
||||||
|
chNext(0) {
|
||||||
|
styler.StartAt(startPos, chMask);
|
||||||
|
styler.StartSegment(startPos);
|
||||||
|
int pos = currentPos;
|
||||||
|
ch = static_cast<unsigned char>(styler.SafeGetCharAt(pos));
|
||||||
|
if (styler.IsLeadByte(static_cast<char>(ch))) {
|
||||||
|
pos++;
|
||||||
|
ch = ch << 8;
|
||||||
|
ch |= static_cast<unsigned char>(styler.SafeGetCharAt(pos));
|
||||||
|
}
|
||||||
|
chNext = static_cast<unsigned char>(styler.SafeGetCharAt(pos+1));
|
||||||
|
if (styler.IsLeadByte(static_cast<char>(chNext))) {
|
||||||
|
chNext = chNext << 8;
|
||||||
|
chNext |= static_cast<unsigned char>(styler.SafeGetCharAt(pos+2));
|
||||||
|
}
|
||||||
|
atLineEnd = (ch == '\r' && chNext != '\n') || (ch == '\n') || (currentPos >= endPos);
|
||||||
|
}
|
||||||
|
void Complete() {
|
||||||
|
styler.ColourTo(currentPos - 1, state);
|
||||||
|
}
|
||||||
|
bool More() {
|
||||||
|
return currentPos <= endPos;
|
||||||
|
}
|
||||||
|
void Forward() {
|
||||||
|
atLineStart = atLineEnd;
|
||||||
|
// A lot of this is repeated from the constructor - TODO: merge code
|
||||||
|
chPrev = ch;
|
||||||
|
currentPos++;
|
||||||
|
if (ch >= 0x100)
|
||||||
|
currentPos++;
|
||||||
|
ch = chNext;
|
||||||
|
chNext = static_cast<unsigned char>(styler.SafeGetCharAt(currentPos+1));
|
||||||
|
if (styler.IsLeadByte(static_cast<char>(chNext))) {
|
||||||
|
chNext = chNext << 8;
|
||||||
|
chNext |= static_cast<unsigned char>(styler.SafeGetCharAt(currentPos + 2));
|
||||||
|
}
|
||||||
|
// Trigger on CR only (Mac style) or either on LF from CR+LF (Dos/Win) or on LF alone (Unix)
|
||||||
|
// Avoid triggering two times on Dos/Win
|
||||||
|
// End of line
|
||||||
|
atLineEnd = (ch == '\r' && chNext != '\n') || (ch == '\n') || (currentPos >= endPos);
|
||||||
|
}
|
||||||
|
void ChangeState(int state_) {
|
||||||
|
state = state_;
|
||||||
|
}
|
||||||
|
void SetState(int state_) {
|
||||||
|
styler.ColourTo(currentPos - 1, state);
|
||||||
|
state = state_;
|
||||||
|
}
|
||||||
|
void ForwardSetState(int state_) {
|
||||||
|
Forward();
|
||||||
|
styler.ColourTo(currentPos - 1, state);
|
||||||
|
state = state_;
|
||||||
|
}
|
||||||
|
int LengthCurrent() {
|
||||||
|
return currentPos - styler.GetStartSegment();
|
||||||
|
}
|
||||||
|
int GetRelative(int n) {
|
||||||
|
return styler.SafeGetCharAt(currentPos+n);
|
||||||
|
}
|
||||||
|
bool Match(char ch0) {
|
||||||
|
return ch == ch0;
|
||||||
|
}
|
||||||
|
bool Match(char ch0, char ch1) {
|
||||||
|
return (ch == ch0) && (chNext == ch1);
|
||||||
|
}
|
||||||
|
bool Match(const char *s) {
|
||||||
|
if (ch != *s)
|
||||||
|
return false;
|
||||||
|
s++;
|
||||||
|
if (chNext != *s)
|
||||||
|
return false;
|
||||||
|
s++;
|
||||||
|
for (int n=2; *s; n++) {
|
||||||
|
if (*s != styler.SafeGetCharAt(currentPos+n))
|
||||||
|
return false;
|
||||||
|
s++;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
// Non-inline
|
||||||
|
void GetCurrent(char *s, int len);
|
||||||
|
void GetCurrentLowered(char *s, int len);
|
||||||
|
};
|
||||||
|
|
||||||
|
inline bool IsASpace(unsigned int ch) {
|
||||||
|
return (ch == ' ') || ((ch >= 0x09) && (ch <= 0x0d));
|
||||||
|
}
|
||||||
|
|
||||||
|
inline bool IsADigit(unsigned int ch) {
|
||||||
|
return (ch >= '0') && (ch <= '9');
|
||||||
|
}
|
@@ -32,6 +32,7 @@ int wxForceScintillaLexers(void)
|
|||||||
extern LexerModule lmAVE;
|
extern LexerModule lmAVE;
|
||||||
extern LexerModule lmConf;
|
extern LexerModule lmConf;
|
||||||
extern LexerModule lmCPP;
|
extern LexerModule lmCPP;
|
||||||
|
extern LexerModule lmNncrontab;
|
||||||
extern LexerModule lmEiffel;
|
extern LexerModule lmEiffel;
|
||||||
extern LexerModule lmHTML;
|
extern LexerModule lmHTML;
|
||||||
extern LexerModule lmLISP;
|
extern LexerModule lmLISP;
|
||||||
@@ -48,6 +49,7 @@ int wxForceScintillaLexers(void)
|
|||||||
&& &lmAVE
|
&& &lmAVE
|
||||||
&& &lmConf
|
&& &lmConf
|
||||||
&& &lmCPP
|
&& &lmCPP
|
||||||
|
&& &lmNncrontab
|
||||||
&& &lmEiffel
|
&& &lmEiffel
|
||||||
&& &lmHTML
|
&& &lmHTML
|
||||||
&& &lmLISP
|
&& &lmLISP
|
||||||
@@ -1202,6 +1204,7 @@ int wxStyledTextCtrl::GetTargetEnd() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Replace the target text with the argument text.
|
// Replace the target text with the argument text.
|
||||||
|
// Text is counted so it can contain nulls.
|
||||||
// Returns the length of the replacement text.
|
// Returns the length of the replacement text.
|
||||||
|
|
||||||
int wxStyledTextCtrl::ReplaceTarget(const wxString& text) {
|
int wxStyledTextCtrl::ReplaceTarget(const wxString& text) {
|
||||||
@@ -1210,6 +1213,7 @@ int wxStyledTextCtrl::GetTargetEnd() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Replace the target text with the argument text after \d processing.
|
// Replace the target text with the argument text after \d processing.
|
||||||
|
// Text is counted so it can contain nulls.
|
||||||
// Looks for \d where d is between 1 and 9 and replaces these with the strings
|
// Looks for \d where d is between 1 and 9 and replaces these with the strings
|
||||||
// matched in the last search operation which were surrounded by \( and \).
|
// matched in the last search operation which were surrounded by \( and \).
|
||||||
// Returns the length of the replacement text including any change
|
// Returns the length of the replacement text including any change
|
||||||
@@ -1221,7 +1225,7 @@ int wxStyledTextCtrl::GetTargetEnd() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Search for a counted string in the target and set the target to the found
|
// Search for a counted string in the target and set the target to the found
|
||||||
// range.
|
// range. Text is counted so it can contain nulls.
|
||||||
// Returns length of range or -1 for failure in which case target is not moved.
|
// Returns length of range or -1 for failure in which case target is not moved.
|
||||||
|
|
||||||
int wxStyledTextCtrl::SearchInTarget(const wxString& text) {
|
int wxStyledTextCtrl::SearchInTarget(const wxString& text) {
|
||||||
|
@@ -32,6 +32,7 @@ int wxForceScintillaLexers(void)
|
|||||||
extern LexerModule lmAVE;
|
extern LexerModule lmAVE;
|
||||||
extern LexerModule lmConf;
|
extern LexerModule lmConf;
|
||||||
extern LexerModule lmCPP;
|
extern LexerModule lmCPP;
|
||||||
|
extern LexerModule lmNncrontab;
|
||||||
extern LexerModule lmEiffel;
|
extern LexerModule lmEiffel;
|
||||||
extern LexerModule lmHTML;
|
extern LexerModule lmHTML;
|
||||||
extern LexerModule lmLISP;
|
extern LexerModule lmLISP;
|
||||||
@@ -48,6 +49,7 @@ int wxForceScintillaLexers(void)
|
|||||||
&& &lmAVE
|
&& &lmAVE
|
||||||
&& &lmConf
|
&& &lmConf
|
||||||
&& &lmCPP
|
&& &lmCPP
|
||||||
|
&& &lmNncrontab
|
||||||
&& &lmEiffel
|
&& &lmEiffel
|
||||||
&& &lmHTML
|
&& &lmHTML
|
||||||
&& &lmLISP
|
&& &lmLISP
|
||||||
|
@@ -72,6 +72,7 @@
|
|||||||
#define wxSTC_MARK_CIRCLEPLUSCONNECTED 19
|
#define wxSTC_MARK_CIRCLEPLUSCONNECTED 19
|
||||||
#define wxSTC_MARK_CIRCLEMINUS 20
|
#define wxSTC_MARK_CIRCLEMINUS 20
|
||||||
#define wxSTC_MARK_CIRCLEMINUSCONNECTED 21
|
#define wxSTC_MARK_CIRCLEMINUSCONNECTED 21
|
||||||
|
#define wxSTC_MARK_CHARACTER 10000
|
||||||
|
|
||||||
// Markers used for outlining column
|
// Markers used for outlining column
|
||||||
#define wxSTC_MARKNUM_FOLDEREND 25
|
#define wxSTC_MARKNUM_FOLDEREND 25
|
||||||
@@ -83,12 +84,16 @@
|
|||||||
#define wxSTC_MARKNUM_FOLDEROPEN 31
|
#define wxSTC_MARKNUM_FOLDEROPEN 31
|
||||||
#define wxSTC_MARGIN_SYMBOL 0
|
#define wxSTC_MARGIN_SYMBOL 0
|
||||||
#define wxSTC_MARGIN_NUMBER 1
|
#define wxSTC_MARGIN_NUMBER 1
|
||||||
|
|
||||||
|
// Styles in range 32..37 are predefined for parts of the UI and are not used as normal styles.
|
||||||
|
// Styles 38 and 39 are for future use.
|
||||||
#define wxSTC_STYLE_DEFAULT 32
|
#define wxSTC_STYLE_DEFAULT 32
|
||||||
#define wxSTC_STYLE_LINENUMBER 33
|
#define wxSTC_STYLE_LINENUMBER 33
|
||||||
#define wxSTC_STYLE_BRACELIGHT 34
|
#define wxSTC_STYLE_BRACELIGHT 34
|
||||||
#define wxSTC_STYLE_BRACEBAD 35
|
#define wxSTC_STYLE_BRACEBAD 35
|
||||||
#define wxSTC_STYLE_CONTROLCHAR 36
|
#define wxSTC_STYLE_CONTROLCHAR 36
|
||||||
#define wxSTC_STYLE_INDENTGUIDE 37
|
#define wxSTC_STYLE_INDENTGUIDE 37
|
||||||
|
#define wxSTC_STYLE_LASTPREDEFINED 39
|
||||||
#define wxSTC_STYLE_MAX 127
|
#define wxSTC_STYLE_MAX 127
|
||||||
|
|
||||||
// Character set identifiers are used in StyleSetCharacterSet.
|
// Character set identifiers are used in StyleSetCharacterSet.
|
||||||
@@ -295,6 +300,7 @@
|
|||||||
#define wxSTC_LEX_EIFFEL 23
|
#define wxSTC_LEX_EIFFEL 23
|
||||||
#define wxSTC_LEX_EIFFELKW 24
|
#define wxSTC_LEX_EIFFELKW 24
|
||||||
#define wxSTC_LEX_TCL 25
|
#define wxSTC_LEX_TCL 25
|
||||||
|
#define wxSTC_LEX_NNCRONTAB 26
|
||||||
|
|
||||||
// When a lexer specifies its language as SCLEX_AUTOMATIC it receives a
|
// When a lexer specifies its language as SCLEX_AUTOMATIC it receives a
|
||||||
// value assigned in sequence from SCLEX_AUTOMATIC+1.
|
// value assigned in sequence from SCLEX_AUTOMATIC+1.
|
||||||
@@ -334,6 +340,8 @@
|
|||||||
#define wxSTC_C_REGEX 14
|
#define wxSTC_C_REGEX 14
|
||||||
#define wxSTC_C_COMMENTLINEDOC 15
|
#define wxSTC_C_COMMENTLINEDOC 15
|
||||||
#define wxSTC_C_WORD2 16
|
#define wxSTC_C_WORD2 16
|
||||||
|
#define wxSTC_C_COMMENTDOCKEYWORD 17
|
||||||
|
#define wxSTC_C_COMMENTDOCKEYWORDERROR 18
|
||||||
|
|
||||||
// Lexical states for SCLEX_HTML, SCLEX_XML
|
// Lexical states for SCLEX_HTML, SCLEX_XML
|
||||||
#define wxSTC_H_DEFAULT 0
|
#define wxSTC_H_DEFAULT 0
|
||||||
@@ -365,7 +373,17 @@
|
|||||||
#define wxSTC_H_XCCOMMENT 20
|
#define wxSTC_H_XCCOMMENT 20
|
||||||
|
|
||||||
// SGML
|
// SGML
|
||||||
#define wxSTC_H_SGML 21
|
#define wxSTC_H_SGML_DEFAULT 21
|
||||||
|
#define wxSTC_H_SGML_COMMAND 22
|
||||||
|
#define wxSTC_H_SGML_1ST_PARAM 23
|
||||||
|
#define wxSTC_H_SGML_DOUBLESTRING 24
|
||||||
|
#define wxSTC_H_SGML_SIMPLESTRING 25
|
||||||
|
#define wxSTC_H_SGML_ERROR 26
|
||||||
|
#define wxSTC_H_SGML_SPECIAL 27
|
||||||
|
#define wxSTC_H_SGML_ENTITY 28
|
||||||
|
#define wxSTC_H_SGML_COMMENT 29
|
||||||
|
#define wxSTC_H_SGML_1ST_PARAM_COMMENT 30
|
||||||
|
#define wxSTC_H_SGML_BLOCK_DEFAULT 31
|
||||||
|
|
||||||
// Embedded Javascript
|
// Embedded Javascript
|
||||||
#define wxSTC_HJ_START 40
|
#define wxSTC_HJ_START 40
|
||||||
@@ -604,6 +622,19 @@
|
|||||||
#define wxSTC_EIFFEL_IDENTIFIER 7
|
#define wxSTC_EIFFEL_IDENTIFIER 7
|
||||||
#define wxSTC_EIFFEL_STRINGEOL 8
|
#define wxSTC_EIFFEL_STRINGEOL 8
|
||||||
|
|
||||||
|
// Lexical states for the SCLEX_NNCRONTAB (nnCron crontab Lexer)
|
||||||
|
#define wxSTC_NNCRONTAB_DEFAULT 0
|
||||||
|
#define wxSTC_NNCRONTAB_COMMENT 1
|
||||||
|
#define wxSTC_NNCRONTAB_TASK 2
|
||||||
|
#define wxSTC_NNCRONTAB_SECTION 3
|
||||||
|
#define wxSTC_NNCRONTAB_KEYWORD 4
|
||||||
|
#define wxSTC_NNCRONTAB_MODIFIER 5
|
||||||
|
#define wxSTC_NNCRONTAB_ASTERISK 6
|
||||||
|
#define wxSTC_NNCRONTAB_NUMBER 7
|
||||||
|
#define wxSTC_NNCRONTAB_STRING 8
|
||||||
|
#define wxSTC_NNCRONTAB_ENVIRONMENT 9
|
||||||
|
#define wxSTC_NNCRONTAB_IDENTIFIER 10
|
||||||
|
|
||||||
// END of generated section
|
// END of generated section
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
// Others
|
// Others
|
||||||
@@ -1223,10 +1254,12 @@ public:
|
|||||||
int GetTargetEnd();
|
int GetTargetEnd();
|
||||||
|
|
||||||
// Replace the target text with the argument text.
|
// Replace the target text with the argument text.
|
||||||
|
// Text is counted so it can contain nulls.
|
||||||
// Returns the length of the replacement text.
|
// Returns the length of the replacement text.
|
||||||
int ReplaceTarget(const wxString& text);
|
int ReplaceTarget(const wxString& text);
|
||||||
|
|
||||||
// Replace the target text with the argument text after \d processing.
|
// Replace the target text with the argument text after \d processing.
|
||||||
|
// Text is counted so it can contain nulls.
|
||||||
// Looks for \d where d is between 1 and 9 and replaces these with the strings
|
// Looks for \d where d is between 1 and 9 and replaces these with the strings
|
||||||
// matched in the last search operation which were surrounded by \( and \).
|
// matched in the last search operation which were surrounded by \( and \).
|
||||||
// Returns the length of the replacement text including any change
|
// Returns the length of the replacement text including any change
|
||||||
@@ -1234,7 +1267,7 @@ public:
|
|||||||
int ReplaceTargetRE(const wxString& text);
|
int ReplaceTargetRE(const wxString& text);
|
||||||
|
|
||||||
// Search for a counted string in the target and set the target to the found
|
// Search for a counted string in the target and set the target to the found
|
||||||
// range.
|
// range. Text is counted so it can contain nulls.
|
||||||
// Returns length of range or -1 for failure in which case target is not moved.
|
// Returns length of range or -1 for failure in which case target is not moved.
|
||||||
int SearchInTarget(const wxString& text);
|
int SearchInTarget(const wxString& text);
|
||||||
|
|
||||||
|
@@ -37,6 +37,7 @@ OBJECTS=PlatWX.o ScintillaWX.o stc.o \
|
|||||||
LexAda.o \
|
LexAda.o \
|
||||||
LexCPP.o \
|
LexCPP.o \
|
||||||
LexConf.o \
|
LexConf.o \
|
||||||
|
LexCrontab.o \
|
||||||
LexEiffel.o \
|
LexEiffel.o \
|
||||||
LexHTML.o \
|
LexHTML.o \
|
||||||
LexLisp.o \
|
LexLisp.o \
|
||||||
@@ -53,6 +54,7 @@ OBJECTS=PlatWX.o ScintillaWX.o stc.o \
|
|||||||
RESearch.o \
|
RESearch.o \
|
||||||
ScintillaBase.o \
|
ScintillaBase.o \
|
||||||
Style.o \
|
Style.o \
|
||||||
|
StyleContext.o \
|
||||||
UniConversion.o \
|
UniConversion.o \
|
||||||
ViewStyle.o \
|
ViewStyle.o \
|
||||||
WindowAccessor.o \
|
WindowAccessor.o \
|
||||||
|
@@ -531,24 +531,20 @@ ListBox::~ListBox() {
|
|||||||
|
|
||||||
void ListBox::Create(Window &parent, int ctrlID) {
|
void ListBox::Create(Window &parent, int ctrlID) {
|
||||||
id = new wxSTCListBox(parent.id, ctrlID);
|
id = new wxSTCListBox(parent.id, ctrlID);
|
||||||
// id = new wxListBox(parent.id, ctrlID, wxDefaultPosition, wxDefaultSize,
|
|
||||||
// 0, NULL, wxLB_SINGLE | wxLB_SORT | wxSIMPLE_BORDER);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ListBox::SetVisibleRows(int rows) {
|
void ListBox::SetVisibleRows(int rows) {
|
||||||
desiredVisibleRows = rows;
|
desiredVisibleRows = rows;
|
||||||
printf("SetVisibleRows: %d\n", rows);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
PRectangle ListBox::GetDesiredRect() {
|
PRectangle ListBox::GetDesiredRect() {
|
||||||
wxSize sz = ((wxListBox*)id)->GetBestSize();
|
wxSize sz = ((wxListBox*)id)->GetBestSize();
|
||||||
printf("GetDesiredRect: %d, %d\n", sz.x, sz.y);
|
|
||||||
PRectangle rc;
|
PRectangle rc;
|
||||||
rc.top = 0;
|
rc.top = 0;
|
||||||
rc.left = 0;
|
rc.left = 0;
|
||||||
if (sz.x > 400)
|
if (sz.x > 400)
|
||||||
sz.x = 400;
|
sz.x = 400;
|
||||||
if (sz.y > 150)
|
if (sz.y > 150) // TODO: Use desiredVisibleRows??
|
||||||
sz.y = 150;
|
sz.y = 150;
|
||||||
rc.right = sz.x;
|
rc.right = sz.x;
|
||||||
rc.bottom = sz.y;
|
rc.bottom = sz.y;
|
||||||
@@ -592,13 +588,7 @@ int ListBox::GetSelection() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int ListBox::Find(const char *prefix) {
|
int ListBox::Find(const char *prefix) {
|
||||||
if (prefix) {
|
// No longer used
|
||||||
for (int x=0; x < ((wxListBox*)id)->GetCount(); x++) {
|
|
||||||
wxString text = ((wxListBox*)id)->GetString(x);
|
|
||||||
if (text.StartsWith(prefix))
|
|
||||||
return x;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -122,9 +122,10 @@ void ScintillaWX::Finalise() {
|
|||||||
|
|
||||||
void ScintillaWX::StartDrag() {
|
void ScintillaWX::StartDrag() {
|
||||||
wxDropSource source(wMain.GetID());
|
wxDropSource source(wMain.GetID());
|
||||||
wxTextDataObject data(dragChars);
|
wxTextDataObject data(wxString(drag.s, drag.len));
|
||||||
wxDragResult result;
|
wxDragResult result;
|
||||||
|
|
||||||
|
dropWentOutside = true;
|
||||||
source.SetData(data);
|
source.SetData(data);
|
||||||
result = source.DoDragDrop(TRUE);
|
result = source.DoDragDrop(TRUE);
|
||||||
if (result == wxDragMove && dropWentOutside)
|
if (result == wxDragMove && dropWentOutside)
|
||||||
@@ -217,9 +218,10 @@ void ScintillaWX::NotifyParent(SCNotification scn) {
|
|||||||
|
|
||||||
void ScintillaWX::Copy() {
|
void ScintillaWX::Copy() {
|
||||||
if (currentPos != anchor) {
|
if (currentPos != anchor) {
|
||||||
char* text = CopySelectionRange();
|
SelectionText st;
|
||||||
|
CopySelectionRange(&st);
|
||||||
wxTheClipboard->Open();
|
wxTheClipboard->Open();
|
||||||
wxTheClipboard->SetData(new wxTextDataObject(text));
|
wxTheClipboard->SetData(new wxTextDataObject(wxString(st.s, st.len)));
|
||||||
wxTheClipboard->Close();
|
wxTheClipboard->Close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -494,14 +496,15 @@ bool ScintillaWX::DoDropText(long x, long y, const wxString& data) {
|
|||||||
|
|
||||||
|
|
||||||
wxDragResult ScintillaWX::DoDragEnter(wxCoord x, wxCoord y, wxDragResult def) {
|
wxDragResult ScintillaWX::DoDragEnter(wxCoord x, wxCoord y, wxDragResult def) {
|
||||||
return def;
|
dragResult = def;
|
||||||
|
return dragResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
wxDragResult ScintillaWX::DoDragOver(wxCoord x, wxCoord y, wxDragResult def) {
|
wxDragResult ScintillaWX::DoDragOver(wxCoord x, wxCoord y, wxDragResult def) {
|
||||||
SetDragPosition(PositionFromLocation(Point(x, y)));
|
SetDragPosition(PositionFromLocation(Point(x, y)));
|
||||||
dragResult = def;
|
dragResult = def;
|
||||||
return def;
|
return dragResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -32,19 +32,28 @@ OBJECTS = \
|
|||||||
Indicator.obj \
|
Indicator.obj \
|
||||||
KeyMap.obj \
|
KeyMap.obj \
|
||||||
KeyWords.obj \
|
KeyWords.obj \
|
||||||
|
LexAVE.obj \
|
||||||
|
LexAda.obj \
|
||||||
LexCPP.obj \
|
LexCPP.obj \
|
||||||
|
LexConf.obj \
|
||||||
|
LexCrontab.obj \
|
||||||
|
LexEiffel.obj \
|
||||||
LexHTML.obj \
|
LexHTML.obj \
|
||||||
|
LexLisp.obj \
|
||||||
LexLua.obj \
|
LexLua.obj \
|
||||||
LexOthers.obj \
|
LexOthers.obj \
|
||||||
|
LexPascal.obj \
|
||||||
LexPerl.obj \
|
LexPerl.obj \
|
||||||
LexPython.obj \
|
LexPython.obj \
|
||||||
|
LexRuby.obj \
|
||||||
LexSQL.obj \
|
LexSQL.obj \
|
||||||
LexVB.obj \
|
LexVB.obj \
|
||||||
LineMarker.obj \
|
LineMarker.obj \
|
||||||
PosRegExp.obj \
|
|
||||||
PropSet.obj \
|
PropSet.obj \
|
||||||
|
RESearch.obj \
|
||||||
ScintillaBase.obj \
|
ScintillaBase.obj \
|
||||||
Style.obj \
|
Style.obj \
|
||||||
|
StyleContext.obj \
|
||||||
UniConversion.obj \
|
UniConversion.obj \
|
||||||
ViewStyle.obj \
|
ViewStyle.obj \
|
||||||
WindowAccessor.obj \
|
WindowAccessor.obj \
|
||||||
|
@@ -13,29 +13,39 @@ OBJECTS = \
|
|||||||
$(S)/AutoComplete.$(OBJSUFF) \
|
$(S)/AutoComplete.$(OBJSUFF) \
|
||||||
$(S)/CallTip.$(OBJSUFF) \
|
$(S)/CallTip.$(OBJSUFF) \
|
||||||
$(S)/CellBuffer.$(OBJSUFF) \
|
$(S)/CellBuffer.$(OBJSUFF) \
|
||||||
$(S)/ContractionState.$(OBJSUFF)\
|
$(S)/ContractionState.$(OBJSUFF) \
|
||||||
$(S)/Document.$(OBJSUFF) \
|
$(S)/Document.$(OBJSUFF) \
|
||||||
|
$(S)/DocumentAccessor.$(OBJSUFF) \
|
||||||
$(S)/Editor.$(OBJSUFF) \
|
$(S)/Editor.$(OBJSUFF) \
|
||||||
$(S)/Indicator.$(OBJSUFF) \
|
$(S)/Indicator.$(OBJSUFF) \
|
||||||
$(S)/KeyMap.$(OBJSUFF) \
|
$(S)/KeyMap.$(OBJSUFF) \
|
||||||
$(S)/KeyWords.$(OBJSUFF) \
|
$(S)/KeyWords.$(OBJSUFF) \
|
||||||
$(S)/LineMarker.$(OBJSUFF) \
|
$(S)/LexAVE.$(OBJSUFF) \
|
||||||
$(S)/PropSet.$(OBJSUFF) \
|
$(S)/LexAda.$(OBJSUFF) \
|
||||||
$(S)/ScintillaBase.$(OBJSUFF) \
|
|
||||||
$(S)/Style.$(OBJSUFF) \
|
|
||||||
$(S)/ViewStyle.$(OBJSUFF) \
|
|
||||||
$(S)/LexCPP.$(OBJSUFF) \
|
$(S)/LexCPP.$(OBJSUFF) \
|
||||||
|
$(S)/LexConf.$(OBJSUFF) \
|
||||||
|
$(S)/LexCrontab.$(OBJSUFF) \
|
||||||
|
$(S)/LexEiffel.$(OBJSUFF) \
|
||||||
$(S)/LexHTML.$(OBJSUFF) \
|
$(S)/LexHTML.$(OBJSUFF) \
|
||||||
|
$(S)/LexLisp.$(OBJSUFF) \
|
||||||
$(S)/LexLua.$(OBJSUFF) \
|
$(S)/LexLua.$(OBJSUFF) \
|
||||||
$(S)/LexOthers.$(OBJSUFF) \
|
$(S)/LexOthers.$(OBJSUFF) \
|
||||||
|
$(S)/LexPascal.$(OBJSUFF) \
|
||||||
$(S)/LexPerl.$(OBJSUFF) \
|
$(S)/LexPerl.$(OBJSUFF) \
|
||||||
$(S)/LexPython.$(OBJSUFF) \
|
$(S)/LexPython.$(OBJSUFF) \
|
||||||
|
$(S)/LexRuby.$(OBJSUFF) \
|
||||||
$(S)/LexSQL.$(OBJSUFF) \
|
$(S)/LexSQL.$(OBJSUFF) \
|
||||||
$(S)/LexVB.$(OBJSUFF) \
|
$(S)/LexVB.$(OBJSUFF) \
|
||||||
$(S)/DocumentAccessor.$(OBJSUFF)\
|
$(S)/LineMarker.$(OBJSUFF) \
|
||||||
|
$(S)/PropSet.$(OBJSUFF) \
|
||||||
|
$(S)/RESearch.$(OBJSUFF) \
|
||||||
|
$(S)/ScintillaBase.$(OBJSUFF) \
|
||||||
|
$(S)/Style.$(OBJSUFF) \
|
||||||
|
$(S)/StyleContext.$(OBJSUFF) \
|
||||||
$(S)/UniConversion.$(OBJSUFF) \
|
$(S)/UniConversion.$(OBJSUFF) \
|
||||||
|
$(S)/ViewStyle.$(OBJSUFF) \
|
||||||
$(S)/WindowAccessor.$(OBJSUFF) \
|
$(S)/WindowAccessor.$(OBJSUFF) \
|
||||||
$(S)/PosRegExp.$(OBJSUFF) \
|
\
|
||||||
PlatWX.$(OBJSUFF) \
|
PlatWX.$(OBJSUFF) \
|
||||||
ScintillaWX.$(OBJSUFF) \
|
ScintillaWX.$(OBJSUFF) \
|
||||||
stc.$(OBJSUFF)
|
stc.$(OBJSUFF)
|
||||||
|
@@ -18,26 +18,18 @@ OBJECTS = \
|
|||||||
$(D)\AutoComplete.obj \
|
$(D)\AutoComplete.obj \
|
||||||
$(D)\CallTip.obj \
|
$(D)\CallTip.obj \
|
||||||
$(D)\CellBuffer.obj \
|
$(D)\CellBuffer.obj \
|
||||||
$(D)\ContractionState.obj\
|
$(D)\ContractionState.obj \
|
||||||
$(D)\Document.obj \
|
$(D)\Document.obj \
|
||||||
$(D)\DocumentAccessor.obj\
|
$(D)\DocumentAccessor.obj \
|
||||||
$(D)\Editor.obj \
|
$(D)\Editor.obj \
|
||||||
$(D)\Indicator.obj \
|
$(D)\Indicator.obj \
|
||||||
$(D)\KeyMap.obj \
|
$(D)\KeyMap.obj \
|
||||||
$(D)\KeyWords.obj \
|
$(D)\KeyWords.obj \
|
||||||
$(D)\LineMarker.obj \
|
|
||||||
$(D)\PropSet.obj \
|
|
||||||
$(D)\RESearch.obj \
|
|
||||||
$(D)\ScintillaBase.obj \
|
|
||||||
$(D)\Style.obj \
|
|
||||||
$(D)\UniConversion.obj \
|
|
||||||
$(D)\ViewStyle.obj \
|
|
||||||
$(D)\WindowAccessor.obj \
|
|
||||||
\
|
|
||||||
$(D)\LexAda.obj \
|
|
||||||
$(D)\LexAVE.obj \
|
$(D)\LexAVE.obj \
|
||||||
$(D)\LexConf.obj \
|
$(D)\LexAda.obj \
|
||||||
$(D)\LexCPP.obj \
|
$(D)\LexCPP.obj \
|
||||||
|
$(D)\LexConf.obj \
|
||||||
|
$(D)\LexCrontab.obj \
|
||||||
$(D)\LexEiffel.obj \
|
$(D)\LexEiffel.obj \
|
||||||
$(D)\LexHTML.obj \
|
$(D)\LexHTML.obj \
|
||||||
$(D)\LexLisp.obj \
|
$(D)\LexLisp.obj \
|
||||||
@@ -49,6 +41,15 @@ OBJECTS = \
|
|||||||
$(D)\LexRuby.obj \
|
$(D)\LexRuby.obj \
|
||||||
$(D)\LexSQL.obj \
|
$(D)\LexSQL.obj \
|
||||||
$(D)\LexVB.obj \
|
$(D)\LexVB.obj \
|
||||||
|
$(D)\LineMarker.obj \
|
||||||
|
$(D)\PropSet.obj \
|
||||||
|
$(D)\RESearch.obj \
|
||||||
|
$(D)\ScintillaBase.obj \
|
||||||
|
$(D)\Style.obj \
|
||||||
|
$(D)\StyleContext.obj \
|
||||||
|
$(D)\UniConversion.obj \
|
||||||
|
$(D)\ViewStyle.obj \
|
||||||
|
$(D)\WindowAccessor.obj \
|
||||||
\
|
\
|
||||||
$(D)\PlatWX.obj \
|
$(D)\PlatWX.obj \
|
||||||
$(D)\ScintillaWX.obj \
|
$(D)\ScintillaWX.obj \
|
||||||
|
@@ -3,5 +3,5 @@ scintilla/include directories from the Scintilla/SCiTE source
|
|||||||
distribution. All other code needed to implement Scintilla on top of
|
distribution. All other code needed to implement Scintilla on top of
|
||||||
wxWindows is located in the directory above this one.
|
wxWindows is located in the directory above this one.
|
||||||
|
|
||||||
The current version of the Scintilla code is 1.39
|
The current version of the Scintilla code is 1.40
|
||||||
|
|
||||||
|
@@ -40,6 +40,7 @@
|
|||||||
#define SCLEX_EIFFEL 23
|
#define SCLEX_EIFFEL 23
|
||||||
#define SCLEX_EIFFELKW 24
|
#define SCLEX_EIFFELKW 24
|
||||||
#define SCLEX_TCL 25
|
#define SCLEX_TCL 25
|
||||||
|
#define SCLEX_NNCRONTAB 26
|
||||||
#define SCLEX_AUTOMATIC 1000
|
#define SCLEX_AUTOMATIC 1000
|
||||||
#define SCE_P_DEFAULT 0
|
#define SCE_P_DEFAULT 0
|
||||||
#define SCE_P_COMMENTLINE 1
|
#define SCE_P_COMMENTLINE 1
|
||||||
@@ -72,6 +73,8 @@
|
|||||||
#define SCE_C_REGEX 14
|
#define SCE_C_REGEX 14
|
||||||
#define SCE_C_COMMENTLINEDOC 15
|
#define SCE_C_COMMENTLINEDOC 15
|
||||||
#define SCE_C_WORD2 16
|
#define SCE_C_WORD2 16
|
||||||
|
#define SCE_C_COMMENTDOCKEYWORD 17
|
||||||
|
#define SCE_C_COMMENTDOCKEYWORDERROR 18
|
||||||
#define SCE_H_DEFAULT 0
|
#define SCE_H_DEFAULT 0
|
||||||
#define SCE_H_TAG 1
|
#define SCE_H_TAG 1
|
||||||
#define SCE_H_TAGUNKNOWN 2
|
#define SCE_H_TAGUNKNOWN 2
|
||||||
@@ -93,7 +96,17 @@
|
|||||||
#define SCE_H_QUESTION 18
|
#define SCE_H_QUESTION 18
|
||||||
#define SCE_H_VALUE 19
|
#define SCE_H_VALUE 19
|
||||||
#define SCE_H_XCCOMMENT 20
|
#define SCE_H_XCCOMMENT 20
|
||||||
#define SCE_H_SGML 21
|
#define SCE_H_SGML_DEFAULT 21
|
||||||
|
#define SCE_H_SGML_COMMAND 22
|
||||||
|
#define SCE_H_SGML_1ST_PARAM 23
|
||||||
|
#define SCE_H_SGML_DOUBLESTRING 24
|
||||||
|
#define SCE_H_SGML_SIMPLESTRING 25
|
||||||
|
#define SCE_H_SGML_ERROR 26
|
||||||
|
#define SCE_H_SGML_SPECIAL 27
|
||||||
|
#define SCE_H_SGML_ENTITY 28
|
||||||
|
#define SCE_H_SGML_COMMENT 29
|
||||||
|
#define SCE_H_SGML_1ST_PARAM_COMMENT 30
|
||||||
|
#define SCE_H_SGML_BLOCK_DEFAULT 31
|
||||||
#define SCE_HJ_START 40
|
#define SCE_HJ_START 40
|
||||||
#define SCE_HJ_DEFAULT 41
|
#define SCE_HJ_DEFAULT 41
|
||||||
#define SCE_HJ_COMMENT 42
|
#define SCE_HJ_COMMENT 42
|
||||||
@@ -295,6 +308,17 @@
|
|||||||
#define SCE_EIFFEL_OPERATOR 6
|
#define SCE_EIFFEL_OPERATOR 6
|
||||||
#define SCE_EIFFEL_IDENTIFIER 7
|
#define SCE_EIFFEL_IDENTIFIER 7
|
||||||
#define SCE_EIFFEL_STRINGEOL 8
|
#define SCE_EIFFEL_STRINGEOL 8
|
||||||
|
#define SCE_NNCRONTAB_DEFAULT 0
|
||||||
|
#define SCE_NNCRONTAB_COMMENT 1
|
||||||
|
#define SCE_NNCRONTAB_TASK 2
|
||||||
|
#define SCE_NNCRONTAB_SECTION 3
|
||||||
|
#define SCE_NNCRONTAB_KEYWORD 4
|
||||||
|
#define SCE_NNCRONTAB_MODIFIER 5
|
||||||
|
#define SCE_NNCRONTAB_ASTERISK 6
|
||||||
|
#define SCE_NNCRONTAB_NUMBER 7
|
||||||
|
#define SCE_NNCRONTAB_STRING 8
|
||||||
|
#define SCE_NNCRONTAB_ENVIRONMENT 9
|
||||||
|
#define SCE_NNCRONTAB_IDENTIFIER 10
|
||||||
//--Autogenerated -- end of section automatically generated from Scintilla.iface
|
//--Autogenerated -- end of section automatically generated from Scintilla.iface
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@@ -11,9 +11,6 @@
|
|||||||
#ifndef SCINTILLA_H
|
#ifndef SCINTILLA_H
|
||||||
#define SCINTILLA_H
|
#define SCINTILLA_H
|
||||||
|
|
||||||
// Compile-time configuration options
|
|
||||||
#define MACRO_SUPPORT 1 // Comment out to remove macro hooks
|
|
||||||
|
|
||||||
#if PLAT_WIN
|
#if PLAT_WIN
|
||||||
#ifdef STATIC_BUILD
|
#ifdef STATIC_BUILD
|
||||||
void Scintilla_RegisterClasses(HINSTANCE hInstance);
|
void Scintilla_RegisterClasses(HINSTANCE hInstance);
|
||||||
@@ -102,6 +99,7 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,
|
|||||||
#define SC_MARK_CIRCLEPLUSCONNECTED 19
|
#define SC_MARK_CIRCLEPLUSCONNECTED 19
|
||||||
#define SC_MARK_CIRCLEMINUS 20
|
#define SC_MARK_CIRCLEMINUS 20
|
||||||
#define SC_MARK_CIRCLEMINUSCONNECTED 21
|
#define SC_MARK_CIRCLEMINUSCONNECTED 21
|
||||||
|
#define SC_MARK_CHARACTER 10000
|
||||||
#define SC_MARKNUM_FOLDEREND 25
|
#define SC_MARKNUM_FOLDEREND 25
|
||||||
#define SC_MARKNUM_FOLDEROPENMID 26
|
#define SC_MARKNUM_FOLDEROPENMID 26
|
||||||
#define SC_MARKNUM_FOLDERMIDTAIL 27
|
#define SC_MARKNUM_FOLDERMIDTAIL 27
|
||||||
@@ -134,6 +132,7 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,
|
|||||||
#define STYLE_BRACEBAD 35
|
#define STYLE_BRACEBAD 35
|
||||||
#define STYLE_CONTROLCHAR 36
|
#define STYLE_CONTROLCHAR 36
|
||||||
#define STYLE_INDENTGUIDE 37
|
#define STYLE_INDENTGUIDE 37
|
||||||
|
#define STYLE_LASTPREDEFINED 39
|
||||||
#define STYLE_MAX 127
|
#define STYLE_MAX 127
|
||||||
#define SC_CHARSET_ANSI 0
|
#define SC_CHARSET_ANSI 0
|
||||||
#define SC_CHARSET_DEFAULT 1
|
#define SC_CHARSET_DEFAULT 1
|
||||||
@@ -507,12 +506,6 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,
|
|||||||
#define SCN_DWELLEND 2017
|
#define SCN_DWELLEND 2017
|
||||||
//--Autogenerated -- end of section automatically generated from Scintilla.iface
|
//--Autogenerated -- end of section automatically generated from Scintilla.iface
|
||||||
|
|
||||||
// Optional module for macro recording
|
|
||||||
#ifdef MACRO_SUPPORT
|
|
||||||
typedef void (tMacroRecorder)(unsigned int iMessage, unsigned long wParam,
|
|
||||||
long lParam, void *userData);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// These structures are defined to be exactly the same shape as the Win32
|
// These structures are defined to be exactly the same shape as the Win32
|
||||||
// CHARRANGE, TEXTRANGE, FINDTEXTEX, FORMATRANGE, and NMHDR structs.
|
// CHARRANGE, TEXTRANGE, FINDTEXTEX, FORMATRANGE, and NMHDR structs.
|
||||||
// So older code that treats Scintilla as a RichEdit will work.
|
// So older code that treats Scintilla as a RichEdit will work.
|
||||||
@@ -566,11 +559,9 @@ struct SCNotification {
|
|||||||
const char *text; // SCN_MODIFIED
|
const char *text; // SCN_MODIFIED
|
||||||
int length; // SCN_MODIFIED
|
int length; // SCN_MODIFIED
|
||||||
int linesAdded; // SCN_MODIFIED
|
int linesAdded; // SCN_MODIFIED
|
||||||
#ifdef MACRO_SUPPORT
|
|
||||||
int message; // SCN_MACRORECORD
|
int message; // SCN_MACRORECORD
|
||||||
uptr_t wParam; // SCN_MACRORECORD
|
uptr_t wParam; // SCN_MACRORECORD
|
||||||
sptr_t lParam; // SCN_MACRORECORD
|
sptr_t lParam; // SCN_MACRORECORD
|
||||||
#endif
|
|
||||||
int line; // SCN_MODIFIED
|
int line; // SCN_MODIFIED
|
||||||
int foldLevelNow; // SCN_MODIFIED
|
int foldLevelNow; // SCN_MODIFIED
|
||||||
int foldLevelPrev; // SCN_MODIFIED
|
int foldLevelPrev; // SCN_MODIFIED
|
||||||
|
@@ -229,6 +229,8 @@ val SC_MARK_CIRCLEPLUSCONNECTED=19
|
|||||||
val SC_MARK_CIRCLEMINUS=20
|
val SC_MARK_CIRCLEMINUS=20
|
||||||
val SC_MARK_CIRCLEMINUSCONNECTED=21
|
val SC_MARK_CIRCLEMINUSCONNECTED=21
|
||||||
|
|
||||||
|
val SC_MARK_CHARACTER=10000
|
||||||
|
|
||||||
# Markers used for outlining column
|
# Markers used for outlining column
|
||||||
val SC_MARKNUM_FOLDEREND=25
|
val SC_MARKNUM_FOLDEREND=25
|
||||||
val SC_MARKNUM_FOLDEROPENMID=26
|
val SC_MARKNUM_FOLDEROPENMID=26
|
||||||
@@ -292,12 +294,15 @@ set void SetMarginSensitiveN=2246(int margin, bool sensitive)
|
|||||||
# Retrieve the mouse click sensitivity of a margin.
|
# Retrieve the mouse click sensitivity of a margin.
|
||||||
get bool GetMarginSensitiveN=2247(int margin,)
|
get bool GetMarginSensitiveN=2247(int margin,)
|
||||||
|
|
||||||
|
# Styles in range 32..37 are predefined for parts of the UI and are not used as normal styles.
|
||||||
|
# Styles 38 and 39 are for future use.
|
||||||
val STYLE_DEFAULT=32
|
val STYLE_DEFAULT=32
|
||||||
val STYLE_LINENUMBER=33
|
val STYLE_LINENUMBER=33
|
||||||
val STYLE_BRACELIGHT=34
|
val STYLE_BRACELIGHT=34
|
||||||
val STYLE_BRACEBAD=35
|
val STYLE_BRACEBAD=35
|
||||||
val STYLE_CONTROLCHAR=36
|
val STYLE_CONTROLCHAR=36
|
||||||
val STYLE_INDENTGUIDE=37
|
val STYLE_INDENTGUIDE=37
|
||||||
|
val STYLE_LASTPREDEFINED=39
|
||||||
val STYLE_MAX=127
|
val STYLE_MAX=127
|
||||||
|
|
||||||
# Character set identifiers are used in StyleSetCharacterSet.
|
# Character set identifiers are used in StyleSetCharacterSet.
|
||||||
@@ -759,10 +764,12 @@ set void SetTargetEnd=2192(position pos,)
|
|||||||
get position GetTargetEnd=2193(,)
|
get position GetTargetEnd=2193(,)
|
||||||
|
|
||||||
# Replace the target text with the argument text.
|
# Replace the target text with the argument text.
|
||||||
|
# Text is counted so it can contain nulls.
|
||||||
# Returns the length of the replacement text.
|
# Returns the length of the replacement text.
|
||||||
fun int ReplaceTarget=2194(int length, string text)
|
fun int ReplaceTarget=2194(int length, string text)
|
||||||
|
|
||||||
# Replace the target text with the argument text after \d processing.
|
# Replace the target text with the argument text after \d processing.
|
||||||
|
# Text is counted so it can contain nulls.
|
||||||
# Looks for \d where d is between 1 and 9 and replaces these with the strings
|
# Looks for \d where d is between 1 and 9 and replaces these with the strings
|
||||||
# matched in the last search operation which were surrounded by \( and \).
|
# matched in the last search operation which were surrounded by \( and \).
|
||||||
# Returns the length of the replacement text including any change
|
# Returns the length of the replacement text including any change
|
||||||
@@ -770,7 +777,7 @@ fun int ReplaceTarget=2194(int length, string text)
|
|||||||
fun int ReplaceTargetRE=2195(int length, string text)
|
fun int ReplaceTargetRE=2195(int length, string text)
|
||||||
|
|
||||||
# Search for a counted string in the target and set the target to the found
|
# Search for a counted string in the target and set the target to the found
|
||||||
# range.
|
# range. Text is counted so it can contain nulls.
|
||||||
# Returns length of range or -1 for failure in which case target is not moved.
|
# Returns length of range or -1 for failure in which case target is not moved.
|
||||||
fun int SearchInTarget=2197(int length, string text)
|
fun int SearchInTarget=2197(int length, string text)
|
||||||
|
|
||||||
@@ -1265,6 +1272,7 @@ val SCLEX_RUBY=22
|
|||||||
val SCLEX_EIFFEL=23
|
val SCLEX_EIFFEL=23
|
||||||
val SCLEX_EIFFELKW=24
|
val SCLEX_EIFFELKW=24
|
||||||
val SCLEX_TCL=25
|
val SCLEX_TCL=25
|
||||||
|
val SCLEX_NNCRONTAB=26
|
||||||
# When a lexer specifies its language as SCLEX_AUTOMATIC it receives a
|
# When a lexer specifies its language as SCLEX_AUTOMATIC it receives a
|
||||||
# value assigned in sequence from SCLEX_AUTOMATIC+1.
|
# value assigned in sequence from SCLEX_AUTOMATIC+1.
|
||||||
val SCLEX_AUTOMATIC=1000
|
val SCLEX_AUTOMATIC=1000
|
||||||
@@ -1301,6 +1309,8 @@ val SCE_C_VERBATIM=13
|
|||||||
val SCE_C_REGEX=14
|
val SCE_C_REGEX=14
|
||||||
val SCE_C_COMMENTLINEDOC=15
|
val SCE_C_COMMENTLINEDOC=15
|
||||||
val SCE_C_WORD2=16
|
val SCE_C_WORD2=16
|
||||||
|
val SCE_C_COMMENTDOCKEYWORD=17
|
||||||
|
val SCE_C_COMMENTDOCKEYWORDERROR=18
|
||||||
# Lexical states for SCLEX_HTML, SCLEX_XML
|
# Lexical states for SCLEX_HTML, SCLEX_XML
|
||||||
val SCE_H_DEFAULT=0
|
val SCE_H_DEFAULT=0
|
||||||
val SCE_H_TAG=1
|
val SCE_H_TAG=1
|
||||||
@@ -1327,7 +1337,17 @@ val SCE_H_VALUE=19
|
|||||||
# X-Code
|
# X-Code
|
||||||
val SCE_H_XCCOMMENT=20
|
val SCE_H_XCCOMMENT=20
|
||||||
# SGML
|
# SGML
|
||||||
val SCE_H_SGML=21
|
val SCE_H_SGML_DEFAULT=21
|
||||||
|
val SCE_H_SGML_COMMAND=22
|
||||||
|
val SCE_H_SGML_1ST_PARAM=23
|
||||||
|
val SCE_H_SGML_DOUBLESTRING=24
|
||||||
|
val SCE_H_SGML_SIMPLESTRING=25
|
||||||
|
val SCE_H_SGML_ERROR=26
|
||||||
|
val SCE_H_SGML_SPECIAL=27
|
||||||
|
val SCE_H_SGML_ENTITY=28
|
||||||
|
val SCE_H_SGML_COMMENT=29
|
||||||
|
val SCE_H_SGML_1ST_PARAM_COMMENT=30
|
||||||
|
val SCE_H_SGML_BLOCK_DEFAULT=31
|
||||||
# Embedded Javascript
|
# Embedded Javascript
|
||||||
val SCE_HJ_START=40
|
val SCE_HJ_START=40
|
||||||
val SCE_HJ_DEFAULT=41
|
val SCE_HJ_DEFAULT=41
|
||||||
@@ -1547,6 +1567,18 @@ val SCE_EIFFEL_CHARACTER=5
|
|||||||
val SCE_EIFFEL_OPERATOR=6
|
val SCE_EIFFEL_OPERATOR=6
|
||||||
val SCE_EIFFEL_IDENTIFIER=7
|
val SCE_EIFFEL_IDENTIFIER=7
|
||||||
val SCE_EIFFEL_STRINGEOL=8
|
val SCE_EIFFEL_STRINGEOL=8
|
||||||
|
# Lexical states for the SCLEX_NNCRONTAB (nnCron crontab Lexer)
|
||||||
|
val SCE_NNCRONTAB_DEFAULT=0
|
||||||
|
val SCE_NNCRONTAB_COMMENT=1
|
||||||
|
val SCE_NNCRONTAB_TASK=2
|
||||||
|
val SCE_NNCRONTAB_SECTION=3
|
||||||
|
val SCE_NNCRONTAB_KEYWORD=4
|
||||||
|
val SCE_NNCRONTAB_MODIFIER=5
|
||||||
|
val SCE_NNCRONTAB_ASTERISK=6
|
||||||
|
val SCE_NNCRONTAB_NUMBER=7
|
||||||
|
val SCE_NNCRONTAB_STRING=8
|
||||||
|
val SCE_NNCRONTAB_ENVIRONMENT=9
|
||||||
|
val SCE_NNCRONTAB_IDENTIFIER=10
|
||||||
|
|
||||||
# Events
|
# Events
|
||||||
|
|
||||||
@@ -1574,171 +1606,3 @@ evt void DwellStart=2016(int position)
|
|||||||
evt void DwellEnd=2017(int position)
|
evt void DwellEnd=2017(int position)
|
||||||
|
|
||||||
cat Deprecated
|
cat Deprecated
|
||||||
|
|
||||||
val SCFIND_DOWN=1
|
|
||||||
|
|
||||||
################################################
|
|
||||||
# From WinDefs.h
|
|
||||||
|
|
||||||
# ***** DEPRECATED from here to end of file ******
|
|
||||||
|
|
||||||
# Will a paste succeed?
|
|
||||||
fun bool EM_CanPaste=1074(,)
|
|
||||||
|
|
||||||
# Are there any undoable actions in the undo history.
|
|
||||||
fun bool EM_CanUndo=198(,)
|
|
||||||
|
|
||||||
# Find the position and line from a point within the window.
|
|
||||||
fun int EM_CharFromPos=215(,point pt)
|
|
||||||
|
|
||||||
# Delete the undo history.
|
|
||||||
fun void EM_EmptyUndoBuffer=205(,)
|
|
||||||
|
|
||||||
# Retrieve the selection range.
|
|
||||||
fun void EM_ExGetSel=1076(,charrangeresult cr)
|
|
||||||
|
|
||||||
# Retrieve the line number of a position in the document.
|
|
||||||
get int EM_ExLineFromChar=1078(,position pos)
|
|
||||||
|
|
||||||
# Select a range of text.
|
|
||||||
fun void EM_ExSetSel=1079(,charrange cr)
|
|
||||||
|
|
||||||
# Find some text in the document.
|
|
||||||
fun position EM_FindText=1080(int flags, findtext ft)
|
|
||||||
|
|
||||||
# Find some text in the document. Returns range of found text in ft argument.
|
|
||||||
fun position EM_FindTextEx=1103(int flags, findtextex ft)
|
|
||||||
|
|
||||||
# On Windows will draw the document into a display context such as a printer.
|
|
||||||
fun void EM_FormatRange=1081(bool draw, formatrange fr)
|
|
||||||
|
|
||||||
# Retrieve the line at the top of the display.
|
|
||||||
get int EM_GetFirstVisibleLine=206(,)
|
|
||||||
|
|
||||||
# Retrieve the contents of a line.
|
|
||||||
# Returns the length of the line.
|
|
||||||
fun int EM_GetLine=196(int line, countedstring text)
|
|
||||||
|
|
||||||
# Returns the number of lines in the document. There is always at least one.
|
|
||||||
fun int EM_GetLineCount=186(,)
|
|
||||||
|
|
||||||
# Returns the size in pixels of left and right margins packed into one integer.
|
|
||||||
# The left margin is in the low half and the right margin in the high half.
|
|
||||||
fun int EM_GetMargins=212(,)
|
|
||||||
|
|
||||||
# Is the document different from when it was last saved?
|
|
||||||
get bool EM_GetModify=184(,)
|
|
||||||
|
|
||||||
# Get the area used to display the document.
|
|
||||||
fun void EM_GetRect=178(,rectangle r)
|
|
||||||
|
|
||||||
# Return the selection packed into one integer with the start of the selection
|
|
||||||
# in the low half and the end in the high half.
|
|
||||||
fun int EM_GetSel=176(,)
|
|
||||||
|
|
||||||
# Retrieve the selected text.
|
|
||||||
# Return the length of the text.
|
|
||||||
fun int EM_GetSelText=1086(,stringresult text)
|
|
||||||
|
|
||||||
# Retrieve a range of text.
|
|
||||||
# Return the length of the text.
|
|
||||||
fun int EM_GetTextRange=1099(, textrange tr)
|
|
||||||
|
|
||||||
# Draw the selection in normal style or with selection highlighted.
|
|
||||||
fun void EM_HideSelection=1087(bool normal,)
|
|
||||||
|
|
||||||
# Retrieve the line of a position.
|
|
||||||
fun int EM_LineFromChar=201(position pos,)
|
|
||||||
|
|
||||||
# Retrieve the position at the start of a line.
|
|
||||||
fun position EM_LineIndex=187(int line,)
|
|
||||||
|
|
||||||
# Retrieve the number of characters on a line not including end of line characters.
|
|
||||||
fun int EM_LineLength=193(int line,)
|
|
||||||
|
|
||||||
# Scroll horizontally and vertically.
|
|
||||||
fun void EM_LineScroll=182(int columns, int lines)
|
|
||||||
|
|
||||||
# Retrieve the point in the window where a position is displayed.
|
|
||||||
fun void EM_PosFromChar=214(pointresult pt, position pos)
|
|
||||||
|
|
||||||
# Replace the selected text with the argument text.
|
|
||||||
fun void EM_ReplaceSel=194(, string text)
|
|
||||||
|
|
||||||
# Ensure the caret is visible.
|
|
||||||
fun void EM_ScrollCaret=183(,)
|
|
||||||
|
|
||||||
# Returns SEL_EMPTY if selection contains no characters, otherwise SEL_TEXT.
|
|
||||||
fun void EM_SelectionType=1090(,)
|
|
||||||
|
|
||||||
# Set the width of the left and right margins
|
|
||||||
fun void EM_SetMargins=211(int flags, int values)
|
|
||||||
|
|
||||||
# Set to read only or read write.
|
|
||||||
set void EM_SetReadOnly=207(bool readOnly,)
|
|
||||||
|
|
||||||
# Select the range of text from start to end.
|
|
||||||
fun void EM_SetSel=177(position start, position end)
|
|
||||||
|
|
||||||
# Undo one action in the undo history.
|
|
||||||
fun void EM_Undo=199(,)
|
|
||||||
|
|
||||||
# Null operation.
|
|
||||||
fun void WM_Null=0(,)
|
|
||||||
|
|
||||||
# Clear the selection.
|
|
||||||
fun void WM_Clear=771(,)
|
|
||||||
|
|
||||||
fun void WM_Command=273(,)
|
|
||||||
|
|
||||||
# Copy the selection to the clipboard.
|
|
||||||
fun void WM_Copy=769(,)
|
|
||||||
|
|
||||||
# Cut the selection to the clipboard.
|
|
||||||
fun void WM_Cut=768(,)
|
|
||||||
|
|
||||||
# Retrieve all the text in the document.
|
|
||||||
# Returns number of characters retrieved.
|
|
||||||
fun int WM_GetText=13(int length, stringresult text)
|
|
||||||
|
|
||||||
# Retrieve the number of characters in the document.
|
|
||||||
fun int WM_GetTextLength=14(,)
|
|
||||||
|
|
||||||
# Notification back to container
|
|
||||||
fun void WM_Notify=78(int id, int stuff)
|
|
||||||
|
|
||||||
# Paste the contents of the clipboard into the document replacing the selection.
|
|
||||||
fun void WM_Paste=770(,)
|
|
||||||
|
|
||||||
# Replace the contents of the document with the argument text.
|
|
||||||
fun void WM_SetText=12(, string text)
|
|
||||||
|
|
||||||
# Undo one action in the undo history.
|
|
||||||
fun void WM_Undo=772(,)
|
|
||||||
|
|
||||||
# Notification codes
|
|
||||||
val EN_CHANGE=768
|
|
||||||
val EN_KILLFOCUS=512
|
|
||||||
val EN_SETFOCUS=256
|
|
||||||
|
|
||||||
# Flags for setting margins.
|
|
||||||
val EC_LEFTMARGIN=1
|
|
||||||
val EC_RIGHTMARGIN=2
|
|
||||||
val EC_USEFONTINFO=0xffff
|
|
||||||
|
|
||||||
# Selection type.
|
|
||||||
val SEL_EMPTY=0
|
|
||||||
val SEL_TEXT=1
|
|
||||||
|
|
||||||
# Find replace mask constants
|
|
||||||
val FR_MATCHCASE=0x4
|
|
||||||
val FR_WHOLEWORD=0x2
|
|
||||||
val FR_DOWN=0x1
|
|
||||||
|
|
||||||
# Key modifier flag.
|
|
||||||
val SHIFT_PRESSED=1
|
|
||||||
val LEFT_CTRL_PRESSED=2
|
|
||||||
val LEFT_ALT_PRESSED=4
|
|
||||||
|
|
||||||
#events
|
|
||||||
evt void EN_Change=768(void)
|
|
||||||
|
@@ -11,17 +11,6 @@
|
|||||||
|
|
||||||
#if PLAT_GTK
|
#if PLAT_GTK
|
||||||
|
|
||||||
#ifndef SCINTILLA_H
|
|
||||||
#ifdef _MSC_VER
|
|
||||||
#pragma message(__FILE__ "(1) : warning : Scintilla.h should be included before ScintillaWidget.h")
|
|
||||||
#pragma message("This will be required in the next version of Scintilla")
|
|
||||||
#else
|
|
||||||
#warning Scintilla.h should be included before ScintillaWidget.h
|
|
||||||
#warning This will be required in the next version of Scintilla
|
|
||||||
#endif
|
|
||||||
#include "Scintilla.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
@@ -1,197 +0,0 @@
|
|||||||
// Scintilla source code edit control
|
|
||||||
/** @file WinDefs.h
|
|
||||||
** The subset of definitions from Windows needed by Scintilla for GTK+.
|
|
||||||
**/
|
|
||||||
// Copyright 1998-2001 by Neil Hodgson <neilh@scintilla.org>
|
|
||||||
// The License.txt file describes the conditions under which this software may be distributed.
|
|
||||||
|
|
||||||
#ifndef WINDEFS_H
|
|
||||||
#define WINDEFS_H
|
|
||||||
|
|
||||||
/* Running GTK version on win32 */
|
|
||||||
#if PLAT_GTK_WIN32
|
|
||||||
#include "Windows.h"
|
|
||||||
#include "Richedit.h"
|
|
||||||
|
|
||||||
/* Name conflicts */
|
|
||||||
#undef DrawText
|
|
||||||
#undef FindText
|
|
||||||
#else
|
|
||||||
|
|
||||||
#define WORD short
|
|
||||||
#define WPARAM unsigned long
|
|
||||||
#define LPARAM long
|
|
||||||
#define LRESULT long
|
|
||||||
#define DWORD long
|
|
||||||
|
|
||||||
#define UINT unsigned int
|
|
||||||
#define LPSTR char *
|
|
||||||
#define LONG long
|
|
||||||
|
|
||||||
//#if 0
|
|
||||||
/* RTF control */
|
|
||||||
#define EM_CANPASTE (1074)
|
|
||||||
#define EM_CANUNDO (198)
|
|
||||||
#define EM_CHARFROMPOS (215)
|
|
||||||
#define EM_EMPTYUNDOBUFFER (205)
|
|
||||||
#define EM_EXGETSEL (1076)
|
|
||||||
#define EM_EXLINEFROMCHAR (1078)
|
|
||||||
#define EM_EXSETSEL (1079)
|
|
||||||
#define EM_FINDTEXT (1080)
|
|
||||||
#define EM_FINDTEXTEX (1103)
|
|
||||||
#define EM_FORMATRANGE (1081)
|
|
||||||
#define EM_GETFIRSTVISIBLELINE (206)
|
|
||||||
#define EM_GETLINE (196)
|
|
||||||
#define EM_GETLINECOUNT (186)
|
|
||||||
#define EM_GETMARGINS (212)
|
|
||||||
#define EM_GETMODIFY (184)
|
|
||||||
#define EM_GETRECT (178)
|
|
||||||
#define EM_GETSEL (176)
|
|
||||||
#define EM_GETSELTEXT (1086)
|
|
||||||
#define EM_GETTEXTRANGE (1099)
|
|
||||||
#define EM_HIDESELECTION (1087)
|
|
||||||
#define EM_LINEFROMCHAR (201)
|
|
||||||
#define EM_LINEINDEX (187)
|
|
||||||
#define EM_LINELENGTH (193)
|
|
||||||
#define EM_LINESCROLL (182)
|
|
||||||
#define EM_POSFROMCHAR (214)
|
|
||||||
#define EM_REPLACESEL (194)
|
|
||||||
#define EM_SCROLLCARET (183)
|
|
||||||
#define EM_SELECTIONTYPE (1090)
|
|
||||||
#define EM_SETMARGINS (211)
|
|
||||||
#define EM_SETREADONLY (207)
|
|
||||||
#define EM_SETSEL (177)
|
|
||||||
#define EM_UNDO (199)
|
|
||||||
|
|
||||||
#define WM_NULL (0)
|
|
||||||
#define WM_CLEAR (771)
|
|
||||||
#define WM_COPY (769)
|
|
||||||
#define WM_CUT (768)
|
|
||||||
#define WM_GETTEXT (13)
|
|
||||||
#define WM_GETTEXTLENGTH (14)
|
|
||||||
#define WM_PASTE (770)
|
|
||||||
#define WM_SETTEXT (12)
|
|
||||||
#define WM_UNDO (772)
|
|
||||||
|
|
||||||
#define EN_CHANGE (768)
|
|
||||||
#define EN_KILLFOCUS (512)
|
|
||||||
#define EN_SETFOCUS (256)
|
|
||||||
|
|
||||||
#define EC_LEFTMARGIN 1
|
|
||||||
#define EC_RIGHTMARGIN 2
|
|
||||||
#define EC_USEFONTINFO 0xffff
|
|
||||||
|
|
||||||
//#endif
|
|
||||||
|
|
||||||
#if 0
|
|
||||||
#if PLAT_GTK
|
|
||||||
#define VK_DOWN GDK_Down
|
|
||||||
#define VK_UP GDK_Up
|
|
||||||
#define VK_LEFT GDK_Left
|
|
||||||
#define VK_RIGHT GDK_Right
|
|
||||||
#define VK_HOME GDK_Home
|
|
||||||
#define VK_END GDK_End
|
|
||||||
#define VK_PRIOR GDK_Page_Up
|
|
||||||
#define VK_NEXT GDK_Page_Down
|
|
||||||
#define VK_DELETE GDK_Delete
|
|
||||||
#define VK_INSERT GDK_Insert
|
|
||||||
#define VK_ESCAPE GDK_Escape
|
|
||||||
#define VK_BACK GDK_BackSpace
|
|
||||||
#define VK_TAB GDK_Tab
|
|
||||||
#define VK_RETURN GDK_Return
|
|
||||||
#define VK_ADD GDK_KP_Add
|
|
||||||
#define VK_SUBTRACT GDK_KP_Subtract
|
|
||||||
#define VK_DIVIDE GDK_KP_Divide
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if PLAT_WX
|
|
||||||
#define VK_DOWN WXK_DOWN
|
|
||||||
#define VK_UP WXK_UP
|
|
||||||
#define VK_LEFT WXK_LEFT
|
|
||||||
#define VK_RIGHT WXK_RIGHT
|
|
||||||
#define VK_HOME WXK_HOME
|
|
||||||
#define VK_END WXK_END
|
|
||||||
#define VK_PRIOR WXK_PRIOR
|
|
||||||
#define VK_NEXT WXK_NEXT
|
|
||||||
#define VK_DELETE WXK_DELETE
|
|
||||||
#define VK_INSERT WXK_INSERT
|
|
||||||
#define VK_ESCAPE WXK_ESCAPE
|
|
||||||
#define VK_BACK WXK_BACK
|
|
||||||
#define VK_TAB WXK_TAB
|
|
||||||
#define VK_RETURN WXK_RETURN
|
|
||||||
#define VK_ADD WXK_ADD
|
|
||||||
#define VK_SUBTRACT WXK_SUBTRACT
|
|
||||||
//TODO:
|
|
||||||
#define VK_DIVIDE WXK_DIVIDE
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define SHIFT_PRESSED 1
|
|
||||||
#define LEFT_CTRL_PRESSED 2
|
|
||||||
#define LEFT_ALT_PRESSED 4
|
|
||||||
|
|
||||||
// Are these needed any more
|
|
||||||
#define LPSTR char *
|
|
||||||
#define LONG long
|
|
||||||
#define LPDWORD (long *)
|
|
||||||
|
|
||||||
/* SELCHANGE structure */
|
|
||||||
#define SEL_EMPTY (0)
|
|
||||||
#define SEL_TEXT (1)
|
|
||||||
#define SEL_OBJECT (2)
|
|
||||||
#define SEL_MULTICHAR (4)
|
|
||||||
#define SEL_MULTIOBJECT (8)
|
|
||||||
|
|
||||||
struct RECT {
|
|
||||||
LONG left;
|
|
||||||
LONG top;
|
|
||||||
LONG right;
|
|
||||||
LONG bottom;
|
|
||||||
};
|
|
||||||
|
|
||||||
/* FINDREPLACE structure */
|
|
||||||
|
|
||||||
#define FR_MATCHCASE (0x4)
|
|
||||||
#define FR_WHOLEWORD (0x2)
|
|
||||||
#define FR_DOWN (0x1)
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if 0
|
|
||||||
struct CHARRANGE {
|
|
||||||
LONG cpMin;
|
|
||||||
LONG cpMax;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct TEXTRANGE {
|
|
||||||
CHARRANGE chrg;
|
|
||||||
LPSTR lpstrText;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct FINDTEXTEX {
|
|
||||||
CHARRANGE chrg;
|
|
||||||
LPSTR lpstrText;
|
|
||||||
CHARRANGE chrgText;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct NMHDR {
|
|
||||||
WindowID hwndFrom;
|
|
||||||
UINT idFrom;
|
|
||||||
UINT code;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct FORMATRANGE {
|
|
||||||
SurfaceID hdc;
|
|
||||||
SurfaceID hdcTarget;
|
|
||||||
RECT rc;
|
|
||||||
RECT rcPage;
|
|
||||||
CHARRANGE chrg;
|
|
||||||
};
|
|
||||||
#endif
|
|
||||||
|
|
||||||
//#define MAKELONG(a, b) ((a) | ((b) << 16))
|
|
||||||
//#define LOWORD(x) (x & 0xffff)
|
|
||||||
//#define HIWORD(x) (x >> 16)
|
|
||||||
|
|
||||||
#endif /* !_MSC_VER */
|
|
||||||
|
|
||||||
#endif
|
|
@@ -357,8 +357,10 @@ void Document::ModifiedAt(int pos) {
|
|||||||
|
|
||||||
// Unlike Undo, Redo, and InsertStyledString, the pos argument is a cell number not a char number
|
// Unlike Undo, Redo, and InsertStyledString, the pos argument is a cell number not a char number
|
||||||
void Document::DeleteChars(int pos, int len) {
|
void Document::DeleteChars(int pos, int len) {
|
||||||
|
if (len == 0)
|
||||||
|
return;
|
||||||
if ((pos + len) > Length())
|
if ((pos + len) > Length())
|
||||||
return ;
|
return;
|
||||||
if (cb.IsReadOnly() && enteredReadOnlyCount == 0) {
|
if (cb.IsReadOnly() && enteredReadOnlyCount == 0) {
|
||||||
enteredReadOnlyCount++;
|
enteredReadOnlyCount++;
|
||||||
NotifyModifyAttempt();
|
NotifyModifyAttempt();
|
||||||
|
@@ -14,10 +14,6 @@
|
|||||||
|
|
||||||
#include "Scintilla.h"
|
#include "Scintilla.h"
|
||||||
|
|
||||||
#if PLAT_WX || PLAT_GTK
|
|
||||||
#include "WinDefs.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "ContractionState.h"
|
#include "ContractionState.h"
|
||||||
#include "SVector.h"
|
#include "SVector.h"
|
||||||
#include "CellBuffer.h"
|
#include "CellBuffer.h"
|
||||||
@@ -58,7 +54,6 @@ Editor::Editor() {
|
|||||||
dwelling = false;
|
dwelling = false;
|
||||||
ptMouseLast.x = 0;
|
ptMouseLast.x = 0;
|
||||||
ptMouseLast.y = 0;
|
ptMouseLast.y = 0;
|
||||||
firstExpose = true;
|
|
||||||
inDragDrop = false;
|
inDragDrop = false;
|
||||||
dropWentOutside = false;
|
dropWentOutside = false;
|
||||||
posDrag = invalidPosition;
|
posDrag = invalidPosition;
|
||||||
@@ -69,9 +64,6 @@ Editor::Editor() {
|
|||||||
lineAnchor = 0;
|
lineAnchor = 0;
|
||||||
originalAnchorPos = 0;
|
originalAnchorPos = 0;
|
||||||
|
|
||||||
dragChars = 0;
|
|
||||||
lenDrag = 0;
|
|
||||||
dragIsRectangle = false;
|
|
||||||
selType = selStream;
|
selType = selStream;
|
||||||
xStartSelect = 0;
|
xStartSelect = 0;
|
||||||
xEndSelect = 0;
|
xEndSelect = 0;
|
||||||
@@ -85,9 +77,6 @@ Editor::Editor() {
|
|||||||
|
|
||||||
searchAnchor = 0;
|
searchAnchor = 0;
|
||||||
|
|
||||||
ucWheelScrollLines = 0;
|
|
||||||
cWheelDelta = 0; //wheel delta from roll
|
|
||||||
|
|
||||||
xOffset = 0;
|
xOffset = 0;
|
||||||
xCaretMargin = 50;
|
xCaretMargin = 50;
|
||||||
horizontalScrollBarVisible = true;
|
horizontalScrollBarVisible = true;
|
||||||
@@ -114,15 +103,11 @@ Editor::Editor() {
|
|||||||
|
|
||||||
modEventMask = SC_MODEVENTMASKALL;
|
modEventMask = SC_MODEVENTMASKALL;
|
||||||
|
|
||||||
displayPopupMenu = true;
|
|
||||||
|
|
||||||
pdoc = new Document();
|
pdoc = new Document();
|
||||||
pdoc ->AddRef();
|
pdoc ->AddRef();
|
||||||
pdoc->AddWatcher(this, 0);
|
pdoc->AddWatcher(this, 0);
|
||||||
|
|
||||||
#ifdef MACRO_SUPPORT
|
recordingMacro = false;
|
||||||
recordingMacro = 0;
|
|
||||||
#endif
|
|
||||||
foldFlags = 0;
|
foldFlags = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -131,10 +116,6 @@ Editor::~Editor() {
|
|||||||
pdoc->Release();
|
pdoc->Release();
|
||||||
pdoc = 0;
|
pdoc = 0;
|
||||||
DropGraphics();
|
DropGraphics();
|
||||||
|
|
||||||
delete []dragChars;
|
|
||||||
dragChars = 0;
|
|
||||||
lenDrag = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Editor::Finalise() {
|
void Editor::Finalise() {
|
||||||
@@ -874,7 +855,7 @@ void Editor::PaintSelMargin(Surface *surfWindow, PRectangle &rc) {
|
|||||||
if (marks) {
|
if (marks) {
|
||||||
for (int markBit = 0; (markBit < 32) && marks; markBit++) {
|
for (int markBit = 0; (markBit < 32) && marks; markBit++) {
|
||||||
if (marks & 1) {
|
if (marks & 1) {
|
||||||
vs.markers[markBit].Draw(surface, rcMarker);
|
vs.markers[markBit].Draw(surface, rcMarker, vs.styles[STYLE_LINENUMBER].font);
|
||||||
}
|
}
|
||||||
marks >>= 1;
|
marks >>= 1;
|
||||||
}
|
}
|
||||||
@@ -1917,14 +1898,12 @@ void Editor::NotifyChar(int ch) {
|
|||||||
scn.nmhdr.code = SCN_CHARADDED;
|
scn.nmhdr.code = SCN_CHARADDED;
|
||||||
scn.ch = ch;
|
scn.ch = ch;
|
||||||
NotifyParent(scn);
|
NotifyParent(scn);
|
||||||
#ifdef MACRO_SUPPORT
|
|
||||||
if (recordingMacro) {
|
if (recordingMacro) {
|
||||||
char txt[2];
|
char txt[2];
|
||||||
txt[0] = static_cast<char>(ch);
|
txt[0] = static_cast<char>(ch);
|
||||||
txt[1] = '\0';
|
txt[1] = '\0';
|
||||||
NotifyMacroRecord(SCI_REPLACESEL, 0, reinterpret_cast<long>(txt));
|
NotifyMacroRecord(SCI_REPLACESEL, 0, reinterpret_cast<long>(txt));
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Editor::NotifySavePoint(bool isSavePoint) {
|
void Editor::NotifySavePoint(bool isSavePoint) {
|
||||||
@@ -2150,7 +2129,6 @@ void Editor::NotifyDeleted(Document *, void *) {
|
|||||||
/* Do nothing */
|
/* Do nothing */
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef MACRO_SUPPORT
|
|
||||||
void Editor::NotifyMacroRecord(unsigned int iMessage, unsigned long wParam, long lParam) {
|
void Editor::NotifyMacroRecord(unsigned int iMessage, unsigned long wParam, long lParam) {
|
||||||
|
|
||||||
// Enumerates all macroable messages
|
// Enumerates all macroable messages
|
||||||
@@ -2159,10 +2137,6 @@ void Editor::NotifyMacroRecord(unsigned int iMessage, unsigned long wParam, long
|
|||||||
case SCI_COPY:
|
case SCI_COPY:
|
||||||
case SCI_PASTE:
|
case SCI_PASTE:
|
||||||
case SCI_CLEAR:
|
case SCI_CLEAR:
|
||||||
case WM_CUT:
|
|
||||||
case WM_COPY:
|
|
||||||
case WM_PASTE:
|
|
||||||
case WM_CLEAR:
|
|
||||||
case SCI_REPLACESEL:
|
case SCI_REPLACESEL:
|
||||||
case SCI_ADDTEXT:
|
case SCI_ADDTEXT:
|
||||||
case SCI_INSERTTEXT:
|
case SCI_INSERTTEXT:
|
||||||
@@ -2236,7 +2210,6 @@ void Editor::NotifyMacroRecord(unsigned int iMessage, unsigned long wParam, long
|
|||||||
scn.lParam = lParam;
|
scn.lParam = lParam;
|
||||||
NotifyParent(scn);
|
NotifyParent(scn);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
// Force scroll and keep position relative to top of window
|
// Force scroll and keep position relative to top of window
|
||||||
void Editor::PageMove(int direction, bool extend) {
|
void Editor::PageMove(int direction, bool extend) {
|
||||||
@@ -2674,7 +2647,6 @@ void Editor::Indent(bool forwards) {
|
|||||||
* @return The position of the found text, -1 if not found.
|
* @return The position of the found text, -1 if not found.
|
||||||
*/
|
*/
|
||||||
long Editor::FindText(
|
long Editor::FindText(
|
||||||
unsigned int iMessage, ///< Can be @c EM_FINDTEXT or @c EM_FINDTEXTEX or @c SCI_FINDTEXT.
|
|
||||||
unsigned long wParam, ///< Search modes : @c SCFIND_MATCHCASE, @c SCFIND_WHOLEWORD,
|
unsigned long wParam, ///< Search modes : @c SCFIND_MATCHCASE, @c SCFIND_WHOLEWORD,
|
||||||
///< @c SCFIND_WORDSTART or @c SCFIND_REGEXP.
|
///< @c SCFIND_WORDSTART or @c SCFIND_REGEXP.
|
||||||
long lParam) { ///< @c TextToFind structure: The text to search for in the given range.
|
long lParam) { ///< @c TextToFind structure: The text to search for in the given range.
|
||||||
@@ -2688,11 +2660,9 @@ long Editor::FindText(
|
|||||||
wParam & SCFIND_REGEXP,
|
wParam & SCFIND_REGEXP,
|
||||||
&lengthFound);
|
&lengthFound);
|
||||||
if (pos != -1) {
|
if (pos != -1) {
|
||||||
if (iMessage != EM_FINDTEXT) {
|
|
||||||
ft->chrgText.cpMin = pos;
|
ft->chrgText.cpMin = pos;
|
||||||
ft->chrgText.cpMax = pos + lengthFound;
|
ft->chrgText.cpMax = pos + lengthFound;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return pos;
|
return pos;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2800,33 +2770,23 @@ char *Editor::CopyRange(int start, int end) {
|
|||||||
return text;
|
return text;
|
||||||
}
|
}
|
||||||
|
|
||||||
int Editor::SelectionRangeLength() {
|
void Editor::CopySelectionRange(SelectionText *ss) {
|
||||||
if (selType == selRectangle) {
|
|
||||||
int lineStart = pdoc->LineFromPosition(SelectionStart());
|
|
||||||
int lineEnd = pdoc->LineFromPosition(SelectionEnd());
|
|
||||||
int totalSize = 0;
|
|
||||||
for (int line = lineStart; line <= lineEnd; line++) {
|
|
||||||
totalSize += SelectionEnd(line) - SelectionStart(line) + 1;
|
|
||||||
if (pdoc->eolMode == SC_EOL_CRLF)
|
|
||||||
totalSize++;
|
|
||||||
}
|
|
||||||
return totalSize;
|
|
||||||
} else {
|
|
||||||
return SelectionEnd() - SelectionStart();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
char *Editor::CopySelectionRange() {
|
|
||||||
if (selType == selRectangle) {
|
|
||||||
char *text = 0;
|
char *text = 0;
|
||||||
|
int size = 0;
|
||||||
|
if (selType == selRectangle) {
|
||||||
int lineStart = pdoc->LineFromPosition(SelectionStart());
|
int lineStart = pdoc->LineFromPosition(SelectionStart());
|
||||||
int lineEnd = pdoc->LineFromPosition(SelectionEnd());
|
int lineEnd = pdoc->LineFromPosition(SelectionEnd());
|
||||||
int totalSize = SelectionRangeLength();
|
int line;
|
||||||
if (totalSize > 0) {
|
for (line = lineStart; line <= lineEnd; line++) {
|
||||||
text = new char[totalSize + 1];
|
size += SelectionEnd(line) - SelectionStart(line) + 1;
|
||||||
|
if (pdoc->eolMode == SC_EOL_CRLF)
|
||||||
|
size++;
|
||||||
|
}
|
||||||
|
if (size > 0) {
|
||||||
|
text = new char[size + 1];
|
||||||
if (text) {
|
if (text) {
|
||||||
int j = 0;
|
int j = 0;
|
||||||
for (int line = lineStart; line <= lineEnd; line++) {
|
for (line = lineStart; line <= lineEnd; line++) {
|
||||||
for (int i = SelectionStart(line);i < SelectionEnd(line);i++) {
|
for (int i = SelectionStart(line);i < SelectionEnd(line);i++) {
|
||||||
text[j++] = pdoc->CharAt(i);
|
text[j++] = pdoc->CharAt(i);
|
||||||
}
|
}
|
||||||
@@ -2835,24 +2795,14 @@ char *Editor::CopySelectionRange() {
|
|||||||
if (pdoc->eolMode != SC_EOL_CR)
|
if (pdoc->eolMode != SC_EOL_CR)
|
||||||
text[j++] = '\n';
|
text[j++] = '\n';
|
||||||
}
|
}
|
||||||
text[totalSize] = '\0';
|
text[size] = '\0';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return text;
|
|
||||||
} else {
|
} else {
|
||||||
return CopyRange(SelectionStart(), SelectionEnd());
|
size = SelectionEnd() - SelectionStart();
|
||||||
}
|
text = CopyRange(SelectionStart(), SelectionEnd());
|
||||||
}
|
|
||||||
|
|
||||||
void Editor::CopySelectionIntoDrag() {
|
|
||||||
delete []dragChars;
|
|
||||||
dragChars = 0;
|
|
||||||
lenDrag = SelectionRangeLength();
|
|
||||||
dragChars = CopySelectionRange();
|
|
||||||
dragIsRectangle = selType == selRectangle;
|
|
||||||
if (!dragChars) {
|
|
||||||
lenDrag = 0;
|
|
||||||
}
|
}
|
||||||
|
ss->Set(text, size, selType == selRectangle);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Editor::SetDragPosition(int newPos) {
|
void Editor::SetDragPosition(int newPos) {
|
||||||
@@ -2882,8 +2832,6 @@ void Editor::StartDrag() {
|
|||||||
//DisplayCursor(Window::cursorArrow);
|
//DisplayCursor(Window::cursorArrow);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void Editor::DropAt(int position, const char *value, bool moving, bool rectangular) {
|
void Editor::DropAt(int position, const char *value, bool moving, bool rectangular) {
|
||||||
//Platform::DebugPrintf("DropAt %d\n", inDragDrop);
|
//Platform::DebugPrintf("DropAt %d\n", inDragDrop);
|
||||||
if (inDragDrop)
|
if (inDragDrop)
|
||||||
@@ -3115,7 +3063,7 @@ void Editor::ButtonDown(Point pt, unsigned int curTime, bool shift, bool ctrl, b
|
|||||||
if (inDragDrop) {
|
if (inDragDrop) {
|
||||||
SetMouseCapture(false);
|
SetMouseCapture(false);
|
||||||
SetDragPosition(newPos);
|
SetDragPosition(newPos);
|
||||||
CopySelectionIntoDrag();
|
CopySelectionRange(&drag);
|
||||||
StartDrag();
|
StartDrag();
|
||||||
} else {
|
} else {
|
||||||
xStartSelect = pt.x - vs.fixedColumnWidth + xOffset;
|
xStartSelect = pt.x - vs.fixedColumnWidth + xOffset;
|
||||||
@@ -3220,25 +3168,23 @@ void Editor::ButtonUp(Point pt, unsigned int curTime, bool ctrl) {
|
|||||||
int selStart = SelectionStart();
|
int selStart = SelectionStart();
|
||||||
int selEnd = SelectionEnd();
|
int selEnd = SelectionEnd();
|
||||||
if (selStart < selEnd) {
|
if (selStart < selEnd) {
|
||||||
if (dragChars && lenDrag) {
|
if (drag.len) {
|
||||||
if (ctrl) {
|
if (ctrl) {
|
||||||
pdoc->InsertString(newPos, dragChars, lenDrag);
|
pdoc->InsertString(newPos, drag.s, drag.len);
|
||||||
SetSelection(newPos, newPos + lenDrag);
|
SetSelection(newPos, newPos + drag.len);
|
||||||
} else if (newPos < selStart) {
|
} else if (newPos < selStart) {
|
||||||
pdoc->DeleteChars(selStart, lenDrag);
|
pdoc->DeleteChars(selStart, drag.len);
|
||||||
pdoc->InsertString(newPos, dragChars, lenDrag);
|
pdoc->InsertString(newPos, drag.s, drag.len);
|
||||||
SetSelection(newPos, newPos + lenDrag);
|
SetSelection(newPos, newPos + drag.len);
|
||||||
} else if (newPos > selEnd) {
|
} else if (newPos > selEnd) {
|
||||||
pdoc->DeleteChars(selStart, lenDrag);
|
pdoc->DeleteChars(selStart, drag.len);
|
||||||
newPos -= lenDrag;
|
newPos -= drag.len;
|
||||||
pdoc->InsertString(newPos, dragChars, lenDrag);
|
pdoc->InsertString(newPos, drag.s, drag.len);
|
||||||
SetSelection(newPos, newPos + lenDrag);
|
SetSelection(newPos, newPos + drag.len);
|
||||||
} else {
|
} else {
|
||||||
SetEmptySelection(newPos);
|
SetEmptySelection(newPos);
|
||||||
}
|
}
|
||||||
delete []dragChars;
|
drag.Set(0, 0);
|
||||||
dragChars = 0;
|
|
||||||
lenDrag = 0;
|
|
||||||
}
|
}
|
||||||
selectionType = selChar;
|
selectionType = selChar;
|
||||||
}
|
}
|
||||||
@@ -3545,14 +3491,11 @@ 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);
|
//Platform::DebugPrintf("S start wnd proc %d %d %d\n",iMessage, wParam, lParam);
|
||||||
|
|
||||||
// Optional macro recording hook
|
// Optional macro recording hook
|
||||||
#ifdef MACRO_SUPPORT
|
|
||||||
if (recordingMacro)
|
if (recordingMacro)
|
||||||
NotifyMacroRecord(iMessage, wParam, lParam);
|
NotifyMacroRecord(iMessage, wParam, lParam);
|
||||||
#endif
|
|
||||||
|
|
||||||
switch (iMessage) {
|
switch (iMessage) {
|
||||||
|
|
||||||
case WM_GETTEXT:
|
|
||||||
case SCI_GETTEXT:
|
case SCI_GETTEXT:
|
||||||
{
|
{
|
||||||
if (lParam == 0)
|
if (lParam == 0)
|
||||||
@@ -3565,7 +3508,6 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) {
|
|||||||
return iChar;
|
return iChar;
|
||||||
}
|
}
|
||||||
|
|
||||||
case WM_SETTEXT:
|
|
||||||
case SCI_SETTEXT:
|
case SCI_SETTEXT:
|
||||||
{
|
{
|
||||||
if (lParam == 0)
|
if (lParam == 0)
|
||||||
@@ -3576,130 +3518,45 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) {
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
case WM_GETTEXTLENGTH:
|
|
||||||
case SCI_GETTEXTLENGTH:
|
case SCI_GETTEXTLENGTH:
|
||||||
return pdoc->Length();
|
return pdoc->Length();
|
||||||
|
|
||||||
case WM_CUT:
|
|
||||||
case SCI_CUT:
|
case SCI_CUT:
|
||||||
Cut();
|
Cut();
|
||||||
SetLastXChosen();
|
SetLastXChosen();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WM_COPY:
|
|
||||||
case SCI_COPY:
|
case SCI_COPY:
|
||||||
Copy();
|
Copy();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WM_PASTE:
|
|
||||||
case SCI_PASTE:
|
case SCI_PASTE:
|
||||||
Paste();
|
Paste();
|
||||||
SetLastXChosen();
|
SetLastXChosen();
|
||||||
EnsureCaretVisible();
|
EnsureCaretVisible();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WM_CLEAR:
|
|
||||||
case SCI_CLEAR:
|
case SCI_CLEAR:
|
||||||
Clear();
|
Clear();
|
||||||
SetLastXChosen();
|
SetLastXChosen();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WM_UNDO:
|
|
||||||
case SCI_UNDO:
|
case SCI_UNDO:
|
||||||
Undo();
|
Undo();
|
||||||
SetLastXChosen();
|
SetLastXChosen();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
// Edit control messages
|
|
||||||
|
|
||||||
// Not supported (no-ops):
|
|
||||||
// EM_GETWORDBREAKPROC
|
|
||||||
// EM_GETWORDBREAKPROCEX
|
|
||||||
// EM_SETWORDBREAKPROC
|
|
||||||
// EM_SETWORDBREAKPROCEX
|
|
||||||
// EM_GETWORDWRAPMODE
|
|
||||||
// EM_SETWORDWRAPMODE
|
|
||||||
// EM_LIMITTEXT
|
|
||||||
// EM_EXLIMITTEXT
|
|
||||||
// EM_SETRECT
|
|
||||||
// EM_SETRECTNP
|
|
||||||
// EM_FMTLINES
|
|
||||||
// EM_GETHANDLE
|
|
||||||
// EM_SETHANDLE
|
|
||||||
// EM_GETPASSWORDCHAR
|
|
||||||
// EM_SETPASSWORDCHAR
|
|
||||||
// EM_SETTABSTOPS
|
|
||||||
// EM_FINDWORDBREAK
|
|
||||||
// EM_GETCHARFORMAT
|
|
||||||
// EM_SETCHARFORMAT
|
|
||||||
// EM_GETOLEINTERFACE
|
|
||||||
// EM_SETOLEINTERFACE
|
|
||||||
// EM_SETOLECALLBACK
|
|
||||||
// EM_GETPARAFORMAT
|
|
||||||
// EM_SETPARAFORMAT
|
|
||||||
// EM_PASTESPECIAL
|
|
||||||
// EM_REQUESTRESIZE
|
|
||||||
// EM_GETBKGNDCOLOR
|
|
||||||
// EM_SETBKGNDCOLOR
|
|
||||||
// EM_STREAMIN
|
|
||||||
// EM_STREAMOUT
|
|
||||||
// EM_GETIMECOLOR
|
|
||||||
// EM_SETIMECOLOR
|
|
||||||
// EM_GETIMEOPTIONS
|
|
||||||
// EM_SETIMEOPTIONS
|
|
||||||
// EM_GETOPTIONS
|
|
||||||
// EM_SETOPTIONS
|
|
||||||
// EM_GETPUNCTUATION
|
|
||||||
// EM_SETPUNCTUATION
|
|
||||||
// EM_GETTHUMB
|
|
||||||
// EM_SETTARGETDEVICE
|
|
||||||
|
|
||||||
// Not supported but should be:
|
|
||||||
// EM_GETEVENTMASK
|
|
||||||
// EM_SETEVENTMASK
|
|
||||||
// For printing:
|
|
||||||
// EM_DISPLAYBAND
|
|
||||||
|
|
||||||
case EM_CANUNDO:
|
|
||||||
case SCI_CANUNDO:
|
case SCI_CANUNDO:
|
||||||
return pdoc->CanUndo() ? TRUE : FALSE;
|
return pdoc->CanUndo() ? TRUE : FALSE;
|
||||||
|
|
||||||
case EM_UNDO:
|
|
||||||
Undo();
|
|
||||||
SetLastXChosen();
|
|
||||||
break;
|
|
||||||
|
|
||||||
case EM_EMPTYUNDOBUFFER:
|
|
||||||
case SCI_EMPTYUNDOBUFFER:
|
case SCI_EMPTYUNDOBUFFER:
|
||||||
pdoc->DeleteUndoHistory();
|
pdoc->DeleteUndoHistory();
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
case EM_GETFIRSTVISIBLELINE:
|
|
||||||
case SCI_GETFIRSTVISIBLELINE:
|
case SCI_GETFIRSTVISIBLELINE:
|
||||||
return topLine;
|
return topLine;
|
||||||
|
|
||||||
case EM_GETLINE: {
|
case SCI_GETLINE: { // Risk of overwriting the end of the buffer
|
||||||
if (lParam == 0) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
char *ptr = reinterpret_cast<char *>(lParam);
|
|
||||||
short *pBufSize = reinterpret_cast<short *>(lParam);
|
|
||||||
short bufSize = *pBufSize;
|
|
||||||
ptr[0] = '\0'; // If no characters copied, have to put a NUL into buffer
|
|
||||||
if (static_cast<int>(wParam) > pdoc->LinesTotal()) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
int lineStart = pdoc->LineStart(wParam);
|
|
||||||
int lineEnd = pdoc->LineStart(wParam + 1);
|
|
||||||
// The first word of the buffer is the size, in TCHARs, of the buffer
|
|
||||||
int iPlace = 0;
|
|
||||||
for (int iChar = lineStart; iChar < lineEnd && iPlace < bufSize; iChar++) {
|
|
||||||
ptr[iPlace++] = pdoc->CharAt(iChar);
|
|
||||||
}
|
|
||||||
return iPlace;
|
|
||||||
}
|
|
||||||
|
|
||||||
case SCI_GETLINE: { // Simpler than EM_GETLINE, but with risk of overwriting the end of the buffer
|
|
||||||
if (lParam == 0) {
|
if (lParam == 0) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -3713,42 +3570,15 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) {
|
|||||||
return iPlace;
|
return iPlace;
|
||||||
}
|
}
|
||||||
|
|
||||||
case EM_GETLINECOUNT:
|
|
||||||
case SCI_GETLINECOUNT:
|
case SCI_GETLINECOUNT:
|
||||||
if (pdoc->LinesTotal() == 0)
|
if (pdoc->LinesTotal() == 0)
|
||||||
return 1;
|
return 1;
|
||||||
else
|
else
|
||||||
return pdoc->LinesTotal();
|
return pdoc->LinesTotal();
|
||||||
|
|
||||||
case EM_GETMODIFY:
|
|
||||||
case SCI_GETMODIFY:
|
case SCI_GETMODIFY:
|
||||||
return !pdoc->IsSavePoint();
|
return !pdoc->IsSavePoint();
|
||||||
|
|
||||||
case EM_GETRECT:
|
|
||||||
if (lParam == 0)
|
|
||||||
return 0;
|
|
||||||
*(reinterpret_cast<PRectangle *>(lParam)) = GetClientRectangle();
|
|
||||||
break;
|
|
||||||
|
|
||||||
case EM_GETSEL:
|
|
||||||
if (wParam)
|
|
||||||
*reinterpret_cast<int *>(wParam) = SelectionStart();
|
|
||||||
if (lParam)
|
|
||||||
*reinterpret_cast<int *>(lParam) = SelectionEnd();
|
|
||||||
return Platform::LongFromTwoShorts(
|
|
||||||
static_cast<short>(SelectionStart()),
|
|
||||||
static_cast<short>(SelectionEnd()));
|
|
||||||
|
|
||||||
case EM_EXGETSEL: {
|
|
||||||
if (lParam == 0)
|
|
||||||
return 0;
|
|
||||||
CharacterRange *pCR = reinterpret_cast<CharacterRange *>(lParam);
|
|
||||||
pCR->cpMin = SelectionStart();
|
|
||||||
pCR->cpMax = SelectionEnd();
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case EM_SETSEL:
|
|
||||||
case SCI_SETSEL: {
|
case SCI_SETSEL: {
|
||||||
int nStart = static_cast<int>(wParam);
|
int nStart = static_cast<int>(wParam);
|
||||||
int nEnd = static_cast<int>(lParam);
|
int nEnd = static_cast<int>(lParam);
|
||||||
@@ -3762,55 +3592,28 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) {
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case EM_EXSETSEL: {
|
|
||||||
if (lParam == 0)
|
|
||||||
return 0;
|
|
||||||
CharacterRange *pCR = reinterpret_cast<CharacterRange *>(lParam);
|
|
||||||
selType = selStream;
|
|
||||||
if (pCR->cpMax == -1) {
|
|
||||||
SetSelection(pCR->cpMin, pdoc->Length());
|
|
||||||
} else {
|
|
||||||
SetSelection(pCR->cpMin, pCR->cpMax);
|
|
||||||
}
|
|
||||||
EnsureCaretVisible();
|
|
||||||
return pdoc->LineFromPosition(SelectionStart());
|
|
||||||
}
|
|
||||||
|
|
||||||
case EM_GETSELTEXT:
|
|
||||||
case SCI_GETSELTEXT: {
|
case SCI_GETSELTEXT: {
|
||||||
if (lParam == 0)
|
if (lParam == 0)
|
||||||
return 0;
|
return 0;
|
||||||
|
SelectionText selectedText;
|
||||||
|
CopySelectionRange(&selectedText);
|
||||||
char *ptr = reinterpret_cast<char *>(lParam);
|
char *ptr = reinterpret_cast<char *>(lParam);
|
||||||
int selSize = SelectionRangeLength();
|
|
||||||
char *text = CopySelectionRange();
|
|
||||||
int iChar = 0;
|
int iChar = 0;
|
||||||
if (text) {
|
if (selectedText.len) {
|
||||||
for (; iChar < selSize; iChar++)
|
for (; iChar < selectedText.len; iChar++)
|
||||||
ptr[iChar] = text[iChar];
|
ptr[iChar] = selectedText.s[iChar];
|
||||||
ptr[iChar] = '\0';
|
ptr[iChar] = '\0';
|
||||||
delete []text;
|
|
||||||
} else {
|
} else {
|
||||||
ptr[0] = '\0';
|
ptr[0] = '\0';
|
||||||
}
|
}
|
||||||
return iChar;
|
return iChar;
|
||||||
}
|
}
|
||||||
|
|
||||||
case EM_LINEFROMCHAR:
|
|
||||||
if (static_cast<int>(wParam) < 0)
|
|
||||||
wParam = SelectionStart();
|
|
||||||
return pdoc->LineFromPosition(wParam);
|
|
||||||
|
|
||||||
case EM_EXLINEFROMCHAR:
|
|
||||||
if (static_cast<int>(lParam) < 0)
|
|
||||||
lParam = SelectionStart(); // Not specified, but probably OK
|
|
||||||
return pdoc->LineFromPosition(lParam);
|
|
||||||
|
|
||||||
case SCI_LINEFROMPOSITION:
|
case SCI_LINEFROMPOSITION:
|
||||||
if (static_cast<int>(wParam) < 0)
|
if (static_cast<int>(wParam) < 0)
|
||||||
return 0;
|
return 0;
|
||||||
return pdoc->LineFromPosition(wParam);
|
return pdoc->LineFromPosition(wParam);
|
||||||
|
|
||||||
case EM_LINEINDEX:
|
|
||||||
case SCI_POSITIONFROMLINE:
|
case SCI_POSITIONFROMLINE:
|
||||||
if (static_cast<int>(wParam) < 0)
|
if (static_cast<int>(wParam) < 0)
|
||||||
wParam = pdoc->LineFromPosition(SelectionStart());
|
wParam = pdoc->LineFromPosition(SelectionStart());
|
||||||
@@ -3822,20 +3625,6 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) {
|
|||||||
// return -1;
|
// return -1;
|
||||||
return pdoc->LineStart(wParam);
|
return pdoc->LineStart(wParam);
|
||||||
|
|
||||||
case EM_LINELENGTH: {
|
|
||||||
if (static_cast<int>(wParam) < 0) // Who use this anyway?
|
|
||||||
return 0; // Should be... Too complex to describe here, see MS specs!
|
|
||||||
if (static_cast<int>(wParam) > pdoc->Length()) // Useful test, anyway...
|
|
||||||
return 0;
|
|
||||||
int line = pdoc->LineFromPosition(wParam);
|
|
||||||
int charsOnLine = 0;
|
|
||||||
for (int pos = pdoc->LineStart(line); pos < pdoc->LineStart(line + 1); pos++) {
|
|
||||||
if ((pdoc->CharAt(pos) != '\r') && (pdoc->CharAt(pos) != '\n'))
|
|
||||||
charsOnLine++;
|
|
||||||
}
|
|
||||||
return charsOnLine;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Replacement of the old Scintilla interpretation of EM_LINELENGTH
|
// Replacement of the old Scintilla interpretation of EM_LINELENGTH
|
||||||
case SCI_LINELENGTH:
|
case SCI_LINELENGTH:
|
||||||
if ((static_cast<int>(wParam) < 0) ||
|
if ((static_cast<int>(wParam) < 0) ||
|
||||||
@@ -3843,7 +3632,6 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) {
|
|||||||
return 0;
|
return 0;
|
||||||
return pdoc->LineStart(wParam + 1) - pdoc->LineStart(wParam);
|
return pdoc->LineStart(wParam + 1) - pdoc->LineStart(wParam);
|
||||||
|
|
||||||
case EM_REPLACESEL:
|
|
||||||
case SCI_REPLACESEL: {
|
case SCI_REPLACESEL: {
|
||||||
if (lParam == 0)
|
if (lParam == 0)
|
||||||
return 0;
|
return 0;
|
||||||
@@ -3890,18 +3678,15 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) {
|
|||||||
case SCI_GETSEARCHFLAGS:
|
case SCI_GETSEARCHFLAGS:
|
||||||
return searchFlags;
|
return searchFlags;
|
||||||
|
|
||||||
case EM_LINESCROLL:
|
|
||||||
case SCI_LINESCROLL:
|
case SCI_LINESCROLL:
|
||||||
ScrollTo(topLine + lParam);
|
ScrollTo(topLine + lParam);
|
||||||
HorizontalScrollTo(xOffset + wParam * vs.spaceWidth);
|
HorizontalScrollTo(xOffset + wParam * vs.spaceWidth);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
case EM_SCROLLCARET:
|
|
||||||
case SCI_SCROLLCARET:
|
case SCI_SCROLLCARET:
|
||||||
EnsureCaretVisible();
|
EnsureCaretVisible();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case EM_SETREADONLY:
|
|
||||||
case SCI_SETREADONLY:
|
case SCI_SETREADONLY:
|
||||||
pdoc->SetReadOnly(wParam);
|
pdoc->SetReadOnly(wParam);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
@@ -3909,33 +3694,9 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) {
|
|||||||
case SCI_GETREADONLY:
|
case SCI_GETREADONLY:
|
||||||
return pdoc->IsReadOnly();
|
return pdoc->IsReadOnly();
|
||||||
|
|
||||||
case EM_CANPASTE:
|
|
||||||
case SCI_CANPASTE:
|
case SCI_CANPASTE:
|
||||||
return CanPaste();
|
return CanPaste();
|
||||||
|
|
||||||
case EM_CHARFROMPOS: {
|
|
||||||
if (lParam == 0)
|
|
||||||
return 0;
|
|
||||||
Point *ppt = reinterpret_cast<Point *>(lParam);
|
|
||||||
int pos = PositionFromLocation(*ppt);
|
|
||||||
int line = pdoc->LineFromPosition(pos);
|
|
||||||
return Platform::LongFromTwoShorts(
|
|
||||||
static_cast<short>(pos), static_cast < short > (line));
|
|
||||||
}
|
|
||||||
|
|
||||||
case EM_POSFROMCHAR: {
|
|
||||||
// The MS specs for this have changed 3 times: using the RichEdit 3 version
|
|
||||||
if (wParam == 0)
|
|
||||||
return 0;
|
|
||||||
Point *ppt = reinterpret_cast<Point *>(wParam);
|
|
||||||
if (lParam < 0) {
|
|
||||||
*ppt = Point(0, 0);
|
|
||||||
} else {
|
|
||||||
*ppt = LocationFromPosition(lParam);
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
case SCI_POINTXFROMPOSITION:
|
case SCI_POINTXFROMPOSITION:
|
||||||
if (lParam < 0) {
|
if (lParam < 0) {
|
||||||
return 0;
|
return 0;
|
||||||
@@ -3952,14 +3713,9 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) {
|
|||||||
return pt.y;
|
return pt.y;
|
||||||
}
|
}
|
||||||
|
|
||||||
case EM_FINDTEXT:
|
|
||||||
return FindText(iMessage, wParam, lParam);
|
|
||||||
|
|
||||||
case EM_FINDTEXTEX:
|
|
||||||
case SCI_FINDTEXT:
|
case SCI_FINDTEXT:
|
||||||
return FindText(iMessage, wParam, lParam);
|
return FindText(wParam, lParam);
|
||||||
|
|
||||||
case EM_GETTEXTRANGE:
|
|
||||||
case SCI_GETTEXTRANGE: {
|
case SCI_GETTEXTRANGE: {
|
||||||
if (lParam == 0)
|
if (lParam == 0)
|
||||||
return 0;
|
return 0;
|
||||||
@@ -3974,53 +3730,20 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) {
|
|||||||
return len; // Not including NUL
|
return len; // Not including NUL
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case SCI_HIDESELECTION:
|
||||||
|
|
||||||
case EM_SELECTIONTYPE:
|
|
||||||
#ifdef SEL_EMPTY
|
|
||||||
if (currentPos == anchor)
|
|
||||||
return SEL_EMPTY;
|
|
||||||
else
|
|
||||||
return SEL_TEXT;
|
|
||||||
#else
|
|
||||||
return 0;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
case EM_HIDESELECTION:
|
|
||||||
hideSelection = wParam;
|
hideSelection = wParam;
|
||||||
Redraw();
|
Redraw();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case EM_FORMATRANGE:
|
|
||||||
case SCI_FORMATRANGE:
|
case SCI_FORMATRANGE:
|
||||||
return FormatRange(wParam, reinterpret_cast<RangeToFormat *>(lParam));
|
return FormatRange(wParam, reinterpret_cast<RangeToFormat *>(lParam));
|
||||||
|
|
||||||
case EM_GETMARGINS:
|
|
||||||
return Platform::LongFromTwoShorts(static_cast<short>(vs.leftMarginWidth),
|
|
||||||
static_cast<short>(vs.rightMarginWidth));
|
|
||||||
|
|
||||||
case SCI_GETMARGINLEFT:
|
case SCI_GETMARGINLEFT:
|
||||||
return vs.leftMarginWidth;
|
return vs.leftMarginWidth;
|
||||||
|
|
||||||
case SCI_GETMARGINRIGHT:
|
case SCI_GETMARGINRIGHT:
|
||||||
return vs.rightMarginWidth;
|
return vs.rightMarginWidth;
|
||||||
|
|
||||||
case EM_SETMARGINS:
|
|
||||||
#ifdef EC_LEFTMARGIN
|
|
||||||
if (wParam & EC_LEFTMARGIN) {
|
|
||||||
vs.leftMarginWidth = Platform::LowShortFromLong(lParam);
|
|
||||||
}
|
|
||||||
if (wParam & EC_RIGHTMARGIN) {
|
|
||||||
vs.rightMarginWidth = Platform::HighShortFromLong(lParam);
|
|
||||||
}
|
|
||||||
if (wParam == EC_USEFONTINFO) {
|
|
||||||
vs.leftMarginWidth = vs.aveCharWidth / 2;
|
|
||||||
vs.rightMarginWidth = vs.aveCharWidth / 2;
|
|
||||||
}
|
|
||||||
InvalidateStyleRedraw();
|
|
||||||
#endif
|
|
||||||
break;
|
|
||||||
|
|
||||||
case SCI_SETMARGINLEFT:
|
case SCI_SETMARGINLEFT:
|
||||||
vs.leftMarginWidth = lParam;
|
vs.leftMarginWidth = lParam;
|
||||||
InvalidateStyleRedraw();
|
InvalidateStyleRedraw();
|
||||||
@@ -4667,10 +4390,6 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) {
|
|||||||
case SCI_LINESONSCREEN:
|
case SCI_LINESONSCREEN:
|
||||||
return LinesOnScreen();
|
return LinesOnScreen();
|
||||||
|
|
||||||
case SCI_USEPOPUP:
|
|
||||||
displayPopupMenu = wParam;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case SCI_SETSELFORE:
|
case SCI_SETSELFORE:
|
||||||
vs.selforeset = wParam;
|
vs.selforeset = wParam;
|
||||||
vs.selforeground.desired = Colour(lParam);
|
vs.selforeground.desired = Colour(lParam);
|
||||||
@@ -4711,7 +4430,7 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) {
|
|||||||
|
|
||||||
case SCI_CLEARCMDKEY:
|
case SCI_CLEARCMDKEY:
|
||||||
kmap.AssignCmdKey(Platform::LowShortFromLong(wParam),
|
kmap.AssignCmdKey(Platform::LowShortFromLong(wParam),
|
||||||
Platform::HighShortFromLong(wParam), WM_NULL);
|
Platform::HighShortFromLong(wParam), SCI_NULL);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SCI_CLEARALLCMDKEYS:
|
case SCI_CLEARALLCMDKEYS:
|
||||||
@@ -4915,15 +4634,13 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) {
|
|||||||
case SCI_GETCURSOR:
|
case SCI_GETCURSOR:
|
||||||
return cursorMode;
|
return cursorMode;
|
||||||
|
|
||||||
#ifdef MACRO_SUPPORT
|
|
||||||
case SCI_STARTRECORD:
|
case SCI_STARTRECORD:
|
||||||
recordingMacro = 1;
|
recordingMacro = true;
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
case SCI_STOPRECORD:
|
case SCI_STOPRECORD:
|
||||||
recordingMacro = 0;
|
recordingMacro = false;
|
||||||
return 0;
|
return 0;
|
||||||
#endif
|
|
||||||
|
|
||||||
case SCI_MOVECARETINSIDEVIEW:
|
case SCI_MOVECARETINSIDEVIEW:
|
||||||
MoveCaretInsideView();
|
MoveCaretInsideView();
|
||||||
|
@@ -50,6 +50,26 @@ public:
|
|||||||
int positions[maxLineLength+1];
|
int positions[maxLineLength+1];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class SelectionText {
|
||||||
|
public:
|
||||||
|
char *s;
|
||||||
|
int len;
|
||||||
|
bool rectangular;
|
||||||
|
SelectionText() : s(0), len(0), rectangular(false) {}
|
||||||
|
~SelectionText() {
|
||||||
|
Set(0, 0);
|
||||||
|
}
|
||||||
|
void Set(char *s_, int len_, bool rectangular_=false) {
|
||||||
|
delete []s;
|
||||||
|
s = s_;
|
||||||
|
if (s)
|
||||||
|
len = len_;
|
||||||
|
else
|
||||||
|
len = 0;
|
||||||
|
rectangular = rectangular_;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*/
|
*/
|
||||||
class Editor : public DocWatcher {
|
class Editor : public DocWatcher {
|
||||||
@@ -68,6 +88,7 @@ protected: // ScintillaBase subclass needs access to much of Editor
|
|||||||
bool stylesValid;
|
bool stylesValid;
|
||||||
ViewStyle vs;
|
ViewStyle vs;
|
||||||
Palette palette;
|
Palette palette;
|
||||||
|
|
||||||
int printMagnification;
|
int printMagnification;
|
||||||
int printColourMode;
|
int printColourMode;
|
||||||
int cursorMode;
|
int cursorMode;
|
||||||
@@ -91,9 +112,6 @@ protected: // ScintillaBase subclass needs access to much of Editor
|
|||||||
Surface pixmapSelPattern;
|
Surface pixmapSelPattern;
|
||||||
Surface pixmapIndentGuide;
|
Surface pixmapIndentGuide;
|
||||||
Surface pixmapIndentGuideHighlight;
|
Surface pixmapIndentGuideHighlight;
|
||||||
// Intellimouse support - currently only implemented for Windows
|
|
||||||
unsigned int ucWheelScrollLines;
|
|
||||||
int cWheelDelta; ///< Wheel delta from roll
|
|
||||||
|
|
||||||
KeyMap kmap;
|
KeyMap kmap;
|
||||||
|
|
||||||
@@ -109,7 +127,6 @@ protected: // ScintillaBase subclass needs access to much of Editor
|
|||||||
bool dwelling;
|
bool dwelling;
|
||||||
enum { selChar, selWord, selLine } selectionType;
|
enum { selChar, selWord, selLine } selectionType;
|
||||||
Point ptMouseLast;
|
Point ptMouseLast;
|
||||||
bool firstExpose;
|
|
||||||
bool inDragDrop;
|
bool inDragDrop;
|
||||||
bool dropWentOutside;
|
bool dropWentOutside;
|
||||||
int posDrag;
|
int posDrag;
|
||||||
@@ -138,9 +155,7 @@ protected: // ScintillaBase subclass needs access to much of Editor
|
|||||||
|
|
||||||
int modEventMask;
|
int modEventMask;
|
||||||
|
|
||||||
char *dragChars;
|
SelectionText drag;
|
||||||
int lenDrag;
|
|
||||||
bool dragIsRectangle;
|
|
||||||
enum { selStream, selRectangle, selRectangleFixed } selType;
|
enum { selStream, selRectangle, selRectangleFixed } selType;
|
||||||
int xStartSelect;
|
int xStartSelect;
|
||||||
int xEndSelect;
|
int xEndSelect;
|
||||||
@@ -154,11 +169,7 @@ protected: // ScintillaBase subclass needs access to much of Editor
|
|||||||
|
|
||||||
int searchAnchor;
|
int searchAnchor;
|
||||||
|
|
||||||
int displayPopupMenu;
|
bool recordingMacro;
|
||||||
|
|
||||||
#ifdef MACRO_SUPPORT
|
|
||||||
int recordingMacro;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
int foldFlags;
|
int foldFlags;
|
||||||
ContractionState cs;
|
ContractionState cs;
|
||||||
@@ -270,11 +281,7 @@ protected: // ScintillaBase subclass needs access to much of Editor
|
|||||||
void NotifyModified(Document *document, DocModification mh, void *userData);
|
void NotifyModified(Document *document, DocModification mh, void *userData);
|
||||||
void NotifyDeleted(Document *document, void *userData);
|
void NotifyDeleted(Document *document, void *userData);
|
||||||
void NotifyStyleNeeded(Document *doc, void *userData, int endPos);
|
void NotifyStyleNeeded(Document *doc, void *userData, int endPos);
|
||||||
|
|
||||||
|
|
||||||
#ifdef MACRO_SUPPORT
|
|
||||||
void NotifyMacroRecord(unsigned int iMessage, unsigned long wParam, long lParam);
|
void NotifyMacroRecord(unsigned int iMessage, unsigned long wParam, long lParam);
|
||||||
#endif
|
|
||||||
|
|
||||||
void PageMove(int direction, bool extend=false);
|
void PageMove(int direction, bool extend=false);
|
||||||
void ChangeCaseOfSelection(bool makeUpperCase);
|
void ChangeCaseOfSelection(bool makeUpperCase);
|
||||||
@@ -289,16 +296,14 @@ protected: // ScintillaBase subclass needs access to much of Editor
|
|||||||
|
|
||||||
void Indent(bool forwards);
|
void Indent(bool forwards);
|
||||||
|
|
||||||
long FindText(unsigned int iMessage, unsigned long wParam, long lParam);
|
long FindText(unsigned long wParam, long lParam);
|
||||||
void SearchAnchor();
|
void SearchAnchor();
|
||||||
long SearchText(unsigned int iMessage, unsigned long wParam, long lParam);
|
long SearchText(unsigned int iMessage, unsigned long wParam, long lParam);
|
||||||
long SearchInTarget(const char *text, int length);
|
long SearchInTarget(const char *text, int length);
|
||||||
void GoToLine(int lineNo);
|
void GoToLine(int lineNo);
|
||||||
|
|
||||||
char *CopyRange(int start, int end);
|
char *CopyRange(int start, int end);
|
||||||
int SelectionRangeLength();
|
void CopySelectionRange(SelectionText *ss);
|
||||||
char *CopySelectionRange();
|
|
||||||
void CopySelectionIntoDrag();
|
|
||||||
void SetDragPosition(int newPos);
|
void SetDragPosition(int newPos);
|
||||||
void DisplayCursor(Window::Cursor c);
|
void DisplayCursor(Window::Cursor c);
|
||||||
virtual void StartDrag();
|
virtual void StartDrag();
|
||||||
|
@@ -108,22 +108,26 @@ LexerModule lmNull(SCLEX_NULL, ColouriseNullDoc, "null");
|
|||||||
int wxForceScintillaLexers(void) {
|
int wxForceScintillaLexers(void) {
|
||||||
extern LexerModule lmAda;
|
extern LexerModule lmAda;
|
||||||
extern LexerModule lmAVE;
|
extern LexerModule lmAVE;
|
||||||
extern LexerModule lmConf;
|
|
||||||
extern LexerModule lmDiff;
|
|
||||||
extern LexerModule lmLatex;
|
|
||||||
extern LexerModule lmPascal;
|
|
||||||
extern LexerModule lmCPP;
|
|
||||||
extern LexerModule lmHTML;
|
|
||||||
extern LexerModule lmXML;
|
|
||||||
extern LexerModule lmProps;
|
|
||||||
extern LexerModule lmErrorList;
|
|
||||||
extern LexerModule lmMake;
|
|
||||||
extern LexerModule lmBatch;
|
extern LexerModule lmBatch;
|
||||||
|
extern LexerModule lmConf;
|
||||||
|
extern LexerModule lmCPP;
|
||||||
|
extern LexerModule lmDiff;
|
||||||
|
extern LexerModule lmEiffel;
|
||||||
|
extern LexerModule lmEiffelkw;
|
||||||
|
extern LexerModule lmErrorList;
|
||||||
|
extern LexerModule lmHTML;
|
||||||
|
extern LexerModule lmLatex;
|
||||||
|
extern LexerModule lmLISP;
|
||||||
|
extern LexerModule lmLua;
|
||||||
|
extern LexerModule lmMake;
|
||||||
|
extern LexerModule lmPascal;
|
||||||
extern LexerModule lmPerl;
|
extern LexerModule lmPerl;
|
||||||
|
extern LexerModule lmProps;
|
||||||
extern LexerModule lmPython;
|
extern LexerModule lmPython;
|
||||||
|
extern LexerModule lmRuby;
|
||||||
extern LexerModule lmSQL;
|
extern LexerModule lmSQL;
|
||||||
extern LexerModule lmVB;
|
extern LexerModule lmVB;
|
||||||
extern LexerModule lmRuby;
|
extern LexerModule lmXML;
|
||||||
|
|
||||||
if (
|
if (
|
||||||
&lmAda
|
&lmAda
|
||||||
@@ -144,6 +148,11 @@ int wxForceScintillaLexers(void) {
|
|||||||
&& &lmSQL
|
&& &lmSQL
|
||||||
&& &lmVB
|
&& &lmVB
|
||||||
&& &lmRuby
|
&& &lmRuby
|
||||||
|
&& &lmEiffel
|
||||||
|
&& &lmEiffelkw
|
||||||
|
&& &lmLISP
|
||||||
|
&& &lmLua
|
||||||
|
&& &lmNull
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
return 1;
|
return 1;
|
||||||
|
@@ -15,317 +15,255 @@
|
|||||||
|
|
||||||
#include "PropSet.h"
|
#include "PropSet.h"
|
||||||
#include "Accessor.h"
|
#include "Accessor.h"
|
||||||
|
#include "StyleContext.h"
|
||||||
#include "KeyWords.h"
|
#include "KeyWords.h"
|
||||||
#include "Scintilla.h"
|
#include "Scintilla.h"
|
||||||
#include "SciLexer.h"
|
#include "SciLexer.h"
|
||||||
|
|
||||||
static bool IsOKBeforeRE(int ch) {
|
static bool IsOKBeforeRE(const int ch) {
|
||||||
return (ch == '(') || (ch == '=') || (ch == ',');
|
return (ch == '(') || (ch == '=') || (ch == ',');
|
||||||
}
|
}
|
||||||
|
|
||||||
static void getRange(unsigned int start,
|
inline bool IsAWordChar(const int ch) {
|
||||||
unsigned int end,
|
|
||||||
Accessor &styler,
|
|
||||||
char *s,
|
|
||||||
unsigned int len) {
|
|
||||||
unsigned int i = 0;
|
|
||||||
while ((i < end - start + 1) && (i < len-1)) {
|
|
||||||
s[i] = styler[start + i];
|
|
||||||
i++;
|
|
||||||
}
|
|
||||||
s[i] = '\0';
|
|
||||||
}
|
|
||||||
|
|
||||||
inline bool IsASpace(int ch) {
|
|
||||||
return (ch == ' ') || ((ch >= 0x09) && (ch <= 0x0d));
|
|
||||||
}
|
|
||||||
|
|
||||||
inline bool IsAWordChar(int ch) {
|
|
||||||
return (ch < 0x80) && (isalnum(ch) || ch == '.' || ch == '_');
|
return (ch < 0x80) && (isalnum(ch) || ch == '.' || ch == '_');
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool IsAWordStart(int ch) {
|
inline bool IsAWordStart(const int ch) {
|
||||||
return (ch < 0x80) && (isalnum(ch) || ch == '_');
|
return (ch < 0x80) && (isalnum(ch) || ch == '_');
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool IsADigit(int ch) {
|
inline bool IsADoxygenChar(const int ch) {
|
||||||
return (ch >= '0') && (ch <= '9');
|
return (islower(ch) || ch == '$' || ch == '@' ||
|
||||||
|
ch == '\\' || ch == '&' || ch == '<' ||
|
||||||
|
ch == '>' || ch == '#' || ch == '{' ||
|
||||||
|
ch == '}' || ch == '[' || ch == ']');
|
||||||
}
|
}
|
||||||
|
|
||||||
// All languages handled so far can treat all characters >= 0x80 as one class
|
inline bool IsStateComment(const int state) {
|
||||||
// which just continues the current token or starts an identifier if in default.
|
return ((state == SCE_C_COMMENT) ||
|
||||||
// DBCS treated specially as the second character can be < 0x80 and hence
|
(state == SCE_C_COMMENTLINE) ||
|
||||||
// syntactically significant. UTF-8 avoids this as all trail bytes are >= 0x80
|
(state == SCE_C_COMMENTDOC) ||
|
||||||
class ColouriseContext {
|
(state == SCE_C_COMMENTDOCKEYWORD) ||
|
||||||
Accessor &styler;
|
(state == SCE_C_COMMENTDOCKEYWORDERROR));
|
||||||
int lengthDoc;
|
}
|
||||||
int currentPos;
|
|
||||||
ColouriseContext& operator=(const ColouriseContext&) {
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
public:
|
|
||||||
bool atEOL;
|
|
||||||
int state;
|
|
||||||
int chPrev;
|
|
||||||
int ch;
|
|
||||||
int chNext;
|
|
||||||
|
|
||||||
ColouriseContext(unsigned int startPos, int length,
|
inline bool IsStateString(const int state) {
|
||||||
int initStyle, Accessor &styler_) :
|
return ((state == SCE_C_STRING) || (state == SCE_C_VERBATIM));
|
||||||
styler(styler_),
|
}
|
||||||
lengthDoc(startPos + length),
|
|
||||||
currentPos(startPos),
|
|
||||||
atEOL(false),
|
|
||||||
state(initStyle),
|
|
||||||
chPrev(0),
|
|
||||||
ch(0),
|
|
||||||
chNext(0) {
|
|
||||||
styler.StartAt(startPos);
|
|
||||||
styler.StartSegment(startPos);
|
|
||||||
int pos = currentPos;
|
|
||||||
ch = static_cast<unsigned char>(styler.SafeGetCharAt(pos));
|
|
||||||
if (styler.IsLeadByte(static_cast<char>(ch))) {
|
|
||||||
pos++;
|
|
||||||
ch = ch << 8;
|
|
||||||
ch |= static_cast<unsigned char>(styler.SafeGetCharAt(pos));
|
|
||||||
}
|
|
||||||
chNext = static_cast<unsigned char>(styler.SafeGetCharAt(pos+1));
|
|
||||||
if (styler.IsLeadByte(static_cast<char>(chNext))) {
|
|
||||||
chNext = chNext << 8;
|
|
||||||
chNext |= static_cast<unsigned char>(styler.SafeGetCharAt(pos+2));
|
|
||||||
}
|
|
||||||
atEOL = (ch == '\r' && chNext != '\n') || (ch == '\n');
|
|
||||||
}
|
|
||||||
void Complete() {
|
|
||||||
styler.ColourTo(currentPos - 1, state);
|
|
||||||
}
|
|
||||||
bool More() {
|
|
||||||
return currentPos <= lengthDoc;
|
|
||||||
}
|
|
||||||
void Forward() {
|
|
||||||
// A lot of this is repeated from the constructor - TODO: merge code
|
|
||||||
chPrev = ch;
|
|
||||||
currentPos++;
|
|
||||||
if (ch >= 0x100)
|
|
||||||
currentPos++;
|
|
||||||
ch = chNext;
|
|
||||||
chNext = static_cast<unsigned char>(styler.SafeGetCharAt(currentPos+1));
|
|
||||||
if (styler.IsLeadByte(static_cast<char>(chNext))) {
|
|
||||||
chNext = chNext << 8;
|
|
||||||
chNext |= static_cast<unsigned char>(styler.SafeGetCharAt(currentPos + 2));
|
|
||||||
}
|
|
||||||
// Trigger on CR only (Mac style) or either on LF from CR+LF (Dos/Win) or on LF alone (Unix)
|
|
||||||
// Avoid triggering two times on Dos/Win
|
|
||||||
// End of line
|
|
||||||
atEOL = (ch == '\r' && chNext != '\n') || (ch == '\n');
|
|
||||||
}
|
|
||||||
void ChangeState(int state_) {
|
|
||||||
state = state_;
|
|
||||||
}
|
|
||||||
void SetState(int state_) {
|
|
||||||
styler.ColourTo(currentPos - 1, state);
|
|
||||||
state = state_;
|
|
||||||
}
|
|
||||||
void ForwardSetState(int state_) {
|
|
||||||
Forward();
|
|
||||||
styler.ColourTo(currentPos - 1, state);
|
|
||||||
state = state_;
|
|
||||||
}
|
|
||||||
void GetCurrent(char *s, int len) {
|
|
||||||
getRange(styler.GetStartSegment(), currentPos - 1, styler, s, len);
|
|
||||||
}
|
|
||||||
int LengthCurrent() {
|
|
||||||
return currentPos - styler.GetStartSegment();
|
|
||||||
}
|
|
||||||
bool Match(char ch0) {
|
|
||||||
return ch == ch0;
|
|
||||||
}
|
|
||||||
bool Match(char ch0, char ch1) {
|
|
||||||
return (ch == ch0) && (chNext == ch1);
|
|
||||||
}
|
|
||||||
bool Match(const char *s) {
|
|
||||||
if (ch != *s)
|
|
||||||
return false;
|
|
||||||
s++;
|
|
||||||
if (chNext != *s)
|
|
||||||
return false;
|
|
||||||
s++;
|
|
||||||
for (int n=2; *s; n++) {
|
|
||||||
if (*s != styler.SafeGetCharAt(currentPos+n))
|
|
||||||
return false;
|
|
||||||
s++;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
static void ColouriseCppDoc(unsigned int startPos, int length, int initStyle, WordList *keywordlists[],
|
static void ColouriseCppDoc(unsigned int startPos, int length, int initStyle, WordList *keywordlists[],
|
||||||
Accessor &styler) {
|
Accessor &styler) {
|
||||||
|
|
||||||
WordList &keywords = *keywordlists[0];
|
WordList &keywords = *keywordlists[0];
|
||||||
WordList &keywords2 = *keywordlists[1];
|
WordList &keywords2 = *keywordlists[1];
|
||||||
|
WordList &keywords3 = *keywordlists[2];
|
||||||
|
|
||||||
bool stylingWithinPreprocessor = styler.GetPropertyInt("styling.within.preprocessor");
|
bool stylingWithinPreprocessor = styler.GetPropertyInt("styling.within.preprocessor");
|
||||||
|
|
||||||
if (initStyle == SCE_C_STRINGEOL) // Does not leak onto next line
|
// Do not leak onto next line
|
||||||
|
if (initStyle == SCE_C_STRINGEOL)
|
||||||
initStyle = SCE_C_DEFAULT;
|
initStyle = SCE_C_DEFAULT;
|
||||||
|
|
||||||
int chPrevNonWhite = ' ';
|
int chPrevNonWhite = ' ';
|
||||||
int visibleChars = 0;
|
int visibleChars = 0;
|
||||||
|
int noDocChars = 0;
|
||||||
bool lastWordWasUUID = false;
|
bool lastWordWasUUID = false;
|
||||||
|
|
||||||
ColouriseContext cc(startPos, length, initStyle, styler);
|
StyleContext sc(startPos, length, initStyle, styler);
|
||||||
|
|
||||||
for (; cc.More(); cc.Forward()) {
|
for (; sc.More(); sc.Forward()) {
|
||||||
|
|
||||||
if (cc.state == SCE_C_STRINGEOL) {
|
// Handle line continuation generically.
|
||||||
if (cc.atEOL) {
|
if (sc.ch == '\\') {
|
||||||
cc.SetState(SCE_C_DEFAULT);
|
if (sc.Match("\\\n")) {
|
||||||
|
sc.Forward();
|
||||||
|
sc.Forward();
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
} else if (cc.state == SCE_C_OPERATOR) {
|
if (sc.Match("\\\r\n")) {
|
||||||
cc.SetState(SCE_C_DEFAULT);
|
sc.Forward();
|
||||||
} else if (cc.state == SCE_C_NUMBER) {
|
sc.Forward();
|
||||||
if (!IsAWordChar(cc.ch)) {
|
sc.Forward();
|
||||||
cc.SetState(SCE_C_DEFAULT);
|
continue;
|
||||||
}
|
}
|
||||||
} else if (cc.state == SCE_C_IDENTIFIER) {
|
}
|
||||||
if (!IsAWordChar(cc.ch) || (cc.ch == '.')) {
|
|
||||||
|
// Determine if the current state should terminate.
|
||||||
|
if (sc.state == SCE_C_OPERATOR) {
|
||||||
|
sc.SetState(SCE_C_DEFAULT);
|
||||||
|
} else if (sc.state == SCE_C_NUMBER) {
|
||||||
|
if (!IsAWordChar(sc.ch)) {
|
||||||
|
sc.SetState(SCE_C_DEFAULT);
|
||||||
|
}
|
||||||
|
} else if (sc.state == SCE_C_IDENTIFIER) {
|
||||||
|
if (!IsAWordChar(sc.ch) || (sc.ch == '.')) {
|
||||||
char s[100];
|
char s[100];
|
||||||
cc.GetCurrent(s, sizeof(s));
|
sc.GetCurrent(s, sizeof(s));
|
||||||
if (keywords.InList(s)) {
|
if (keywords.InList(s)) {
|
||||||
lastWordWasUUID = strcmp(s, "uuid") == 0;
|
lastWordWasUUID = strcmp(s, "uuid") == 0;
|
||||||
cc.ChangeState(SCE_C_WORD);
|
sc.ChangeState(SCE_C_WORD);
|
||||||
} else if (keywords2.InList(s)) {
|
} else if (keywords2.InList(s)) {
|
||||||
cc.ChangeState(SCE_C_WORD2);
|
sc.ChangeState(SCE_C_WORD2);
|
||||||
}
|
}
|
||||||
cc.SetState(SCE_C_DEFAULT);
|
sc.SetState(SCE_C_DEFAULT);
|
||||||
}
|
}
|
||||||
} if (cc.state == SCE_C_PREPROCESSOR) {
|
} else if (sc.state == SCE_C_PREPROCESSOR) {
|
||||||
if (stylingWithinPreprocessor) {
|
if (stylingWithinPreprocessor) {
|
||||||
if (IsASpace(cc.ch)) {
|
if (IsASpace(sc.ch)) {
|
||||||
cc.SetState(SCE_C_DEFAULT);
|
sc.SetState(SCE_C_DEFAULT);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (cc.atEOL && (cc.chPrev != '\\')) {
|
if (sc.atLineEnd) {
|
||||||
cc.SetState(SCE_C_DEFAULT);
|
sc.SetState(SCE_C_DEFAULT);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (cc.state == SCE_C_COMMENT) {
|
} else if (sc.state == SCE_C_COMMENT) {
|
||||||
if (cc.Match('*', '/')) {
|
if (sc.Match('*', '/')) {
|
||||||
cc.Forward();
|
sc.Forward();
|
||||||
cc.ForwardSetState(SCE_C_DEFAULT);
|
sc.ForwardSetState(SCE_C_DEFAULT);
|
||||||
}
|
}
|
||||||
} else if (cc.state == SCE_C_COMMENTDOC) {
|
} else if (sc.state == SCE_C_COMMENTDOC) {
|
||||||
if (cc.Match('*', '/')) {
|
if (sc.Match('*', '/')) {
|
||||||
cc.Forward();
|
sc.Forward();
|
||||||
cc.ForwardSetState(SCE_C_DEFAULT);
|
sc.ForwardSetState(SCE_C_DEFAULT);
|
||||||
|
} else if ((sc.ch == '@' || sc.ch == '\\') && (noDocChars == 0)) {
|
||||||
|
sc.SetState(SCE_C_COMMENTDOCKEYWORD);
|
||||||
|
} else if (sc.atLineEnd) {
|
||||||
|
noDocChars = 0;
|
||||||
|
} else if (!isspace(sc.ch) && (sc.ch != '*')) {
|
||||||
|
noDocChars++;
|
||||||
}
|
}
|
||||||
} else if (cc.state == SCE_C_COMMENTLINE || cc.state == SCE_C_COMMENTLINEDOC) {
|
} else if (sc.state == SCE_C_COMMENTLINE || sc.state == SCE_C_COMMENTLINEDOC) {
|
||||||
if (cc.ch == '\r' || cc.ch == '\n') {
|
if (sc.atLineEnd) {
|
||||||
cc.SetState(SCE_C_DEFAULT);
|
sc.SetState(SCE_C_DEFAULT);
|
||||||
|
visibleChars = 0;
|
||||||
}
|
}
|
||||||
} else if (cc.state == SCE_C_STRING) {
|
} else if (sc.state == SCE_C_COMMENTDOCKEYWORD) {
|
||||||
if (cc.ch == '\\') {
|
if (sc.Match('*', '/')) {
|
||||||
if (cc.chNext == '\"' || cc.chNext == '\'' || cc.chNext == '\\') {
|
sc.ChangeState(SCE_C_COMMENTDOCKEYWORDERROR);
|
||||||
cc.Forward();
|
sc.Forward();
|
||||||
|
sc.ForwardSetState(SCE_C_DEFAULT);
|
||||||
|
} else if (!IsADoxygenChar(sc.ch)) {
|
||||||
|
char s[100];
|
||||||
|
sc.GetCurrent(s, sizeof(s));
|
||||||
|
if (!isspace(sc.ch) || !keywords3.InList(s+1)) {
|
||||||
|
sc.ChangeState(SCE_C_COMMENTDOCKEYWORDERROR);
|
||||||
}
|
}
|
||||||
} else if (cc.ch == '\"') {
|
sc.SetState(SCE_C_COMMENTDOC);
|
||||||
cc.ForwardSetState(SCE_C_DEFAULT);
|
|
||||||
} else if ((cc.atEOL) && (cc.chPrev != '\\')) {
|
|
||||||
cc.ChangeState(SCE_C_STRINGEOL);
|
|
||||||
}
|
}
|
||||||
} else if (cc.state == SCE_C_CHARACTER) {
|
} else if (sc.state == SCE_C_STRING) {
|
||||||
if ((cc.ch == '\r' || cc.ch == '\n') && (cc.chPrev != '\\')) {
|
if (sc.ch == '\\') {
|
||||||
cc.ChangeState(SCE_C_STRINGEOL);
|
if (sc.chNext == '\"' || sc.chNext == '\'' || sc.chNext == '\\') {
|
||||||
} else if (cc.ch == '\\') {
|
sc.Forward();
|
||||||
if (cc.chNext == '\"' || cc.chNext == '\'' || cc.chNext == '\\') {
|
|
||||||
cc.Forward();
|
|
||||||
}
|
}
|
||||||
} else if (cc.ch == '\'') {
|
} else if (sc.ch == '\"') {
|
||||||
cc.ForwardSetState(SCE_C_DEFAULT);
|
sc.ForwardSetState(SCE_C_DEFAULT);
|
||||||
|
} else if (sc.atLineEnd) {
|
||||||
|
sc.ChangeState(SCE_C_STRINGEOL);
|
||||||
|
sc.ForwardSetState(SCE_C_DEFAULT);
|
||||||
|
visibleChars = 0;
|
||||||
}
|
}
|
||||||
} else if (cc.state == SCE_C_REGEX) {
|
} else if (sc.state == SCE_C_CHARACTER) {
|
||||||
if (cc.ch == '\r' || cc.ch == '\n' || cc.ch == '/') {
|
if (sc.atLineEnd) {
|
||||||
cc.ForwardSetState(SCE_C_DEFAULT);
|
sc.ChangeState(SCE_C_STRINGEOL);
|
||||||
} else if (cc.ch == '\\') {
|
sc.ForwardSetState(SCE_C_DEFAULT);
|
||||||
|
visibleChars = 0;
|
||||||
|
} else if (sc.ch == '\\') {
|
||||||
|
if (sc.chNext == '\"' || sc.chNext == '\'' || sc.chNext == '\\') {
|
||||||
|
sc.Forward();
|
||||||
|
}
|
||||||
|
} else if (sc.ch == '\'') {
|
||||||
|
sc.ForwardSetState(SCE_C_DEFAULT);
|
||||||
|
}
|
||||||
|
} else if (sc.state == SCE_C_REGEX) {
|
||||||
|
if (sc.ch == '\r' || sc.ch == '\n' || sc.ch == '/') {
|
||||||
|
sc.ForwardSetState(SCE_C_DEFAULT);
|
||||||
|
} else if (sc.ch == '\\') {
|
||||||
// Gobble up the quoted character
|
// Gobble up the quoted character
|
||||||
if (cc.chNext == '\\' || cc.chNext == '/') {
|
if (sc.chNext == '\\' || sc.chNext == '/') {
|
||||||
cc.Forward();
|
sc.Forward();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (cc.state == SCE_C_VERBATIM) {
|
} else if (sc.state == SCE_C_VERBATIM) {
|
||||||
if (cc.ch == '\"') {
|
if (sc.ch == '\"') {
|
||||||
if (cc.chNext == '\"') {
|
if (sc.chNext == '\"') {
|
||||||
cc.Forward();
|
sc.Forward();
|
||||||
} else {
|
} else {
|
||||||
cc.ForwardSetState(SCE_C_DEFAULT);
|
sc.ForwardSetState(SCE_C_DEFAULT);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (cc.state == SCE_C_UUID) {
|
} else if (sc.state == SCE_C_UUID) {
|
||||||
if (cc.ch == '\r' || cc.ch == '\n' || cc.ch == ')') {
|
if (sc.ch == '\r' || sc.ch == '\n' || sc.ch == ')') {
|
||||||
cc.SetState(SCE_C_DEFAULT);
|
sc.SetState(SCE_C_DEFAULT);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cc.state == SCE_C_DEFAULT) {
|
// Determine if a new state should be entered.
|
||||||
if (cc.Match('@', '\"')) {
|
if (sc.state == SCE_C_DEFAULT) {
|
||||||
cc.SetState(SCE_C_VERBATIM);
|
if (sc.Match('@', '\"')) {
|
||||||
cc.Forward();
|
sc.SetState(SCE_C_VERBATIM);
|
||||||
} else if (IsADigit(cc.ch) || (cc.ch == '.' && IsADigit(cc.chNext))) {
|
sc.Forward();
|
||||||
|
} else if (IsADigit(sc.ch) || (sc.ch == '.' && IsADigit(sc.chNext))) {
|
||||||
if (lastWordWasUUID) {
|
if (lastWordWasUUID) {
|
||||||
cc.SetState(SCE_C_UUID);
|
sc.SetState(SCE_C_UUID);
|
||||||
lastWordWasUUID = false;
|
lastWordWasUUID = false;
|
||||||
} else {
|
} else {
|
||||||
cc.SetState(SCE_C_NUMBER);
|
sc.SetState(SCE_C_NUMBER);
|
||||||
}
|
}
|
||||||
} else if (IsAWordStart(cc.ch) || (cc.ch == '@')) {
|
} else if (IsAWordStart(sc.ch) || (sc.ch == '@')) {
|
||||||
if (lastWordWasUUID) {
|
if (lastWordWasUUID) {
|
||||||
cc.SetState(SCE_C_UUID);
|
sc.SetState(SCE_C_UUID);
|
||||||
lastWordWasUUID = false;
|
lastWordWasUUID = false;
|
||||||
} else {
|
} else {
|
||||||
cc.SetState(SCE_C_IDENTIFIER);
|
sc.SetState(SCE_C_IDENTIFIER);
|
||||||
}
|
}
|
||||||
} else if (cc.Match('/', '*')) {
|
} else if (sc.Match('/', '*')) {
|
||||||
if (cc.Match("/**") || cc.Match("/*!")) // Support of Qt/Doxygen doc. style
|
if (sc.Match("/**") || sc.Match("/*!")) { // Support of Qt/Doxygen doc. style
|
||||||
cc.SetState(SCE_C_COMMENTDOC);
|
noDocChars = 0;
|
||||||
|
sc.SetState(SCE_C_COMMENTDOC);
|
||||||
|
} else {
|
||||||
|
sc.SetState(SCE_C_COMMENT);
|
||||||
|
}
|
||||||
|
sc.Forward(); // Eat the * so it isn't used for the end of the comment
|
||||||
|
} else if (sc.Match('/', '/')) {
|
||||||
|
if (sc.Match("///") || sc.Match("//!")) // Support of Qt/Doxygen doc. style
|
||||||
|
sc.SetState(SCE_C_COMMENTLINEDOC);
|
||||||
else
|
else
|
||||||
cc.SetState(SCE_C_COMMENT);
|
sc.SetState(SCE_C_COMMENTLINE);
|
||||||
cc.Forward(); // Eat the * so it isn't used for the end of the comment
|
} else if (sc.ch == '/' && IsOKBeforeRE(chPrevNonWhite)) {
|
||||||
} else if (cc.Match('/', '/')) {
|
sc.SetState(SCE_C_REGEX);
|
||||||
if (cc.Match("///") || cc.Match("//!")) // Support of Qt/Doxygen doc. style
|
} else if (sc.ch == '\"') {
|
||||||
cc.SetState(SCE_C_COMMENTLINEDOC);
|
sc.SetState(SCE_C_STRING);
|
||||||
else
|
} else if (sc.ch == '\'') {
|
||||||
cc.SetState(SCE_C_COMMENTLINE);
|
sc.SetState(SCE_C_CHARACTER);
|
||||||
} else if (cc.ch == '/' && IsOKBeforeRE(chPrevNonWhite)) {
|
} else if (sc.ch == '#' && visibleChars == 0) {
|
||||||
cc.SetState(SCE_C_REGEX);
|
|
||||||
} else if (cc.ch == '\"') {
|
|
||||||
cc.SetState(SCE_C_STRING);
|
|
||||||
} else if (cc.ch == '\'') {
|
|
||||||
cc.SetState(SCE_C_CHARACTER);
|
|
||||||
} else if (cc.ch == '#' && visibleChars == 0) {
|
|
||||||
// Preprocessor commands are alone on their line
|
// Preprocessor commands are alone on their line
|
||||||
cc.SetState(SCE_C_PREPROCESSOR);
|
sc.SetState(SCE_C_PREPROCESSOR);
|
||||||
// Skip whitespace between # and preprocessor word
|
// Skip whitespace between # and preprocessor word
|
||||||
do {
|
do {
|
||||||
cc.Forward();
|
sc.Forward();
|
||||||
} while (IsASpace(cc.ch) && cc.More());
|
} while ((sc.ch == ' ') && (sc.ch == '\t') && sc.More());
|
||||||
} else if (isoperator(static_cast<char>(cc.ch))) {
|
if (sc.atLineEnd) {
|
||||||
cc.SetState(SCE_C_OPERATOR);
|
sc.SetState(SCE_C_DEFAULT);
|
||||||
|
}
|
||||||
|
} else if (isoperator(static_cast<char>(sc.ch))) {
|
||||||
|
sc.SetState(SCE_C_OPERATOR);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (cc.atEOL) {
|
|
||||||
|
if (sc.atLineEnd) {
|
||||||
// Reset states to begining of colourise so no surprises
|
// Reset states to begining of colourise so no surprises
|
||||||
// if different sets of lines lexed.
|
// if different sets of lines lexed.
|
||||||
chPrevNonWhite = ' ';
|
chPrevNonWhite = ' ';
|
||||||
visibleChars = 0;
|
visibleChars = 0;
|
||||||
lastWordWasUUID = false;
|
lastWordWasUUID = false;
|
||||||
}
|
}
|
||||||
if (!IsASpace(cc.ch)) {
|
if (!IsASpace(sc.ch)) {
|
||||||
chPrevNonWhite = cc.ch;
|
chPrevNonWhite = sc.ch;
|
||||||
visibleChars++;
|
visibleChars++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
cc.Complete();
|
sc.Complete();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void FoldCppDoc(unsigned int startPos, int length, int initStyle, WordList *[],
|
static void FoldCppDoc(unsigned int startPos, int length, int initStyle, WordList *[],
|
||||||
|
204
src/stc/scintilla/src/LexCrontab.cxx
Normal file
204
src/stc/scintilla/src/LexCrontab.cxx
Normal file
@@ -0,0 +1,204 @@
|
|||||||
|
// Scintilla source code edit control
|
||||||
|
/** @file LexCrontab.cxx
|
||||||
|
** Lexer to use with extended crontab files used by a powerful
|
||||||
|
** Windows scheduler/event monitor/automation manager nnCron.
|
||||||
|
** (http://nemtsev.virtualave.net/)
|
||||||
|
**/
|
||||||
|
// Copyright 1998-2001 by Neil Hodgson <neilh@scintilla.org>
|
||||||
|
// The License.txt file describes the conditions under which this software may be distributed.
|
||||||
|
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <ctype.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdarg.h>
|
||||||
|
|
||||||
|
#include "Platform.h"
|
||||||
|
|
||||||
|
#include "PropSet.h"
|
||||||
|
#include "Accessor.h"
|
||||||
|
#include "KeyWords.h"
|
||||||
|
#include "Scintilla.h"
|
||||||
|
#include "SciLexer.h"
|
||||||
|
|
||||||
|
static void ColouriseNncrontabDoc(unsigned int startPos, int length, int, WordList
|
||||||
|
*keywordLists[], Accessor &styler)
|
||||||
|
{
|
||||||
|
int state = SCE_NNCRONTAB_DEFAULT;
|
||||||
|
char chNext = styler[startPos];
|
||||||
|
int lengthDoc = startPos + length;
|
||||||
|
// create a buffer large enough to take the largest chunk...
|
||||||
|
char *buffer = new char[length];
|
||||||
|
int bufferCount = 0;
|
||||||
|
// used when highliting environment variables inside quoted string:
|
||||||
|
bool insideString = false;
|
||||||
|
|
||||||
|
// this assumes that we have 3 keyword list in conf.properties
|
||||||
|
WordList §ion = *keywordLists[0];
|
||||||
|
WordList &keyword = *keywordLists[1];
|
||||||
|
WordList &modifier = *keywordLists[2];
|
||||||
|
|
||||||
|
// go through all provided text segment
|
||||||
|
// using the hand-written state machine shown below
|
||||||
|
styler.StartAt(startPos);
|
||||||
|
styler.StartSegment(startPos);
|
||||||
|
for (int i = startPos; i < lengthDoc; i++) {
|
||||||
|
char ch = chNext;
|
||||||
|
chNext = styler.SafeGetCharAt(i + 1);
|
||||||
|
|
||||||
|
if (styler.IsLeadByte(ch)) {
|
||||||
|
chNext = styler.SafeGetCharAt(i + 2);
|
||||||
|
i++;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
switch(state) {
|
||||||
|
case SCE_NNCRONTAB_DEFAULT:
|
||||||
|
if( ch == '\n' || ch == '\r' || ch == '\t' || ch == ' ') {
|
||||||
|
// whitespace is simply ignored here...
|
||||||
|
styler.ColourTo(i,SCE_NNCRONTAB_DEFAULT);
|
||||||
|
break;
|
||||||
|
} else if( ch == '#' && styler.SafeGetCharAt(i+1) == '(') {
|
||||||
|
// signals the start of a task...
|
||||||
|
state = SCE_NNCRONTAB_TASK;
|
||||||
|
styler.ColourTo(i,SCE_NNCRONTAB_TASK);
|
||||||
|
}
|
||||||
|
else if( ch == '\\' && styler.SafeGetCharAt(i+1) == ' ') {
|
||||||
|
// signals the start of an extended comment...
|
||||||
|
state = SCE_NNCRONTAB_COMMENT;
|
||||||
|
styler.ColourTo(i,SCE_NNCRONTAB_COMMENT);
|
||||||
|
} else if( ch == '#' ) {
|
||||||
|
// signals the start of a plain comment...
|
||||||
|
state = SCE_NNCRONTAB_COMMENT;
|
||||||
|
styler.ColourTo(i,SCE_NNCRONTAB_COMMENT);
|
||||||
|
} else if( ch == ')' && styler.SafeGetCharAt(i+1) == '#') {
|
||||||
|
// signals the end of a task...
|
||||||
|
state = SCE_NNCRONTAB_TASK;
|
||||||
|
styler.ColourTo(i,SCE_NNCRONTAB_TASK);
|
||||||
|
} else if( ch == '"') {
|
||||||
|
state = SCE_NNCRONTAB_STRING;
|
||||||
|
styler.ColourTo(i,SCE_NNCRONTAB_STRING);
|
||||||
|
} else if( ch == '%') {
|
||||||
|
// signals environment variables
|
||||||
|
state = SCE_NNCRONTAB_ENVIRONMENT;
|
||||||
|
styler.ColourTo(i,SCE_NNCRONTAB_ENVIRONMENT);
|
||||||
|
} else if( ch == '*' ) {
|
||||||
|
// signals an asterisk
|
||||||
|
// no state jump necessary for this simple case...
|
||||||
|
styler.ColourTo(i,SCE_NNCRONTAB_ASTERISK);
|
||||||
|
} else if( isalpha(ch) || ch == '<' ) {
|
||||||
|
// signals the start of an identifier
|
||||||
|
bufferCount = 0;
|
||||||
|
buffer[bufferCount++] = ch;
|
||||||
|
state = SCE_NNCRONTAB_IDENTIFIER;
|
||||||
|
} else if( isdigit(ch) ) {
|
||||||
|
// signals the start of a number
|
||||||
|
bufferCount = 0;
|
||||||
|
buffer[bufferCount++] = ch;
|
||||||
|
state = SCE_NNCRONTAB_NUMBER;
|
||||||
|
} else {
|
||||||
|
// style it the default style..
|
||||||
|
styler.ColourTo(i,SCE_NNCRONTAB_DEFAULT);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case SCE_NNCRONTAB_COMMENT:
|
||||||
|
// if we find a newline here,
|
||||||
|
// we simply go to default state
|
||||||
|
// else continue to work on it...
|
||||||
|
if( ch == '\n' || ch == '\r' ) {
|
||||||
|
state = SCE_NNCRONTAB_DEFAULT;
|
||||||
|
} else {
|
||||||
|
styler.ColourTo(i,SCE_NNCRONTAB_COMMENT);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case SCE_NNCRONTAB_TASK:
|
||||||
|
// if we find a newline here,
|
||||||
|
// we simply go to default state
|
||||||
|
// else continue to work on it...
|
||||||
|
if( ch == '\n' || ch == '\r' ) {
|
||||||
|
state = SCE_NNCRONTAB_DEFAULT;
|
||||||
|
} else {
|
||||||
|
styler.ColourTo(i,SCE_NNCRONTAB_TASK);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case SCE_NNCRONTAB_STRING:
|
||||||
|
if( ch == '%' ) {
|
||||||
|
state = SCE_NNCRONTAB_ENVIRONMENT;
|
||||||
|
insideString = true;
|
||||||
|
styler.ColourTo(i-1,SCE_NNCRONTAB_STRING);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
// if we find the end of a string char, we simply go to default state
|
||||||
|
// else we're still dealing with an string...
|
||||||
|
if( (ch == '"' && styler.SafeGetCharAt(i-1)!='\\') ||
|
||||||
|
(ch == '\n') || (ch == '\r') ) {
|
||||||
|
state = SCE_NNCRONTAB_DEFAULT;
|
||||||
|
}
|
||||||
|
styler.ColourTo(i,SCE_NNCRONTAB_STRING);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case SCE_NNCRONTAB_ENVIRONMENT:
|
||||||
|
// if we find the end of a string char, we simply go to default state
|
||||||
|
// else we're still dealing with an string...
|
||||||
|
if( ch == '%' && insideString ) {
|
||||||
|
state = SCE_NNCRONTAB_STRING;
|
||||||
|
insideString = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if( (ch == '%' && styler.SafeGetCharAt(i-1)!='\\')
|
||||||
|
|| (ch == '\n') || (ch == '\r') ) {
|
||||||
|
state = SCE_NNCRONTAB_DEFAULT;
|
||||||
|
styler.ColourTo(i,SCE_NNCRONTAB_ENVIRONMENT);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
styler.ColourTo(i+1,SCE_NNCRONTAB_ENVIRONMENT);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case SCE_NNCRONTAB_IDENTIFIER:
|
||||||
|
// stay in CONF_IDENTIFIER state until we find a non-alphanumeric
|
||||||
|
if( isalnum(ch) || (ch == '_') || (ch == '-') || (ch == '/') ||
|
||||||
|
(ch == '$') || (ch == '.') || (ch == '<') || (ch == '>') ) {
|
||||||
|
buffer[bufferCount++] = ch;
|
||||||
|
} else {
|
||||||
|
state = SCE_NNCRONTAB_DEFAULT;
|
||||||
|
buffer[bufferCount] = '\0';
|
||||||
|
|
||||||
|
// check if the buffer contains a keyword,
|
||||||
|
// and highlight it if it is a keyword...
|
||||||
|
if(section.InList(buffer)) {
|
||||||
|
styler.ColourTo(i,SCE_NNCRONTAB_SECTION );
|
||||||
|
} else if(keyword.InList(buffer)) {
|
||||||
|
styler.ColourTo(i-1,SCE_NNCRONTAB_KEYWORD );
|
||||||
|
} // else if(strchr(buffer,'/') || strchr(buffer,'.')) {
|
||||||
|
// styler.ColourTo(i-1,SCE_NNCRONTAB_EXTENSION);
|
||||||
|
// }
|
||||||
|
else if(modifier.InList(buffer)) {
|
||||||
|
styler.ColourTo(i-1,SCE_NNCRONTAB_MODIFIER );
|
||||||
|
} else {
|
||||||
|
styler.ColourTo(i-1,SCE_NNCRONTAB_DEFAULT);
|
||||||
|
}
|
||||||
|
// push back the faulty character
|
||||||
|
chNext = styler[i--];
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case SCE_NNCRONTAB_NUMBER:
|
||||||
|
// stay in CONF_NUMBER state until we find a non-numeric
|
||||||
|
if( isdigit(ch) /* || ch == '.' */ ) {
|
||||||
|
buffer[bufferCount++] = ch;
|
||||||
|
} else {
|
||||||
|
state = SCE_NNCRONTAB_DEFAULT;
|
||||||
|
buffer[bufferCount] = '\0';
|
||||||
|
// Colourize here... (normal number)
|
||||||
|
styler.ColourTo(i-1,SCE_NNCRONTAB_NUMBER);
|
||||||
|
// push back a character
|
||||||
|
chNext = styler[i--];
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
LexerModule lmNncrontab(SCLEX_NNCRONTAB, ColouriseNncrontabDoc, "nncrontab");
|
@@ -16,6 +16,7 @@
|
|||||||
|
|
||||||
#include "PropSet.h"
|
#include "PropSet.h"
|
||||||
#include "Accessor.h"
|
#include "Accessor.h"
|
||||||
|
#include "StyleContext.h"
|
||||||
#include "KeyWords.h"
|
#include "KeyWords.h"
|
||||||
#include "Scintilla.h"
|
#include "Scintilla.h"
|
||||||
#include "SciLexer.h"
|
#include "SciLexer.h"
|
||||||
@@ -31,23 +32,6 @@ inline bool isEiffelOperator(unsigned int ch) {
|
|||||||
ch == '!' || ch == '@' || ch == '?';
|
ch == '!' || ch == '@' || ch == '?';
|
||||||
}
|
}
|
||||||
|
|
||||||
static void getRangeLowered(unsigned int start,
|
|
||||||
unsigned int end,
|
|
||||||
Accessor &styler,
|
|
||||||
char *s,
|
|
||||||
unsigned int len) {
|
|
||||||
unsigned int i = 0;
|
|
||||||
while ((i < end - start + 1) && (i < len-1)) {
|
|
||||||
s[i] = static_cast<char>(tolower(styler[start + i]));
|
|
||||||
i++;
|
|
||||||
}
|
|
||||||
s[i] = '\0';
|
|
||||||
}
|
|
||||||
|
|
||||||
inline bool IsASpace(unsigned int ch) {
|
|
||||||
return (ch == ' ') || ((ch >= 0x09) && (ch <= 0x0d));
|
|
||||||
}
|
|
||||||
|
|
||||||
inline bool IsAWordChar(unsigned int ch) {
|
inline bool IsAWordChar(unsigned int ch) {
|
||||||
return (ch < 0x80) && (isalnum(ch) || ch == '.' || ch == '_');
|
return (ch < 0x80) && (isalnum(ch) || ch == '.' || ch == '_');
|
||||||
}
|
}
|
||||||
@@ -56,81 +40,6 @@ inline bool IsAWordStart(unsigned int ch) {
|
|||||||
return (ch < 0x80) && (isalnum(ch) || ch == '_');
|
return (ch < 0x80) && (isalnum(ch) || ch == '_');
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool IsADigit(unsigned int ch) {
|
|
||||||
return (ch >= '0') && (ch <= '9');
|
|
||||||
}
|
|
||||||
|
|
||||||
// All languages handled so far can treat all characters >= 0x80 as one class
|
|
||||||
// which just continues the current token or starts an identifier if in default.
|
|
||||||
// DBCS treated specially as the second character can be < 0x80 and hence
|
|
||||||
// syntactically significant. UTF-8 avoids this as all trail bytes are >= 0x80
|
|
||||||
class xColouriseContext {
|
|
||||||
Accessor &styler;
|
|
||||||
int lengthDoc;
|
|
||||||
int currentPos;
|
|
||||||
xColouriseContext& operator=(const xColouriseContext&) {
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
public:
|
|
||||||
int state;
|
|
||||||
unsigned int chPrev;
|
|
||||||
unsigned int ch;
|
|
||||||
unsigned int chNext;
|
|
||||||
|
|
||||||
xColouriseContext(unsigned int startPos, int length,
|
|
||||||
int initStyle, Accessor &styler_) :
|
|
||||||
styler(styler_),
|
|
||||||
lengthDoc(startPos + length),
|
|
||||||
currentPos(startPos),
|
|
||||||
state(initStyle),
|
|
||||||
chPrev(0),
|
|
||||||
ch(0),
|
|
||||||
chNext(0) {
|
|
||||||
styler.StartAt(startPos);
|
|
||||||
styler.StartSegment(startPos);
|
|
||||||
int pos = currentPos;
|
|
||||||
ch = static_cast<unsigned char>(styler.SafeGetCharAt(pos));
|
|
||||||
if (styler.IsLeadByte(static_cast<char>(ch))) {
|
|
||||||
pos++;
|
|
||||||
ch = ch << 8;
|
|
||||||
ch |= static_cast<unsigned char>(styler.SafeGetCharAt(pos));
|
|
||||||
}
|
|
||||||
chNext = static_cast<unsigned char>(styler.SafeGetCharAt(pos+1));
|
|
||||||
if (styler.IsLeadByte(static_cast<char>(chNext))) {
|
|
||||||
chNext = chNext << 8;
|
|
||||||
chNext |= static_cast<unsigned char>(styler.SafeGetCharAt(pos+2));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
void Complete() {
|
|
||||||
styler.ColourTo(currentPos - 1, state);
|
|
||||||
}
|
|
||||||
bool More() {
|
|
||||||
return currentPos <= lengthDoc;
|
|
||||||
}
|
|
||||||
void Forward() {
|
|
||||||
chPrev = ch;
|
|
||||||
currentPos++;
|
|
||||||
if (ch >= 0x100)
|
|
||||||
currentPos++;
|
|
||||||
ch = chNext;
|
|
||||||
chNext = static_cast<unsigned char>(styler.SafeGetCharAt(currentPos+1));
|
|
||||||
if (styler.IsLeadByte(static_cast<char>(chNext))) {
|
|
||||||
chNext = chNext << 8;
|
|
||||||
chNext |= static_cast<unsigned char>(styler.SafeGetCharAt(currentPos + 2));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
void ChangeState(int state_) {
|
|
||||||
state = state_;
|
|
||||||
}
|
|
||||||
void SetState(int state_) {
|
|
||||||
styler.ColourTo(currentPos - 1, state);
|
|
||||||
state = state_;
|
|
||||||
}
|
|
||||||
void GetCurrentLowered(char *s, int len) {
|
|
||||||
getRangeLowered(styler.GetStartSegment(), currentPos - 1, styler, s, len);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
static void ColouriseEiffelDoc(unsigned int startPos,
|
static void ColouriseEiffelDoc(unsigned int startPos,
|
||||||
int length,
|
int length,
|
||||||
int initStyle,
|
int initStyle,
|
||||||
@@ -139,68 +48,68 @@ static void ColouriseEiffelDoc(unsigned int startPos,
|
|||||||
|
|
||||||
WordList &keywords = *keywordlists[0];
|
WordList &keywords = *keywordlists[0];
|
||||||
|
|
||||||
xColouriseContext lc(startPos, length, initStyle, styler);
|
StyleContext sc(startPos, length, initStyle, styler);
|
||||||
|
|
||||||
for (; lc.More(); lc.Forward()) {
|
for (; sc.More(); sc.Forward()) {
|
||||||
|
|
||||||
if (lc.state == SCE_EIFFEL_STRINGEOL) {
|
if (sc.state == SCE_EIFFEL_STRINGEOL) {
|
||||||
if (lc.ch != '\r' && lc.ch != '\n') {
|
if (sc.ch != '\r' && sc.ch != '\n') {
|
||||||
lc.SetState(SCE_EIFFEL_DEFAULT);
|
sc.SetState(SCE_EIFFEL_DEFAULT);
|
||||||
}
|
}
|
||||||
} else if (lc.state == SCE_EIFFEL_OPERATOR) {
|
} else if (sc.state == SCE_EIFFEL_OPERATOR) {
|
||||||
lc.SetState(SCE_EIFFEL_DEFAULT);
|
sc.SetState(SCE_EIFFEL_DEFAULT);
|
||||||
} else if (lc.state == SCE_EIFFEL_WORD) {
|
} else if (sc.state == SCE_EIFFEL_WORD) {
|
||||||
if (!IsAWordChar(lc.ch)) {
|
if (!IsAWordChar(sc.ch)) {
|
||||||
char s[100];
|
char s[100];
|
||||||
lc.GetCurrentLowered(s, sizeof(s));
|
sc.GetCurrentLowered(s, sizeof(s));
|
||||||
if (!keywords.InList(s)) {
|
if (!keywords.InList(s)) {
|
||||||
lc.ChangeState(SCE_EIFFEL_IDENTIFIER);
|
sc.ChangeState(SCE_EIFFEL_IDENTIFIER);
|
||||||
}
|
}
|
||||||
lc.SetState(SCE_EIFFEL_DEFAULT);
|
sc.SetState(SCE_EIFFEL_DEFAULT);
|
||||||
}
|
}
|
||||||
} else if (lc.state == SCE_EIFFEL_NUMBER) {
|
} else if (sc.state == SCE_EIFFEL_NUMBER) {
|
||||||
if (!IsAWordChar(lc.ch)) {
|
if (!IsAWordChar(sc.ch)) {
|
||||||
lc.SetState(SCE_EIFFEL_DEFAULT);
|
sc.SetState(SCE_EIFFEL_DEFAULT);
|
||||||
}
|
}
|
||||||
} else if (lc.state == SCE_EIFFEL_COMMENTLINE) {
|
} else if (sc.state == SCE_EIFFEL_COMMENTLINE) {
|
||||||
if (lc.ch == '\r' || lc.ch == '\n') {
|
if (sc.ch == '\r' || sc.ch == '\n') {
|
||||||
lc.SetState(SCE_EIFFEL_DEFAULT);
|
sc.SetState(SCE_EIFFEL_DEFAULT);
|
||||||
}
|
}
|
||||||
} else if (lc.state == SCE_EIFFEL_STRING) {
|
} else if (sc.state == SCE_EIFFEL_STRING) {
|
||||||
if (lc.ch == '%') {
|
if (sc.ch == '%') {
|
||||||
lc.Forward();
|
sc.Forward();
|
||||||
} else if (lc.ch == '\"') {
|
} else if (sc.ch == '\"') {
|
||||||
lc.Forward();
|
sc.Forward();
|
||||||
lc.SetState(SCE_EIFFEL_DEFAULT);
|
sc.SetState(SCE_EIFFEL_DEFAULT);
|
||||||
}
|
}
|
||||||
} else if (lc.state == SCE_EIFFEL_CHARACTER) {
|
} else if (sc.state == SCE_EIFFEL_CHARACTER) {
|
||||||
if (lc.ch == '\r' || lc.ch == '\n') {
|
if (sc.ch == '\r' || sc.ch == '\n') {
|
||||||
lc.SetState(SCE_EIFFEL_STRINGEOL);
|
sc.SetState(SCE_EIFFEL_STRINGEOL);
|
||||||
} else if (lc.ch == '%') {
|
} else if (sc.ch == '%') {
|
||||||
lc.Forward();
|
sc.Forward();
|
||||||
} else if (lc.ch == '\'') {
|
} else if (sc.ch == '\'') {
|
||||||
lc.Forward();
|
sc.Forward();
|
||||||
lc.SetState(SCE_EIFFEL_DEFAULT);
|
sc.SetState(SCE_EIFFEL_DEFAULT);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (lc.state == SCE_EIFFEL_DEFAULT) {
|
if (sc.state == SCE_EIFFEL_DEFAULT) {
|
||||||
if (lc.ch == '-' && lc.chNext == '-') {
|
if (sc.ch == '-' && sc.chNext == '-') {
|
||||||
lc.SetState(SCE_EIFFEL_COMMENTLINE);
|
sc.SetState(SCE_EIFFEL_COMMENTLINE);
|
||||||
} else if (lc.ch == '\"') {
|
} else if (sc.ch == '\"') {
|
||||||
lc.SetState(SCE_EIFFEL_STRING);
|
sc.SetState(SCE_EIFFEL_STRING);
|
||||||
} else if (lc.ch == '\'') {
|
} else if (sc.ch == '\'') {
|
||||||
lc.SetState(SCE_EIFFEL_CHARACTER);
|
sc.SetState(SCE_EIFFEL_CHARACTER);
|
||||||
} else if (IsADigit(lc.ch) || (lc.ch == '.')) {
|
} else if (IsADigit(sc.ch) || (sc.ch == '.')) {
|
||||||
lc.SetState(SCE_EIFFEL_NUMBER);
|
sc.SetState(SCE_EIFFEL_NUMBER);
|
||||||
} else if (IsAWordStart(lc.ch)) {
|
} else if (IsAWordStart(sc.ch)) {
|
||||||
lc.SetState(SCE_EIFFEL_WORD);
|
sc.SetState(SCE_EIFFEL_WORD);
|
||||||
} else if (isEiffelOperator(lc.ch)) {
|
} else if (isEiffelOperator(sc.ch)) {
|
||||||
lc.SetState(SCE_EIFFEL_OPERATOR);
|
sc.SetState(SCE_EIFFEL_OPERATOR);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
lc.Complete();
|
sc.Complete();
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool IsEiffelComment(Accessor &styler, int pos, int len) {
|
static bool IsEiffelComment(Accessor &styler, int pos, int len) {
|
||||||
|
@@ -23,16 +23,16 @@
|
|||||||
#define SCE_HA_VBS (SCE_HBA_START - SCE_HB_START)
|
#define SCE_HA_VBS (SCE_HBA_START - SCE_HB_START)
|
||||||
#define SCE_HA_PYTHON (SCE_HPA_START - SCE_HP_START)
|
#define SCE_HA_PYTHON (SCE_HPA_START - SCE_HP_START)
|
||||||
|
|
||||||
enum { eScriptNone = 0, eScriptJS, eScriptVBS, eScriptPython, eScriptPHP, eScriptXML };
|
enum { eScriptNone = 0, eScriptJS, eScriptVBS, eScriptPython, eScriptPHP, eScriptXML, eScriptSGML, eScriptSGMLblock };
|
||||||
enum { eHtml = 0, eNonHtmlScript, eNonHtmlPreProc, eNonHtmlScriptPreProc };
|
enum { eHtml = 0, eNonHtmlScript, eNonHtmlPreProc, eNonHtmlScriptPreProc };
|
||||||
|
|
||||||
static int segIsScriptingIndicator(Accessor &styler, unsigned int start, unsigned int end, int prevValue) {
|
static int segIsScriptingIndicator(Accessor &styler, unsigned int start, unsigned int end, int prevValue) {
|
||||||
char s[30 + 1];
|
char s[30 + 1];
|
||||||
s[0] = '\0';
|
unsigned int i = 0;
|
||||||
for (unsigned int i = 0; i < end - start + 1 && i < 30; i++) {
|
for (; i < end - start + 1 && i < 30; i++) {
|
||||||
s[i] = static_cast<char>(tolower(styler[start + i]));
|
s[i] = static_cast<char>(tolower(styler[start + i]));
|
||||||
s[i + 1] = '\0';
|
|
||||||
}
|
}
|
||||||
|
s[i] = '\0';
|
||||||
//Platform::DebugPrintf("Scripting indicator [%s]\n", s);
|
//Platform::DebugPrintf("Scripting indicator [%s]\n", s);
|
||||||
if (strstr(s, "src")) // External script
|
if (strstr(s, "src")) // External script
|
||||||
return eScriptNone;
|
return eScriptNone;
|
||||||
@@ -55,11 +55,11 @@ static int segIsScriptingIndicator(Accessor &styler, unsigned int start, unsigne
|
|||||||
static int PrintScriptingIndicatorOffset(Accessor &styler, unsigned int start, unsigned int end) {
|
static int PrintScriptingIndicatorOffset(Accessor &styler, unsigned int start, unsigned int end) {
|
||||||
int iResult = 0;
|
int iResult = 0;
|
||||||
char s[30 + 1];
|
char s[30 + 1];
|
||||||
s[0] = '\0';
|
unsigned int i = 0;
|
||||||
for (unsigned int i = 0; i < end - start + 1 && i < 30; i++) {
|
for (; i < end - start + 1 && i < 30; i++) {
|
||||||
s[i] = static_cast<char>(tolower(styler[start + i]));
|
s[i] = static_cast<char>(tolower(styler[start + i]));
|
||||||
s[i + 1] = '\0';
|
|
||||||
}
|
}
|
||||||
|
s[i] = '\0';
|
||||||
if (0 == strncmp(s, "php", 3)) {
|
if (0 == strncmp(s, "php", 3)) {
|
||||||
iResult = 3;
|
iResult = 3;
|
||||||
}
|
}
|
||||||
@@ -68,22 +68,21 @@ static int PrintScriptingIndicatorOffset(Accessor &styler, unsigned int start, u
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int ScriptOfState(int state) {
|
static int ScriptOfState(int state) {
|
||||||
int scriptLanguage;
|
|
||||||
|
|
||||||
if ((state >= SCE_HP_START) && (state <= SCE_HP_IDENTIFIER)) {
|
if ((state >= SCE_HP_START) && (state <= SCE_HP_IDENTIFIER)) {
|
||||||
scriptLanguage = eScriptPython;
|
return eScriptPython;
|
||||||
} else if ((state >= SCE_HB_START) && (state <= SCE_HB_STRINGEOL)) {
|
} else if ((state >= SCE_HB_START) && (state <= SCE_HB_STRINGEOL)) {
|
||||||
scriptLanguage = eScriptVBS;
|
return eScriptVBS;
|
||||||
} else if ((state >= SCE_HJ_START) && (state <= SCE_HJ_REGEX)) {
|
} else if ((state >= SCE_HJ_START) && (state <= SCE_HJ_REGEX)) {
|
||||||
scriptLanguage = eScriptJS;
|
return eScriptJS;
|
||||||
} else if ((state >= SCE_HPHP_DEFAULT) && (state <= SCE_HPHP_COMMENTLINE)) {
|
} else if ((state >= SCE_HPHP_DEFAULT) && (state <= SCE_HPHP_COMMENTLINE)) {
|
||||||
scriptLanguage = eScriptPHP;
|
return eScriptPHP;
|
||||||
|
} else if ((state >= SCE_H_SGML_DEFAULT) && (state <= SCE_H_SGML_BLOCK_DEFAULT)) {
|
||||||
|
return eScriptSGML;
|
||||||
|
} else if (state == SCE_H_SGML_BLOCK_DEFAULT) {
|
||||||
|
return eScriptSGMLblock;
|
||||||
} else {
|
} else {
|
||||||
// scriptLanguage = defaultScript;
|
return eScriptNone;
|
||||||
scriptLanguage = eScriptNone;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return scriptLanguage;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int statePrintForState(int state, int inScriptType) {
|
static int statePrintForState(int state, int inScriptType) {
|
||||||
@@ -174,11 +173,11 @@ static void classifyAttribHTML(unsigned int start, unsigned int end, WordList &k
|
|||||||
chAttr = SCE_H_NUMBER;
|
chAttr = SCE_H_NUMBER;
|
||||||
} else {
|
} else {
|
||||||
char s[30 + 1];
|
char s[30 + 1];
|
||||||
s[0] = '\0';
|
unsigned int i = 0;
|
||||||
for (unsigned int i = 0; i < end - start + 1 && i < 30; i++) {
|
for (; i < end - start + 1 && i < 30; i++) {
|
||||||
s[i] = static_cast<char>(tolower(styler[start + i]));
|
s[i] = static_cast<char>(tolower(styler[start + i]));
|
||||||
s[i + 1] = '\0';
|
|
||||||
}
|
}
|
||||||
|
s[i] = '\0';
|
||||||
if (keywords.InList(s))
|
if (keywords.InList(s))
|
||||||
chAttr = SCE_H_ATTRIBUTE;
|
chAttr = SCE_H_ATTRIBUTE;
|
||||||
}
|
}
|
||||||
@@ -195,18 +194,14 @@ static int classifyTagHTML(unsigned int start, unsigned int end,
|
|||||||
unsigned int i = 0;
|
unsigned int i = 0;
|
||||||
for (unsigned int cPos = start; cPos <= end && i < 30; cPos++) {
|
for (unsigned int cPos = start; cPos <= end && i < 30; cPos++) {
|
||||||
char ch = styler[cPos];
|
char ch = styler[cPos];
|
||||||
if (ch != '<')
|
if ((ch != '<') && (ch != '/'))
|
||||||
s[i++] = static_cast<char>(tolower(ch));
|
s[i++] = static_cast<char>(tolower(ch));
|
||||||
}
|
}
|
||||||
s[i] = '\0';
|
s[i] = '\0';
|
||||||
bool isScript = false;
|
bool isScript = false;
|
||||||
char chAttr = SCE_H_TAGUNKNOWN;
|
char chAttr = SCE_H_TAGUNKNOWN;
|
||||||
if (s[0] == '!' && s[1] == '-' && s[2] == '-') { //Comment
|
if (s[0] == '!') {
|
||||||
chAttr = SCE_H_COMMENT;
|
chAttr = SCE_H_SGML_DEFAULT;
|
||||||
} else if (strcmp(s, "![cdata[") == 0) { // In lower case because already converted
|
|
||||||
chAttr = SCE_H_CDATA;
|
|
||||||
} else if (s[0] == '!') {
|
|
||||||
chAttr = SCE_H_SGML;
|
|
||||||
} else if (s[0] == '/') { // Closing tag
|
} else if (s[0] == '/') { // Closing tag
|
||||||
if (keywords.InList(s + 1))
|
if (keywords.InList(s + 1))
|
||||||
chAttr = SCE_H_TAG;
|
chAttr = SCE_H_TAG;
|
||||||
@@ -231,10 +226,11 @@ static void classifyWordHTJS(unsigned int start, unsigned int end,
|
|||||||
chAttr = SCE_HJ_NUMBER;
|
chAttr = SCE_HJ_NUMBER;
|
||||||
else {
|
else {
|
||||||
char s[30 + 1];
|
char s[30 + 1];
|
||||||
for (unsigned int i = 0; i < end - start + 1 && i < 30; i++) {
|
unsigned int i = 0;
|
||||||
|
for (; i < end - start + 1 && i < 30; i++) {
|
||||||
s[i] = styler[start + i];
|
s[i] = styler[start + i];
|
||||||
s[i + 1] = '\0';
|
|
||||||
}
|
}
|
||||||
|
s[i] = '\0';
|
||||||
if (keywords.InList(s))
|
if (keywords.InList(s))
|
||||||
chAttr = SCE_HJ_KEYWORD;
|
chAttr = SCE_HJ_KEYWORD;
|
||||||
}
|
}
|
||||||
@@ -248,10 +244,11 @@ static int classifyWordHTVB(unsigned int start, unsigned int end, WordList &keyw
|
|||||||
chAttr = SCE_HB_NUMBER;
|
chAttr = SCE_HB_NUMBER;
|
||||||
else {
|
else {
|
||||||
char s[30 + 1];
|
char s[30 + 1];
|
||||||
for (unsigned int i = 0; i < end - start + 1 && i < 30; i++) {
|
unsigned int i = 0;
|
||||||
|
for (; i < end - start + 1 && i < 30; i++) {
|
||||||
s[i] = static_cast<char>(tolower(styler[start + i]));
|
s[i] = static_cast<char>(tolower(styler[start + i]));
|
||||||
s[i + 1] = '\0';
|
|
||||||
}
|
}
|
||||||
|
s[i] = '\0';
|
||||||
if (keywords.InList(s)) {
|
if (keywords.InList(s)) {
|
||||||
chAttr = SCE_HB_WORD;
|
chAttr = SCE_HB_WORD;
|
||||||
if (strcmp(s, "rem") == 0)
|
if (strcmp(s, "rem") == 0)
|
||||||
@@ -268,10 +265,11 @@ static int classifyWordHTVB(unsigned int start, unsigned int end, WordList &keyw
|
|||||||
static void classifyWordHTPy(unsigned int start, unsigned int end, WordList &keywords, Accessor &styler, char *prevWord, int inScriptType) {
|
static void classifyWordHTPy(unsigned int start, unsigned int end, WordList &keywords, Accessor &styler, char *prevWord, int inScriptType) {
|
||||||
bool wordIsNumber = isdigit(styler[start]);
|
bool wordIsNumber = isdigit(styler[start]);
|
||||||
char s[30 + 1];
|
char s[30 + 1];
|
||||||
for (unsigned int i = 0; i < end - start + 1 && i < 30; i++) {
|
unsigned int i = 0;
|
||||||
|
for (; i < end - start + 1 && i < 30; i++) {
|
||||||
s[i] = styler[start + i];
|
s[i] = styler[start + i];
|
||||||
s[i + 1] = '\0';
|
|
||||||
}
|
}
|
||||||
|
s[i] = '\0';
|
||||||
char chAttr = SCE_HP_IDENTIFIER;
|
char chAttr = SCE_HP_IDENTIFIER;
|
||||||
if (0 == strcmp(prevWord, "class"))
|
if (0 == strcmp(prevWord, "class"))
|
||||||
chAttr = SCE_HP_CLASSNAME;
|
chAttr = SCE_HP_CLASSNAME;
|
||||||
@@ -294,16 +292,37 @@ static void classifyWordHTPHP(unsigned int start, unsigned int end, WordList &ke
|
|||||||
chAttr = SCE_HPHP_NUMBER;
|
chAttr = SCE_HPHP_NUMBER;
|
||||||
else {
|
else {
|
||||||
char s[30 + 1];
|
char s[30 + 1];
|
||||||
for (unsigned int i = 0; i < end - start + 1 && i < 30; i++) {
|
unsigned int i = 0;
|
||||||
|
for (; i < end - start + 1 && i < 30; i++) {
|
||||||
s[i] = styler[start + i];
|
s[i] = styler[start + i];
|
||||||
s[i + 1] = '\0';
|
|
||||||
}
|
}
|
||||||
|
s[i] = '\0';
|
||||||
if (keywords.InList(s))
|
if (keywords.InList(s))
|
||||||
chAttr = SCE_HPHP_WORD;
|
chAttr = SCE_HPHP_WORD;
|
||||||
}
|
}
|
||||||
styler.ColourTo(end, chAttr);
|
styler.ColourTo(end, chAttr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bool isWordHSGML(unsigned int start, unsigned int end, WordList &keywords, Accessor &styler) {
|
||||||
|
char s[30 + 1];
|
||||||
|
unsigned int i = 0;
|
||||||
|
for (; i < end - start + 1 && i < 30; i++) {
|
||||||
|
s[i] = styler[start + i];
|
||||||
|
}
|
||||||
|
s[i] = '\0';
|
||||||
|
return keywords.InList(s);
|
||||||
|
}
|
||||||
|
|
||||||
|
static bool isWordCdata(unsigned int start, unsigned int end, Accessor &styler) {
|
||||||
|
char s[30 + 1];
|
||||||
|
unsigned int i = 0;
|
||||||
|
for (; i < end - start + 1 && i < 30; i++) {
|
||||||
|
s[i] = styler[start + i];
|
||||||
|
}
|
||||||
|
s[i] = '\0';
|
||||||
|
return (0 == strcmp(s, "[CDATA["));
|
||||||
|
}
|
||||||
|
|
||||||
// Return the first state to reach when entering a scripting language
|
// Return the first state to reach when entering a scripting language
|
||||||
static int StateForScript(int scriptLanguage) {
|
static int StateForScript(int scriptLanguage) {
|
||||||
int Result;
|
int Result;
|
||||||
@@ -320,6 +339,9 @@ static int StateForScript(int scriptLanguage) {
|
|||||||
case eScriptXML:
|
case eScriptXML:
|
||||||
Result = SCE_H_TAGUNKNOWN;
|
Result = SCE_H_TAGUNKNOWN;
|
||||||
break;
|
break;
|
||||||
|
case eScriptSGML:
|
||||||
|
Result = SCE_H_SGML_DEFAULT;
|
||||||
|
break;
|
||||||
default :
|
default :
|
||||||
Result = SCE_HJ_START;
|
Result = SCE_HJ_START;
|
||||||
break;
|
break;
|
||||||
@@ -331,6 +353,10 @@ inline bool ishtmlwordchar(char ch) {
|
|||||||
return isalnum(ch) || ch == '.' || ch == '-' || ch == '_' || ch == ':' || ch == '!' || ch == '#';
|
return isalnum(ch) || ch == '.' || ch == '-' || ch == '_' || ch == ':' || ch == '!' || ch == '#';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline bool issgmlwordchar(char ch) {
|
||||||
|
return isalnum(ch) || ch == '.' || ch == '_' || ch == ':' || ch == '!' || ch == '#' || ch == '[';
|
||||||
|
}
|
||||||
|
|
||||||
static bool InTagState(int state) {
|
static bool InTagState(int state) {
|
||||||
return state == SCE_H_TAG || state == SCE_H_TAGUNKNOWN ||
|
return state == SCE_H_TAG || state == SCE_H_TAGUNKNOWN ||
|
||||||
state == SCE_H_SCRIPT ||
|
state == SCE_H_SCRIPT ||
|
||||||
@@ -339,6 +365,10 @@ static bool InTagState(int state) {
|
|||||||
state == SCE_H_DOUBLESTRING || state == SCE_H_SINGLESTRING;
|
state == SCE_H_DOUBLESTRING || state == SCE_H_SINGLESTRING;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bool IsCommentState(const int state) {
|
||||||
|
return state == SCE_H_COMMENT || state == SCE_H_SGML_COMMENT;
|
||||||
|
}
|
||||||
|
|
||||||
static bool isLineEnd(char ch) {
|
static bool isLineEnd(char ch) {
|
||||||
return ch == '\r' || ch == '\n';
|
return ch == '\r' || ch == '\n';
|
||||||
}
|
}
|
||||||
@@ -356,15 +386,15 @@ static bool isPHPStringState(int state) {
|
|||||||
|
|
||||||
static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initStyle, WordList *keywordlists[],
|
static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initStyle, WordList *keywordlists[],
|
||||||
Accessor &styler) {
|
Accessor &styler) {
|
||||||
|
|
||||||
WordList &keywords = *keywordlists[0];
|
WordList &keywords = *keywordlists[0];
|
||||||
WordList &keywords2 = *keywordlists[1];
|
WordList &keywords2 = *keywordlists[1];
|
||||||
WordList &keywords3 = *keywordlists[2];
|
WordList &keywords3 = *keywordlists[2];
|
||||||
WordList &keywords4 = *keywordlists[3];
|
WordList &keywords4 = *keywordlists[3];
|
||||||
WordList &keywords5 = *keywordlists[4];
|
WordList &keywords5 = *keywordlists[4];
|
||||||
|
WordList &keywords6 = *keywordlists[5]; // SGML (DTD) keywords
|
||||||
|
|
||||||
// Lexer for HTML requires more lexical states (7 bits worth) than most lexers
|
// Lexer for HTML requires more lexical states (7 bits worth) than most lexers
|
||||||
styler.StartAt(startPos, 127);
|
styler.StartAt(startPos, STYLE_MAX);
|
||||||
char prevWord[200];
|
char prevWord[200];
|
||||||
prevWord[0] = '\0';
|
prevWord[0] = '\0';
|
||||||
int StateToPrint = initStyle;
|
int StateToPrint = initStyle;
|
||||||
@@ -378,45 +408,47 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
|
|||||||
}
|
}
|
||||||
state = SCE_H_DEFAULT;
|
state = SCE_H_DEFAULT;
|
||||||
}
|
}
|
||||||
styler.StartAt(startPos, 127);
|
styler.StartAt(startPos, STYLE_MAX);
|
||||||
|
|
||||||
int lineState = eScriptVBS;
|
|
||||||
int lineCurrent = styler.GetLine(startPos);
|
int lineCurrent = styler.GetLine(startPos);
|
||||||
if (lineCurrent > 0)
|
int lineState;
|
||||||
|
if (lineCurrent > 0) {
|
||||||
lineState = styler.GetLineState(lineCurrent);
|
lineState = styler.GetLineState(lineCurrent);
|
||||||
|
} else {
|
||||||
|
// Default client and ASP scripting language is JavaScript
|
||||||
|
lineState = eScriptJS << 8;
|
||||||
|
lineState |= styler.GetPropertyInt("asp.default.language", eScriptJS) << 4;
|
||||||
|
}
|
||||||
int inScriptType = (lineState >> 0) & 0x03; // 2 bits of scripting type
|
int inScriptType = (lineState >> 0) & 0x03; // 2 bits of scripting type
|
||||||
bool tagOpened = (lineState >> 2) & 0x01; // 1 bit to know if we are in an opened tag
|
bool tagOpened = (lineState >> 2) & 0x01; // 1 bit to know if we are in an opened tag
|
||||||
bool tagClosing = (lineState >> 3) & 0x01; // 1 bit to know if we are in a closing tag
|
bool tagClosing = (lineState >> 3) & 0x01; // 1 bit to know if we are in a closing tag
|
||||||
int defaultScript = (lineState >> 4) & 0x0F; // 4 bits of script name
|
int aspScript = (lineState >> 4) & 0x0F; // 4 bits of script name
|
||||||
int beforePreProc = (lineState >> 8) & 0xFF; // 8 bits of state
|
int clientScript = (lineState >> 8) & 0x0F; // 4 bits of script name
|
||||||
|
int beforePreProc = (lineState >> 12) & 0xFF; // 8 bits of state
|
||||||
|
|
||||||
int scriptLanguage = ScriptOfState(state);
|
int scriptLanguage = ScriptOfState(state);
|
||||||
|
|
||||||
bool fold = styler.GetPropertyInt("fold");
|
const bool foldHTML = styler.GetPropertyInt("fold.html", 0);
|
||||||
bool foldHTML = styler.GetPropertyInt("fold.html",0);
|
const bool fold = foldHTML && styler.GetPropertyInt("fold");
|
||||||
bool foldCompact = styler.GetPropertyInt("fold.compact",1);
|
const bool foldCompact = styler.GetPropertyInt("fold.compact", 1);
|
||||||
|
|
||||||
fold = foldHTML && fold;
|
|
||||||
|
|
||||||
int levelPrev = styler.LevelAt(lineCurrent) & SC_FOLDLEVELNUMBERMASK;
|
int levelPrev = styler.LevelAt(lineCurrent) & SC_FOLDLEVELNUMBERMASK;
|
||||||
int levelCurrent = levelPrev;
|
int levelCurrent = levelPrev;
|
||||||
int visibleChars;
|
int visibleChars = 0;
|
||||||
|
|
||||||
visibleChars = 0;
|
|
||||||
|
|
||||||
char chPrev = ' ';
|
char chPrev = ' ';
|
||||||
char ch = ' ';
|
char ch = ' ';
|
||||||
char chPrevNonWhite = ' ';
|
char chPrevNonWhite = ' ';
|
||||||
styler.StartSegment(startPos);
|
styler.StartSegment(startPos);
|
||||||
int lengthDoc = startPos + length;
|
const int lengthDoc = startPos + length;
|
||||||
for (int i = startPos; i < lengthDoc; i++) {
|
for (int i = startPos; i < lengthDoc; i++) {
|
||||||
char chPrev2 = chPrev;
|
const char chPrev2 = chPrev;
|
||||||
chPrev = ch;
|
chPrev = ch;
|
||||||
if (ch != ' ' && ch != '\t')
|
if (ch != ' ' && ch != '\t')
|
||||||
chPrevNonWhite = ch;
|
chPrevNonWhite = ch;
|
||||||
ch = styler[i];
|
ch = styler[i];
|
||||||
char chNext = styler.SafeGetCharAt(i + 1);
|
char chNext = styler.SafeGetCharAt(i + 1);
|
||||||
char chNext2 = styler.SafeGetCharAt(i + 2);
|
const char chNext2 = styler.SafeGetCharAt(i + 2);
|
||||||
|
|
||||||
// Handle DBCS codepages
|
// Handle DBCS codepages
|
||||||
if (styler.IsLeadByte(ch)) {
|
if (styler.IsLeadByte(ch)) {
|
||||||
@@ -451,18 +483,21 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
|
|||||||
} else if ((ch == '\n') && !((chNext == '\r') && (chNext2 == '\n')) && (chNext != '\n')) {
|
} else if ((ch == '\n') && !((chNext == '\r') && (chNext2 == '\n')) && (chNext != '\n')) {
|
||||||
// check if the number of tabs is lower than the level
|
// check if the number of tabs is lower than the level
|
||||||
int Findlevel = (levelCurrent & ~SC_FOLDLEVELBASE) * 8;
|
int Findlevel = (levelCurrent & ~SC_FOLDLEVELBASE) * 8;
|
||||||
for (int j = 0;Findlevel > 0;j++) {
|
for (int j = 0; Findlevel > 0; j++) {
|
||||||
char chTmp = styler.SafeGetCharAt(i + j + 1);
|
char chTmp = styler.SafeGetCharAt(i + j + 1);
|
||||||
if (chTmp == '\t') {
|
if (chTmp == '\t') {
|
||||||
Findlevel -= 8;
|
Findlevel -= 8;
|
||||||
} else if (chTmp == ' ') {
|
} else if (chTmp == ' ') {
|
||||||
Findlevel--;
|
Findlevel--;
|
||||||
} else break;
|
} else {
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Findlevel > 0) {
|
if (Findlevel > 0) {
|
||||||
levelCurrent -= Findlevel / 8;
|
levelCurrent -= Findlevel / 8;
|
||||||
if (Findlevel % 8) levelCurrent--;
|
if (Findlevel % 8)
|
||||||
|
levelCurrent--;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -490,8 +525,9 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
|
|||||||
((inScriptType & 0x03) << 0) |
|
((inScriptType & 0x03) << 0) |
|
||||||
((tagOpened & 0x01) << 2) |
|
((tagOpened & 0x01) << 2) |
|
||||||
((tagClosing & 0x01) << 3) |
|
((tagClosing & 0x01) << 3) |
|
||||||
((defaultScript & 0x0F) << 4) |
|
((aspScript & 0x0F) << 4) |
|
||||||
((beforePreProc & 0xFF) << 8));
|
((clientScript & 0x0F) << 8) |
|
||||||
|
((beforePreProc & 0xFF) << 12));
|
||||||
}
|
}
|
||||||
|
|
||||||
// generic end of script processing
|
// generic end of script processing
|
||||||
@@ -514,14 +550,15 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
|
|||||||
case SCE_HP_TRIPLEDOUBLE:
|
case SCE_HP_TRIPLEDOUBLE:
|
||||||
break;
|
break;
|
||||||
default :
|
default :
|
||||||
// maybe we should check here if it's a tag and if it's SCRIPT
|
// closing tag of the script (it's a closing HTML tag anyway)
|
||||||
styler.ColourTo(i - 1, StateToPrint);
|
styler.ColourTo(i - 1, StateToPrint);
|
||||||
state = SCE_H_TAGUNKNOWN;
|
state = SCE_H_TAGUNKNOWN;
|
||||||
inScriptType = eHtml;
|
inScriptType = eHtml;
|
||||||
scriptLanguage = eScriptNone;
|
scriptLanguage = eScriptNone;
|
||||||
|
clientScript = eScriptJS;
|
||||||
i += 2;
|
i += 2;
|
||||||
// unfold closing script
|
visibleChars += 2;
|
||||||
levelCurrent--;
|
tagClosing = true;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -537,6 +574,7 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
|
|||||||
beforePreProc = state;
|
beforePreProc = state;
|
||||||
scriptLanguage = segIsScriptingIndicator(styler, styler.GetStartSegment() + 2, i + 10, eScriptPHP);
|
scriptLanguage = segIsScriptingIndicator(styler, styler.GetStartSegment() + 2, i + 10, eScriptPHP);
|
||||||
i++;
|
i++;
|
||||||
|
visibleChars++;
|
||||||
i += PrintScriptingIndicatorOffset(styler, styler.GetStartSegment() + 2, i + 10);
|
i += PrintScriptingIndicatorOffset(styler, styler.GetStartSegment() + 2, i + 10);
|
||||||
if (scriptLanguage == eScriptXML)
|
if (scriptLanguage == eScriptXML)
|
||||||
styler.ColourTo(i, SCE_H_XMLSTART);
|
styler.ColourTo(i, SCE_H_XMLSTART);
|
||||||
@@ -567,6 +605,7 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
|
|||||||
|
|
||||||
if (chNext2 == '@') {
|
if (chNext2 == '@') {
|
||||||
i += 2; // place as if it was the second next char treated
|
i += 2; // place as if it was the second next char treated
|
||||||
|
visibleChars += 2;
|
||||||
state = SCE_H_ASPAT;
|
state = SCE_H_ASPAT;
|
||||||
} else if ((chNext2 == '-') && (styler.SafeGetCharAt(i + 3) == '-')) {
|
} else if ((chNext2 == '-') && (styler.SafeGetCharAt(i + 3) == '-')) {
|
||||||
styler.ColourTo(i + 3, SCE_H_ASP);
|
styler.ColourTo(i + 3, SCE_H_ASP);
|
||||||
@@ -576,11 +615,13 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
|
|||||||
} else {
|
} else {
|
||||||
if (chNext2 == '=') {
|
if (chNext2 == '=') {
|
||||||
i += 2; // place as if it was the second next char treated
|
i += 2; // place as if it was the second next char treated
|
||||||
|
visibleChars += 2;
|
||||||
} else {
|
} else {
|
||||||
i++; // place as if it was the next char treated
|
i++; // place as if it was the next char treated
|
||||||
|
visibleChars++;
|
||||||
}
|
}
|
||||||
|
|
||||||
state = StateForScript(defaultScript);
|
state = StateForScript(aspScript);
|
||||||
}
|
}
|
||||||
scriptLanguage = eScriptVBS;
|
scriptLanguage = eScriptVBS;
|
||||||
styler.ColourTo(i, SCE_H_ASP);
|
styler.ColourTo(i, SCE_H_ASP);
|
||||||
@@ -591,17 +632,42 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/////////////////////////////////////
|
||||||
|
// handle the start of SGML language (DTD)
|
||||||
|
else if (((scriptLanguage == eScriptNone) || (scriptLanguage == eScriptXML)) &&
|
||||||
|
(chPrev == '<') &&
|
||||||
|
(ch == '!') &&
|
||||||
|
(StateToPrint != SCE_H_CDATA) && (!IsCommentState(StateToPrint))) {
|
||||||
|
beforePreProc = state;
|
||||||
|
styler.ColourTo(i - 2, StateToPrint);
|
||||||
|
if ((chNext == '-') && (chNext2 == '-')) {
|
||||||
|
state = SCE_H_COMMENT; // wait for a pending command
|
||||||
|
}
|
||||||
|
else if (isWordCdata(i + 1, i + 7, styler)) {
|
||||||
|
state = SCE_H_CDATA;
|
||||||
|
} else {
|
||||||
|
styler.ColourTo(i, SCE_H_SGML_DEFAULT); // <! is default
|
||||||
|
scriptLanguage = eScriptSGML;
|
||||||
|
state = SCE_H_SGML_COMMAND; // wait for a pending command
|
||||||
|
}
|
||||||
|
// fold whole tag (-- when closing the tag)
|
||||||
|
|
||||||
|
levelCurrent++;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
// handle the end of a pre-processor = Non-HTML
|
// handle the end of a pre-processor = Non-HTML
|
||||||
else if (
|
else if ((
|
||||||
((inScriptType == eNonHtmlPreProc)
|
((inScriptType == eNonHtmlPreProc)
|
||||||
|| (inScriptType == eNonHtmlScriptPreProc)) && (
|
|| (inScriptType == eNonHtmlScriptPreProc)) && (
|
||||||
((scriptLanguage == eScriptPHP) && (ch == '?') && !isPHPStringState(state) && (state != SCE_HPHP_COMMENT)) ||
|
((scriptLanguage == eScriptPHP) && (ch == '?') && !isPHPStringState(state) && (state != SCE_HPHP_COMMENT)) ||
|
||||||
((scriptLanguage != eScriptNone) && !isStringState(state) &&
|
((scriptLanguage != eScriptNone) && !isStringState(state) &&
|
||||||
(ch == '%'))
|
(ch == '%'))
|
||||||
) && (chNext == '>')) {
|
) && (chNext == '>')) ||
|
||||||
|
((scriptLanguage == eScriptSGML) && (ch == '>') && (state != SCE_H_SGML_COMMENT))) {
|
||||||
if (state == SCE_H_ASPAT) {
|
if (state == SCE_H_ASPAT) {
|
||||||
defaultScript = segIsScriptingIndicator(styler,
|
aspScript = segIsScriptingIndicator(styler,
|
||||||
styler.GetStartSegment(), i - 1, defaultScript);
|
styler.GetStartSegment(), i - 1, aspScript);
|
||||||
}
|
}
|
||||||
// Bounce out of any ASP mode
|
// Bounce out of any ASP mode
|
||||||
switch (state) {
|
switch (state) {
|
||||||
@@ -624,11 +690,16 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
|
|||||||
styler.ColourTo(i - 1, StateToPrint);
|
styler.ColourTo(i - 1, StateToPrint);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
if (scriptLanguage != eScriptSGML) {
|
||||||
i++;
|
i++;
|
||||||
|
visibleChars++;
|
||||||
|
}
|
||||||
if (ch == '%')
|
if (ch == '%')
|
||||||
styler.ColourTo(i, SCE_H_ASP);
|
styler.ColourTo(i, SCE_H_ASP);
|
||||||
else if (scriptLanguage == eScriptXML)
|
else if (scriptLanguage == eScriptXML)
|
||||||
styler.ColourTo(i, SCE_H_XMLEND);
|
styler.ColourTo(i, SCE_H_XMLEND);
|
||||||
|
else if (scriptLanguage == eScriptSGML)
|
||||||
|
styler.ColourTo(i, SCE_H_SGML_DEFAULT);
|
||||||
else
|
else
|
||||||
styler.ColourTo(i, SCE_H_QUESTION);
|
styler.ColourTo(i, SCE_H_QUESTION);
|
||||||
state = beforePreProc;
|
state = beforePreProc;
|
||||||
@@ -648,47 +719,156 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
|
|||||||
if (ch == '<') {
|
if (ch == '<') {
|
||||||
// in HTML, fold on tag open and unfold on tag close
|
// in HTML, fold on tag open and unfold on tag close
|
||||||
tagOpened = true;
|
tagOpened = true;
|
||||||
if (chNext == '/') {
|
tagClosing = (chNext == '/');
|
||||||
tagClosing = true;
|
|
||||||
} else {
|
|
||||||
tagClosing = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
styler.ColourTo(i - 1, StateToPrint);
|
styler.ColourTo(i - 1, StateToPrint);
|
||||||
if (chNext == '!' && chNext2 == '-' && styler.SafeGetCharAt(i + 3) == '-') {
|
if (chNext != '!')
|
||||||
// should be better
|
|
||||||
i += 3;
|
|
||||||
levelCurrent++;
|
|
||||||
state = SCE_H_COMMENT;
|
|
||||||
} else
|
|
||||||
state = SCE_H_TAGUNKNOWN;
|
state = SCE_H_TAGUNKNOWN;
|
||||||
} else if (ch == '&') {
|
} else if (ch == '&') {
|
||||||
styler.ColourTo(i - 1, SCE_H_DEFAULT);
|
styler.ColourTo(i - 1, SCE_H_DEFAULT);
|
||||||
state = SCE_H_ENTITY;
|
state = SCE_H_ENTITY;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case SCE_H_COMMENT:
|
case SCE_H_SGML_DEFAULT:
|
||||||
if ((ch == '>') && (chPrev == '-') && (chPrev2 == '-')) {
|
if (scriptLanguage == eScriptSGMLblock)
|
||||||
// unfold HTML comment
|
StateToPrint = SCE_H_SGML_BLOCK_DEFAULT;
|
||||||
levelCurrent--;
|
|
||||||
|
if (ch == '\"') {
|
||||||
|
styler.ColourTo(i - 1, StateToPrint);
|
||||||
|
state = SCE_H_SGML_DOUBLESTRING;
|
||||||
|
} else if (ch == '\'') {
|
||||||
|
styler.ColourTo(i - 1, StateToPrint);
|
||||||
|
state = SCE_H_SGML_SIMPLESTRING;
|
||||||
|
} else if ((ch == '-') && (chPrev == '-')) {
|
||||||
|
styler.ColourTo(i - 2, StateToPrint);
|
||||||
|
state = SCE_H_SGML_COMMENT;
|
||||||
|
} else if (isalpha(ch) && (chPrev == '%')) {
|
||||||
|
styler.ColourTo(i - 2, StateToPrint);
|
||||||
|
state = SCE_H_SGML_ENTITY;
|
||||||
|
} else if (ch == '#') {
|
||||||
|
styler.ColourTo(i - 1, StateToPrint);
|
||||||
|
state = SCE_H_SGML_SPECIAL;
|
||||||
|
} else if (ch == '[') {
|
||||||
|
styler.ColourTo(i - 1, StateToPrint);
|
||||||
|
scriptLanguage = eScriptSGMLblock;
|
||||||
|
} else if (ch == ']') {
|
||||||
|
if (scriptLanguage == eScriptSGMLblock) {
|
||||||
styler.ColourTo(i, StateToPrint);
|
styler.ColourTo(i, StateToPrint);
|
||||||
state = SCE_H_DEFAULT;
|
scriptLanguage = eScriptSGML;
|
||||||
tagOpened = false;
|
} else {
|
||||||
|
styler.ColourTo(i - 1, StateToPrint);
|
||||||
|
styler.ColourTo(i, SCE_H_SGML_ERROR);
|
||||||
|
}
|
||||||
|
} else if (scriptLanguage == eScriptSGMLblock) {
|
||||||
|
if ((ch == '!') && (chPrev == '<')) {
|
||||||
|
styler.ColourTo(i - 2, StateToPrint);
|
||||||
|
styler.ColourTo(i, SCE_H_SGML_DEFAULT);
|
||||||
|
state = SCE_H_SGML_COMMAND;
|
||||||
|
} else if (ch == '>') {
|
||||||
|
styler.ColourTo(i - 1, StateToPrint);
|
||||||
|
styler.ColourTo(i, SCE_H_SGML_DEFAULT);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case SCE_H_SGML_COMMAND:
|
||||||
|
if ((ch == '-') && (chPrev == '-')) {
|
||||||
|
styler.ColourTo(i - 2, StateToPrint);
|
||||||
|
state = SCE_H_SGML_COMMENT;
|
||||||
|
} else if (!issgmlwordchar(ch)) {
|
||||||
|
if (isWordHSGML(styler.GetStartSegment(), i - 1, keywords6, styler)) {
|
||||||
|
styler.ColourTo(i - 1, StateToPrint);
|
||||||
|
state = SCE_H_SGML_1ST_PARAM;
|
||||||
|
} else {
|
||||||
|
state = SCE_H_SGML_ERROR;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case SCE_H_SGML_1ST_PARAM:
|
||||||
|
// wait for the beginning of the word
|
||||||
|
if ((ch == '-') && (chPrev == '-')) {
|
||||||
|
if (scriptLanguage == eScriptSGMLblock) {
|
||||||
|
styler.ColourTo(i - 2, SCE_H_SGML_BLOCK_DEFAULT);
|
||||||
|
} else {
|
||||||
|
styler.ColourTo(i - 2, SCE_H_SGML_DEFAULT);
|
||||||
|
}
|
||||||
|
state = SCE_H_SGML_1ST_PARAM_COMMENT;
|
||||||
|
} else if (issgmlwordchar(ch)) {
|
||||||
|
if (scriptLanguage == eScriptSGMLblock) {
|
||||||
|
styler.ColourTo(i - 1, SCE_H_SGML_BLOCK_DEFAULT);
|
||||||
|
} else {
|
||||||
|
styler.ColourTo(i - 1, SCE_H_SGML_DEFAULT);
|
||||||
|
}
|
||||||
|
// find the length of the word
|
||||||
|
int size = 1;
|
||||||
|
while (ishtmlwordchar(styler.SafeGetCharAt(i + size)))
|
||||||
|
size++;
|
||||||
|
styler.ColourTo(i + size - 1, StateToPrint);
|
||||||
|
i += size - 1;
|
||||||
|
visibleChars += size - 1;
|
||||||
|
ch = styler.SafeGetCharAt(i);
|
||||||
|
state = SCE_H_SGML_DEFAULT;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case SCE_H_SGML_ERROR:
|
||||||
|
if ((ch == '-') && (chPrev == '-')) {
|
||||||
|
styler.ColourTo(i - 2, StateToPrint);
|
||||||
|
state = SCE_H_SGML_COMMENT;
|
||||||
|
}
|
||||||
|
case SCE_H_SGML_DOUBLESTRING:
|
||||||
|
if (ch == '\"') {
|
||||||
|
styler.ColourTo(i, StateToPrint);
|
||||||
|
state = SCE_H_SGML_DEFAULT;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case SCE_H_SGML_SIMPLESTRING:
|
||||||
|
if (ch == '\'') {
|
||||||
|
styler.ColourTo(i, StateToPrint);
|
||||||
|
state = SCE_H_SGML_DEFAULT;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case SCE_H_SGML_COMMENT:
|
||||||
|
if ((ch == '-') && (chPrev == '-')) {
|
||||||
|
styler.ColourTo(i, StateToPrint);
|
||||||
|
state = SCE_H_SGML_DEFAULT;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case SCE_H_CDATA:
|
case SCE_H_CDATA:
|
||||||
if ((ch == '>') && (chPrev == ']') && (chPrev2 == ']')) {
|
if ((chPrev2 == ']') && (chPrev == ']') && (ch == '>')) {
|
||||||
styler.ColourTo(i, StateToPrint);
|
styler.ColourTo(i, StateToPrint);
|
||||||
state = SCE_H_DEFAULT;
|
state = SCE_H_DEFAULT;
|
||||||
tagOpened = false;
|
levelCurrent--;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case SCE_H_SGML:
|
case SCE_H_COMMENT:
|
||||||
if (ch == '>') {
|
if ((chPrev2 == '-') && (chPrev == '-') && (ch == '>')) {
|
||||||
levelCurrent--;
|
|
||||||
styler.ColourTo(i, StateToPrint);
|
styler.ColourTo(i, StateToPrint);
|
||||||
state = SCE_H_DEFAULT;
|
state = SCE_H_DEFAULT;
|
||||||
tagOpened = false;
|
levelCurrent--;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case SCE_H_SGML_1ST_PARAM_COMMENT:
|
||||||
|
if ((ch == '-') && (chPrev == '-')) {
|
||||||
|
styler.ColourTo(i, SCE_H_SGML_COMMENT);
|
||||||
|
state = SCE_H_SGML_1ST_PARAM;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case SCE_H_SGML_SPECIAL:
|
||||||
|
if (!isupper(ch)) {
|
||||||
|
styler.ColourTo(i - 1, StateToPrint);
|
||||||
|
if (isalnum(ch)) {
|
||||||
|
state = SCE_H_SGML_ERROR;
|
||||||
|
} else {
|
||||||
|
state = SCE_H_SGML_DEFAULT;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case SCE_H_SGML_ENTITY:
|
||||||
|
if (ch == ';') {
|
||||||
|
styler.ColourTo(i, StateToPrint);
|
||||||
|
state = SCE_H_SGML_DEFAULT;
|
||||||
|
} else if (!isalnum(ch) && ch != '-' && ch != '.') {
|
||||||
|
styler.ColourTo(i, SCE_H_SGML_ERROR);
|
||||||
|
state = SCE_H_SGML_DEFAULT;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case SCE_H_ENTITY:
|
case SCE_H_ENTITY:
|
||||||
@@ -705,9 +885,14 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
|
|||||||
if (!ishtmlwordchar(ch) && !((ch == '/') && (chPrev == '<')) && ch != '[') {
|
if (!ishtmlwordchar(ch) && !((ch == '/') && (chPrev == '<')) && ch != '[') {
|
||||||
int eClass = classifyTagHTML(styler.GetStartSegment(), i - 1, keywords, styler);
|
int eClass = classifyTagHTML(styler.GetStartSegment(), i - 1, keywords, styler);
|
||||||
if (eClass == SCE_H_SCRIPT) {
|
if (eClass == SCE_H_SCRIPT) {
|
||||||
|
if (!tagClosing) {
|
||||||
inScriptType = eNonHtmlScript;
|
inScriptType = eNonHtmlScript;
|
||||||
scriptLanguage = defaultScript;
|
scriptLanguage = clientScript;
|
||||||
eClass = SCE_H_TAG;
|
eClass = SCE_H_TAG;
|
||||||
|
} else {
|
||||||
|
scriptLanguage = eScriptNone;
|
||||||
|
eClass = SCE_H_TAG;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (ch == '>') {
|
if (ch == '>') {
|
||||||
styler.ColourTo(i, eClass);
|
styler.ColourTo(i, eClass);
|
||||||
@@ -717,10 +902,11 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
|
|||||||
state = SCE_H_DEFAULT;
|
state = SCE_H_DEFAULT;
|
||||||
}
|
}
|
||||||
tagOpened = false;
|
tagOpened = false;
|
||||||
if (tagClosing)
|
if (tagClosing) {
|
||||||
levelCurrent--;
|
levelCurrent--;
|
||||||
else
|
} else {
|
||||||
levelCurrent++;
|
levelCurrent++;
|
||||||
|
}
|
||||||
tagClosing = false;
|
tagClosing = false;
|
||||||
} else if (ch == '/' && chNext == '>') {
|
} else if (ch == '/' && chNext == '>') {
|
||||||
if (eClass == SCE_H_TAGUNKNOWN) {
|
if (eClass == SCE_H_TAGUNKNOWN) {
|
||||||
@@ -735,10 +921,8 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
|
|||||||
tagOpened = false;
|
tagOpened = false;
|
||||||
} else {
|
} else {
|
||||||
if (eClass != SCE_H_TAGUNKNOWN) {
|
if (eClass != SCE_H_TAGUNKNOWN) {
|
||||||
if (eClass == SCE_H_CDATA) {
|
if (eClass == SCE_H_SGML_DEFAULT) {
|
||||||
state = SCE_H_CDATA;
|
state = SCE_H_SGML_DEFAULT;
|
||||||
} else if (eClass == SCE_H_SGML) {
|
|
||||||
state = SCE_H_SGML;
|
|
||||||
} else {
|
} else {
|
||||||
state = SCE_H_OTHER;
|
state = SCE_H_OTHER;
|
||||||
}
|
}
|
||||||
@@ -750,7 +934,8 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
|
|||||||
if (!ishtmlwordchar(ch) && ch != '/' && ch != '-') {
|
if (!ishtmlwordchar(ch) && ch != '/' && ch != '-') {
|
||||||
if (inScriptType == eNonHtmlScript) {
|
if (inScriptType == eNonHtmlScript) {
|
||||||
int scriptLanguagePrev = scriptLanguage;
|
int scriptLanguagePrev = scriptLanguage;
|
||||||
scriptLanguage = segIsScriptingIndicator(styler, styler.GetStartSegment(), i - 1, scriptLanguage);
|
clientScript = segIsScriptingIndicator(styler, styler.GetStartSegment(), i - 1, scriptLanguage);
|
||||||
|
scriptLanguage = clientScript;
|
||||||
if ((scriptLanguagePrev != scriptLanguage) && (scriptLanguage == eScriptNone))
|
if ((scriptLanguagePrev != scriptLanguage) && (scriptLanguage == eScriptNone))
|
||||||
inScriptType = eHtml;
|
inScriptType = eHtml;
|
||||||
}
|
}
|
||||||
@@ -1218,7 +1403,7 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
|
|||||||
if (!isdigit(ch)) {
|
if (!isdigit(ch)) {
|
||||||
styler.ColourTo(i - 1, SCE_HPHP_NUMBER);
|
styler.ColourTo(i - 1, SCE_HPHP_NUMBER);
|
||||||
if (isoperator(ch))
|
if (isoperator(ch))
|
||||||
state =SCE_HPHP_OPERATOR;
|
state = SCE_HPHP_OPERATOR;
|
||||||
else
|
else
|
||||||
state = SCE_HPHP_DEFAULT;
|
state = SCE_HPHP_DEFAULT;
|
||||||
}
|
}
|
||||||
@@ -1227,7 +1412,7 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
|
|||||||
if (!iswordstart(ch)) {
|
if (!iswordstart(ch)) {
|
||||||
styler.ColourTo(i - 1, SCE_HPHP_VARIABLE);
|
styler.ColourTo(i - 1, SCE_HPHP_VARIABLE);
|
||||||
if (isoperator(ch))
|
if (isoperator(ch))
|
||||||
state =SCE_HPHP_OPERATOR;
|
state = SCE_HPHP_OPERATOR;
|
||||||
else
|
else
|
||||||
state = SCE_HPHP_DEFAULT;
|
state = SCE_HPHP_DEFAULT;
|
||||||
}
|
}
|
||||||
@@ -1249,7 +1434,7 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
|
|||||||
// skip the next char
|
// skip the next char
|
||||||
i++;
|
i++;
|
||||||
} else if (ch == '$') {
|
} else if (ch == '$') {
|
||||||
styler.ColourTo(i-1, StateToPrint);
|
styler.ColourTo(i - 1, StateToPrint);
|
||||||
state = SCE_HPHP_HSTRING_VARIABLE;
|
state = SCE_HPHP_HSTRING_VARIABLE;
|
||||||
} else if (ch == '\"') {
|
} else if (ch == '\"') {
|
||||||
styler.ColourTo(i, StateToPrint);
|
styler.ColourTo(i, StateToPrint);
|
||||||
@@ -1267,7 +1452,7 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
|
|||||||
break;
|
break;
|
||||||
case SCE_HPHP_HSTRING_VARIABLE:
|
case SCE_HPHP_HSTRING_VARIABLE:
|
||||||
if (!iswordstart(ch)) {
|
if (!iswordstart(ch)) {
|
||||||
styler.ColourTo(i-1, StateToPrint);
|
styler.ColourTo(i - 1, StateToPrint);
|
||||||
i--; // strange but it works
|
i--; // strange but it works
|
||||||
state = SCE_HPHP_HSTRING;
|
state = SCE_HPHP_HSTRING;
|
||||||
}
|
}
|
||||||
@@ -1304,6 +1489,7 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
|
|||||||
|
|
||||||
// Some of the above terminated their lexeme but since the same character starts
|
// Some of the above terminated their lexeme but since the same character starts
|
||||||
// the same class again, only reenter if non empty segment.
|
// the same class again, only reenter if non empty segment.
|
||||||
|
|
||||||
bool nonEmptySegment = i >= static_cast<int>(styler.GetStartSegment());
|
bool nonEmptySegment = i >= static_cast<int>(styler.GetStartSegment());
|
||||||
if (state == SCE_HB_DEFAULT) { // One of the above succeeded
|
if (state == SCE_HB_DEFAULT) { // One of the above succeeded
|
||||||
if ((ch == '\"') && (nonEmptySegment)) {
|
if ((ch == '\"') && (nonEmptySegment)) {
|
||||||
@@ -1357,4 +1543,3 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
|
|||||||
|
|
||||||
LexerModule lmHTML(SCLEX_HTML, ColouriseHyperTextDoc, "hypertext");
|
LexerModule lmHTML(SCLEX_HTML, ColouriseHyperTextDoc, "hypertext");
|
||||||
LexerModule lmXML(SCLEX_XML, ColouriseHyperTextDoc, "xml");
|
LexerModule lmXML(SCLEX_XML, ColouriseHyperTextDoc, "xml");
|
||||||
|
|
||||||
|
@@ -15,70 +15,18 @@
|
|||||||
|
|
||||||
#include "PropSet.h"
|
#include "PropSet.h"
|
||||||
#include "Accessor.h"
|
#include "Accessor.h"
|
||||||
|
#include "StyleContext.h"
|
||||||
#include "KeyWords.h"
|
#include "KeyWords.h"
|
||||||
#include "Scintilla.h"
|
#include "Scintilla.h"
|
||||||
#include "SciLexer.h"
|
#include "SciLexer.h"
|
||||||
|
|
||||||
/* Returns true if the "as" word that begins at start follows an import statement */
|
enum kwType { kwOther, kwClass, kwDef, kwImport };
|
||||||
static bool IsImportAs(unsigned int start, Accessor &styler) {
|
|
||||||
unsigned int i;
|
|
||||||
unsigned int j;
|
|
||||||
char s[10];
|
|
||||||
|
|
||||||
/* Find any import before start but after any statement terminator or quote */
|
|
||||||
i = start;
|
|
||||||
while (i > 0) {
|
|
||||||
char ch = styler[i - 1];
|
|
||||||
|
|
||||||
if (ch == '\n' || ch == '\r' || ch == ';' || ch == '\'' || ch == '"' || ch == '`')
|
|
||||||
break;
|
|
||||||
if (ch == 't' && i > 5) {
|
|
||||||
for (j = 0; j < 6; j++)
|
|
||||||
s[j] = styler[(i - 6) + j];
|
|
||||||
s[j] = '\0';
|
|
||||||
if (strcmp(s, "import") == 0)
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
i--;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void ClassifyWordPy(unsigned int start, unsigned int end, WordList &keywords, Accessor &styler, char *prevWord) {
|
|
||||||
char s[100];
|
|
||||||
bool wordIsNumber = isdigit(styler[start]);
|
|
||||||
for (unsigned int i = 0; i < end - start + 1 && i < 30; i++) {
|
|
||||||
s[i] = styler[start + i];
|
|
||||||
s[i + 1] = '\0';
|
|
||||||
}
|
|
||||||
char chAttr = SCE_P_IDENTIFIER;
|
|
||||||
if (0 == strcmp(prevWord, "class"))
|
|
||||||
chAttr = SCE_P_CLASSNAME;
|
|
||||||
else if (0 == strcmp(prevWord, "def"))
|
|
||||||
chAttr = SCE_P_DEFNAME;
|
|
||||||
else if (wordIsNumber)
|
|
||||||
chAttr = SCE_P_NUMBER;
|
|
||||||
else if (keywords.InList(s))
|
|
||||||
chAttr = SCE_P_WORD;
|
|
||||||
else if (strcmp(s, "as") == 0 && IsImportAs(start, styler))
|
|
||||||
chAttr = SCE_P_WORD;
|
|
||||||
// make sure that dot-qualifiers inside the word are lexed correct
|
|
||||||
else for (unsigned int i = 0; i < end - start + 1; i++) {
|
|
||||||
if (styler[start + i] == '.') {
|
|
||||||
styler.ColourTo(start + i - 1, chAttr);
|
|
||||||
styler.ColourTo(start + i, SCE_P_OPERATOR);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
styler.ColourTo(end, chAttr);
|
|
||||||
strcpy(prevWord, s);
|
|
||||||
}
|
|
||||||
|
|
||||||
static bool IsPyComment(Accessor &styler, int pos, int len) {
|
static bool IsPyComment(Accessor &styler, int pos, int len) {
|
||||||
return len>0 && styler[pos]=='#';
|
return len>0 && styler[pos]=='#';
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool IsPyStringStart(char ch, char chNext, char chNext2) {
|
static bool IsPyStringStart(int ch, int chNext, int chNext2) {
|
||||||
if (ch == '\'' || ch == '"')
|
if (ch == '\'' || ch == '"')
|
||||||
return true;
|
return true;
|
||||||
if (ch == 'u' || ch == 'U') {
|
if (ch == 'u' || ch == 'U') {
|
||||||
@@ -93,10 +41,6 @@ static bool IsPyStringStart(char ch, char chNext, char chNext2) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool IsPyWordStart(char ch, char chNext, char chNext2) {
|
|
||||||
return (iswordchar(ch) && !IsPyStringStart(ch, chNext, chNext2));
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Return the state to use for the string starting at i; *nextIndex will be set to the first index following the quote(s) */
|
/* Return the state to use for the string starting at i; *nextIndex will be set to the first index following the quote(s) */
|
||||||
static int GetPyStringState(Accessor &styler, int i, int *nextIndex) {
|
static int GetPyStringState(Accessor &styler, int i, int *nextIndex) {
|
||||||
char ch = styler.SafeGetCharAt(i);
|
char ch = styler.SafeGetCharAt(i);
|
||||||
@@ -139,10 +83,18 @@ static int GetPyStringState(Accessor &styler, int i, int *nextIndex) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline bool IsAWordChar(int ch) {
|
||||||
|
return (ch < 0x80) && (isalnum(ch) || ch == '.' || ch == '_');
|
||||||
|
}
|
||||||
|
|
||||||
|
inline bool IsAWordStart(int ch) {
|
||||||
|
return (ch < 0x80) && (isalnum(ch) || ch == '_');
|
||||||
|
}
|
||||||
|
|
||||||
static void ColourisePyDoc(unsigned int startPos, int length, int initStyle,
|
static void ColourisePyDoc(unsigned int startPos, int length, int initStyle,
|
||||||
WordList *keywordlists[], Accessor &styler) {
|
WordList *keywordlists[], Accessor &styler) {
|
||||||
|
|
||||||
int lengthDoc = startPos + length;
|
int endPos = startPos + length;
|
||||||
|
|
||||||
// Backtrack to previous line in case need to fix its tab whinging
|
// Backtrack to previous line in case need to fix its tab whinging
|
||||||
int lineCurrent = styler.GetLine(startPos);
|
int lineCurrent = styler.GetLine(startPos);
|
||||||
@@ -156,32 +108,27 @@ static void ColourisePyDoc(unsigned int startPos, int length, int initStyle,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Python uses a different mask because bad indentation is marked by oring with 32
|
|
||||||
styler.StartAt(startPos, 127);
|
|
||||||
|
|
||||||
WordList &keywords = *keywordlists[0];
|
WordList &keywords = *keywordlists[0];
|
||||||
|
|
||||||
int whingeLevel = styler.GetPropertyInt("tab.timmy.whinge.level");
|
const int whingeLevel = styler.GetPropertyInt("tab.timmy.whinge.level");
|
||||||
char prevWord[200];
|
|
||||||
prevWord[0] = '\0';
|
|
||||||
if (length == 0)
|
|
||||||
return ;
|
|
||||||
|
|
||||||
int state = initStyle & 31;
|
initStyle = initStyle & 31;
|
||||||
|
if (initStyle == SCE_P_STRINGEOL) {
|
||||||
|
initStyle = SCE_P_DEFAULT;
|
||||||
|
}
|
||||||
|
|
||||||
int nextIndex = 0;
|
kwType kwLast = kwOther;
|
||||||
char chPrev = ' ';
|
|
||||||
char chPrev2 = ' ';
|
|
||||||
char chNext = styler[startPos];
|
|
||||||
styler.StartSegment(startPos);
|
|
||||||
bool atStartLine = true;
|
|
||||||
int spaceFlags = 0;
|
int spaceFlags = 0;
|
||||||
styler.IndentAmount(lineCurrent, &spaceFlags, IsPyComment);
|
styler.IndentAmount(lineCurrent, &spaceFlags, IsPyComment);
|
||||||
for (int i = startPos; i < lengthDoc; i++) {
|
|
||||||
|
|
||||||
if (atStartLine) {
|
// Python uses a different mask because bad indentation is marked by oring with 32
|
||||||
char chBad = static_cast<char>(64);
|
StyleContext sc(startPos, endPos-startPos, initStyle, styler, 0x7f);
|
||||||
char chGood = static_cast<char>(0);
|
|
||||||
|
for (; sc.More(); sc.Forward()) {
|
||||||
|
|
||||||
|
if (sc.atLineStart) {
|
||||||
|
const char chBad = static_cast<char>(64);
|
||||||
|
const char chGood = static_cast<char>(0);
|
||||||
char chFlags = chGood;
|
char chFlags = chGood;
|
||||||
if (whingeLevel == 1) {
|
if (whingeLevel == 1) {
|
||||||
chFlags = (spaceFlags & wsInconsistent) ? chBad : chGood;
|
chFlags = (spaceFlags & wsInconsistent) ? chBad : chGood;
|
||||||
@@ -192,132 +139,117 @@ static void ColourisePyDoc(unsigned int startPos, int length, int initStyle,
|
|||||||
} else if (whingeLevel == 4) {
|
} else if (whingeLevel == 4) {
|
||||||
chFlags = (spaceFlags & wsTab) ? chBad : chGood;
|
chFlags = (spaceFlags & wsTab) ? chBad : chGood;
|
||||||
}
|
}
|
||||||
styler.SetFlags(chFlags, static_cast<char>(state));
|
styler.SetFlags(chFlags, static_cast<char>(sc.state));
|
||||||
atStartLine = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
char ch = chNext;
|
if (sc.atLineEnd) {
|
||||||
chNext = styler.SafeGetCharAt(i + 1);
|
if ((sc.state == SCE_P_DEFAULT) ||
|
||||||
char chNext2 = styler.SafeGetCharAt(i + 2);
|
(sc.state == SCE_P_TRIPLE) ||
|
||||||
|
(sc.state == SCE_P_TRIPLEDOUBLE)) {
|
||||||
if ((ch == '\r' && chNext != '\n') || (ch == '\n') || (i == lengthDoc)) {
|
|
||||||
if ((state == SCE_P_DEFAULT) || (state == SCE_P_TRIPLE) || (state == SCE_P_TRIPLEDOUBLE)) {
|
|
||||||
// Perform colourisation of white space and triple quoted strings at end of each line to allow
|
// Perform colourisation of white space and triple quoted strings at end of each line to allow
|
||||||
// tab marking to work inside white space and triple quoted strings
|
// tab marking to work inside white space and triple quoted strings
|
||||||
styler.ColourTo(i, state);
|
sc.ForwardSetState(sc.state);
|
||||||
}
|
}
|
||||||
lineCurrent++;
|
lineCurrent++;
|
||||||
styler.IndentAmount(lineCurrent, &spaceFlags, IsPyComment);
|
styler.IndentAmount(lineCurrent, &spaceFlags, IsPyComment);
|
||||||
atStartLine = true;
|
if ((sc.state == SCE_P_STRING) || (sc.state == SCE_P_CHARACTER)) {
|
||||||
|
sc.ChangeState(SCE_P_STRINGEOL);
|
||||||
|
sc.ForwardSetState(SCE_P_DEFAULT);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (styler.IsLeadByte(ch)) {
|
// Check for a state end
|
||||||
chNext = styler.SafeGetCharAt(i + 2);
|
if (sc.state == SCE_P_OPERATOR) {
|
||||||
chPrev = ' ';
|
kwLast = kwOther;
|
||||||
chPrev2 = ' ';
|
sc.SetState(SCE_C_DEFAULT);
|
||||||
i += 1;
|
} else if (sc.state == SCE_P_NUMBER) {
|
||||||
continue;
|
if (!IsAWordChar(sc.ch)) {
|
||||||
|
sc.SetState(SCE_P_DEFAULT);
|
||||||
|
}
|
||||||
|
} else if (sc.state == SCE_P_WORD) {
|
||||||
|
if ((sc.ch == '.') || (!IsAWordChar(sc.ch))) {
|
||||||
|
char s[100];
|
||||||
|
sc.GetCurrent(s, sizeof(s));
|
||||||
|
int style = SCE_P_IDENTIFIER;
|
||||||
|
if ((kwLast == kwImport) && (strcmp(s, "as") == 0)) {
|
||||||
|
style = SCE_P_WORD;
|
||||||
|
} else if (keywords.InList(s)) {
|
||||||
|
style = SCE_P_WORD;
|
||||||
|
} else if (kwLast == kwClass) {
|
||||||
|
style = SCE_P_CLASSNAME;
|
||||||
|
} else if (kwLast == kwDef) {
|
||||||
|
style = SCE_P_DEFNAME;
|
||||||
|
}
|
||||||
|
sc.ChangeState(style);
|
||||||
|
sc.SetState(SCE_P_DEFAULT);
|
||||||
|
if (style == SCE_P_WORD) {
|
||||||
|
if (0 == strcmp(s, "class"))
|
||||||
|
kwLast = kwClass;
|
||||||
|
else if (0 == strcmp(s, "def"))
|
||||||
|
kwLast = kwDef;
|
||||||
|
else if (0 == strcmp(s, "import"))
|
||||||
|
kwLast = kwImport;
|
||||||
|
else
|
||||||
|
kwLast = kwOther;
|
||||||
|
} else if (style == SCE_P_CLASSNAME) {
|
||||||
|
kwLast = kwOther;
|
||||||
|
} else if (style == SCE_P_DEFNAME) {
|
||||||
|
kwLast = kwOther;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if ((sc.state == SCE_P_COMMENTLINE) || (sc.state == SCE_P_COMMENTBLOCK)) {
|
||||||
|
if (sc.ch == '\r' || sc.ch == '\n') {
|
||||||
|
sc.SetState(SCE_P_DEFAULT);
|
||||||
|
}
|
||||||
|
} else if ((sc.state == SCE_P_STRING) || (sc.state == SCE_P_CHARACTER)) {
|
||||||
|
if (sc.ch == '\\') {
|
||||||
|
if ((sc.chNext == '\r') && (sc.GetRelative(2) == '\n')) {
|
||||||
|
sc.Forward();
|
||||||
|
}
|
||||||
|
sc.Forward();
|
||||||
|
} else if ((sc.state == SCE_P_STRING) && (sc.ch == '\"')) {
|
||||||
|
sc.ForwardSetState(SCE_P_DEFAULT);
|
||||||
|
} else if ((sc.state == SCE_P_CHARACTER) && (sc.ch == '\'')) {
|
||||||
|
sc.ForwardSetState(SCE_P_DEFAULT);
|
||||||
|
}
|
||||||
|
} else if (sc.state == SCE_P_TRIPLE) {
|
||||||
|
if (sc.ch == '\\') {
|
||||||
|
sc.Forward();
|
||||||
|
} else if (sc.Match("\'\'\'")) {
|
||||||
|
sc.Forward();
|
||||||
|
sc.Forward();
|
||||||
|
sc.ForwardSetState(SCE_P_DEFAULT);
|
||||||
|
}
|
||||||
|
} else if (sc.state == SCE_P_TRIPLEDOUBLE) {
|
||||||
|
if (sc.ch == '\\') {
|
||||||
|
sc.Forward();
|
||||||
|
} else if (sc.Match("\"\"\"")) {
|
||||||
|
sc.Forward();
|
||||||
|
sc.Forward();
|
||||||
|
sc.ForwardSetState(SCE_P_DEFAULT);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (state == SCE_P_STRINGEOL) {
|
// Check for a new state starting character
|
||||||
if (ch != '\r' && ch != '\n') {
|
if (sc.state == SCE_P_DEFAULT) {
|
||||||
styler.ColourTo(i - 1, state);
|
if (isascii(sc.ch) && isoperator(static_cast<char>(sc.ch)) || sc.ch == '`') {
|
||||||
state = SCE_P_DEFAULT;
|
sc.SetState(SCE_P_OPERATOR);
|
||||||
|
} else if (sc.ch == '#') {
|
||||||
|
sc.SetState(sc.chNext == '#' ? SCE_P_COMMENTBLOCK : SCE_P_COMMENTLINE);
|
||||||
|
} else if (IsADigit(sc.ch) || (sc.ch == '.' && IsADigit(sc.chNext))) {
|
||||||
|
sc.SetState(SCE_P_NUMBER);
|
||||||
|
} else if (IsPyStringStart(sc.ch, sc.chNext, sc.GetRelative(2))) {
|
||||||
|
int nextIndex = 0;
|
||||||
|
sc.SetState(GetPyStringState(styler, sc.currentPos, &nextIndex));
|
||||||
|
while (nextIndex > (sc.currentPos+1)) {
|
||||||
|
sc.Forward();
|
||||||
}
|
}
|
||||||
}
|
} else if (IsAWordStart(sc.ch)) {
|
||||||
if (state == SCE_P_DEFAULT) {
|
sc.SetState(SCE_P_WORD);
|
||||||
if (IsPyWordStart(ch, chNext, chNext2)) {
|
|
||||||
styler.ColourTo(i - 1, state);
|
|
||||||
state = SCE_P_WORD;
|
|
||||||
} else if (ch == '#') {
|
|
||||||
styler.ColourTo(i - 1, state);
|
|
||||||
state = chNext == '#' ? SCE_P_COMMENTBLOCK : SCE_P_COMMENTLINE;
|
|
||||||
} else if (IsPyStringStart(ch, chNext, chNext2)) {
|
|
||||||
styler.ColourTo(i - 1, state);
|
|
||||||
state = GetPyStringState(styler, i, &nextIndex);
|
|
||||||
if (nextIndex != i + 1) {
|
|
||||||
i = nextIndex - 1;
|
|
||||||
ch = ' ';
|
|
||||||
chPrev = ' ';
|
|
||||||
chNext = styler.SafeGetCharAt(i + 1);
|
|
||||||
}
|
|
||||||
} else if (isoperator(ch)) {
|
|
||||||
styler.ColourTo(i - 1, state);
|
|
||||||
styler.ColourTo(i, SCE_P_OPERATOR);
|
|
||||||
}
|
|
||||||
} else if (state == SCE_P_WORD) {
|
|
||||||
if (!iswordchar(ch)) {
|
|
||||||
ClassifyWordPy(styler.GetStartSegment(), i - 1, keywords, styler, prevWord);
|
|
||||||
state = SCE_P_DEFAULT;
|
|
||||||
if (ch == '#') {
|
|
||||||
state = chNext == '#' ? SCE_P_COMMENTBLOCK : SCE_P_COMMENTLINE;
|
|
||||||
} else if (IsPyStringStart(ch, chNext, chNext2)) {
|
|
||||||
styler.ColourTo(i - 1, state);
|
|
||||||
state = GetPyStringState(styler, i, &nextIndex);
|
|
||||||
if (nextIndex != i + 1) {
|
|
||||||
i = nextIndex - 1;
|
|
||||||
ch = ' ';
|
|
||||||
chPrev = ' ';
|
|
||||||
chNext = styler.SafeGetCharAt(i + 1);
|
|
||||||
}
|
|
||||||
} else if (isoperator(ch)) {
|
|
||||||
styler.ColourTo(i, SCE_P_OPERATOR);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (state == SCE_P_COMMENTLINE || state == SCE_P_COMMENTBLOCK) {
|
|
||||||
if (ch == '\r' || ch == '\n') {
|
|
||||||
styler.ColourTo(i - 1, state);
|
|
||||||
state = SCE_P_DEFAULT;
|
|
||||||
}
|
|
||||||
} else if (state == SCE_P_STRING) {
|
|
||||||
if ((ch == '\r' || ch == '\n') && (chPrev != '\\')) {
|
|
||||||
styler.ColourTo(i - 1, state);
|
|
||||||
state = SCE_P_STRINGEOL;
|
|
||||||
} else if (ch == '\\') {
|
|
||||||
if (chNext == '\"' || chNext == '\'' || chNext == '\\') {
|
|
||||||
i++;
|
|
||||||
ch = chNext;
|
|
||||||
chNext = styler.SafeGetCharAt(i + 1);
|
|
||||||
}
|
|
||||||
} else if (ch == '\"') {
|
|
||||||
styler.ColourTo(i, state);
|
|
||||||
state = SCE_P_DEFAULT;
|
|
||||||
}
|
|
||||||
} else if (state == SCE_P_CHARACTER) {
|
|
||||||
if ((ch == '\r' || ch == '\n') && (chPrev != '\\')) {
|
|
||||||
styler.ColourTo(i - 1, state);
|
|
||||||
state = SCE_P_STRINGEOL;
|
|
||||||
} else if (ch == '\\') {
|
|
||||||
if (chNext == '\"' || chNext == '\'' || chNext == '\\') {
|
|
||||||
i++;
|
|
||||||
ch = chNext;
|
|
||||||
chNext = styler.SafeGetCharAt(i + 1);
|
|
||||||
}
|
|
||||||
} else if (ch == '\'') {
|
|
||||||
styler.ColourTo(i, state);
|
|
||||||
state = SCE_P_DEFAULT;
|
|
||||||
}
|
|
||||||
} else if (state == SCE_P_TRIPLE) {
|
|
||||||
if (ch == '\'' && chPrev == '\'' && chPrev2 == '\'') {
|
|
||||||
styler.ColourTo(i, state);
|
|
||||||
state = SCE_P_DEFAULT;
|
|
||||||
}
|
|
||||||
} else if (state == SCE_P_TRIPLEDOUBLE) {
|
|
||||||
if (ch == '\"' && chPrev == '\"' && chPrev2 == '\"') {
|
|
||||||
styler.ColourTo(i, state);
|
|
||||||
state = SCE_P_DEFAULT;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
chPrev2 = chPrev;
|
sc.Complete();
|
||||||
chPrev = ch;
|
|
||||||
}
|
|
||||||
if (state == SCE_P_WORD) {
|
|
||||||
ClassifyWordPy(styler.GetStartSegment(), lengthDoc, keywords, styler, prevWord);
|
|
||||||
} else {
|
|
||||||
styler.ColourTo(lengthDoc, state);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool IsCommentLine(int line, Accessor &styler) {
|
static bool IsCommentLine(int line, Accessor &styler) {
|
||||||
@@ -338,13 +270,14 @@ static bool IsQuoteLine(int line, Accessor &styler) {
|
|||||||
return ((style == SCE_P_TRIPLE) || (style== SCE_P_TRIPLEDOUBLE));
|
return ((style == SCE_P_TRIPLE) || (style== SCE_P_TRIPLEDOUBLE));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void FoldPyDoc(unsigned int startPos, int length, int /*initStyle - unused*/,
|
static void FoldPyDoc(unsigned int startPos, int length, int /*initStyle - unused*/,
|
||||||
WordList *[], Accessor &styler) {
|
WordList *[], Accessor &styler) {
|
||||||
int maxPos = startPos + length;
|
const int maxPos = startPos + length;
|
||||||
int maxLines = styler.GetLine(maxPos-1);
|
const int maxLines = styler.GetLine(maxPos-1); // Requested last line
|
||||||
|
const int docLines = styler.GetLine(styler.Length() - 1); // Available last line
|
||||||
bool foldComment = styler.GetPropertyInt("fold.comment.python");
|
const bool foldComment = styler.GetPropertyInt("fold.comment.python");
|
||||||
bool foldQuotes = styler.GetPropertyInt("fold.quotes.python");
|
const bool foldQuotes = styler.GetPropertyInt("fold.quotes.python");
|
||||||
|
|
||||||
// Backtrack to previous non-blank line so we can determine indent level
|
// Backtrack to previous non-blank line so we can determine indent level
|
||||||
// for any white space lines (needed esp. within triple quoted strings)
|
// for any white space lines (needed esp. within triple quoted strings)
|
||||||
@@ -363,8 +296,8 @@ static void FoldPyDoc(unsigned int startPos, int length, int /*initStyle - unuse
|
|||||||
}
|
}
|
||||||
int indentCurrentLevel = indentCurrent & SC_FOLDLEVELNUMBERMASK;
|
int indentCurrentLevel = indentCurrent & SC_FOLDLEVELNUMBERMASK;
|
||||||
|
|
||||||
|
// Set up initial loop state
|
||||||
startPos = styler.LineStart(lineCurrent);
|
startPos = styler.LineStart(lineCurrent);
|
||||||
// Set up initial state
|
|
||||||
int prev_state = SCE_P_DEFAULT & 31;
|
int prev_state = SCE_P_DEFAULT & 31;
|
||||||
if (lineCurrent >= 1)
|
if (lineCurrent >= 1)
|
||||||
prev_state = styler.StyleAt(startPos-1) & 31;
|
prev_state = styler.StyleAt(startPos-1) & 31;
|
||||||
@@ -374,21 +307,27 @@ static void FoldPyDoc(unsigned int startPos, int length, int /*initStyle - unuse
|
|||||||
prevComment = foldComment && IsCommentLine(lineCurrent - 1, styler);
|
prevComment = foldComment && IsCommentLine(lineCurrent - 1, styler);
|
||||||
|
|
||||||
// Process all characters to end of requested range or end of any triple quote
|
// Process all characters to end of requested range or end of any triple quote
|
||||||
// or comment that hangs over the end of the range
|
// or comment that hangs over the end of the range. Cap processing in all cases
|
||||||
while ((lineCurrent <= maxLines) || prevQuote || prevComment) {
|
// to end of document (in case of unclosed quote or comment at end).
|
||||||
|
while ((lineCurrent <= docLines) && ((lineCurrent <= maxLines) || prevQuote || prevComment)) {
|
||||||
|
|
||||||
// Gather info
|
// Gather info
|
||||||
int lev = indentCurrent;
|
int lev = indentCurrent;
|
||||||
int lineNext = lineCurrent + 1;
|
int lineNext = lineCurrent + 1;
|
||||||
|
int indentNext = indentCurrent;
|
||||||
|
int quote = false;
|
||||||
|
if (lineNext <= docLines) {
|
||||||
|
// Information about next line is only available if not at end of document
|
||||||
|
indentNext = styler.IndentAmount(lineNext, &spaceFlags, NULL);
|
||||||
int style = styler.StyleAt(styler.LineStart(lineNext)) & 31;
|
int style = styler.StyleAt(styler.LineStart(lineNext)) & 31;
|
||||||
int indentNext = styler.IndentAmount(lineNext, &spaceFlags, NULL);
|
quote = foldQuotes && ((style == SCE_P_TRIPLE) || (style== SCE_P_TRIPLEDOUBLE));
|
||||||
int quote = foldQuotes && ((style == SCE_P_TRIPLE) || (style== SCE_P_TRIPLEDOUBLE));
|
}
|
||||||
int quote_start = (quote && !prevQuote);
|
const int quote_start = (quote && !prevQuote);
|
||||||
int quote_continue = (quote && prevQuote);
|
const int quote_continue = (quote && prevQuote);
|
||||||
int comment = foldComment && IsCommentLine(lineCurrent, styler);
|
const int comment = foldComment && IsCommentLine(lineCurrent, styler);
|
||||||
int comment_start = (comment && !prevComment &&
|
const int comment_start = (comment && !prevComment && (lineNext <= docLines) &&
|
||||||
IsCommentLine(lineNext, styler) && (lev > SC_FOLDLEVELBASE));
|
IsCommentLine(lineNext, styler) && (lev > SC_FOLDLEVELBASE));
|
||||||
int comment_continue = (comment && prevComment);
|
const int comment_continue = (comment && prevComment);
|
||||||
if ((!quote || !prevQuote) && !comment)
|
if ((!quote || !prevQuote) && !comment)
|
||||||
indentCurrentLevel = indentCurrent & SC_FOLDLEVELNUMBERMASK;
|
indentCurrentLevel = indentCurrent & SC_FOLDLEVELNUMBERMASK;
|
||||||
if (quote)
|
if (quote)
|
||||||
@@ -411,22 +350,35 @@ static void FoldPyDoc(unsigned int startPos, int length, int /*initStyle - unuse
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Skip past any blank lines for next indent level info; we skip also comments
|
// Skip past any blank lines for next indent level info; we skip also comments
|
||||||
// starting in column 0 which effectively folds them into surrounding code
|
// starting in column 0 which effectively folds them into surrounding code rather
|
||||||
// rather than screwing up folding. Then set indent level on the lines
|
// than screwing up folding.
|
||||||
// we skipped to be same as maximum of current and next indent. This approach
|
const int saveIndentNext = indentNext;
|
||||||
// does a reasonable job of collapsing white space into surrounding code
|
|
||||||
// without getting confused by white space at the start of an indented level.
|
|
||||||
while (!quote &&
|
while (!quote &&
|
||||||
((indentNext & SC_FOLDLEVELWHITEFLAG) || styler[styler.LineStart(lineNext)] == '#') &&
|
(lineNext < docLines) &&
|
||||||
(lineNext < maxLines)) {
|
((indentNext & SC_FOLDLEVELWHITEFLAG) ||
|
||||||
int level = Platform::Maximum(indentCurrent, indentNext);
|
(lineNext <= docLines && styler[styler.LineStart(lineNext)] == '#'))) {
|
||||||
if (indentNext & SC_FOLDLEVELWHITEFLAG)
|
|
||||||
level = SC_FOLDLEVELWHITEFLAG | indentCurrentLevel;
|
|
||||||
styler.SetLevel(lineNext, level);
|
|
||||||
lineNext++;
|
lineNext++;
|
||||||
indentNext = styler.IndentAmount(lineNext, &spaceFlags, NULL);
|
indentNext = styler.IndentAmount(lineNext, &spaceFlags, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Next compute max indent level of current line and next non-blank line.
|
||||||
|
// This is the level to which we set all the intervening blank or comment lines.
|
||||||
|
const int skip_level = Platform::Maximum(indentCurrentLevel,
|
||||||
|
indentNext & SC_FOLDLEVELNUMBERMASK);
|
||||||
|
|
||||||
|
// Now set all the indent levels on the lines we skipped
|
||||||
|
int skipLine = lineCurrent + 1;
|
||||||
|
int skipIndentNext = saveIndentNext;
|
||||||
|
while (skipLine < lineNext) {
|
||||||
|
int skipLineLevel = skip_level;
|
||||||
|
if (skipIndentNext & SC_FOLDLEVELWHITEFLAG)
|
||||||
|
skipLineLevel = SC_FOLDLEVELWHITEFLAG | skipLineLevel;
|
||||||
|
styler.SetLevel(skipLine, skipLineLevel);
|
||||||
|
skipLine++;
|
||||||
|
skipIndentNext = styler.IndentAmount(skipLine, &spaceFlags, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
// Set fold header on non-quote/non-comment line
|
// Set fold header on non-quote/non-comment line
|
||||||
if (!quote && !comment && !(indentCurrent & SC_FOLDLEVELWHITEFLAG) ) {
|
if (!quote && !comment && !(indentCurrent & SC_FOLDLEVELWHITEFLAG) ) {
|
||||||
if ((indentCurrent & SC_FOLDLEVELNUMBERMASK) < (indentNext & SC_FOLDLEVELNUMBERMASK))
|
if ((indentCurrent & SC_FOLDLEVELNUMBERMASK) < (indentNext & SC_FOLDLEVELNUMBERMASK))
|
||||||
@@ -443,8 +395,9 @@ static void FoldPyDoc(unsigned int startPos, int length, int /*initStyle - unuse
|
|||||||
lineCurrent = lineNext;
|
lineCurrent = lineNext;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Make sure last line indent level is set too
|
// NOTE: Cannot set level of last line here because indentCurrent doesn't have
|
||||||
styler.SetLevel(lineCurrent, indentCurrent);
|
// header flag set; the loop above is crafted to take care of this case!
|
||||||
|
//styler.SetLevel(lineCurrent, indentCurrent);
|
||||||
}
|
}
|
||||||
|
|
||||||
LexerModule lmPython(SCLEX_PYTHON, ColourisePyDoc, "python", FoldPyDoc);
|
LexerModule lmPython(SCLEX_PYTHON, ColourisePyDoc, "python", FoldPyDoc);
|
||||||
|
@@ -40,7 +40,7 @@ static void DrawMinus(Surface *surface, int centreX, int centreY, int armSize, C
|
|||||||
surface->FillRectangle(rcH, fore);
|
surface->FillRectangle(rcH, fore);
|
||||||
}
|
}
|
||||||
|
|
||||||
void LineMarker::Draw(Surface *surface, PRectangle &rcWhole) {
|
void LineMarker::Draw(Surface *surface, PRectangle &rcWhole, Font &fontForCharacter) {
|
||||||
// Restrict most shapes a bit
|
// Restrict most shapes a bit
|
||||||
PRectangle rc = rcWhole;
|
PRectangle rc = rcWhole;
|
||||||
rc.top++;
|
rc.top++;
|
||||||
@@ -230,6 +230,15 @@ void LineMarker::Draw(Surface *surface, PRectangle &rcWhole) {
|
|||||||
surface->MoveTo(centreX, rcWhole.top);
|
surface->MoveTo(centreX, rcWhole.top);
|
||||||
surface->LineTo(centreX, centreY - blobSize);
|
surface->LineTo(centreX, centreY - blobSize);
|
||||||
|
|
||||||
|
} else if (markType >= SC_MARK_CHARACTER) {
|
||||||
|
char character[1];
|
||||||
|
character[0] = static_cast<char>(markType - SC_MARK_CHARACTER);
|
||||||
|
int width = surface->WidthText(fontForCharacter, character, 1);
|
||||||
|
rc.left += (rc.Width() - width) / 2;
|
||||||
|
rc.right = rc.left + width;
|
||||||
|
surface->DrawTextClipped(rc, fontForCharacter, rc.bottom - 2,
|
||||||
|
character, 1, fore.allocated, back.allocated);
|
||||||
|
|
||||||
} else { // SC_MARK_SHORTARROW
|
} else { // SC_MARK_SHORTARROW
|
||||||
Point pts[] = {
|
Point pts[] = {
|
||||||
Point(centreX, centreY + dimOn2),
|
Point(centreX, centreY + dimOn2),
|
||||||
|
@@ -20,7 +20,7 @@ public:
|
|||||||
fore = Colour(0,0,0);
|
fore = Colour(0,0,0);
|
||||||
back = Colour(0xff,0xff,0xff);
|
back = Colour(0xff,0xff,0xff);
|
||||||
}
|
}
|
||||||
void Draw(Surface *surface, PRectangle &rc);
|
void Draw(Surface *surface, PRectangle &rc, Font &fontForCharacter);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@@ -30,9 +30,8 @@
|
|||||||
* Modification history:
|
* Modification history:
|
||||||
*
|
*
|
||||||
* $Log$
|
* $Log$
|
||||||
* Revision 1.1 2001/09/01 03:05:24 RD
|
* Revision 1.2 2001/10/18 01:24:58 RD
|
||||||
* Upgraded to version 1.39 of Scintilla, and upated wxStyledTextCtrl
|
* Updated to version 1.40 of Scintilla
|
||||||
* accordingly.
|
|
||||||
*
|
*
|
||||||
* Revision 1.6 2001/04/29 13:32:10 nyamatongwe
|
* Revision 1.6 2001/04/29 13:32:10 nyamatongwe
|
||||||
* Addition of new target methods - versions of ReplaceTarget that take counted
|
* Addition of new target methods - versions of ReplaceTarget that take counted
|
||||||
|
@@ -35,6 +35,7 @@
|
|||||||
#include "ScintillaBase.h"
|
#include "ScintillaBase.h"
|
||||||
|
|
||||||
ScintillaBase::ScintillaBase() {
|
ScintillaBase::ScintillaBase() {
|
||||||
|
displayPopupMenu = true;
|
||||||
listType = 0;
|
listType = 0;
|
||||||
#ifdef SCI_LEXER
|
#ifdef SCI_LEXER
|
||||||
lexLanguage = SCLEX_CONTAINER;
|
lexLanguage = SCLEX_CONTAINER;
|
||||||
@@ -514,6 +515,10 @@ sptr_t ScintillaBase::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lPara
|
|||||||
InvalidateStyleRedraw();
|
InvalidateStyleRedraw();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case SCI_USEPOPUP:
|
||||||
|
displayPopupMenu = wParam;
|
||||||
|
break;
|
||||||
|
|
||||||
#ifdef SCI_LEXER
|
#ifdef SCI_LEXER
|
||||||
case SCI_SETLEXER:
|
case SCI_SETLEXER:
|
||||||
SetLexer(wParam);
|
SetLexer(wParam);
|
||||||
|
@@ -30,6 +30,7 @@ protected:
|
|||||||
idcmdSelectAll=16
|
idcmdSelectAll=16
|
||||||
};
|
};
|
||||||
|
|
||||||
|
bool displayPopupMenu;
|
||||||
Menu popup;
|
Menu popup;
|
||||||
AutoComplete ac;
|
AutoComplete ac;
|
||||||
|
|
||||||
@@ -42,7 +43,7 @@ protected:
|
|||||||
int lexLanguage;
|
int lexLanguage;
|
||||||
LexerModule *lexCurrent;
|
LexerModule *lexCurrent;
|
||||||
PropSet props;
|
PropSet props;
|
||||||
enum {numWordLists=5};
|
enum {numWordLists=6};
|
||||||
WordList *keyWordLists[numWordLists+1];
|
WordList *keyWordLists[numWordLists+1];
|
||||||
void SetLexer(uptr_t wParam);
|
void SetLexer(uptr_t wParam);
|
||||||
void SetLexerLanguage(const char *languageName);
|
void SetLexerLanguage(const char *languageName);
|
||||||
|
51
src/stc/scintilla/src/StyleContext.cxx
Normal file
51
src/stc/scintilla/src/StyleContext.cxx
Normal file
@@ -0,0 +1,51 @@
|
|||||||
|
// Scintilla source code edit control
|
||||||
|
/** @file StyleContext.cxx
|
||||||
|
** Lexer infrastructure.
|
||||||
|
**/
|
||||||
|
// Copyright 1998-2001 by Neil Hodgson <neilh@scintilla.org>
|
||||||
|
// This file is in the public domain.
|
||||||
|
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <ctype.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
#include "Platform.h"
|
||||||
|
|
||||||
|
#include "PropSet.h"
|
||||||
|
#include "Accessor.h"
|
||||||
|
#include "StyleContext.h"
|
||||||
|
|
||||||
|
static void getRange(unsigned int start,
|
||||||
|
unsigned int end,
|
||||||
|
Accessor &styler,
|
||||||
|
char *s,
|
||||||
|
unsigned int len) {
|
||||||
|
unsigned int i = 0;
|
||||||
|
while ((i < end - start + 1) && (i < len-1)) {
|
||||||
|
s[i] = styler[start + i];
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
s[i] = '\0';
|
||||||
|
}
|
||||||
|
|
||||||
|
void StyleContext::GetCurrent(char *s, int len) {
|
||||||
|
getRange(styler.GetStartSegment(), currentPos - 1, styler, s, len);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void getRangeLowered(unsigned int start,
|
||||||
|
unsigned int end,
|
||||||
|
Accessor &styler,
|
||||||
|
char *s,
|
||||||
|
unsigned int len) {
|
||||||
|
unsigned int i = 0;
|
||||||
|
while ((i < end - start + 1) && (i < len-1)) {
|
||||||
|
s[i] = static_cast<char>(tolower(styler[start + i]));
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
s[i] = '\0';
|
||||||
|
}
|
||||||
|
|
||||||
|
void StyleContext::GetCurrentLowered(char *s, int len) {
|
||||||
|
getRangeLowered(styler.GetStartSegment(), currentPos - 1, styler, s, len);
|
||||||
|
}
|
127
src/stc/scintilla/src/StyleContext.h
Normal file
127
src/stc/scintilla/src/StyleContext.h
Normal file
@@ -0,0 +1,127 @@
|
|||||||
|
// Scintilla source code edit control
|
||||||
|
/** @file StyleContext.cxx
|
||||||
|
** Lexer infrastructure.
|
||||||
|
**/
|
||||||
|
// Copyright 1998-2001 by Neil Hodgson <neilh@scintilla.org>
|
||||||
|
// This file is in the public domain.
|
||||||
|
|
||||||
|
// All languages handled so far can treat all characters >= 0x80 as one class
|
||||||
|
// which just continues the current token or starts an identifier if in default.
|
||||||
|
// DBCS treated specially as the second character can be < 0x80 and hence
|
||||||
|
// syntactically significant. UTF-8 avoids this as all trail bytes are >= 0x80
|
||||||
|
class StyleContext {
|
||||||
|
Accessor &styler;
|
||||||
|
int endPos;
|
||||||
|
StyleContext& operator=(const StyleContext&) {
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
public:
|
||||||
|
int currentPos;
|
||||||
|
bool atLineStart;
|
||||||
|
bool atLineEnd;
|
||||||
|
int state;
|
||||||
|
int chPrev;
|
||||||
|
int ch;
|
||||||
|
int chNext;
|
||||||
|
|
||||||
|
StyleContext(unsigned int startPos, int length,
|
||||||
|
int initStyle, Accessor &styler_, char chMask=31) :
|
||||||
|
styler(styler_),
|
||||||
|
endPos(startPos + length),
|
||||||
|
currentPos(startPos),
|
||||||
|
atLineStart(true),
|
||||||
|
atLineEnd(false),
|
||||||
|
state(initStyle),
|
||||||
|
chPrev(0),
|
||||||
|
ch(0),
|
||||||
|
chNext(0) {
|
||||||
|
styler.StartAt(startPos, chMask);
|
||||||
|
styler.StartSegment(startPos);
|
||||||
|
int pos = currentPos;
|
||||||
|
ch = static_cast<unsigned char>(styler.SafeGetCharAt(pos));
|
||||||
|
if (styler.IsLeadByte(static_cast<char>(ch))) {
|
||||||
|
pos++;
|
||||||
|
ch = ch << 8;
|
||||||
|
ch |= static_cast<unsigned char>(styler.SafeGetCharAt(pos));
|
||||||
|
}
|
||||||
|
chNext = static_cast<unsigned char>(styler.SafeGetCharAt(pos+1));
|
||||||
|
if (styler.IsLeadByte(static_cast<char>(chNext))) {
|
||||||
|
chNext = chNext << 8;
|
||||||
|
chNext |= static_cast<unsigned char>(styler.SafeGetCharAt(pos+2));
|
||||||
|
}
|
||||||
|
atLineEnd = (ch == '\r' && chNext != '\n') || (ch == '\n') || (currentPos >= endPos);
|
||||||
|
}
|
||||||
|
void Complete() {
|
||||||
|
styler.ColourTo(currentPos - 1, state);
|
||||||
|
}
|
||||||
|
bool More() {
|
||||||
|
return currentPos <= endPos;
|
||||||
|
}
|
||||||
|
void Forward() {
|
||||||
|
atLineStart = atLineEnd;
|
||||||
|
// A lot of this is repeated from the constructor - TODO: merge code
|
||||||
|
chPrev = ch;
|
||||||
|
currentPos++;
|
||||||
|
if (ch >= 0x100)
|
||||||
|
currentPos++;
|
||||||
|
ch = chNext;
|
||||||
|
chNext = static_cast<unsigned char>(styler.SafeGetCharAt(currentPos+1));
|
||||||
|
if (styler.IsLeadByte(static_cast<char>(chNext))) {
|
||||||
|
chNext = chNext << 8;
|
||||||
|
chNext |= static_cast<unsigned char>(styler.SafeGetCharAt(currentPos + 2));
|
||||||
|
}
|
||||||
|
// Trigger on CR only (Mac style) or either on LF from CR+LF (Dos/Win) or on LF alone (Unix)
|
||||||
|
// Avoid triggering two times on Dos/Win
|
||||||
|
// End of line
|
||||||
|
atLineEnd = (ch == '\r' && chNext != '\n') || (ch == '\n') || (currentPos >= endPos);
|
||||||
|
}
|
||||||
|
void ChangeState(int state_) {
|
||||||
|
state = state_;
|
||||||
|
}
|
||||||
|
void SetState(int state_) {
|
||||||
|
styler.ColourTo(currentPos - 1, state);
|
||||||
|
state = state_;
|
||||||
|
}
|
||||||
|
void ForwardSetState(int state_) {
|
||||||
|
Forward();
|
||||||
|
styler.ColourTo(currentPos - 1, state);
|
||||||
|
state = state_;
|
||||||
|
}
|
||||||
|
int LengthCurrent() {
|
||||||
|
return currentPos - styler.GetStartSegment();
|
||||||
|
}
|
||||||
|
int GetRelative(int n) {
|
||||||
|
return styler.SafeGetCharAt(currentPos+n);
|
||||||
|
}
|
||||||
|
bool Match(char ch0) {
|
||||||
|
return ch == ch0;
|
||||||
|
}
|
||||||
|
bool Match(char ch0, char ch1) {
|
||||||
|
return (ch == ch0) && (chNext == ch1);
|
||||||
|
}
|
||||||
|
bool Match(const char *s) {
|
||||||
|
if (ch != *s)
|
||||||
|
return false;
|
||||||
|
s++;
|
||||||
|
if (chNext != *s)
|
||||||
|
return false;
|
||||||
|
s++;
|
||||||
|
for (int n=2; *s; n++) {
|
||||||
|
if (*s != styler.SafeGetCharAt(currentPos+n))
|
||||||
|
return false;
|
||||||
|
s++;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
// Non-inline
|
||||||
|
void GetCurrent(char *s, int len);
|
||||||
|
void GetCurrentLowered(char *s, int len);
|
||||||
|
};
|
||||||
|
|
||||||
|
inline bool IsASpace(unsigned int ch) {
|
||||||
|
return (ch == ' ') || ((ch >= 0x09) && (ch <= 0x0d));
|
||||||
|
}
|
||||||
|
|
||||||
|
inline bool IsADigit(unsigned int ch) {
|
||||||
|
return (ch >= '0') && (ch <= '9');
|
||||||
|
}
|
@@ -32,6 +32,7 @@ int wxForceScintillaLexers(void)
|
|||||||
extern LexerModule lmAVE;
|
extern LexerModule lmAVE;
|
||||||
extern LexerModule lmConf;
|
extern LexerModule lmConf;
|
||||||
extern LexerModule lmCPP;
|
extern LexerModule lmCPP;
|
||||||
|
extern LexerModule lmNncrontab;
|
||||||
extern LexerModule lmEiffel;
|
extern LexerModule lmEiffel;
|
||||||
extern LexerModule lmHTML;
|
extern LexerModule lmHTML;
|
||||||
extern LexerModule lmLISP;
|
extern LexerModule lmLISP;
|
||||||
@@ -48,6 +49,7 @@ int wxForceScintillaLexers(void)
|
|||||||
&& &lmAVE
|
&& &lmAVE
|
||||||
&& &lmConf
|
&& &lmConf
|
||||||
&& &lmCPP
|
&& &lmCPP
|
||||||
|
&& &lmNncrontab
|
||||||
&& &lmEiffel
|
&& &lmEiffel
|
||||||
&& &lmHTML
|
&& &lmHTML
|
||||||
&& &lmLISP
|
&& &lmLISP
|
||||||
@@ -1202,6 +1204,7 @@ int wxStyledTextCtrl::GetTargetEnd() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Replace the target text with the argument text.
|
// Replace the target text with the argument text.
|
||||||
|
// Text is counted so it can contain nulls.
|
||||||
// Returns the length of the replacement text.
|
// Returns the length of the replacement text.
|
||||||
|
|
||||||
int wxStyledTextCtrl::ReplaceTarget(const wxString& text) {
|
int wxStyledTextCtrl::ReplaceTarget(const wxString& text) {
|
||||||
@@ -1210,6 +1213,7 @@ int wxStyledTextCtrl::GetTargetEnd() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Replace the target text with the argument text after \d processing.
|
// Replace the target text with the argument text after \d processing.
|
||||||
|
// Text is counted so it can contain nulls.
|
||||||
// Looks for \d where d is between 1 and 9 and replaces these with the strings
|
// Looks for \d where d is between 1 and 9 and replaces these with the strings
|
||||||
// matched in the last search operation which were surrounded by \( and \).
|
// matched in the last search operation which were surrounded by \( and \).
|
||||||
// Returns the length of the replacement text including any change
|
// Returns the length of the replacement text including any change
|
||||||
@@ -1221,7 +1225,7 @@ int wxStyledTextCtrl::GetTargetEnd() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Search for a counted string in the target and set the target to the found
|
// Search for a counted string in the target and set the target to the found
|
||||||
// range.
|
// range. Text is counted so it can contain nulls.
|
||||||
// Returns length of range or -1 for failure in which case target is not moved.
|
// Returns length of range or -1 for failure in which case target is not moved.
|
||||||
|
|
||||||
int wxStyledTextCtrl::SearchInTarget(const wxString& text) {
|
int wxStyledTextCtrl::SearchInTarget(const wxString& text) {
|
||||||
|
@@ -32,6 +32,7 @@ int wxForceScintillaLexers(void)
|
|||||||
extern LexerModule lmAVE;
|
extern LexerModule lmAVE;
|
||||||
extern LexerModule lmConf;
|
extern LexerModule lmConf;
|
||||||
extern LexerModule lmCPP;
|
extern LexerModule lmCPP;
|
||||||
|
extern LexerModule lmNncrontab;
|
||||||
extern LexerModule lmEiffel;
|
extern LexerModule lmEiffel;
|
||||||
extern LexerModule lmHTML;
|
extern LexerModule lmHTML;
|
||||||
extern LexerModule lmLISP;
|
extern LexerModule lmLISP;
|
||||||
@@ -48,6 +49,7 @@ int wxForceScintillaLexers(void)
|
|||||||
&& &lmAVE
|
&& &lmAVE
|
||||||
&& &lmConf
|
&& &lmConf
|
||||||
&& &lmCPP
|
&& &lmCPP
|
||||||
|
&& &lmNncrontab
|
||||||
&& &lmEiffel
|
&& &lmEiffel
|
||||||
&& &lmHTML
|
&& &lmHTML
|
||||||
&& &lmLISP
|
&& &lmLISP
|
||||||
|
Reference in New Issue
Block a user