Skip to content

Commit

Permalink
Merge branch 'scintilla-update'
Browse files Browse the repository at this point in the history
  • Loading branch information
b4n committed Jul 30, 2012
2 parents 5110fab + 4cdcaa2 commit cb54ccf
Show file tree
Hide file tree
Showing 26 changed files with 310 additions and 135 deletions.
2 changes: 1 addition & 1 deletion NEWS
@@ -1,7 +1,7 @@
Geany 1.23 (unreleased)

Editor
* Update Scintilla to version 3.2.0.
* Update Scintilla to version 3.2.1 (#3540469).


Geany 1.22 (June 18, 2012)
Expand Down
1 change: 1 addition & 0 deletions data/filetypes.c
Expand Up @@ -5,6 +5,7 @@ default=default
comment=comment
commentline=comment_line
commentdoc=comment_doc
preprocessorcomment=comment
number=number_1
word=keyword_1
word2=keyword_2
Expand Down
8 changes: 4 additions & 4 deletions scintilla/include/Platform.h
Expand Up @@ -31,14 +31,14 @@
#undef PLAT_WX
#define PLAT_WX 1

#elif defined(GTK)
#undef PLAT_GTK
#define PLAT_GTK 1

#elif defined(SCINTILLA_QT)
#undef PLAT_QT
#define PLAT_QT 1

#elif defined(GTK)
#undef PLAT_GTK
#define PLAT_GTK 1

#if defined(__WIN32__) || defined(_MSC_VER)
#undef PLAT_GTK_WIN32
#define PLAT_GTK_WIN32 1
Expand Down
1 change: 1 addition & 0 deletions scintilla/include/SciLexer.h
Expand Up @@ -160,6 +160,7 @@
#define SCE_C_STRINGRAW 20
#define SCE_C_TRIPLEVERBATIM 21
#define SCE_C_HASHQUOTEDSTRING 22
#define SCE_C_PREPROCESSORCOMMENT 23
#define SCE_D_DEFAULT 0
#define SCE_D_COMMENT 1
#define SCE_D_COMMENTLINE 2
Expand Down
4 changes: 4 additions & 0 deletions scintilla/include/Scintilla.h
Expand Up @@ -246,6 +246,7 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,
#define SCI_GETCARETPERIOD 2075
#define SCI_SETCARETPERIOD 2076
#define SCI_SETWORDCHARS 2077
#define SCI_GETWORDCHARS 2646
#define SCI_BEGINUNDOACTION 2078
#define SCI_ENDUNDOACTION 2079
#define INDIC_PLAIN 0
Expand Down Expand Up @@ -684,6 +685,9 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,
#define SCI_WORDRIGHTEND 2441
#define SCI_WORDRIGHTENDEXTEND 2442
#define SCI_SETWHITESPACECHARS 2443
#define SCI_GETWHITESPACECHARS 2647
#define SCI_SETPUNCTUATIONCHARS 2648
#define SCI_GETPUNCTUATIONCHARS 2649
#define SCI_SETCHARSDEFAULT 2444
#define SCI_AUTOCGETCURRENT 2445
#define SCI_AUTOCGETCURRENTTEXT 2610
Expand Down
63 changes: 39 additions & 24 deletions scintilla/include/Scintilla.iface
Expand Up @@ -287,13 +287,13 @@ val SC_MASK_FOLDERS=0xFE000000
fun void MarkerDefine=2040(int markerNumber, int markerSymbol)

# Set the foreground colour used for a particular marker number.
fun void MarkerSetFore=2041(int markerNumber, colour fore)
set void MarkerSetFore=2041(int markerNumber, colour fore)

# Set the background colour used for a particular marker number.
fun void MarkerSetBack=2042(int markerNumber, colour back)
set void MarkerSetBack=2042(int markerNumber, colour back)

# Set the background colour used for a particular marker number when its folding block is selected.
fun void MarkerSetBackSelected=2292(int markerNumber, colour back)
set void MarkerSetBackSelected=2292(int markerNumber, colour back)

# Enable/disable highlight for current folding bloc (smallest one that contains the caret)
fun void MarkerEnableHighlight=2293(bool enabled,)
Expand Down Expand Up @@ -324,7 +324,7 @@ fun void MarkerDefinePixmap=2049(int markerNumber, string pixmap)
fun void MarkerAddSet=2466(int line, int set)

# Set the alpha used for a marker that is drawn in the text area, not the margin.
fun void MarkerSetAlpha=2476(int markerNumber, int alpha)
set void MarkerSetAlpha=2476(int markerNumber, int alpha)

enu MarginType=SC_MARGIN_
val SC_MARGIN_SYMBOL=0
Expand Down Expand Up @@ -403,7 +403,7 @@ val SC_CHARSET_THAI=222
val SC_CHARSET_8859_15=1000

# Clear all the styles and make equivalent to the global default style.
set void StyleClearAll=2050(,)
fun void StyleClearAll=2050(,)

# Set the foreground colour of a style.
set void StyleSetFore=2051(int style, colour fore)
Expand Down Expand Up @@ -454,7 +454,7 @@ get int StyleGetSize=2485(int style,)

# Get the font of a style.
# Returns the length of the fontName
fun int StyleGetFont=2486(int style, stringresult fontName)
get int StyleGetFont=2486(int style, stringresult fontName)

# Get is a style to have its end of line filled or not.
get bool StyleGetEOLFilled=2487(int style,)
Expand Down Expand Up @@ -552,6 +552,10 @@ set void SetCaretPeriod=2076(int periodMilliseconds,)
# First sets defaults like SetCharsDefault.
set void SetWordChars=2077(, string characters)

# Get the set of characters making up words for when moving or selecting by word.
# Retuns the number of characters
get int GetWordChars=2646(, stringresult characters)

# Start a sequence of actions that is undone and redone as a unit.
# May be nested.
fun void BeginUndoAction=2078(,)
Expand Down Expand Up @@ -1108,7 +1112,7 @@ val SC_FOLDFLAG_LINEAFTER_CONTRACTED=0x0010
val SC_FOLDFLAG_LEVELNUMBERS=0x0040

# Set some style options for folding.
fun void SetFoldFlags=2233(int flags,)
set void SetFoldFlags=2233(int flags,)

# Ensure a particular line is visible by expanding any header line hiding it.
# Use the currently set visibility policy to determine which range to display.
Expand Down Expand Up @@ -1277,7 +1281,7 @@ set void SetMultiPaste=2614(int multiPaste,)
get int GetMultiPaste=2615(,)

# Retrieve the value of a tag from a regular expression search.
fun int GetTag=2616(int tagNumber, stringresult tagValue)
get int GetTag=2616(int tagNumber, stringresult tagValue)

# Make the target range start and end be the same as the selection range start and end.
fun void TargetFromSelection=2287(,)
Expand Down Expand Up @@ -1629,7 +1633,7 @@ fun void DelLineLeft=2395(,)
# Delete forwards from the current position to the end of the line.
fun void DelLineRight=2396(,)

# Get and Set the xOffset (ie, horizonal scroll position).
# Get and Set the xOffset (ie, horizontal scroll position).
set void SetXOffset=2397(int newOffset,)
get int GetXOffset=2398(,)

Expand Down Expand Up @@ -1663,7 +1667,7 @@ val CARET_JUMPS=0x10
# where most code reside, and the lines after the caret, eg. the body of a function.
val CARET_EVEN=0x08

# Set the way the caret is kept visible when going sideway.
# Set the way the caret is kept visible when going sideways.
# The exclusion zone is given in pixels.
fun void SetXCaretPolicy=2402(int caretPolicy, int caretSlop)

Expand Down Expand Up @@ -1800,15 +1804,25 @@ fun void WordRightEndExtend=2442(,)
# Should be called after SetWordChars.
set void SetWhitespaceChars=2443(, string characters)

# Get the set of characters making up whitespace for when moving or selecting by word.
get int GetWhitespaceChars=2647(, stringresult characters)

# Set the set of characters making up punctuation characters
# Should be called after SetWordChars.
set void SetPunctuationChars=2648(, string characters)

# Get the set of characters making up punctuation characters
get int GetPunctuationChars=2649(, stringresult characters)

# Reset the set of characters for whitespace and word characters to the defaults.
fun void SetCharsDefault=2444(,)

# Get currently selected item position in the auto-completion list
fun int AutoCGetCurrent=2445(,)
get int AutoCGetCurrent=2445(,)

# Get currently selected item text in the auto-completion list
# Returns the length of the item text
fun int AutoCGetCurrentText=2610(, stringresult s)
get int AutoCGetCurrentText=2610(, stringresult s)

enu CaseInsensitiveBehaviour=SC_CASEINSENSITIVEBEHAVIOUR_
val SC_CASEINSENSITIVEBEHAVIOUR_RESPECTCASE=0
Expand Down Expand Up @@ -1893,7 +1907,7 @@ get int GetIndicatorCurrent=2501(,)
# Set the value used for IndicatorFillRange
set void SetIndicatorValue=2502(int value,)

# Get the current indicator vaue
# Get the current indicator value
get int GetIndicatorValue=2503(,)

# Turn a indicator on over a range.
Expand Down Expand Up @@ -2090,10 +2104,10 @@ get int GetSelections=2570(,)
fun void ClearSelections=2571(,)

# Set a simple selection
fun int SetSelection=2572(int caret,int anchor)
fun int SetSelection=2572(int caret, int anchor)

# Add a selection
fun int AddSelection=2573(int caret,int anchor)
fun int AddSelection=2573(int caret, int anchor)

# Set the main selection
set void SetMainSelection=2574(int selection,)
Expand All @@ -2117,7 +2131,7 @@ set void SetSelectionNStart=2584(int selection, position pos)
get position GetSelectionNStart=2585(int selection,)

# Sets the position that ends the selection - this becomes the currentPosition.
set void SetSelectionNEnd=2586(int selection, position pos,)
set void SetSelectionNEnd=2586(int selection, position pos)

# Returns the position at the end of the selection.
get position GetSelectionNEnd=2587(int selection,)
Expand Down Expand Up @@ -2221,7 +2235,7 @@ fun void ScrollToEnd=2629(,)
val SC_TECHNOLOGY_DEFAULT=0
val SC_TECHNOLOGY_DIRECTWRITE=1

# Set the technolgy used.
# Set the technology used.
set void SetTechnology=2630(int technology,)

# Get the tech.
Expand Down Expand Up @@ -2270,11 +2284,11 @@ set void SetLexerLanguage=4006(, string language)
fun void LoadLexerLibrary=4007(, string path)

# Retrieve a "property" value previously set with SetProperty.
fun int GetProperty=4008(string key, stringresult buf)
get int GetProperty=4008(string key, stringresult buf)

# Retrieve a "property" value previously set with SetProperty,
# with "$()" variable replacement on returned buffer.
fun int GetPropertyExpanded=4009(string key, stringresult buf)
get int GetPropertyExpanded=4009(string key, stringresult buf)

# Retrieve a "property" value previously set with SetProperty,
# interpreted as an int AFTER any "$()" variable replacement.
Expand Down Expand Up @@ -2311,7 +2325,7 @@ fun int DescribeKeyWordSets=4017(, stringresult descriptions)
# Type of modification and the action which caused the modification.
# These are defined as a bit mask to make it easy to specify which notifications are wanted.
# One bit is set from each of SC_MOD_* and SC_PERFORMED_*.
enu ModificationFlags=SC_MOD_ SC_PERFORMED_ SC_LAST
enu ModificationFlags=SC_MOD_ SC_PERFORMED_ SC_MULTISTEPUNDOREDO SC_LASTSTEPINUNDOREDO SC_MULTILINEUNDOREDO SC_STARTACTION SC_MODEVENTMASKALL
val SC_MOD_INSERTTEXT=0x1
val SC_MOD_DELETETEXT=0x2
val SC_MOD_CHANGESTYLE=0x4
Expand Down Expand Up @@ -2540,6 +2554,7 @@ val SCE_C_GLOBALCLASS=19
val SCE_C_STRINGRAW=20
val SCE_C_TRIPLEVERBATIM=21
val SCE_C_HASHQUOTEDSTRING=22
val SCE_C_PREPROCESSORCOMMENT=23
# Lexical states for SCLEX_D
lex D=SCLEX_D SCE_D_
val SCE_D_DEFAULT=0
Expand Down Expand Up @@ -2590,10 +2605,10 @@ val SCE_TCL_WORD8=19
val SCE_TCL_COMMENT_BOX=20
val SCE_TCL_BLOCK_COMMENT=21
# Lexical states for SCLEX_HTML, SCLEX_XML
lex HTML=SCLEX_HTML SCE_H
lex XML=SCLEX_XML SCE_H
lex ASP=SCLEX_ASP SCE_H
lex PHP=SCLEX_PHP SCE_H
lex HTML=SCLEX_HTML SCE_H_ SCE_HJ_ SCE_HJA_ SCE_HB_ SCE_HBA_ SCE_HP_ SCE_HPHP_ SCE_HPA_
lex XML=SCLEX_XML SCE_H_ SCE_HJ_ SCE_HJA_ SCE_HB_ SCE_HBA_ SCE_HP_ SCE_HPHP_ SCE_HPA_
lex ASP=SCLEX_ASP SCE_H_ SCE_HJ_ SCE_HJA_ SCE_HB_ SCE_HBA_ SCE_HP_ SCE_HPHP_ SCE_HPA_
lex PHP=SCLEX_PHP SCE_H_ SCE_HJ_ SCE_HJA_ SCE_HB_ SCE_HBA_ SCE_HP_ SCE_HPHP_ SCE_HPA_
val SCE_H_DEFAULT=0
val SCE_H_TAG=1
val SCE_H_TAGUNKNOWN=2
Expand Down
32 changes: 25 additions & 7 deletions scintilla/lexers/LexCPP.cxx
Expand Up @@ -379,6 +379,12 @@ class LexerCPP : public ILexer {

int SCI_METHOD LexerCPP::PropertySet(const char *key, const char *val) {
if (osCPP.PropertySet(&options, key, val)) {
if (strcmp(key, "lexer.cpp.allow.dollars") == 0) {
setWord = CharacterSet(CharacterSet::setAlphaNum, "._", 0x80, true);
if (options.identifiersAllowDollars) {
setWord.Add('$');
}
}
return 0;
}
return -1;
Expand Down Expand Up @@ -453,7 +459,6 @@ void SCI_METHOD LexerCPP::Lex(unsigned int startPos, int length, int initStyle,

if (options.identifiersAllowDollars) {
setWordStart.Add('$');
setWord.Add('$');
}

int chPrevNonWhite = ' ';
Expand Down Expand Up @@ -517,7 +522,7 @@ void SCI_METHOD LexerCPP::Lex(unsigned int startPos, int length, int initStyle,

int activitySet = preproc.IsInactive() ? activeFlag : 0;

for (; sc.More(); sc.Forward()) {
for (; sc.More();) {

if (sc.atLineStart) {
// Using MaskActive() is not needed in the following statement.
Expand All @@ -527,6 +532,9 @@ void SCI_METHOD LexerCPP::Lex(unsigned int startPos, int length, int initStyle,
// ends with a line continuation by locking in the state upto this position.
sc.SetState(sc.state);
}
if ((MaskActive(sc.state) == SCE_C_PREPROCESSOR) && (!continuationLine)) {
sc.SetState(SCE_C_DEFAULT|activitySet);
}
// Reset states to begining of colourise so no surprises
// if different sets of lines lexed.
visibleChars = 0;
Expand Down Expand Up @@ -556,6 +564,7 @@ void SCI_METHOD LexerCPP::Lex(unsigned int startPos, int length, int initStyle,
sc.Forward();
}
continuationLine = true;
sc.Forward();
continue;
}
}
Expand Down Expand Up @@ -610,18 +619,26 @@ void SCI_METHOD LexerCPP::Lex(unsigned int startPos, int length, int initStyle,
}
break;
case SCE_C_PREPROCESSOR:
if (sc.atLineStart && !continuationLine) {
sc.SetState(SCE_C_DEFAULT|activitySet);
} else if (options.stylingWithinPreprocessor) {
if (options.stylingWithinPreprocessor) {
if (IsASpace(sc.ch)) {
sc.SetState(SCE_C_DEFAULT|activitySet);
}
} else {
if (sc.Match('/', '*') || sc.Match('/', '/')) {
if (sc.Match('/', '*')) {
sc.SetState(SCE_C_PREPROCESSORCOMMENT|activitySet);
sc.Forward(); // Eat the *
} else if (sc.Match('/', '/')) {
sc.SetState(SCE_C_DEFAULT|activitySet);
}
}
break;
case SCE_C_PREPROCESSORCOMMENT:
if (sc.Match('*', '/')) {
sc.Forward();
sc.ForwardSetState(SCE_C_PREPROCESSOR|activitySet);
continue; // Without advancing in case of '\'.
}
break;
case SCE_C_COMMENT:
if (sc.Match('*', '/')) {
sc.Forward();
Expand Down Expand Up @@ -918,11 +935,12 @@ void SCI_METHOD LexerCPP::Lex(unsigned int startPos, int length, int initStyle,
}
}

if (!IsASpace(sc.ch) && !IsSpaceEquiv(sc.state)) {
if (!IsASpace(sc.ch) && !IsSpaceEquiv(MaskActive(sc.state))) {
chPrevNonWhite = sc.ch;
visibleChars++;
}
continuationLine = false;
sc.Forward();
}
const bool rawStringsChanged = rawStringTerminators.Merge(rawSTNew, lineCurrent);
if (definitionsChanged || rawStringsChanged)
Expand Down

0 comments on commit cb54ccf

Please sign in to comment.