Merge branch 'scintilla-update'
This commit is contained in:
commit
cb54ccf8e1
2
NEWS
2
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)
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
@ -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
|
||||
|
@ -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,)
|
||||
@ -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
|
||||
@ -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)
|
||||
@ -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,)
|
||||
@ -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(,)
|
||||
@ -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.
|
||||
@ -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(,)
|
||||
@ -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(,)
|
||||
|
||||
@ -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)
|
||||
|
||||
@ -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
|
||||
@ -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.
|
||||
@ -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,)
|
||||
@ -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,)
|
||||
@ -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.
|
||||
@ -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.
|
||||
@ -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
|
||||
@ -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
|
||||
@ -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
|
||||
|
@ -379,6 +379,12 @@ public:
|
||||
|
||||
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;
|
||||
@ -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 = ' ';
|
||||
@ -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.
|
||||
@ -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;
|
||||
@ -556,6 +564,7 @@ void SCI_METHOD LexerCPP::Lex(unsigned int startPos, int length, int initStyle,
|
||||
sc.Forward();
|
||||
}
|
||||
continuationLine = true;
|
||||
sc.Forward();
|
||||
continue;
|
||||
}
|
||||
}
|
||||
@ -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();
|
||||
@ -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)
|
||||
|
@ -98,18 +98,29 @@ static void ColouriseCssDoc(unsigned int startPos, int length, int initStyle, Wo
|
||||
// Set to 1 for Sassy CSS (.scss)
|
||||
bool isScssDocument = styler.GetPropertyInt("lexer.css.scss.language") != 0;
|
||||
|
||||
// TODO: implement Less support
|
||||
bool isLessDocument = false;
|
||||
// property lexer.css.less.language
|
||||
// Set to 1 for Less CSS (.less)
|
||||
bool isLessDocument = styler.GetPropertyInt("lexer.css.less.language") != 0;
|
||||
|
||||
// SCSS and Less both support single-line comments
|
||||
// property lexer.css.hss.language
|
||||
// Set to 1 for HSS (.hss)
|
||||
bool isHssDocument = styler.GetPropertyInt("lexer.css.hss.language") != 0;
|
||||
|
||||
// SCSS/LESS/HSS have the concept of variable
|
||||
bool hasVariables = isScssDocument || isLessDocument || isHssDocument;
|
||||
char varPrefix = 0;
|
||||
if (hasVariables)
|
||||
varPrefix = isLessDocument ? '@' : '$';
|
||||
|
||||
// SCSS/LESS/HSS support single-line comments
|
||||
typedef enum _CommentModes { eCommentBlock = 0, eCommentLine = 1} CommentMode;
|
||||
CommentMode comment_mode = eCommentBlock;
|
||||
bool hasSingleLineComments = isScssDocument || isLessDocument;
|
||||
bool hasSingleLineComments = isScssDocument || isLessDocument || isHssDocument;
|
||||
|
||||
// must keep track of nesting level in document types that support it (SCSS, Less)
|
||||
// must keep track of nesting level in document types that support it (SCSS/LESS/HSS)
|
||||
bool hasNesting = false;
|
||||
int nestingLevel = 0;
|
||||
if (isScssDocument || isLessDocument) {
|
||||
if (isScssDocument || isLessDocument || isHssDocument) {
|
||||
hasNesting = true;
|
||||
nestingLevel = NestingLevelLookBehind(startPos, styler);
|
||||
}
|
||||
@ -329,11 +340,13 @@ static void ColouriseCssDoc(unsigned int startPos, int length, int initStyle, Wo
|
||||
insideParentheses = false;
|
||||
|
||||
// SCSS special modes
|
||||
if (isScssDocument) {
|
||||
if (hasVariables) {
|
||||
// variable name
|
||||
if (sc.ch == '$') {
|
||||
if (sc.ch == varPrefix) {
|
||||
switch (sc.state) {
|
||||
case SCE_CSS_DEFAULT:
|
||||
if (isLessDocument) // give priority to pseudo elements
|
||||
break;
|
||||
case SCE_CSS_VALUE:
|
||||
lastStateVar = sc.state;
|
||||
sc.SetState(SCE_CSS_VARIABLE);
|
||||
|
@ -87,7 +87,7 @@ static void ColouriseFortranDoc(unsigned int startPos, int length, int initStyle
|
||||
/***********************************************/
|
||||
// Handle the fix format generically
|
||||
int toLineStart = sc.currentPos - posLineStart;
|
||||
if (isFixFormat && (toLineStart < 6 || toLineStart > 72)) {
|
||||
if (isFixFormat && (toLineStart < 6 || toLineStart >= 72)) {
|
||||
if ((toLineStart == 0 && (tolower(sc.ch) == 'c' || sc.ch == '*')) || sc.ch == '!') {
|
||||
if (sc.MatchIgnoreCase("cdec$") || sc.MatchIgnoreCase("*dec$") || sc.MatchIgnoreCase("!dec$") ||
|
||||
sc.MatchIgnoreCase("cdir$") || sc.MatchIgnoreCase("*dir$") || sc.MatchIgnoreCase("!dir$") ||
|
||||
@ -99,7 +99,7 @@ static void ColouriseFortranDoc(unsigned int startPos, int length, int initStyle
|
||||
}
|
||||
|
||||
while (!sc.atLineEnd && sc.More()) sc.Forward(); // Until line end
|
||||
} else if (toLineStart > 72) {
|
||||
} else if (toLineStart >= 72) {
|
||||
sc.SetState(SCE_F_COMMENT);
|
||||
while (!sc.atLineEnd && sc.More()) sc.Forward(); // Until line end
|
||||
} else if (toLineStart < 5) {
|
||||
@ -108,17 +108,27 @@ static void ColouriseFortranDoc(unsigned int startPos, int length, int initStyle
|
||||
else
|
||||
sc.SetState(SCE_F_DEFAULT);
|
||||
} else if (toLineStart == 5) {
|
||||
if (!IsASpace(sc.ch) && sc.ch != '0') {
|
||||
//if (!IsASpace(sc.ch) && sc.ch != '0') {
|
||||
if (sc.ch != '\r' && sc.ch != '\n') {
|
||||
sc.SetState(SCE_F_CONTINUATION);
|
||||
sc.ForwardSetState(prevState);
|
||||
if (!IsASpace(sc.ch) && sc.ch != '0')
|
||||
sc.ForwardSetState(prevState);
|
||||
} else
|
||||
sc.SetState(SCE_F_DEFAULT);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
/***************************************/
|
||||
// Hanndle preprocessor directives
|
||||
if (sc.ch == '#' && numNonBlank == 1)
|
||||
{
|
||||
sc.SetState(SCE_F_PREPROCESSOR);
|
||||
while (!sc.atLineEnd && sc.More())
|
||||
sc.Forward(); // Until line end
|
||||
}
|
||||
/***************************************/
|
||||
// Handle line continuation generically.
|
||||
if (!isFixFormat && sc.ch == '&') {
|
||||
if (!isFixFormat && sc.ch == '&' && sc.state != SCE_F_COMMENT) {
|
||||
char chTemp = ' ';
|
||||
int j = 1;
|
||||
while (IsABlank(chTemp) && j<132) {
|
||||
@ -252,7 +262,8 @@ static int classifyFoldPointFortran(const char* s, const char* prevWord, const c
|
||||
|| strcmp(s, "function") == 0 || strcmp(s, "interface") == 0
|
||||
|| strcmp(s, "module") == 0 || strcmp(s, "program") == 0
|
||||
|| strcmp(s, "subroutine") == 0 || strcmp(s, "then") == 0
|
||||
|| (strcmp(s, "type") == 0 && chNextNonBlank != '(') ){
|
||||
|| (strcmp(s, "type") == 0 && chNextNonBlank != '(')
|
||||
|| strcmp(s, "critical") == 0){
|
||||
if (strcmp(prevWord, "end") == 0)
|
||||
lev = 0;
|
||||
else
|
||||
@ -265,12 +276,14 @@ static int classifyFoldPointFortran(const char* s, const char* prevWord, const c
|
||||
|| strcmp(s, "endfunction") == 0 || strcmp(s, "endinterface") == 0
|
||||
|| strcmp(s, "endmodule") == 0 || strcmp(s, "endprogram") == 0
|
||||
|| strcmp(s, "endsubroutine") == 0 || strcmp(s, "endtype") == 0
|
||||
|| strcmp(s, "endwhere") == 0
|
||||
|| (strcmp(s, "procedure") == 0 && strcmp(prevWord,"module")==0) ) { // Take care of the module procedure statement
|
||||
|| strcmp(s, "endwhere") == 0 || strcmp(s, "endcritical") == 0
|
||||
|| (strcmp(s, "procedure") == 0 && strcmp(prevWord, "module") == 0) ) { // Take care of the "module procedure" statement
|
||||
lev = -1;
|
||||
} else if (strcmp(prevWord, "end") == 0 && strcmp(s, "if") == 0){ // end if
|
||||
lev = 0;
|
||||
}
|
||||
} else if (strcmp(prevWord, "type") == 0 && strcmp(s, "is") == 0){ // type is
|
||||
lev = -1;
|
||||
}
|
||||
return lev;
|
||||
}
|
||||
// Folding the code
|
||||
@ -312,7 +325,7 @@ static void FoldFortranDoc(unsigned int startPos, int length, int initStyle,
|
||||
styleNext = styler.StyleAt(i + 1);
|
||||
bool atEOL = (ch == '\r' && chNext != '\n') || (ch == '\n');
|
||||
//
|
||||
if (stylePrev == SCE_F_DEFAULT && (style == SCE_F_WORD || style == SCE_F_LABEL)) {
|
||||
if (((isFixFormat && stylePrev == SCE_F_CONTINUATION) || stylePrev == SCE_F_DEFAULT || stylePrev == SCE_F_OPERATOR) && (style == SCE_F_WORD || style == SCE_F_LABEL)) {
|
||||
// Store last word and label start point.
|
||||
lastStart = i;
|
||||
}
|
||||
|
@ -1089,7 +1089,7 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
|
||||
state = SCE_H_SGML_COMMAND; // wait for a pending command
|
||||
}
|
||||
// fold whole tag (-- when closing the tag)
|
||||
if (foldHTMLPreprocessor || (state == SCE_H_COMMENT))
|
||||
if (foldHTMLPreprocessor || state == SCE_H_COMMENT || state == SCE_H_CDATA)
|
||||
levelCurrent++;
|
||||
continue;
|
||||
}
|
||||
|
@ -40,11 +40,32 @@ public:
|
||||
if (base & setDigits)
|
||||
AddString("0123456789");
|
||||
}
|
||||
CharacterSet(const CharacterSet &other) {
|
||||
size = other.size;
|
||||
valueAfter = other.valueAfter;
|
||||
bset = new bool[size];
|
||||
for (int i=0; i < size; i++) {
|
||||
bset[i] = other.bset[i];
|
||||
}
|
||||
}
|
||||
~CharacterSet() {
|
||||
delete []bset;
|
||||
bset = 0;
|
||||
size = 0;
|
||||
}
|
||||
CharacterSet &operator=(const CharacterSet &other) {
|
||||
if (this != &other) {
|
||||
bool *bsetNew = new bool[other.size];
|
||||
for (int i=0; i < other.size; i++) {
|
||||
bsetNew[i] = other.bset[i];
|
||||
}
|
||||
delete []bset;
|
||||
size = other.size;
|
||||
valueAfter = other.valueAfter;
|
||||
bset = bsetNew;
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
void Add(int val) {
|
||||
assert(val >= 0);
|
||||
assert(val < size);
|
||||
@ -90,7 +111,15 @@ inline bool IsADigit(int ch, int base) {
|
||||
}
|
||||
|
||||
inline bool IsASCII(int ch) {
|
||||
return ch < 0x80;
|
||||
return (ch >= 0) && (ch < 0x80);
|
||||
}
|
||||
|
||||
inline bool IsLowerCase(int ch) {
|
||||
return (ch >= 'a') && (ch <= 'z');
|
||||
}
|
||||
|
||||
inline bool IsUpperCase(int ch) {
|
||||
return (ch >= 'A') && (ch <= 'Z');
|
||||
}
|
||||
|
||||
inline bool IsAlphaNumeric(int ch) {
|
||||
@ -109,15 +138,15 @@ inline bool isspacechar(int ch) {
|
||||
}
|
||||
|
||||
inline bool iswordchar(int ch) {
|
||||
return IsASCII(ch) && (IsAlphaNumeric(ch) || ch == '.' || ch == '_');
|
||||
return IsAlphaNumeric(ch) || ch == '.' || ch == '_';
|
||||
}
|
||||
|
||||
inline bool iswordstart(int ch) {
|
||||
return IsASCII(ch) && (IsAlphaNumeric(ch) || ch == '_');
|
||||
return IsAlphaNumeric(ch) || ch == '_';
|
||||
}
|
||||
|
||||
inline bool isoperator(int ch) {
|
||||
if (IsASCII(ch) && IsAlphaNumeric(ch))
|
||||
if (IsAlphaNumeric(ch))
|
||||
return false;
|
||||
if (ch == '%' || ch == '^' || ch == '&' || ch == '*' ||
|
||||
ch == '(' || ch == ')' || ch == '-' || ch == '+' ||
|
||||
|
@ -10,6 +10,8 @@
|
||||
#include <stdio.h>
|
||||
#include <assert.h>
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "Platform.h"
|
||||
|
||||
#include "CharacterSet.h"
|
||||
@ -101,6 +103,16 @@ void AutoComplete::SetList(const char *list) {
|
||||
lb->SetList(list, separator, typesep);
|
||||
}
|
||||
|
||||
int AutoComplete::GetSelection() const {
|
||||
return lb->GetSelection();
|
||||
}
|
||||
|
||||
std::string AutoComplete::GetValue(int item) const {
|
||||
char value[maxItemLen];
|
||||
lb->GetValue(item, value, sizeof(value));
|
||||
return std::string(value);
|
||||
}
|
||||
|
||||
void AutoComplete::Show(bool show) {
|
||||
lb->Show(show);
|
||||
if (show)
|
||||
@ -130,7 +142,6 @@ void AutoComplete::Move(int delta) {
|
||||
void AutoComplete::Select(const char *word) {
|
||||
size_t lenWord = strlen(word);
|
||||
int location = -1;
|
||||
const int maxItemLen=1000;
|
||||
int start = 0; // lower bound of the api array block to search
|
||||
int end = lb->Length() - 1; // upper bound of the api array block to search
|
||||
while ((start <= end) && (location == -1)) { // Binary searching loop
|
||||
|
@ -20,8 +20,10 @@ class AutoComplete {
|
||||
char fillUpChars[256];
|
||||
char separator;
|
||||
char typesep; // Type seperator
|
||||
enum { maxItemLen=1000 };
|
||||
|
||||
public:
|
||||
|
||||
bool ignoreCase;
|
||||
bool chooseSingle;
|
||||
ListBox *lb;
|
||||
@ -61,6 +63,12 @@ public:
|
||||
|
||||
/// The list string contains a sequence of words separated by the separator character
|
||||
void SetList(const char *list);
|
||||
|
||||
/// Return the position of the currently selected list item
|
||||
int GetSelection() const;
|
||||
|
||||
/// Return the value of an item in the list
|
||||
std::string GetValue(int item) const;
|
||||
|
||||
void Show(bool show);
|
||||
void Cancel();
|
||||
|
@ -46,3 +46,19 @@ void CharClassify::SetCharClasses(const unsigned char *chars, cc newCharClass) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int CharClassify::GetCharsOfClass(cc characterClass, unsigned char *buffer) {
|
||||
// Get characters belonging to the given char class; return the number
|
||||
// of characters (if the buffer is NULL, don't write to it).
|
||||
int count = 0;
|
||||
for (int ch = maxChar - 1; ch >= 0; --ch) {
|
||||
if (charClass[ch] == characterClass) {
|
||||
++count;
|
||||
if (buffer) {
|
||||
*buffer = static_cast<unsigned char>(ch);
|
||||
buffer++;
|
||||
}
|
||||
}
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
@ -19,6 +19,7 @@ public:
|
||||
enum cc { ccSpace, ccNewLine, ccWord, ccPunctuation };
|
||||
void SetDefaultCharClasses(bool includeWordClass);
|
||||
void SetCharClasses(const unsigned char *chars, cc newCharClass);
|
||||
int GetCharsOfClass(cc charClass, unsigned char *buffer);
|
||||
cc GetClass(unsigned char ch) const { return static_cast<cc>(charClass[ch]);}
|
||||
bool IsWord(unsigned char ch) const { return static_cast<cc>(charClass[ch]) == ccWord;}
|
||||
|
||||
|
@ -35,27 +35,10 @@
|
||||
using namespace Scintilla;
|
||||
#endif
|
||||
|
||||
// This is ASCII specific but is safe with chars >= 0x80
|
||||
static inline bool isspacechar(unsigned char ch) {
|
||||
return (ch == ' ') || ((ch >= 0x09) && (ch <= 0x0d));
|
||||
}
|
||||
|
||||
static inline bool IsPunctuation(char ch) {
|
||||
return isascii(ch) && ispunct(ch);
|
||||
}
|
||||
|
||||
static inline bool IsADigit(char ch) {
|
||||
return isascii(ch) && isdigit(ch);
|
||||
}
|
||||
|
||||
static inline bool IsLowerCase(char ch) {
|
||||
return isascii(ch) && islower(ch);
|
||||
}
|
||||
|
||||
static inline bool IsUpperCase(char ch) {
|
||||
return isascii(ch) && isupper(ch);
|
||||
}
|
||||
|
||||
void LexInterface::Colourise(int start, int end) {
|
||||
if (pdoc && instance && !performingStyle) {
|
||||
// Protect against reentrance, which may occur, for example, when
|
||||
@ -751,7 +734,7 @@ void Document::CheckReadOnly() {
|
||||
// SetStyleAt does not change the persistent state of a document
|
||||
|
||||
bool Document::DeleteChars(int pos, int len) {
|
||||
if (len == 0)
|
||||
if (len <= 0)
|
||||
return false;
|
||||
if ((pos + len) > Length())
|
||||
return false;
|
||||
@ -849,6 +832,10 @@ int Document::Undo() {
|
||||
bool multiLine = false;
|
||||
int steps = cb.StartUndo();
|
||||
//Platform::DebugPrintf("Steps=%d\n", steps);
|
||||
int coalescedRemovePos = -1;
|
||||
int coalescedRemoveLen = 0;
|
||||
int prevRemoveActionPos = -1;
|
||||
int prevRemoveActionLen = 0;
|
||||
for (int step = 0; step < steps; step++) {
|
||||
const int prevLinesTotal = LinesTotal();
|
||||
const Action &action = cb.GetUndoStep();
|
||||
@ -859,15 +846,20 @@ int Document::Undo() {
|
||||
DocModification dm(SC_MOD_CONTAINER | SC_PERFORMED_UNDO);
|
||||
dm.token = action.position;
|
||||
NotifyModified(dm);
|
||||
if (!action.mayCoalesce) {
|
||||
coalescedRemovePos = -1;
|
||||
coalescedRemoveLen = 0;
|
||||
prevRemoveActionPos = -1;
|
||||
prevRemoveActionLen = 0;
|
||||
}
|
||||
} else {
|
||||
NotifyModified(DocModification(
|
||||
SC_MOD_BEFOREDELETE | SC_PERFORMED_UNDO, action));
|
||||
}
|
||||
cb.PerformUndoStep();
|
||||
int cellPosition = action.position;
|
||||
if (action.at != containerAction) {
|
||||
ModifiedAt(cellPosition);
|
||||
newPos = cellPosition;
|
||||
ModifiedAt(action.position);
|
||||
newPos = action.position;
|
||||
}
|
||||
|
||||
int modFlags = SC_PERFORMED_UNDO;
|
||||
@ -875,8 +867,22 @@ int Document::Undo() {
|
||||
if (action.at == removeAction) {
|
||||
newPos += action.lenData;
|
||||
modFlags |= SC_MOD_INSERTTEXT;
|
||||
if ((coalescedRemoveLen > 0) &&
|
||||
(action.position == prevRemoveActionPos || action.position == (prevRemoveActionPos + prevRemoveActionLen))) {
|
||||
coalescedRemoveLen += action.lenData;
|
||||
newPos = coalescedRemovePos + coalescedRemoveLen;
|
||||
} else {
|
||||
coalescedRemovePos = action.position;
|
||||
coalescedRemoveLen = action.lenData;
|
||||
}
|
||||
prevRemoveActionPos = action.position;
|
||||
prevRemoveActionLen = action.lenData;
|
||||
} else if (action.at == insertAction) {
|
||||
modFlags |= SC_MOD_DELETETEXT;
|
||||
coalescedRemovePos = -1;
|
||||
coalescedRemoveLen = 0;
|
||||
prevRemoveActionPos = -1;
|
||||
prevRemoveActionLen = 0;
|
||||
}
|
||||
if (steps > 1)
|
||||
modFlags |= SC_MULTISTEPUNDOREDO;
|
||||
@ -888,7 +894,7 @@ int Document::Undo() {
|
||||
if (multiLine)
|
||||
modFlags |= SC_MULTILINEUNDOREDO;
|
||||
}
|
||||
NotifyModified(DocModification(modFlags, cellPosition, action.lenData,
|
||||
NotifyModified(DocModification(modFlags, action.position, action.lenData,
|
||||
linesAdded, action.data));
|
||||
}
|
||||
|
||||
@ -1003,21 +1009,19 @@ static int NextTab(int pos, int tabSize) {
|
||||
return ((pos / tabSize) + 1) * tabSize;
|
||||
}
|
||||
|
||||
static void CreateIndentation(char *linebuf, int length, int indent, int tabSize, bool insertSpaces) {
|
||||
length--; // ensure space for \0
|
||||
static std::string CreateIndentation(int indent, int tabSize, bool insertSpaces) {
|
||||
std::string indentation;
|
||||
if (!insertSpaces) {
|
||||
while ((indent >= tabSize) && (length > 0)) {
|
||||
*linebuf++ = '\t';
|
||||
while (indent >= tabSize) {
|
||||
indentation += '\t';
|
||||
indent -= tabSize;
|
||||
length--;
|
||||
}
|
||||
}
|
||||
while ((indent > 0) && (length > 0)) {
|
||||
*linebuf++ = ' ';
|
||||
while (indent > 0) {
|
||||
indentation += ' ';
|
||||
indent--;
|
||||
length--;
|
||||
}
|
||||
*linebuf = '\0';
|
||||
return indentation;
|
||||
}
|
||||
|
||||
int SCI_METHOD Document::GetLineIndentation(int line) {
|
||||
@ -1043,13 +1047,12 @@ void Document::SetLineIndentation(int line, int indent) {
|
||||
if (indent < 0)
|
||||
indent = 0;
|
||||
if (indent != indentOfLine) {
|
||||
char linebuf[1000];
|
||||
CreateIndentation(linebuf, sizeof(linebuf), indent, tabInChars, !useTabs);
|
||||
std::string linebuf = CreateIndentation(indent, tabInChars, !useTabs);
|
||||
int thisLineStart = LineStart(line);
|
||||
int indentPos = GetLineIndentPosition(line);
|
||||
UndoGroup ug(this);
|
||||
DeleteChars(thisLineStart, indentPos - thisLineStart);
|
||||
InsertCString(thisLineStart, linebuf);
|
||||
InsertCString(thisLineStart, linebuf.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
@ -1615,6 +1618,10 @@ void Document::SetCharClasses(const unsigned char *chars, CharClassify::cc newCh
|
||||
charClass.SetCharClasses(chars, newCharClass);
|
||||
}
|
||||
|
||||
int Document::GetCharsOfClass(CharClassify::cc characterClass, unsigned char *buffer) {
|
||||
return charClass.GetCharsOfClass(characterClass, buffer);
|
||||
}
|
||||
|
||||
void Document::SetStylingBits(int bits) {
|
||||
stylingBits = bits;
|
||||
stylingBitsMask = (1 << stylingBits) - 1;
|
||||
@ -1730,10 +1737,12 @@ void Document::MarginSetText(int line, const char *text) {
|
||||
|
||||
void Document::MarginSetStyle(int line, int style) {
|
||||
static_cast<LineAnnotation *>(perLineData[ldMargin])->SetStyle(line, style);
|
||||
NotifyModified(DocModification(SC_MOD_CHANGEMARGIN, LineStart(line), 0, 0, 0, line));
|
||||
}
|
||||
|
||||
void Document::MarginSetStyles(int line, const unsigned char *styles) {
|
||||
static_cast<LineAnnotation *>(perLineData[ldMargin])->SetStyles(line, styles);
|
||||
NotifyModified(DocModification(SC_MOD_CHANGEMARGIN, LineStart(line), 0, 0, 0, line));
|
||||
}
|
||||
|
||||
int Document::MarginLength(int line) const {
|
||||
|
@ -364,6 +364,7 @@ public:
|
||||
|
||||
void SetDefaultCharClasses(bool includeWordClass);
|
||||
void SetCharClasses(const unsigned char *chars, CharClassify::cc newCharClass);
|
||||
int GetCharsOfClass(CharClassify::cc charClass, unsigned char *buffer);
|
||||
void SetStylingBits(int bits);
|
||||
void SCI_METHOD StartStyling(int position, char mask);
|
||||
bool SCI_METHOD SetStyleFor(int length, char style);
|
||||
|
@ -663,7 +663,8 @@ PRectangle Editor::RectangleFromRange(int start, int end) {
|
||||
int maxLine = cs.DisplayFromDoc(lineDocMax) + cs.GetHeight(lineDocMax) - 1;
|
||||
PRectangle rcClient = GetTextRectangle();
|
||||
PRectangle rc;
|
||||
rc.left = vs.fixedColumnWidth;
|
||||
const int leftTextOverlap = ((xOffset == 0) && (vs.leftMarginWidth > 0)) ? 1 : 0;
|
||||
rc.left = vs.fixedColumnWidth - leftTextOverlap;
|
||||
rc.top = (minLine - topLine) * vs.lineHeight;
|
||||
if (rc.top < 0)
|
||||
rc.top = 0;
|
||||
@ -3228,7 +3229,7 @@ void Editor::DrawBlockCaret(Surface *surface, ViewStyle &vsDraw, LineLayout *ll,
|
||||
// glyph / combining character. If so we'll need to draw that too.
|
||||
int offsetFirstChar = offset;
|
||||
int offsetLastChar = offset + (posAfter - posCaret);
|
||||
while ((offsetLastChar - numCharsToDraw) >= lineStart) {
|
||||
while ((posBefore > 0) && ((offsetLastChar - numCharsToDraw) >= lineStart)) {
|
||||
if ((ll->positions[offsetLastChar] - ll->positions[offsetLastChar - numCharsToDraw]) > 0) {
|
||||
// The char does not share horizontal space
|
||||
break;
|
||||
@ -3242,6 +3243,8 @@ void Editor::DrawBlockCaret(Surface *surface, ViewStyle &vsDraw, LineLayout *ll,
|
||||
|
||||
// See if the next character shares horizontal space, if so we'll
|
||||
// need to draw that too.
|
||||
if (offsetFirstChar < 0)
|
||||
offsetFirstChar = 0;
|
||||
numCharsToDraw = offsetLastChar - offsetFirstChar;
|
||||
while ((offsetLastChar < ll->LineStart(subLine + 1)) && (offsetLastChar <= ll->numCharsInLine)) {
|
||||
// Update posAfter to point to the 2nd next char, this is where
|
||||
@ -3501,8 +3504,12 @@ void Editor::Paint(Surface *surfaceWindow, PRectangle rcArea) {
|
||||
}
|
||||
//Platform::DebugPrintf("start display %d, offset = %d\n", pdoc->Length(), xOffset);
|
||||
|
||||
// Allow text at start of line to overlap 1 pixel into the margin as this displays
|
||||
// serifs and italic stems for aliased text.
|
||||
const int leftTextOverlap = ((xOffset == 0) && (vs.leftMarginWidth > 0)) ? 1 : 0;
|
||||
|
||||
// Do the painting
|
||||
if (rcArea.right > vs.fixedColumnWidth) {
|
||||
if (rcArea.right > vs.fixedColumnWidth - leftTextOverlap) {
|
||||
|
||||
Surface *surface = surfaceWindow;
|
||||
if (bufferedDraw) {
|
||||
@ -3526,7 +3533,9 @@ void Editor::Paint(Surface *surfaceWindow, PRectangle rcArea) {
|
||||
// Remove selection margin from drawing area so text will not be drawn
|
||||
// on it in unbuffered mode.
|
||||
if (!bufferedDraw) {
|
||||
surfaceWindow->SetClip(rcTextArea);
|
||||
PRectangle rcClipText = rcTextArea;
|
||||
rcClipText.left -= leftTextOverlap;
|
||||
surfaceWindow->SetClip(rcClipText);
|
||||
}
|
||||
|
||||
// Loop on visible lines
|
||||
@ -3577,6 +3586,13 @@ void Editor::Paint(Surface *surfaceWindow, PRectangle rcArea) {
|
||||
ll->SetBracesHighlight(rangeLine, braces, static_cast<char>(bracesMatchStyle),
|
||||
highlightGuideColumn * vs.spaceWidth, bracesIgnoreStyle);
|
||||
|
||||
if (leftTextOverlap && bufferedDraw) {
|
||||
PRectangle rcSpacer = rcLine;
|
||||
rcSpacer.right = rcSpacer.left;
|
||||
rcSpacer.left -= 1;
|
||||
surface->FillRectangle(rcSpacer, vs.styles[STYLE_DEFAULT].back);
|
||||
}
|
||||
|
||||
// Draw the line
|
||||
DrawLine(surface, vs, lineDoc, visibleLine, xStart, rcLine, ll, subLine);
|
||||
//durPaint += et.Duration(true);
|
||||
@ -3610,8 +3626,8 @@ void Editor::Paint(Surface *surfaceWindow, PRectangle rcArea) {
|
||||
DrawCarets(surface, vs, lineDoc, xStart, rcLine, ll, subLine);
|
||||
|
||||
if (bufferedDraw) {
|
||||
Point from(vs.fixedColumnWidth, 0);
|
||||
PRectangle rcCopyArea(vs.fixedColumnWidth, yposScreen,
|
||||
Point from(vs.fixedColumnWidth-leftTextOverlap, 0);
|
||||
PRectangle rcCopyArea(vs.fixedColumnWidth-leftTextOverlap, yposScreen,
|
||||
rcClient.right - vs.rightMarginWidth, yposScreen + vs.lineHeight);
|
||||
surfaceWindow->Copy(rcCopyArea, from, *pixmapLine);
|
||||
}
|
||||
@ -4422,7 +4438,7 @@ bool Editor::NotifyMarginClick(Point pt, bool shift, bool ctrl, bool alt) {
|
||||
int marginClicked = -1;
|
||||
int x = 0;
|
||||
for (int margin = 0; margin < ViewStyle::margins; margin++) {
|
||||
if ((pt.x > x) && (pt.x < x + vs.ms[margin].width))
|
||||
if ((pt.x >= x) && (pt.x < x + vs.ms[margin].width))
|
||||
marginClicked = margin;
|
||||
x += vs.ms[margin].width;
|
||||
}
|
||||
@ -5845,6 +5861,18 @@ char *Editor::CopyRange(int start, int end) {
|
||||
return text;
|
||||
}
|
||||
|
||||
std::string Editor::RangeText(int start, int end) const {
|
||||
if (start < end) {
|
||||
int len = end - start;
|
||||
std::string ret(len, '\0');
|
||||
for (int i = 0; i < len; i++) {
|
||||
ret[i] = pdoc->CharAt(start + i);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
return std::string();
|
||||
}
|
||||
|
||||
void Editor::CopySelectionRange(SelectionText *ss, bool allowLineCopy) {
|
||||
if (sel.Empty()) {
|
||||
if (allowLineCopy) {
|
||||
@ -6919,10 +6947,10 @@ void Editor::EnsureLineVisible(int lineDoc, bool enforcePolicy) {
|
||||
}
|
||||
|
||||
int Editor::GetTag(char *tagValue, int tagNumber) {
|
||||
char name[3] = "\\?";
|
||||
const char *text = 0;
|
||||
int length = 0;
|
||||
if ((tagNumber >= 1) && (tagNumber <= 9)) {
|
||||
char name[3] = "\\?";
|
||||
name[1] = static_cast<char>(tagNumber + '0');
|
||||
length = 2;
|
||||
text = pdoc->SubstituteByPosition(name, &length);
|
||||
@ -7510,6 +7538,9 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) {
|
||||
caret.period = wParam;
|
||||
break;
|
||||
|
||||
case SCI_GETWORDCHARS:
|
||||
return pdoc->GetCharsOfClass(CharClassify::ccWord, reinterpret_cast<unsigned char *>(lParam));
|
||||
|
||||
case SCI_SETWORDCHARS: {
|
||||
pdoc->SetDefaultCharClasses(false);
|
||||
if (lParam == 0)
|
||||
@ -7518,6 +7549,9 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) {
|
||||
}
|
||||
break;
|
||||
|
||||
case SCI_GETWHITESPACECHARS:
|
||||
return pdoc->GetCharsOfClass(CharClassify::ccSpace, reinterpret_cast<unsigned char *>(lParam));
|
||||
|
||||
case SCI_SETWHITESPACECHARS: {
|
||||
if (lParam == 0)
|
||||
return 0;
|
||||
@ -7525,6 +7559,16 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) {
|
||||
}
|
||||
break;
|
||||
|
||||
case SCI_GETPUNCTUATIONCHARS:
|
||||
return pdoc->GetCharsOfClass(CharClassify::ccPunctuation, reinterpret_cast<unsigned char *>(lParam));
|
||||
|
||||
case SCI_SETPUNCTUATIONCHARS: {
|
||||
if (lParam == 0)
|
||||
return 0;
|
||||
pdoc->SetCharClasses(reinterpret_cast<unsigned char *>(lParam), CharClassify::ccPunctuation);
|
||||
}
|
||||
break;
|
||||
|
||||
case SCI_SETCHARSDEFAULT:
|
||||
pdoc->SetDefaultCharClasses(true);
|
||||
break;
|
||||
|
@ -480,6 +480,7 @@ protected: // ScintillaBase subclass needs access to much of Editor
|
||||
|
||||
virtual void CopyToClipboard(const SelectionText &selectedText) = 0;
|
||||
char *CopyRange(int start, int end);
|
||||
std::string RangeText(int start, int end) const;
|
||||
void CopySelectionRange(SelectionText *ss, bool allowLineCopy=false);
|
||||
void CopyRangeToClipboard(int start, int end);
|
||||
void CopyText(int length, const char *text);
|
||||
|
@ -99,7 +99,7 @@ void MarkerHandleSet::RemoveHandle(int handle) {
|
||||
}
|
||||
}
|
||||
|
||||
bool MarkerHandleSet::RemoveNumber(int markerNum) {
|
||||
bool MarkerHandleSet::RemoveNumber(int markerNum, bool all) {
|
||||
bool performedDeletion = false;
|
||||
MarkerHandleNumber **pmhn = &root;
|
||||
while (*pmhn) {
|
||||
@ -108,6 +108,8 @@ bool MarkerHandleSet::RemoveNumber(int markerNum) {
|
||||
*pmhn = mhn->next;
|
||||
delete mhn;
|
||||
performedDeletion = true;
|
||||
if (!all)
|
||||
break;
|
||||
} else {
|
||||
pmhn = &((*pmhn)->next);
|
||||
}
|
||||
@ -223,12 +225,7 @@ bool LineMarkers::DeleteMark(int line, int markerNum, bool all) {
|
||||
delete markers[line];
|
||||
markers[line] = NULL;
|
||||
} else {
|
||||
bool performedDeletion = markers[line]->RemoveNumber(markerNum);
|
||||
someChanges = someChanges || performedDeletion;
|
||||
while (all && performedDeletion) {
|
||||
performedDeletion = markers[line]->RemoveNumber(markerNum);
|
||||
someChanges = someChanges || performedDeletion;
|
||||
}
|
||||
someChanges = markers[line]->RemoveNumber(markerNum, all);
|
||||
if (markers[line]->Length() == 0) {
|
||||
delete markers[line];
|
||||
markers[line] = NULL;
|
||||
|
@ -37,7 +37,7 @@ public:
|
||||
bool Contains(int handle) const;
|
||||
bool InsertHandle(int handle, int markerNum);
|
||||
void RemoveHandle(int handle);
|
||||
bool RemoveNumber(int markerNum);
|
||||
bool RemoveNumber(int markerNum, bool all);
|
||||
void CombineWith(MarkerHandleSet *other);
|
||||
};
|
||||
|
||||
|
@ -213,6 +213,7 @@ void ScintillaBase::AutoCompleteStart(int lenEntered, const char *list) {
|
||||
pdoc->InsertString(sel.MainCaret(), list + lenEntered, lenInsert - lenEntered);
|
||||
SetEmptySelection(sel.MainCaret() + lenInsert - lenEntered);
|
||||
}
|
||||
ac.Cancel();
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -293,13 +294,8 @@ void ScintillaBase::AutoCompleteMove(int delta) {
|
||||
}
|
||||
|
||||
void ScintillaBase::AutoCompleteMoveToCurrentWord() {
|
||||
char wordCurrent[1000];
|
||||
int i;
|
||||
int startWord = ac.posStart - ac.startLen;
|
||||
for (i = startWord; i < sel.MainCaret() && i - startWord < 1000; i++)
|
||||
wordCurrent[i - startWord] = pdoc->CharAt(i);
|
||||
wordCurrent[Platform::Minimum(i - startWord, 999)] = '\0';
|
||||
ac.Select(wordCurrent);
|
||||
std::string wordCurrent = RangeText(ac.posStart - ac.startLen, sel.MainCaret());
|
||||
ac.Select(wordCurrent.c_str());
|
||||
}
|
||||
|
||||
void ScintillaBase::AutoCompleteCharacterAdded(char ch) {
|
||||
@ -328,15 +324,12 @@ void ScintillaBase::AutoCompleteCharacterDeleted() {
|
||||
}
|
||||
|
||||
void ScintillaBase::AutoCompleteCompleted() {
|
||||
int item = ac.lb->GetSelection();
|
||||
char selected[1000];
|
||||
selected[0] = '\0';
|
||||
if (item != -1) {
|
||||
ac.lb->GetValue(item, selected, sizeof(selected));
|
||||
} else {
|
||||
int item = ac.GetSelection();
|
||||
if (item == -1) {
|
||||
AutoCompleteCancel();
|
||||
return;
|
||||
}
|
||||
const std::string selected = ac.GetValue(item);
|
||||
|
||||
ac.Show(false);
|
||||
|
||||
@ -348,7 +341,7 @@ void ScintillaBase::AutoCompleteCompleted() {
|
||||
Position firstPos = ac.posStart - ac.startLen;
|
||||
scn.position = firstPos;
|
||||
scn.lParam = firstPos;
|
||||
scn.text = selected;
|
||||
scn.text = selected.c_str();
|
||||
NotifyParent(scn);
|
||||
|
||||
if (!ac.Active())
|
||||
@ -369,8 +362,8 @@ void ScintillaBase::AutoCompleteCompleted() {
|
||||
}
|
||||
SetEmptySelection(ac.posStart);
|
||||
if (item != -1) {
|
||||
pdoc->InsertCString(firstPos, selected);
|
||||
SetEmptySelection(firstPos + static_cast<int>(strlen(selected)));
|
||||
pdoc->InsertCString(firstPos, selected.c_str());
|
||||
SetEmptySelection(firstPos + static_cast<int>(selected.length()));
|
||||
}
|
||||
SetLastXChosen();
|
||||
}
|
||||
@ -378,19 +371,17 @@ void ScintillaBase::AutoCompleteCompleted() {
|
||||
int ScintillaBase::AutoCompleteGetCurrent() {
|
||||
if (!ac.Active())
|
||||
return -1;
|
||||
return ac.lb->GetSelection();
|
||||
return ac.GetSelection();
|
||||
}
|
||||
|
||||
int ScintillaBase::AutoCompleteGetCurrentText(char *buffer) {
|
||||
if (ac.Active()) {
|
||||
int item = ac.lb->GetSelection();
|
||||
char selected[1000];
|
||||
selected[0] = '\0';
|
||||
int item = ac.GetSelection();
|
||||
if (item != -1) {
|
||||
ac.lb->GetValue(item, selected, sizeof(selected));
|
||||
const std::string selected = ac.GetValue(item);
|
||||
if (buffer != NULL)
|
||||
strcpy(buffer, selected);
|
||||
return static_cast<int>(strlen(selected));
|
||||
strcpy(buffer, selected.c_str());
|
||||
return static_cast<int>(selected.length());
|
||||
}
|
||||
}
|
||||
if (buffer != NULL)
|
||||
|
@ -103,7 +103,7 @@ public:
|
||||
/// Margins are ordered: Line Numbers, Selection Margin, Spacing Margin
|
||||
enum { margins=5 };
|
||||
int leftMarginWidth; ///< Spacing margin on left of text
|
||||
int rightMarginWidth; ///< Spacing margin on left of text
|
||||
int rightMarginWidth; ///< Spacing margin on right of text
|
||||
int maskInLine; ///< Mask for markers to be put into text because there is nowhere for them to go in margin
|
||||
MarginStyle ms[margins];
|
||||
int fixedColumnWidth;
|
||||
|
@ -1 +1 @@
|
||||
320
|
||||
321
|
||||
|
@ -1554,6 +1554,7 @@ gboolean highlighting_is_comment_style(gint lexer, gint style)
|
||||
return (style == SCE_C_COMMENT ||
|
||||
style == SCE_C_COMMENTLINE ||
|
||||
style == SCE_C_COMMENTDOC ||
|
||||
style == SCE_C_PREPROCESSORCOMMENT ||
|
||||
style == SCE_C_COMMENTLINEDOC ||
|
||||
style == SCE_C_COMMENTDOCKEYWORD ||
|
||||
style == SCE_C_COMMENTDOCKEYWORDERROR);
|
||||
|
@ -180,6 +180,7 @@ static const HLStyle highlighting_styles_C[] =
|
||||
{ SCE_C_COMMENT, "comment", FALSE },
|
||||
{ SCE_C_COMMENTLINE, "commentline", FALSE },
|
||||
{ SCE_C_COMMENTDOC, "commentdoc", FALSE },
|
||||
{ SCE_C_PREPROCESSORCOMMENT, "preprocessorcomment", FALSE },
|
||||
{ SCE_C_NUMBER, "number", FALSE },
|
||||
{ SCE_C_WORD, "word", FALSE },
|
||||
{ SCE_C_WORD2, "word2", FALSE },
|
||||
|
Loading…
x
Reference in New Issue
Block a user