// Invisible mark that only sets the line background color.
#define wxSTC_MARK_BACKGROUND 22
+#define wxSTC_MARK_DOTDOTDOT 23
+#define wxSTC_MARK_ARROWS 24
#define wxSTC_MARK_CHARACTER 10000
// Markers used for outlining column.
// Delete the selection or if no selection, the character before the caret.
// Will not delete the character before at the start of a line.
#define wxSTC_CMD_DELETEBACKNOTLINE 2344
+
+// Move caret to first position on display line.
+#define wxSTC_CMD_HOMEDISPLAY 2345
+
+// Move caret to first position on display line extending selection to
+// new caret position.
+#define wxSTC_CMD_HOMEDISPLAYEXTEND 2346
+
+// Move caret to last position on display line.
+#define wxSTC_CMD_LINEENDDISPLAY 2347
+
+// Move caret to last position on display line extending selection to new
+// caret position.
+#define wxSTC_CMD_LINEENDDISPLAYEXTEND 2348
#define wxSTC_EDGE_NONE 0
#define wxSTC_EDGE_LINE 1
#define wxSTC_EDGE_BACKGROUND 2
// Retrieve the foreground colour of an indicator.
wxColour IndicatorGetForeground(int indic);
+ // Set the foreground colour of all whitespace and whether to use this setting.
+ void SetWhitespaceForeground(bool useSetting, const wxColour& fore);
+
+ // Set the background colour of all whitespace and whether to use this setting.
+ void SetWhitespaceBackground(bool useSetting, const wxColour& back);
+
// Divide each styling byte into lexical class bits (default: 5) and indicator
// bits (default: 3). If a lexer requires more than 32 lexical states, then this
// is used to expand the possible states.
// Retrieve the height of a particular line of text in pixels.
int TextHeight(int line);
+ // Move caret to first position on display line.
+ void HomeDisplay();
+
+ // Move caret to first position on display line extending selection to
+ // new caret position.
+ void HomeDisplayExtend();
+
+ // Move caret to last position on display line.
+ void LineEndDisplay();
+
+ // Move caret to last position on display line extending selection to new
+ // caret position.
+ void LineEndDisplayExtend();
+
// Move the caret inside current view if it's not there already.
void MoveCaretInsideView();
'IndicSetFore' : ('IndicatorSetForeground', 0, 0, 0),
'IndicGetFore' : ('IndicatorGetForeground', 0, 0, 0),
+ 'SetWhitespaceFore' : ('SetWhitespaceForeground', 0, 0, 0),
+ 'SetWhitespaceBack' : ('SetWhitespaceBackground', 0, 0, 0),
+
'AutoCShow' : ('AutoCompShow', 0, 0, 0),
'AutoCCancel' : ('AutoCompCancel', 0, 0, 0),
'AutoCActive' : ('AutoCompActive', 0, 0, 0),
'GetFocus' : ('GetSTCFocus', 0, 0, 0),
+
'' : ('', 0, 0, 0),
}
distribution. All other code needed to implement Scintilla on top of
wxWindows is located in the directory above this one.
-The current version of the Scintilla code is 1.47
+The current version of the Scintilla code is 1.48
#define SC_MARK_CIRCLEMINUS 20
#define SC_MARK_CIRCLEMINUSCONNECTED 21
#define SC_MARK_BACKGROUND 22
+#define SC_MARK_DOTDOTDOT 23
+#define SC_MARK_ARROWS 24
#define SC_MARK_CHARACTER 10000
#define SC_MARKNUM_FOLDEREND 25
#define SC_MARKNUM_FOLDEROPENMID 26
#define SCI_INDICGETSTYLE 2081
#define SCI_INDICSETFORE 2082
#define SCI_INDICGETFORE 2083
+#define SCI_SETWHITESPACEFORE 2084
+#define SCI_SETWHITESPACEBACK 2085
#define SCI_SETSTYLEBITS 2090
#define SCI_GETSTYLEBITS 2091
#define SCI_SETLINESTATE 2092
#define SCI_LINESCROLLDOWN 2342
#define SCI_LINESCROLLUP 2343
#define SCI_DELETEBACKNOTLINE 2344
+#define SCI_HOMEDISPLAY 2345
+#define SCI_HOMEDISPLAYEXTEND 2346
+#define SCI_LINEENDDISPLAY 2347
+#define SCI_LINEENDDISPLAYEXTEND 2348
#define SCI_MOVECARETINSIDEVIEW 2401
#define SCI_LINELENGTH 2350
#define SCI_BRACEHIGHLIGHT 2351
# Invisible mark that only sets the line background color.
val SC_MARK_BACKGROUND=22
+val SC_MARK_DOTDOTDOT=23
+val SC_MARK_ARROWS=24
val SC_MARK_CHARACTER=10000
# Retrieve the foreground colour of an indicator.
get colour IndicGetFore=2083(int indic,)
+# Set the foreground colour of all whitespace and whether to use this setting.
+fun void SetWhitespaceFore=2084(bool useSetting, colour fore)
+
+# Set the background colour of all whitespace and whether to use this setting.
+fun void SetWhitespaceBack=2085(bool useSetting, colour back)
+
# Divide each styling byte into lexical class bits (default: 5) and indicator
# bits (default: 3). If a lexer requires more than 32 lexical states, then this
# is used to expand the possible states.
# Will not delete the character before at the start of a line.
fun void DeleteBackNotLine=2344(,)
+# Move caret to first position on display line.
+fun void HomeDisplay=2345(,)
+
+# Move caret to first position on display line extending selection to
+# new caret position.
+fun void HomeDisplayExtend=2346(,)
+
+# Move caret to last position on display line.
+fun void LineEndDisplay=2347(,)
+
+# Move caret to last position on display line extending selection to new
+# caret position.
+fun void LineEndDisplayExtend=2348(,)
+
# Move the caret inside current view if it's not there already.
fun void MoveCaretInsideView=2401(,)
levels = 0;
sizeLevels = 0;
handleCurrent = 1;
+ growSize = 1000;
Init();
}
void LineVector::InsertValue(int pos, int value) {
//Platform::DebugPrintf("InsertValue[%d] = %d\n", pos, value);
if ((lines + 2) >= size) {
+ if (growSize * 6 < size)
+ growSize *= 2;
Expand(size + growSize);
if (levels) {
ExpandLevels(size + growSize);
*/
class LineVector {
public:
- enum { growSize = 4000 };
+ int growSize;
int lines;
LineData *linesData;
int size;
}
void Editor::InvalidateStyleRedraw() {
+ NeedWrapping();
InvalidateStyleData();
Redraw();
}
return pos;
}
-int Editor::MovePositionTo(int newPos, bool extend) {
+int Editor::MovePositionTo(int newPos, bool extend, bool ensureVisible) {
int delta = newPos - currentPos;
newPos = pdoc->ClampPositionIntoDocument(newPos);
newPos = MovePositionOutsideChar(newPos, delta);
} else {
SetEmptySelection(newPos);
}
- EnsureCaretVisible();
+ if (ensureVisible)
+ EnsureCaretVisible();
ShowCaretAtCurrentPosition();
NotifyMove(newPos);
return 0;
}
}
-void Editor::MoveCaretInsideView() {
+void Editor::MoveCaretInsideView(bool ensureVisible) {
PRectangle rcClient = GetTextRectangle();
Point pt = LocationFromPosition(currentPos);
if (pt.y < rcClient.top) {
MovePositionTo(PositionFromLocation(
- Point(lastXChosen, rcClient.top)));
+ Point(lastXChosen, rcClient.top)),
+ false, ensureVisible);
} else if ((pt.y + vs.lineHeight - 1) > rcClient.bottom) {
int yOfLastLineFullyDisplayed = rcClient.top + (LinesOnScreen() - 1) * vs.lineHeight;
MovePositionTo(PositionFromLocation(
- Point(lastXChosen, rcClient.top + yOfLastLineFullyDisplayed)));
+ Point(lastXChosen, rcClient.top + yOfLastLineFullyDisplayed)),
+ false, ensureVisible);
}
}
bool lastSegItalics = false;
Font &ctrlCharsFont = vstyle.styles[STYLE_CONTROLCHAR].font;
+ bool isControlNext = IsControlCharacter(ll->chars[0]);
for (int charInLine = 0; charInLine < numCharsInLine; charInLine++) {
+ bool isControl = isControlNext;
+ isControlNext = IsControlCharacter(ll->chars[charInLine + 1]);
if ((ll->styles[charInLine] != ll->styles[charInLine + 1]) ||
- IsControlCharacter(ll->chars[charInLine]) || IsControlCharacter(ll->chars[charInLine + 1])) {
+ isControl || isControlNext) {
ll->positions[startseg] = 0;
if (vstyle.styles[ll->styles[charInLine]].visible) {
- if (IsControlCharacter(ll->chars[charInLine])) {
+ if (isControl) {
if (ll->chars[charInLine] == '\t') {
ll->positions[charInLine + 1] = ((((startsegx + 2) /
tabWidth) + 1) * tabWidth) - startsegx;
}
lastSegItalics = false;
} else { // Regular character
- lastSegItalics = vstyle.styles[ll->styles[charInLine]].italic;
int lenSeg = charInLine - startseg + 1;
if ((lenSeg == 1) && (' ' == ll->chars[startseg])) {
+ lastSegItalics = false;
// Over half the segments are single characters and of these about half are space characters.
ll->positions[charInLine + 1] = vstyle.styles[ll->styles[charInLine]].spaceWidth;
} else {
+ lastSegItalics = vstyle.styles[ll->styles[charInLine]].italic;
surface->MeasureWidths(vstyle.styles[ll->styles[charInLine]].font, ll->chars + startseg,
lenSeg, ll->positions + startseg + 1);
}
rcSegment.right = ll->positions[i + 1] + xStart - subLineStart;
// Only try to draw if really visible - enhances performance by not calling environment to
// draw strings that are completely past the right side of the window.
- //if (rcSegment.left <= rcLine.right) {
if ((rcSegment.left <= rcLine.right) && (rcSegment.right >= rcLine.left)) {
int styleMain = ll->styles[i];
ColourAllocated textBack = vsDraw.styles[styleMain].back.allocated;
}
if (ll->chars[i] == '\t') {
// Manage tab display
+ if (!overrideBackground && vsDraw.whitespaceBackgroundSet && (vsDraw.viewWhitespace != wsInvisible) && (!inIndentation || vsDraw.viewWhitespace == wsVisibleAlways))
+ textBack = vsDraw.whitespaceBackground.allocated;
surface->FillRectangle(rcSegment, textBack);
if ((vsDraw.viewWhitespace != wsInvisible) || ((inIndentation && vsDraw.viewIndentationGuides))) {
+ if (vsDraw.whitespaceForegroundSet)
+ textFore = vsDraw.whitespaceForeground.allocated;
surface->PenColour(textFore);
}
if (inIndentation && vsDraw.viewIndentationGuides) {
for (int cpos = 0; cpos <= i - startseg; cpos++) {
if (ll->chars[cpos + startseg] == ' ') {
if (vsDraw.viewWhitespace != wsInvisible) {
+ if (vsDraw.whitespaceForegroundSet)
+ textFore = vsDraw.whitespaceForeground.allocated;
if (!inIndentation || vsDraw.viewWhitespace == wsVisibleAlways) {
int xmid = (ll->positions[cpos + startseg] + ll->positions[cpos + startseg + 1]) / 2;
+ if (!overrideBackground && vsDraw.whitespaceBackgroundSet) {
+ textBack = vsDraw.whitespaceBackground.allocated;
+ PRectangle rcSpace(ll->positions[cpos + startseg] + xStart, rcSegment.top, ll->positions[cpos + startseg + 1] + xStart, rcSegment.bottom);
+ surface->FillRectangle(rcSpace, textBack);
+ }
PRectangle rcDot(xmid + xStart - subLineStart, rcSegment.top + vsDraw.lineHeight / 2, 0, 0);
rcDot.right = rcDot.left + 1;
rcDot.bottom = rcDot.top + 1;
// Don't show the selection when printing
vsPrint.selbackset = false;
vsPrint.selforeset = false;
+ vsPrint.whitespaceBackgroundSet = false;
+ vsPrint.whitespaceForegroundSet = false;
vsPrint.showCaretLineBackground = false;
// Set colours for printing according to users settings
case SCI_LINESCROLLDOWN:
case SCI_LINESCROLLUP:
case SCI_DELETEBACKNOTLINE:
+ case SCI_HOMEDISPLAY:
+ case SCI_HOMEDISPLAYEXTEND:
+ case SCI_LINEENDDISPLAY:
+ case SCI_LINEENDDISPLAYEXTEND:
break;
// Filter out all others like display changes. Also, newlines are redundant
MovePositionTo(posNew, extend);
}
+int Editor::StartEndDisplayLine(int pos, bool start) {
+ RefreshStyleData();
+ int line = pdoc->LineFromPosition(pos);
+ AutoSurface surface(IsUnicodeMode());
+ LineLayout *ll = RetrieveLineLayout(line);
+ int posRet = INVALID_POSITION;
+ if (surface && ll) {
+ unsigned int posLineStart = pdoc->LineStart(line);
+ LayoutLine(line, surface, vs, ll, wrapWidth);
+ int posInLine = pos - posLineStart;
+ if (posInLine <= ll->maxLineLength) {
+ for (int subLine=0; subLine<ll->lines; subLine++) {
+ if ((posInLine >= ll->LineStart(subLine)) && (posInLine <= ll->LineStart(subLine+1))) {
+ if (start) {
+ posRet = ll->LineStart(subLine) + posLineStart;
+ } else {
+ if (subLine == ll->lines - 1)
+ posRet = ll->LineStart(subLine+1) + posLineStart;
+ else
+ posRet = ll->LineStart(subLine+1) + posLineStart - 1;
+ }
+ }
+ }
+ }
+ }
+ llc.Dispose(ll);
+ if (posRet == INVALID_POSITION) {
+ return pos;
+ } else {
+ return posRet;
+ }
+}
+
int Editor::KeyCommand(unsigned int iMessage) {
switch (iMessage) {
case SCI_LINEDOWN:
break;
case SCI_LINESCROLLDOWN:
ScrollTo(topLine + 1);
- MoveCaretInsideView();
+ MoveCaretInsideView(false);
break;
case SCI_LINEUP:
CursorUpOrDown(-1);
break;
case SCI_LINESCROLLUP:
ScrollTo(topLine - 1);
- MoveCaretInsideView();
+ MoveCaretInsideView(false);
break;
case SCI_CHARLEFT:
if (SelectionEmpty()) {
case SCI_ZOOMIN:
if (vs.zoomLevel < 20) {
vs.zoomLevel++;
- NeedWrapping();
InvalidateStyleRedraw();
NotifyZoom();
}
case SCI_ZOOMOUT:
if (vs.zoomLevel > -10) {
vs.zoomLevel--;
- NeedWrapping();
InvalidateStyleRedraw();
NotifyZoom();
}
MovePositionTo(MovePositionSoVisible(pdoc->WordPartRight(currentPos), 1), true);
SetLastXChosen();
break;
+ case SCI_HOMEDISPLAY:
+ MovePositionTo(MovePositionSoVisible(
+ StartEndDisplayLine(currentPos, true), -1));
+ SetLastXChosen();
+ break;
+ case SCI_HOMEDISPLAYEXTEND:
+ MovePositionTo(MovePositionSoVisible(
+ StartEndDisplayLine(currentPos, true), -1), true);
+ SetLastXChosen();
+ break;
+ case SCI_LINEENDDISPLAY:
+ MovePositionTo(MovePositionSoVisible(
+ StartEndDisplayLine(currentPos, false), 1));
+ SetLastXChosen();
+ break;
+ case SCI_LINEENDDISPLAYEXTEND:
+ MovePositionTo(MovePositionSoVisible(
+ StartEndDisplayLine(currentPos, false), 1), true);
+ SetLastXChosen();
+ break;
}
return 0;
}
case SCI_SETMARGINLEFT:
vs.leftMarginWidth = lParam;
- NeedWrapping();
InvalidateStyleRedraw();
break;
case SCI_SETMARGINRIGHT:
vs.rightMarginWidth = lParam;
- NeedWrapping();
InvalidateStyleRedraw();
break;
case SCI_SETWRAPMODE:
wrapState = (wParam == SC_WRAP_WORD) ? eWrapWord : eWrapNone;
- NeedWrapping();
xOffset = 0;
InvalidateStyleRedraw();
ReconfigureScrollBars();
case SCI_SETCODEPAGE:
pdoc->dbcsCodePage = wParam;
+ InvalidateStyleRedraw();
break;
case SCI_GETCODEPAGE:
case SCI_SETMARGINWIDTHN:
if (ValidMargin(wParam)) {
vs.ms[wParam].width = lParam;
- NeedWrapping();
InvalidateStyleRedraw();
}
break;
InvalidateStyleRedraw();
break;
+ case SCI_SETWHITESPACEFORE:
+ vs.whitespaceForegroundSet = wParam != 0;
+ vs.whitespaceForeground.desired = ColourDesired(lParam);
+ InvalidateStyleRedraw();
+ break;
+
+ case SCI_SETWHITESPACEBACK:
+ vs.whitespaceBackgroundSet = wParam != 0;
+ vs.whitespaceBackground.desired = ColourDesired(lParam);
+ InvalidateStyleRedraw();
+ break;
+
case SCI_SETCARETFORE:
vs.caretcolour.desired = ColourDesired(wParam);
InvalidateStyleRedraw();
case SCI_WORDPARTRIGHT:
case SCI_WORDPARTRIGHTEXTEND:
case SCI_DELETEBACKNOTLINE:
+ case SCI_HOMEDISPLAY:
+ case SCI_HOMEDISPLAYEXTEND:
+ case SCI_LINEENDDISPLAY:
+ case SCI_LINEENDDISPLAYEXTEND:
return KeyCommand(iMessage);
case SCI_BRACEHIGHLIGHT:
case SCI_SETZOOM:
vs.zoomLevel = wParam;
- NeedWrapping();
InvalidateStyleRedraw();
NotifyZoom();
break;
void SetSelection(int currentPos_);
void SetEmptySelection(int currentPos_);
int MovePositionOutsideChar(int pos, int moveDir, bool checkLineEnd=true);
- int MovePositionTo(int newPos, bool extend = false);
+ int MovePositionTo(int newPos, bool extend=false, bool ensureVisible=true);
int MovePositionSoVisible(int pos, int moveDir);
void SetLastXChosen();
void ScrollTo(int line);
virtual void ScrollText(int linesToMove);
void HorizontalScrollTo(int xPos);
- void MoveCaretInsideView();
+ void MoveCaretInsideView(bool ensureVisible=true);
int DisplayFromPosition(int pos);
void EnsureCaretVisible(bool useMargin=true, bool vert=true, bool horiz=true);
void ShowCaretAtCurrentPosition();
void PageMove(int direction, bool extend=false);
void ChangeCaseOfSelection(bool makeUpperCase);
void LineTranspose();
- virtual void CancelModes();
+ virtual void CancelModes();
void NewLine();
void CursorUpOrDown(int direction, bool extend=false);
+ int StartEndDisplayLine(int pos, bool start);
virtual int KeyCommand(unsigned int iMessage);
virtual int KeyDefault(int /* key */, int /*modifiers*/);
int KeyDown(int key, bool shift, bool ctrl, bool alt, bool *consumed=0);
{SCK_HOME, SCI_SHIFT, SCI_VCHOMEEXTEND},
{SCK_HOME, SCI_CTRL, SCI_DOCUMENTSTART},
{SCK_HOME, SCI_CSHIFT, SCI_DOCUMENTSTARTEXTEND},
+ {SCK_HOME, SCI_ALT, SCI_HOMEDISPLAY},
+ {SCK_HOME, SCI_ASHIFT, SCI_HOMEDISPLAYEXTEND},
{SCK_END, SCI_NORM, SCI_LINEEND},
{SCK_END, SCI_SHIFT, SCI_LINEENDEXTEND},
{SCK_END, SCI_CTRL, SCI_DOCUMENTEND},
{SCK_END, SCI_CSHIFT, SCI_DOCUMENTENDEXTEND},
+ {SCK_END, SCI_ALT, SCI_LINEENDDISPLAY},
+ {SCK_END, SCI_ASHIFT, SCI_LINEENDDISPLAYEXTEND},
{SCK_PRIOR, SCI_NORM, SCI_PAGEUP},
{SCK_PRIOR, SCI_SHIFT, SCI_PAGEUPEXTEND},
{SCK_NEXT, SCI_NORM, SCI_PAGEDOWN},
{SCK_TAB, SCI_NORM, SCI_TAB},
{SCK_TAB, SCI_SHIFT, SCI_BACKTAB},
{SCK_RETURN, SCI_NORM, SCI_NEWLINE},
+ {SCK_RETURN, SCI_SHIFT, SCI_NEWLINE},
{SCK_ADD, SCI_CTRL, SCI_ZOOMIN},
{SCK_SUBTRACT, SCI_CTRL, SCI_ZOOMOUT},
{SCK_DIVIDE, SCI_CTRL, SCI_SETZOOM},
sc.SetState(SCE_C_DEFAULT);
}
} else {
- if (sc.atLineEnd) {
+ if ((sc.atLineEnd) || (sc.Match('/', '*')) || (sc.Match('/', '/'))) {
sc.SetState(SCE_C_DEFAULT);
}
}
if (lineBuffer[0] == '>') {
// Command or return status
styler.ColourTo(endPos, SCE_ERR_CMD);
+ } else if (lineBuffer[0] == '<') {
+ // Diff removal, but not interested. Trapped to avoid hitting CTAG cases.
+ styler.ColourTo(endPos, SCE_ERR_DEFAULT);
} else if (lineBuffer[0] == '!') {
styler.ColourTo(endPos, SCE_ERR_DIFF_CHANGED);
} else if (lineBuffer[0] == '+') {
break;
} else if (((state == 11) || (state == 14)) && !((lineBuffer[i] == ' ') || isdigit(lineBuffer[i]))) {
state = 99;
- } else if ((state == 20) && isdigit(lineBuffer[i])) {
+ } else if ((state == 20) && (lineBuffer[i-1] == '\t') &&
+ ((lineBuffer[i] == '/' && lineBuffer[i+1] == '^') || isdigit(lineBuffer[i]))) {
state = 24;
break;
} else if ((state == 20) && ((lineBuffer[i] == '/') && (lineBuffer[i+1] == '^'))) {
/** @file LexPascal.cxx
** Lexer for Pascal.
** Written by Laurent le Tynevez
+ ** Updated by Simon Steele <s.steele@pnotepad.org> September 2002
**/
#include <stdlib.h>
#include "KeyWords.h"
#include "Scintilla.h"
#include "SciLexer.h"
+#include "StyleContext.h"
-static int classifyWordPascal(unsigned int start, unsigned int end, WordList &keywords, Accessor &styler) {
- char s[100];
- for (unsigned int i = 0; i < end - start + 1 && i < 30; i++) {
+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] = static_cast<char>(tolower(styler[start + i]));
- s[i + 1] = '\0';
+ i++;
}
- int lev= 0;
+ s[i] = '\0';
+}
+
+static bool IsStreamCommentStyle(int style) {
+ return style == SCE_C_COMMENT ||
+ style == SCE_C_COMMENTDOC ||
+ style == SCE_C_COMMENTDOCKEYWORD ||
+ style == SCE_C_COMMENTDOCKEYWORDERROR;
+}
+
+static inline bool IsAWordChar(const int ch) {
+ return (ch < 0x80) && (isalnum(ch) || ch == '.' || ch == '_');
+}
+
+// returns 1 if the item starts a class definition, and -1 if the word is "end".
+static int classifyWordPascal(unsigned int start, unsigned int end, /*WordList &keywords*/WordList *keywordlists[], Accessor &styler, bool bInClass) {
+ int ret = 0;
+
+ WordList& keywords = *keywordlists[0];
+ WordList& classwords = *keywordlists[1];
+
+ char s[100];
+ getRange(start, end, styler, s, sizeof(s));
+
char chAttr = SCE_C_IDENTIFIER;
- if (isdigit(s[0]) || (s[0] == '.')){
+ if (isdigit(s[0]) || (s[0] == '.')) {
chAttr = SCE_C_NUMBER;
}
else {
if (keywords.InList(s)) {
chAttr = SCE_C_WORD;
- if (strcmp(s, "begin") == 0 || strcmp(s, "object") == 0)
- lev=1;
- else if (strcmp(s, "end") == 0)
- lev=-1;
+
+ if(strcmp(s, "class") == 0)
+ ret = 1;
+ else if(strcmp(s, "end") == 0)
+ ret = -1;
+ } else if (bInClass) {
+ if (classwords.InList(s)) {
+ chAttr = SCE_C_WORD;
+ }
}
}
styler.ColourTo(end, chAttr);
+ return ret;
+}
+
+static int classifyFoldPointPascal(const char* s) {
+ int lev = 0;
+ if (!(isdigit(s[0]) || (s[0] == '.'))) {
+ if (strcmp(s, "begin") == 0 ||
+ strcmp(s, "object") == 0 ||
+ strcmp(s, "case") == 0 ||
+ strcmp(s, "class") == 0 ||
+ strcmp(s, "record") == 0 ||
+ strcmp(s, "try") == 0) {
+ lev=1;
+ } else if (strcmp(s, "end") == 0) {
+ lev=-1;
+ }
+ }
return lev;
}
static void ColourisePascalDoc(unsigned int startPos, int length, int initStyle, WordList *keywordlists[],
Accessor &styler) {
- WordList &keywords = *keywordlists[0];
styler.StartAt(startPos);
- bool fold = styler.GetPropertyInt("fold") != 0;
- int lineCurrent = styler.GetLine(startPos);
- int levelPrev = styler.LevelAt(lineCurrent) & SC_FOLDLEVELNUMBERMASK;
- int levelCurrent = levelPrev;
-
int state = initStyle;
if (state == SCE_C_STRINGEOL) // Does not leak onto next line
state = SCE_C_DEFAULT;
char chNext = styler[startPos];
unsigned int lengthDoc = startPos + length;
int visibleChars = 0;
+
+ bool bInClassDefinition;
+ int currentLine = styler.GetLine(startPos);
+ if (currentLine > 0) {
+ styler.SetLineState(currentLine, styler.GetLineState(currentLine-1));
+ bInClassDefinition = (styler.GetLineState(currentLine) == 1);
+ } else {
+ styler.SetLineState(currentLine, 0);
+ bInClassDefinition = false;
+ }
+
styler.StartSegment(startPos);
for (unsigned int i = startPos; i < lengthDoc; i++) {
char ch = chNext;
+
chNext = styler.SafeGetCharAt(i + 1);
if ((ch == '\r' && chNext != '\n') || (ch == '\n')) {
styler.ColourTo(i, state);
state = SCE_C_DEFAULT;
}
- if (fold) {
- int lev = levelPrev;
- if (visibleChars == 0)
- lev |= SC_FOLDLEVELWHITEFLAG;
- if ((levelCurrent > levelPrev) && (visibleChars > 0))
- lev |= SC_FOLDLEVELHEADERFLAG;
- styler.SetLevel(lineCurrent, lev);
- lineCurrent++;
- levelPrev = levelCurrent;
- }
visibleChars = 0;
+ currentLine++;
+ styler.SetLineState(currentLine, (bInClassDefinition ? 1 : 0));
}
if (!isspacechar(ch))
visibleChars++;
} else if (ch == '/' && chNext == '/') {
styler.ColourTo(i-1, state);
state = SCE_C_COMMENTLINE;
- } else if (ch == '\"') {
- styler.ColourTo(i-1, state);
- state = SCE_C_STRING;
} else if (ch == '\'') {
styler.ColourTo(i-1, state);
state = SCE_C_CHARACTER;
}
} else if (state == SCE_C_IDENTIFIER) {
if (!iswordchar(ch)) {
- int levelChange = classifyWordPascal(styler.GetStartSegment(), i - 1, keywords, styler);
+ int lStateChange = classifyWordPascal(styler.GetStartSegment(), i - 1, keywordlists, styler, bInClassDefinition);
+
+ if(lStateChange == 1) {
+ styler.SetLineState(currentLine, 1);
+ bInClassDefinition = true;
+ } else if(lStateChange == -1) {
+ styler.SetLineState(currentLine, 0);
+ bInClassDefinition = false;
+ }
+
state = SCE_C_DEFAULT;
chNext = styler.SafeGetCharAt(i + 1);
if (ch == '{' && chNext != '$' && chNext != '&') {
state = SCE_C_COMMENTDOC;
} else if (ch == '/' && chNext == '/') {
state = SCE_C_COMMENTLINE;
- } else if (ch == '\"') {
- state = SCE_C_STRING;
} else if (ch == '\'') {
state = SCE_C_CHARACTER;
} else if (isoperator(ch)) {
styler.ColourTo(i, SCE_C_OPERATOR);
}
- levelCurrent+=levelChange;
}
} else {
if (state == SCE_C_PREPROCESSOR) {
styler.ColourTo(i-1, state);
state = SCE_C_DEFAULT;
}
- } else if (state == SCE_C_STRING) {
- if (ch == '\\') {
- if (chNext == '\"' || chNext == '\'' || chNext == '\\') {
- i++;
- ch = chNext;
- chNext = styler.SafeGetCharAt(i + 1);
- }
- } else if (ch == '\"') {
- styler.ColourTo(i, state);
- state = SCE_C_DEFAULT;
- } else if (chNext == '\r' || chNext == '\n') {
- styler.ColourTo(i-1, SCE_C_STRINGEOL);
- state = SCE_C_STRINGEOL;
- }
} else if (state == SCE_C_CHARACTER) {
- if ((ch == '\r' || ch == '\n') && (chPrev != '\\')) {
+ if ((ch == '\r' || ch == '\n')) {
styler.ColourTo(i-1, SCE_C_STRINGEOL);
state = SCE_C_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_C_DEFAULT;
chPrev = ch;
}
styler.ColourTo(lengthDoc - 1, state);
+}
- // Fill in the real level of the next line, keeping the current flags as they will be filled in later
- if (fold) {
- int flagsNext = styler.LevelAt(lineCurrent) & ~SC_FOLDLEVELNUMBERMASK;
- styler.SetLevel(lineCurrent, levelPrev | flagsNext);
+static void FoldPascalDoc(unsigned int startPos, int length, int initStyle, WordList *[],
+ Accessor &styler) {
+ bool foldComment = styler.GetPropertyInt("fold.comment") != 0;
+ bool foldPreprocessor = styler.GetPropertyInt("fold.preprocessor") != 0;
+ bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0;
+ unsigned int endPos = startPos + length;
+ int visibleChars = 0;
+ int lineCurrent = styler.GetLine(startPos);
+ int levelPrev = styler.LevelAt(lineCurrent) & SC_FOLDLEVELNUMBERMASK;
+ int levelCurrent = levelPrev;
+ char chNext = styler[startPos];
+ int styleNext = styler.StyleAt(startPos);
+ int style = initStyle;
+
+ int lastStart = 0;
+
+ for (unsigned int i = startPos; i < endPos; i++) {
+ char ch = chNext;
+ chNext = styler.SafeGetCharAt(i + 1);
+ int stylePrev = style;
+ style = styleNext;
+ styleNext = styler.StyleAt(i + 1);
+ bool atEOL = (ch == '\r' && chNext != '\n') || (ch == '\n');
+
+ if (stylePrev == SCE_C_DEFAULT && style == SCE_C_WORD)
+ {
+ // Store last word start point.
+ lastStart = i;
+ }
+
+ if (stylePrev == SCE_C_WORD) {
+ if(iswordchar(ch) && !iswordchar(chNext)) {
+ char s[100];
+ getRange(lastStart, i, styler, s, sizeof(s));
+ levelCurrent += classifyFoldPointPascal(s);
+ }
+ }
+
+ if (foldComment && (style == SCE_C_COMMENTLINE)) {
+ if ((ch == '/') && (chNext == '/')) {
+ char chNext2 = styler.SafeGetCharAt(i + 2);
+ if (chNext2 == '{') {
+ levelCurrent++;
+ } else if (chNext2 == '}') {
+ levelCurrent--;
+ }
+ }
+ }
+
+ if (foldPreprocessor && (style == SCE_C_PREPROCESSOR)) {
+ if (ch == '{' && chNext == '$') {
+ unsigned int j=i+2; // skip {$
+ while ((j<endPos) && IsASpaceOrTab(styler.SafeGetCharAt(j))) {
+ j++;
+ }
+ if (styler.Match(j, "region") || styler.Match(j, "if")) {
+ levelCurrent++;
+ } else if (styler.Match(j, "end")) {
+ levelCurrent--;
+ }
+ }
+ }
+
+ if (foldComment && IsStreamCommentStyle(style)) {
+ if (!IsStreamCommentStyle(stylePrev)) {
+ levelCurrent++;
+ } else if (!IsStreamCommentStyle(styleNext) && !atEOL) {
+ // Comments don't end at end of line and the next character may be unstyled.
+ levelCurrent--;
+ }
+ }
+
+ if (atEOL) {
+ int lev = levelPrev;
+ if (visibleChars == 0 && foldCompact)
+ lev |= SC_FOLDLEVELWHITEFLAG;
+ if ((levelCurrent > levelPrev) && (visibleChars > 0))
+ lev |= SC_FOLDLEVELHEADERFLAG;
+ if (lev != styler.LevelAt(lineCurrent)) {
+ styler.SetLevel(lineCurrent, lev);
+ }
+ lineCurrent++;
+ levelPrev = levelCurrent;
+ visibleChars = 0;
+ }
+
+ if (!isspacechar(ch))
+ visibleChars++;
}
+
+ // Fill in the real level of the next line, keeping the current flags as they will be filled in later
+ int flagsNext = styler.LevelAt(lineCurrent) & ~SC_FOLDLEVELNUMBERMASK;
+ styler.SetLevel(lineCurrent, levelPrev | flagsNext);
}
-LexerModule lmPascal(SCLEX_PASCAL, ColourisePascalDoc, "pascal");
+LexerModule lmPascal(SCLEX_PASCAL, ColourisePascalDoc, "pascal", FoldPascalDoc);
// Check for a state end
if (sc.state == SCE_P_OPERATOR) {
kwLast = kwOther;
- sc.SetState(SCE_C_DEFAULT);
+ sc.SetState(SCE_P_DEFAULT);
} else if (sc.state == SCE_P_NUMBER) {
if (!IsAWordChar(sc.ch) &&
!(!hexadecimal && ((sc.ch == '+' || sc.ch == '-') && (sc.chPrev == 'e' || sc.chPrev == 'E')))) {
surface->DrawTextClipped(rc, fontForCharacter, rc.bottom - 2,
character, 1, fore.allocated, back.allocated);
+ } else if (markType == SC_MARK_DOTDOTDOT) {
+ int right = centreX - 6;
+ for (int b=0; b<3; b++) {
+ PRectangle rcBlob(right, rc.bottom - 4, right + 2, rc.bottom-2);
+ surface->FillRectangle(rcBlob, fore.allocated);
+ right += 5;
+ }
+ } else if (markType == SC_MARK_ARROWS) {
+ surface->PenColour(fore.allocated);
+ int right = centreX - 2;
+ for (int b=0; b<3; b++) {
+ surface->MoveTo(right - 4, centreY - 4);
+ surface->LineTo(right, centreY);
+ surface->LineTo(right - 5, centreY + 5);
+ right += 4;
+ }
} else { // SC_MARK_SHORTARROW
Point pts[] = {
Point(centreX, centreY + dimOn2),
return false;
}
-static bool iswordsep(char ch, bool onlyLineEnds) {
- if (!isspace(ch))
- return false;
- if (!onlyLineEnds)
- return true;
- return ch == '\r' || ch == '\n';
-}
-
/**
* Creates an array that points into each word in the string and puts \0 terminators
* after each word.
*/
static char **ArrayFromWordList(char *wordlist, int *len, bool onlyLineEnds = false) {
- char prev = '\n';
+ int prev = '\n';
int words = 0;
+ // For rapid determination of whether a character is a separator, build
+ // a look up table.
+ bool wordSeparator[256];
+ for (int i=0;i<256; i++) {
+ wordSeparator[i] = false;
+ }
+ wordSeparator['\r'] = true;
+ wordSeparator['\n'] = true;
+ if (!onlyLineEnds) {
+ wordSeparator[' '] = true;
+ wordSeparator['\t'] = true;
+ }
for (int j = 0; wordlist[j]; j++) {
- if (!iswordsep(wordlist[j], onlyLineEnds) && iswordsep(prev, onlyLineEnds))
+ int curr = static_cast<unsigned char>(wordlist[j]);
+ if (!wordSeparator[curr] && wordSeparator[prev])
words++;
- prev = wordlist[j];
+ prev = curr;
}
- char **keywords = new char * [words + 1];
+ char **keywords = new char *[words + 1];
if (keywords) {
words = 0;
prev = '\0';
size_t slen = strlen(wordlist);
for (size_t k = 0; k < slen; k++) {
- if (!iswordsep(wordlist[k], onlyLineEnds)) {
+ if (!wordSeparator[static_cast<unsigned char>(wordlist[k])]) {
if (!prev) {
keywords[words] = &wordlist[k];
words++;
* Modification history:
*
* $Log$
- * Revision 1.4 2002/09/06 16:58:12 RD
- * Updated to Scintilla from 1.45 to 1.47
+ * Revision 1.5 2002/09/11 00:55:27 RD
+ * Update to Scintilla 1.48
*
* Revision 1.6 2001/04/29 13:32:10 nyamatongwe
* Addition of new target methods - versions of ReplaceTarget that take counted
Editor::AddCharUTF(s, len, treatAsDBCS);
}
if (ac.Active()) {
- AutoCompleteChanged(s[0]);
- // For fill ups add the character after the autocompletion has
+ AutoCompleteCharacterAdded(s[0]);
+ // For fill ups add the character after the autocompletion has
// triggered so containers see the key so can display a calltip.
if (isFillUp) {
Editor::AddCharUTF(s, len, treatAsDBCS);
return 0;
case SCI_DELETEBACK:
DelCharBack(true);
- AutoCompleteChanged();
+ AutoCompleteCharacterDeleted();
EnsureCaretVisible();
return 0;
case SCI_DELETEBACKNOTLINE:
DelCharBack(false);
- AutoCompleteChanged();
+ AutoCompleteCharacterDeleted();
EnsureCaretVisible();
return 0;
case SCI_TAB:
// Make an allowance for large strings in list
rcList.left = pt.x - 5;
rcList.right = rcList.left + widthLB;
- if (((pt.y + vs.lineHeight) >= (rcClient.bottom - heightAlloced)) && // Wont fit below.
- ((pt.y + vs.lineHeight / 2) >= (rcClient.bottom + rcClient.top) / 2)) { // and there is more room above.
+ if (((pt.y + vs.lineHeight) >= (rcClient.bottom - heightAlloced)) && // Wont fit below.
+ ((pt.y + vs.lineHeight / 2) >= (rcClient.bottom + rcClient.top) / 2)) { // and there is more room above.
rcList.top = pt.y - heightAlloced;
} else {
rcList.top = pt.y + vs.lineHeight;
ac.Select(wordCurrent);
}
-void ScintillaBase::AutoCompleteChanged(char ch) {
+void ScintillaBase::AutoCompleteCharacterAdded(char ch) {
if (ac.IsFillUpChar(ch)) {
AutoCompleteCompleted();
- } else if (currentPos <= ac.posStart - ac.startLen) {
+ } else if (ac.IsStopChar(ch)) {
ac.Cancel();
- } else if (ac.cancelAtStartPos && currentPos <= ac.posStart) {
+ } else {
+ AutoCompleteMoveToCurrentWord();
+ }
+}
+
+void ScintillaBase::AutoCompleteCharacterDeleted() {
+ if (currentPos <= ac.posStart - ac.startLen) {
ac.Cancel();
- } else if (ac.IsStopChar(ch)) {
+ } else if (ac.cancelAtStartPos && (currentPos <= ac.posStart)) {
ac.Cancel();
} else {
AutoCompleteMoveToCurrentWord();
void AutoCompleteStart(int lenEntered, const char *list);
void AutoCompleteCancel();
void AutoCompleteMove(int delta);
- void AutoCompleteChanged(char ch=0);
+ void AutoCompleteCharacterAdded(char ch);
+ void AutoCompleteCharacterDeleted();
void AutoCompleteCompleted();
void AutoCompleteMoveToCurrentWord();
static void AutoCompleteDoubleClick(void* p);
selbackset = source.selbackset;
selbackground.desired = source.selbackground.desired;
selbackground2.desired = source.selbackground2.desired;
+ whitespaceForegroundSet = source.whitespaceForegroundSet;
+ whitespaceForeground.desired = source.whitespaceForeground.desired;
+ whitespaceBackgroundSet = source.whitespaceBackgroundSet;
+ whitespaceBackground.desired = source.whitespaceBackground.desired;
selbar.desired = source.selbar.desired;
selbarlight.desired = source.selbarlight.desired;
caretcolour.desired = source.caretcolour.desired;
selbackset = true;
selbackground.desired = ColourDesired(0xc0, 0xc0, 0xc0);
selbackground2.desired = ColourDesired(0xb0, 0xb0, 0xb0);
+ whitespaceForegroundSet = false;
+ whitespaceForeground.desired = ColourDesired(0, 0, 0);
+ whitespaceBackgroundSet = false;
+ whitespaceBackground.desired = ColourDesired(0xff, 0xff, 0xff);
selbar.desired = Platform::Chrome();
selbarlight.desired = Platform::ChromeHighlight();
styles[STYLE_LINENUMBER].fore.desired = ColourDesired(0, 0, 0);
pal.WantFind(selforeground, want);
pal.WantFind(selbackground, want);
pal.WantFind(selbackground2, want);
+ pal.WantFind(whitespaceForeground, want);
+ pal.WantFind(whitespaceBackground, want);
pal.WantFind(selbar, want);
pal.WantFind(selbarlight, want);
pal.WantFind(caretcolour, want);
bool selbackset;
ColourPair selbackground;
ColourPair selbackground2;
+ bool whitespaceForegroundSet;
+ ColourPair whitespaceForeground;
+ bool whitespaceBackgroundSet;
+ ColourPair whitespaceBackground;
ColourPair selbar;
ColourPair selbarlight;
/// Margins are ordered: Line Numbers, Selection Margin, Spacing Margin
return wxColourFromLong(c);
}
+// Set the foreground colour of all whitespace and whether to use this setting.
+void wxStyledTextCtrl::SetWhitespaceForeground(bool useSetting, const wxColour& fore) {
+ SendMsg(2084, useSetting, wxColourAsLong(fore));
+}
+
+// Set the background colour of all whitespace and whether to use this setting.
+void wxStyledTextCtrl::SetWhitespaceBackground(bool useSetting, const wxColour& back) {
+ SendMsg(2085, useSetting, wxColourAsLong(back));
+}
+
// Divide each styling byte into lexical class bits (default: 5) and indicator
// bits (default: 3). If a lexer requires more than 32 lexical states, then this
// is used to expand the possible states.
return SendMsg(2279, line, 0);
}
+// Move caret to first position on display line.
+void wxStyledTextCtrl::HomeDisplay() {
+ SendMsg(2345, 0, 0);
+}
+
+// Move caret to first position on display line extending selection to
+// new caret position.
+void wxStyledTextCtrl::HomeDisplayExtend() {
+ SendMsg(2346, 0, 0);
+}
+
+// Move caret to last position on display line.
+void wxStyledTextCtrl::LineEndDisplay() {
+ SendMsg(2347, 0, 0);
+}
+
+// Move caret to last position on display line extending selection to new
+// caret position.
+void wxStyledTextCtrl::LineEndDisplayExtend() {
+ SendMsg(2348, 0, 0);
+}
+
// Move the caret inside current view if it's not there already.
void wxStyledTextCtrl::MoveCaretInsideView() {
SendMsg(2401, 0, 0);
// Invisible mark that only sets the line background color.
#define wxSTC_MARK_BACKGROUND 22
+#define wxSTC_MARK_DOTDOTDOT 23
+#define wxSTC_MARK_ARROWS 24
#define wxSTC_MARK_CHARACTER 10000
// Markers used for outlining column.
// Delete the selection or if no selection, the character before the caret.
// Will not delete the character before at the start of a line.
#define wxSTC_CMD_DELETEBACKNOTLINE 2344
+
+// Move caret to first position on display line.
+#define wxSTC_CMD_HOMEDISPLAY 2345
+
+// Move caret to first position on display line extending selection to
+// new caret position.
+#define wxSTC_CMD_HOMEDISPLAYEXTEND 2346
+
+// Move caret to last position on display line.
+#define wxSTC_CMD_LINEENDDISPLAY 2347
+
+// Move caret to last position on display line extending selection to new
+// caret position.
+#define wxSTC_CMD_LINEENDDISPLAYEXTEND 2348
#define wxSTC_EDGE_NONE 0
#define wxSTC_EDGE_LINE 1
#define wxSTC_EDGE_BACKGROUND 2
// Retrieve the foreground colour of an indicator.
wxColour IndicatorGetForeground(int indic);
+ // Set the foreground colour of all whitespace and whether to use this setting.
+ void SetWhitespaceForeground(bool useSetting, const wxColour& fore);
+
+ // Set the background colour of all whitespace and whether to use this setting.
+ void SetWhitespaceBackground(bool useSetting, const wxColour& back);
+
// Divide each styling byte into lexical class bits (default: 5) and indicator
// bits (default: 3). If a lexer requires more than 32 lexical states, then this
// is used to expand the possible states.
// Retrieve the height of a particular line of text in pixels.
int TextHeight(int line);
+ // Move caret to first position on display line.
+ void HomeDisplay();
+
+ // Move caret to first position on display line extending selection to
+ // new caret position.
+ void HomeDisplayExtend();
+
+ // Move caret to last position on display line.
+ void LineEndDisplay();
+
+ // Move caret to last position on display line extending selection to new
+ // caret position.
+ void LineEndDisplayExtend();
+
// Move the caret inside current view if it's not there already.
void MoveCaretInsideView();
'IndicSetFore' : ('IndicatorSetForeground', 0, 0, 0),
'IndicGetFore' : ('IndicatorGetForeground', 0, 0, 0),
+ 'SetWhitespaceFore' : ('SetWhitespaceForeground', 0, 0, 0),
+ 'SetWhitespaceBack' : ('SetWhitespaceBackground', 0, 0, 0),
+
'AutoCShow' : ('AutoCompShow', 0, 0, 0),
'AutoCCancel' : ('AutoCompCancel', 0, 0, 0),
'AutoCActive' : ('AutoCompActive', 0, 0, 0),
'GetFocus' : ('GetSTCFocus', 0, 0, 0),
+
'' : ('', 0, 0, 0),
}
distribution. All other code needed to implement Scintilla on top of
wxWindows is located in the directory above this one.
-The current version of the Scintilla code is 1.47
+The current version of the Scintilla code is 1.48
#define SC_MARK_CIRCLEMINUS 20
#define SC_MARK_CIRCLEMINUSCONNECTED 21
#define SC_MARK_BACKGROUND 22
+#define SC_MARK_DOTDOTDOT 23
+#define SC_MARK_ARROWS 24
#define SC_MARK_CHARACTER 10000
#define SC_MARKNUM_FOLDEREND 25
#define SC_MARKNUM_FOLDEROPENMID 26
#define SCI_INDICGETSTYLE 2081
#define SCI_INDICSETFORE 2082
#define SCI_INDICGETFORE 2083
+#define SCI_SETWHITESPACEFORE 2084
+#define SCI_SETWHITESPACEBACK 2085
#define SCI_SETSTYLEBITS 2090
#define SCI_GETSTYLEBITS 2091
#define SCI_SETLINESTATE 2092
#define SCI_LINESCROLLDOWN 2342
#define SCI_LINESCROLLUP 2343
#define SCI_DELETEBACKNOTLINE 2344
+#define SCI_HOMEDISPLAY 2345
+#define SCI_HOMEDISPLAYEXTEND 2346
+#define SCI_LINEENDDISPLAY 2347
+#define SCI_LINEENDDISPLAYEXTEND 2348
#define SCI_MOVECARETINSIDEVIEW 2401
#define SCI_LINELENGTH 2350
#define SCI_BRACEHIGHLIGHT 2351
# Invisible mark that only sets the line background color.
val SC_MARK_BACKGROUND=22
+val SC_MARK_DOTDOTDOT=23
+val SC_MARK_ARROWS=24
val SC_MARK_CHARACTER=10000
# Retrieve the foreground colour of an indicator.
get colour IndicGetFore=2083(int indic,)
+# Set the foreground colour of all whitespace and whether to use this setting.
+fun void SetWhitespaceFore=2084(bool useSetting, colour fore)
+
+# Set the background colour of all whitespace and whether to use this setting.
+fun void SetWhitespaceBack=2085(bool useSetting, colour back)
+
# Divide each styling byte into lexical class bits (default: 5) and indicator
# bits (default: 3). If a lexer requires more than 32 lexical states, then this
# is used to expand the possible states.
# Will not delete the character before at the start of a line.
fun void DeleteBackNotLine=2344(,)
+# Move caret to first position on display line.
+fun void HomeDisplay=2345(,)
+
+# Move caret to first position on display line extending selection to
+# new caret position.
+fun void HomeDisplayExtend=2346(,)
+
+# Move caret to last position on display line.
+fun void LineEndDisplay=2347(,)
+
+# Move caret to last position on display line extending selection to new
+# caret position.
+fun void LineEndDisplayExtend=2348(,)
+
# Move the caret inside current view if it's not there already.
fun void MoveCaretInsideView=2401(,)
levels = 0;
sizeLevels = 0;
handleCurrent = 1;
+ growSize = 1000;
Init();
}
void LineVector::InsertValue(int pos, int value) {
//Platform::DebugPrintf("InsertValue[%d] = %d\n", pos, value);
if ((lines + 2) >= size) {
+ if (growSize * 6 < size)
+ growSize *= 2;
Expand(size + growSize);
if (levels) {
ExpandLevels(size + growSize);
*/
class LineVector {
public:
- enum { growSize = 4000 };
+ int growSize;
int lines;
LineData *linesData;
int size;
}
void Editor::InvalidateStyleRedraw() {
+ NeedWrapping();
InvalidateStyleData();
Redraw();
}
return pos;
}
-int Editor::MovePositionTo(int newPos, bool extend) {
+int Editor::MovePositionTo(int newPos, bool extend, bool ensureVisible) {
int delta = newPos - currentPos;
newPos = pdoc->ClampPositionIntoDocument(newPos);
newPos = MovePositionOutsideChar(newPos, delta);
} else {
SetEmptySelection(newPos);
}
- EnsureCaretVisible();
+ if (ensureVisible)
+ EnsureCaretVisible();
ShowCaretAtCurrentPosition();
NotifyMove(newPos);
return 0;
}
}
-void Editor::MoveCaretInsideView() {
+void Editor::MoveCaretInsideView(bool ensureVisible) {
PRectangle rcClient = GetTextRectangle();
Point pt = LocationFromPosition(currentPos);
if (pt.y < rcClient.top) {
MovePositionTo(PositionFromLocation(
- Point(lastXChosen, rcClient.top)));
+ Point(lastXChosen, rcClient.top)),
+ false, ensureVisible);
} else if ((pt.y + vs.lineHeight - 1) > rcClient.bottom) {
int yOfLastLineFullyDisplayed = rcClient.top + (LinesOnScreen() - 1) * vs.lineHeight;
MovePositionTo(PositionFromLocation(
- Point(lastXChosen, rcClient.top + yOfLastLineFullyDisplayed)));
+ Point(lastXChosen, rcClient.top + yOfLastLineFullyDisplayed)),
+ false, ensureVisible);
}
}
bool lastSegItalics = false;
Font &ctrlCharsFont = vstyle.styles[STYLE_CONTROLCHAR].font;
+ bool isControlNext = IsControlCharacter(ll->chars[0]);
for (int charInLine = 0; charInLine < numCharsInLine; charInLine++) {
+ bool isControl = isControlNext;
+ isControlNext = IsControlCharacter(ll->chars[charInLine + 1]);
if ((ll->styles[charInLine] != ll->styles[charInLine + 1]) ||
- IsControlCharacter(ll->chars[charInLine]) || IsControlCharacter(ll->chars[charInLine + 1])) {
+ isControl || isControlNext) {
ll->positions[startseg] = 0;
if (vstyle.styles[ll->styles[charInLine]].visible) {
- if (IsControlCharacter(ll->chars[charInLine])) {
+ if (isControl) {
if (ll->chars[charInLine] == '\t') {
ll->positions[charInLine + 1] = ((((startsegx + 2) /
tabWidth) + 1) * tabWidth) - startsegx;
}
lastSegItalics = false;
} else { // Regular character
- lastSegItalics = vstyle.styles[ll->styles[charInLine]].italic;
int lenSeg = charInLine - startseg + 1;
if ((lenSeg == 1) && (' ' == ll->chars[startseg])) {
+ lastSegItalics = false;
// Over half the segments are single characters and of these about half are space characters.
ll->positions[charInLine + 1] = vstyle.styles[ll->styles[charInLine]].spaceWidth;
} else {
+ lastSegItalics = vstyle.styles[ll->styles[charInLine]].italic;
surface->MeasureWidths(vstyle.styles[ll->styles[charInLine]].font, ll->chars + startseg,
lenSeg, ll->positions + startseg + 1);
}
rcSegment.right = ll->positions[i + 1] + xStart - subLineStart;
// Only try to draw if really visible - enhances performance by not calling environment to
// draw strings that are completely past the right side of the window.
- //if (rcSegment.left <= rcLine.right) {
if ((rcSegment.left <= rcLine.right) && (rcSegment.right >= rcLine.left)) {
int styleMain = ll->styles[i];
ColourAllocated textBack = vsDraw.styles[styleMain].back.allocated;
}
if (ll->chars[i] == '\t') {
// Manage tab display
+ if (!overrideBackground && vsDraw.whitespaceBackgroundSet && (vsDraw.viewWhitespace != wsInvisible) && (!inIndentation || vsDraw.viewWhitespace == wsVisibleAlways))
+ textBack = vsDraw.whitespaceBackground.allocated;
surface->FillRectangle(rcSegment, textBack);
if ((vsDraw.viewWhitespace != wsInvisible) || ((inIndentation && vsDraw.viewIndentationGuides))) {
+ if (vsDraw.whitespaceForegroundSet)
+ textFore = vsDraw.whitespaceForeground.allocated;
surface->PenColour(textFore);
}
if (inIndentation && vsDraw.viewIndentationGuides) {
for (int cpos = 0; cpos <= i - startseg; cpos++) {
if (ll->chars[cpos + startseg] == ' ') {
if (vsDraw.viewWhitespace != wsInvisible) {
+ if (vsDraw.whitespaceForegroundSet)
+ textFore = vsDraw.whitespaceForeground.allocated;
if (!inIndentation || vsDraw.viewWhitespace == wsVisibleAlways) {
int xmid = (ll->positions[cpos + startseg] + ll->positions[cpos + startseg + 1]) / 2;
+ if (!overrideBackground && vsDraw.whitespaceBackgroundSet) {
+ textBack = vsDraw.whitespaceBackground.allocated;
+ PRectangle rcSpace(ll->positions[cpos + startseg] + xStart, rcSegment.top, ll->positions[cpos + startseg + 1] + xStart, rcSegment.bottom);
+ surface->FillRectangle(rcSpace, textBack);
+ }
PRectangle rcDot(xmid + xStart - subLineStart, rcSegment.top + vsDraw.lineHeight / 2, 0, 0);
rcDot.right = rcDot.left + 1;
rcDot.bottom = rcDot.top + 1;
// Don't show the selection when printing
vsPrint.selbackset = false;
vsPrint.selforeset = false;
+ vsPrint.whitespaceBackgroundSet = false;
+ vsPrint.whitespaceForegroundSet = false;
vsPrint.showCaretLineBackground = false;
// Set colours for printing according to users settings
case SCI_LINESCROLLDOWN:
case SCI_LINESCROLLUP:
case SCI_DELETEBACKNOTLINE:
+ case SCI_HOMEDISPLAY:
+ case SCI_HOMEDISPLAYEXTEND:
+ case SCI_LINEENDDISPLAY:
+ case SCI_LINEENDDISPLAYEXTEND:
break;
// Filter out all others like display changes. Also, newlines are redundant
MovePositionTo(posNew, extend);
}
+int Editor::StartEndDisplayLine(int pos, bool start) {
+ RefreshStyleData();
+ int line = pdoc->LineFromPosition(pos);
+ AutoSurface surface(IsUnicodeMode());
+ LineLayout *ll = RetrieveLineLayout(line);
+ int posRet = INVALID_POSITION;
+ if (surface && ll) {
+ unsigned int posLineStart = pdoc->LineStart(line);
+ LayoutLine(line, surface, vs, ll, wrapWidth);
+ int posInLine = pos - posLineStart;
+ if (posInLine <= ll->maxLineLength) {
+ for (int subLine=0; subLine<ll->lines; subLine++) {
+ if ((posInLine >= ll->LineStart(subLine)) && (posInLine <= ll->LineStart(subLine+1))) {
+ if (start) {
+ posRet = ll->LineStart(subLine) + posLineStart;
+ } else {
+ if (subLine == ll->lines - 1)
+ posRet = ll->LineStart(subLine+1) + posLineStart;
+ else
+ posRet = ll->LineStart(subLine+1) + posLineStart - 1;
+ }
+ }
+ }
+ }
+ }
+ llc.Dispose(ll);
+ if (posRet == INVALID_POSITION) {
+ return pos;
+ } else {
+ return posRet;
+ }
+}
+
int Editor::KeyCommand(unsigned int iMessage) {
switch (iMessage) {
case SCI_LINEDOWN:
break;
case SCI_LINESCROLLDOWN:
ScrollTo(topLine + 1);
- MoveCaretInsideView();
+ MoveCaretInsideView(false);
break;
case SCI_LINEUP:
CursorUpOrDown(-1);
break;
case SCI_LINESCROLLUP:
ScrollTo(topLine - 1);
- MoveCaretInsideView();
+ MoveCaretInsideView(false);
break;
case SCI_CHARLEFT:
if (SelectionEmpty()) {
case SCI_ZOOMIN:
if (vs.zoomLevel < 20) {
vs.zoomLevel++;
- NeedWrapping();
InvalidateStyleRedraw();
NotifyZoom();
}
case SCI_ZOOMOUT:
if (vs.zoomLevel > -10) {
vs.zoomLevel--;
- NeedWrapping();
InvalidateStyleRedraw();
NotifyZoom();
}
MovePositionTo(MovePositionSoVisible(pdoc->WordPartRight(currentPos), 1), true);
SetLastXChosen();
break;
+ case SCI_HOMEDISPLAY:
+ MovePositionTo(MovePositionSoVisible(
+ StartEndDisplayLine(currentPos, true), -1));
+ SetLastXChosen();
+ break;
+ case SCI_HOMEDISPLAYEXTEND:
+ MovePositionTo(MovePositionSoVisible(
+ StartEndDisplayLine(currentPos, true), -1), true);
+ SetLastXChosen();
+ break;
+ case SCI_LINEENDDISPLAY:
+ MovePositionTo(MovePositionSoVisible(
+ StartEndDisplayLine(currentPos, false), 1));
+ SetLastXChosen();
+ break;
+ case SCI_LINEENDDISPLAYEXTEND:
+ MovePositionTo(MovePositionSoVisible(
+ StartEndDisplayLine(currentPos, false), 1), true);
+ SetLastXChosen();
+ break;
}
return 0;
}
case SCI_SETMARGINLEFT:
vs.leftMarginWidth = lParam;
- NeedWrapping();
InvalidateStyleRedraw();
break;
case SCI_SETMARGINRIGHT:
vs.rightMarginWidth = lParam;
- NeedWrapping();
InvalidateStyleRedraw();
break;
case SCI_SETWRAPMODE:
wrapState = (wParam == SC_WRAP_WORD) ? eWrapWord : eWrapNone;
- NeedWrapping();
xOffset = 0;
InvalidateStyleRedraw();
ReconfigureScrollBars();
case SCI_SETCODEPAGE:
pdoc->dbcsCodePage = wParam;
+ InvalidateStyleRedraw();
break;
case SCI_GETCODEPAGE:
case SCI_SETMARGINWIDTHN:
if (ValidMargin(wParam)) {
vs.ms[wParam].width = lParam;
- NeedWrapping();
InvalidateStyleRedraw();
}
break;
InvalidateStyleRedraw();
break;
+ case SCI_SETWHITESPACEFORE:
+ vs.whitespaceForegroundSet = wParam != 0;
+ vs.whitespaceForeground.desired = ColourDesired(lParam);
+ InvalidateStyleRedraw();
+ break;
+
+ case SCI_SETWHITESPACEBACK:
+ vs.whitespaceBackgroundSet = wParam != 0;
+ vs.whitespaceBackground.desired = ColourDesired(lParam);
+ InvalidateStyleRedraw();
+ break;
+
case SCI_SETCARETFORE:
vs.caretcolour.desired = ColourDesired(wParam);
InvalidateStyleRedraw();
case SCI_WORDPARTRIGHT:
case SCI_WORDPARTRIGHTEXTEND:
case SCI_DELETEBACKNOTLINE:
+ case SCI_HOMEDISPLAY:
+ case SCI_HOMEDISPLAYEXTEND:
+ case SCI_LINEENDDISPLAY:
+ case SCI_LINEENDDISPLAYEXTEND:
return KeyCommand(iMessage);
case SCI_BRACEHIGHLIGHT:
case SCI_SETZOOM:
vs.zoomLevel = wParam;
- NeedWrapping();
InvalidateStyleRedraw();
NotifyZoom();
break;
void SetSelection(int currentPos_);
void SetEmptySelection(int currentPos_);
int MovePositionOutsideChar(int pos, int moveDir, bool checkLineEnd=true);
- int MovePositionTo(int newPos, bool extend = false);
+ int MovePositionTo(int newPos, bool extend=false, bool ensureVisible=true);
int MovePositionSoVisible(int pos, int moveDir);
void SetLastXChosen();
void ScrollTo(int line);
virtual void ScrollText(int linesToMove);
void HorizontalScrollTo(int xPos);
- void MoveCaretInsideView();
+ void MoveCaretInsideView(bool ensureVisible=true);
int DisplayFromPosition(int pos);
void EnsureCaretVisible(bool useMargin=true, bool vert=true, bool horiz=true);
void ShowCaretAtCurrentPosition();
void PageMove(int direction, bool extend=false);
void ChangeCaseOfSelection(bool makeUpperCase);
void LineTranspose();
- virtual void CancelModes();
+ virtual void CancelModes();
void NewLine();
void CursorUpOrDown(int direction, bool extend=false);
+ int StartEndDisplayLine(int pos, bool start);
virtual int KeyCommand(unsigned int iMessage);
virtual int KeyDefault(int /* key */, int /*modifiers*/);
int KeyDown(int key, bool shift, bool ctrl, bool alt, bool *consumed=0);
{SCK_HOME, SCI_SHIFT, SCI_VCHOMEEXTEND},
{SCK_HOME, SCI_CTRL, SCI_DOCUMENTSTART},
{SCK_HOME, SCI_CSHIFT, SCI_DOCUMENTSTARTEXTEND},
+ {SCK_HOME, SCI_ALT, SCI_HOMEDISPLAY},
+ {SCK_HOME, SCI_ASHIFT, SCI_HOMEDISPLAYEXTEND},
{SCK_END, SCI_NORM, SCI_LINEEND},
{SCK_END, SCI_SHIFT, SCI_LINEENDEXTEND},
{SCK_END, SCI_CTRL, SCI_DOCUMENTEND},
{SCK_END, SCI_CSHIFT, SCI_DOCUMENTENDEXTEND},
+ {SCK_END, SCI_ALT, SCI_LINEENDDISPLAY},
+ {SCK_END, SCI_ASHIFT, SCI_LINEENDDISPLAYEXTEND},
{SCK_PRIOR, SCI_NORM, SCI_PAGEUP},
{SCK_PRIOR, SCI_SHIFT, SCI_PAGEUPEXTEND},
{SCK_NEXT, SCI_NORM, SCI_PAGEDOWN},
{SCK_TAB, SCI_NORM, SCI_TAB},
{SCK_TAB, SCI_SHIFT, SCI_BACKTAB},
{SCK_RETURN, SCI_NORM, SCI_NEWLINE},
+ {SCK_RETURN, SCI_SHIFT, SCI_NEWLINE},
{SCK_ADD, SCI_CTRL, SCI_ZOOMIN},
{SCK_SUBTRACT, SCI_CTRL, SCI_ZOOMOUT},
{SCK_DIVIDE, SCI_CTRL, SCI_SETZOOM},
sc.SetState(SCE_C_DEFAULT);
}
} else {
- if (sc.atLineEnd) {
+ if ((sc.atLineEnd) || (sc.Match('/', '*')) || (sc.Match('/', '/'))) {
sc.SetState(SCE_C_DEFAULT);
}
}
if (lineBuffer[0] == '>') {
// Command or return status
styler.ColourTo(endPos, SCE_ERR_CMD);
+ } else if (lineBuffer[0] == '<') {
+ // Diff removal, but not interested. Trapped to avoid hitting CTAG cases.
+ styler.ColourTo(endPos, SCE_ERR_DEFAULT);
} else if (lineBuffer[0] == '!') {
styler.ColourTo(endPos, SCE_ERR_DIFF_CHANGED);
} else if (lineBuffer[0] == '+') {
break;
} else if (((state == 11) || (state == 14)) && !((lineBuffer[i] == ' ') || isdigit(lineBuffer[i]))) {
state = 99;
- } else if ((state == 20) && isdigit(lineBuffer[i])) {
+ } else if ((state == 20) && (lineBuffer[i-1] == '\t') &&
+ ((lineBuffer[i] == '/' && lineBuffer[i+1] == '^') || isdigit(lineBuffer[i]))) {
state = 24;
break;
} else if ((state == 20) && ((lineBuffer[i] == '/') && (lineBuffer[i+1] == '^'))) {
/** @file LexPascal.cxx
** Lexer for Pascal.
** Written by Laurent le Tynevez
+ ** Updated by Simon Steele <s.steele@pnotepad.org> September 2002
**/
#include <stdlib.h>
#include "KeyWords.h"
#include "Scintilla.h"
#include "SciLexer.h"
+#include "StyleContext.h"
-static int classifyWordPascal(unsigned int start, unsigned int end, WordList &keywords, Accessor &styler) {
- char s[100];
- for (unsigned int i = 0; i < end - start + 1 && i < 30; i++) {
+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] = static_cast<char>(tolower(styler[start + i]));
- s[i + 1] = '\0';
+ i++;
}
- int lev= 0;
+ s[i] = '\0';
+}
+
+static bool IsStreamCommentStyle(int style) {
+ return style == SCE_C_COMMENT ||
+ style == SCE_C_COMMENTDOC ||
+ style == SCE_C_COMMENTDOCKEYWORD ||
+ style == SCE_C_COMMENTDOCKEYWORDERROR;
+}
+
+static inline bool IsAWordChar(const int ch) {
+ return (ch < 0x80) && (isalnum(ch) || ch == '.' || ch == '_');
+}
+
+// returns 1 if the item starts a class definition, and -1 if the word is "end".
+static int classifyWordPascal(unsigned int start, unsigned int end, /*WordList &keywords*/WordList *keywordlists[], Accessor &styler, bool bInClass) {
+ int ret = 0;
+
+ WordList& keywords = *keywordlists[0];
+ WordList& classwords = *keywordlists[1];
+
+ char s[100];
+ getRange(start, end, styler, s, sizeof(s));
+
char chAttr = SCE_C_IDENTIFIER;
- if (isdigit(s[0]) || (s[0] == '.')){
+ if (isdigit(s[0]) || (s[0] == '.')) {
chAttr = SCE_C_NUMBER;
}
else {
if (keywords.InList(s)) {
chAttr = SCE_C_WORD;
- if (strcmp(s, "begin") == 0 || strcmp(s, "object") == 0)
- lev=1;
- else if (strcmp(s, "end") == 0)
- lev=-1;
+
+ if(strcmp(s, "class") == 0)
+ ret = 1;
+ else if(strcmp(s, "end") == 0)
+ ret = -1;
+ } else if (bInClass) {
+ if (classwords.InList(s)) {
+ chAttr = SCE_C_WORD;
+ }
}
}
styler.ColourTo(end, chAttr);
+ return ret;
+}
+
+static int classifyFoldPointPascal(const char* s) {
+ int lev = 0;
+ if (!(isdigit(s[0]) || (s[0] == '.'))) {
+ if (strcmp(s, "begin") == 0 ||
+ strcmp(s, "object") == 0 ||
+ strcmp(s, "case") == 0 ||
+ strcmp(s, "class") == 0 ||
+ strcmp(s, "record") == 0 ||
+ strcmp(s, "try") == 0) {
+ lev=1;
+ } else if (strcmp(s, "end") == 0) {
+ lev=-1;
+ }
+ }
return lev;
}
static void ColourisePascalDoc(unsigned int startPos, int length, int initStyle, WordList *keywordlists[],
Accessor &styler) {
- WordList &keywords = *keywordlists[0];
styler.StartAt(startPos);
- bool fold = styler.GetPropertyInt("fold") != 0;
- int lineCurrent = styler.GetLine(startPos);
- int levelPrev = styler.LevelAt(lineCurrent) & SC_FOLDLEVELNUMBERMASK;
- int levelCurrent = levelPrev;
-
int state = initStyle;
if (state == SCE_C_STRINGEOL) // Does not leak onto next line
state = SCE_C_DEFAULT;
char chNext = styler[startPos];
unsigned int lengthDoc = startPos + length;
int visibleChars = 0;
+
+ bool bInClassDefinition;
+ int currentLine = styler.GetLine(startPos);
+ if (currentLine > 0) {
+ styler.SetLineState(currentLine, styler.GetLineState(currentLine-1));
+ bInClassDefinition = (styler.GetLineState(currentLine) == 1);
+ } else {
+ styler.SetLineState(currentLine, 0);
+ bInClassDefinition = false;
+ }
+
styler.StartSegment(startPos);
for (unsigned int i = startPos; i < lengthDoc; i++) {
char ch = chNext;
+
chNext = styler.SafeGetCharAt(i + 1);
if ((ch == '\r' && chNext != '\n') || (ch == '\n')) {
styler.ColourTo(i, state);
state = SCE_C_DEFAULT;
}
- if (fold) {
- int lev = levelPrev;
- if (visibleChars == 0)
- lev |= SC_FOLDLEVELWHITEFLAG;
- if ((levelCurrent > levelPrev) && (visibleChars > 0))
- lev |= SC_FOLDLEVELHEADERFLAG;
- styler.SetLevel(lineCurrent, lev);
- lineCurrent++;
- levelPrev = levelCurrent;
- }
visibleChars = 0;
+ currentLine++;
+ styler.SetLineState(currentLine, (bInClassDefinition ? 1 : 0));
}
if (!isspacechar(ch))
visibleChars++;
} else if (ch == '/' && chNext == '/') {
styler.ColourTo(i-1, state);
state = SCE_C_COMMENTLINE;
- } else if (ch == '\"') {
- styler.ColourTo(i-1, state);
- state = SCE_C_STRING;
} else if (ch == '\'') {
styler.ColourTo(i-1, state);
state = SCE_C_CHARACTER;
}
} else if (state == SCE_C_IDENTIFIER) {
if (!iswordchar(ch)) {
- int levelChange = classifyWordPascal(styler.GetStartSegment(), i - 1, keywords, styler);
+ int lStateChange = classifyWordPascal(styler.GetStartSegment(), i - 1, keywordlists, styler, bInClassDefinition);
+
+ if(lStateChange == 1) {
+ styler.SetLineState(currentLine, 1);
+ bInClassDefinition = true;
+ } else if(lStateChange == -1) {
+ styler.SetLineState(currentLine, 0);
+ bInClassDefinition = false;
+ }
+
state = SCE_C_DEFAULT;
chNext = styler.SafeGetCharAt(i + 1);
if (ch == '{' && chNext != '$' && chNext != '&') {
state = SCE_C_COMMENTDOC;
} else if (ch == '/' && chNext == '/') {
state = SCE_C_COMMENTLINE;
- } else if (ch == '\"') {
- state = SCE_C_STRING;
} else if (ch == '\'') {
state = SCE_C_CHARACTER;
} else if (isoperator(ch)) {
styler.ColourTo(i, SCE_C_OPERATOR);
}
- levelCurrent+=levelChange;
}
} else {
if (state == SCE_C_PREPROCESSOR) {
styler.ColourTo(i-1, state);
state = SCE_C_DEFAULT;
}
- } else if (state == SCE_C_STRING) {
- if (ch == '\\') {
- if (chNext == '\"' || chNext == '\'' || chNext == '\\') {
- i++;
- ch = chNext;
- chNext = styler.SafeGetCharAt(i + 1);
- }
- } else if (ch == '\"') {
- styler.ColourTo(i, state);
- state = SCE_C_DEFAULT;
- } else if (chNext == '\r' || chNext == '\n') {
- styler.ColourTo(i-1, SCE_C_STRINGEOL);
- state = SCE_C_STRINGEOL;
- }
} else if (state == SCE_C_CHARACTER) {
- if ((ch == '\r' || ch == '\n') && (chPrev != '\\')) {
+ if ((ch == '\r' || ch == '\n')) {
styler.ColourTo(i-1, SCE_C_STRINGEOL);
state = SCE_C_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_C_DEFAULT;
chPrev = ch;
}
styler.ColourTo(lengthDoc - 1, state);
+}
- // Fill in the real level of the next line, keeping the current flags as they will be filled in later
- if (fold) {
- int flagsNext = styler.LevelAt(lineCurrent) & ~SC_FOLDLEVELNUMBERMASK;
- styler.SetLevel(lineCurrent, levelPrev | flagsNext);
+static void FoldPascalDoc(unsigned int startPos, int length, int initStyle, WordList *[],
+ Accessor &styler) {
+ bool foldComment = styler.GetPropertyInt("fold.comment") != 0;
+ bool foldPreprocessor = styler.GetPropertyInt("fold.preprocessor") != 0;
+ bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0;
+ unsigned int endPos = startPos + length;
+ int visibleChars = 0;
+ int lineCurrent = styler.GetLine(startPos);
+ int levelPrev = styler.LevelAt(lineCurrent) & SC_FOLDLEVELNUMBERMASK;
+ int levelCurrent = levelPrev;
+ char chNext = styler[startPos];
+ int styleNext = styler.StyleAt(startPos);
+ int style = initStyle;
+
+ int lastStart = 0;
+
+ for (unsigned int i = startPos; i < endPos; i++) {
+ char ch = chNext;
+ chNext = styler.SafeGetCharAt(i + 1);
+ int stylePrev = style;
+ style = styleNext;
+ styleNext = styler.StyleAt(i + 1);
+ bool atEOL = (ch == '\r' && chNext != '\n') || (ch == '\n');
+
+ if (stylePrev == SCE_C_DEFAULT && style == SCE_C_WORD)
+ {
+ // Store last word start point.
+ lastStart = i;
+ }
+
+ if (stylePrev == SCE_C_WORD) {
+ if(iswordchar(ch) && !iswordchar(chNext)) {
+ char s[100];
+ getRange(lastStart, i, styler, s, sizeof(s));
+ levelCurrent += classifyFoldPointPascal(s);
+ }
+ }
+
+ if (foldComment && (style == SCE_C_COMMENTLINE)) {
+ if ((ch == '/') && (chNext == '/')) {
+ char chNext2 = styler.SafeGetCharAt(i + 2);
+ if (chNext2 == '{') {
+ levelCurrent++;
+ } else if (chNext2 == '}') {
+ levelCurrent--;
+ }
+ }
+ }
+
+ if (foldPreprocessor && (style == SCE_C_PREPROCESSOR)) {
+ if (ch == '{' && chNext == '$') {
+ unsigned int j=i+2; // skip {$
+ while ((j<endPos) && IsASpaceOrTab(styler.SafeGetCharAt(j))) {
+ j++;
+ }
+ if (styler.Match(j, "region") || styler.Match(j, "if")) {
+ levelCurrent++;
+ } else if (styler.Match(j, "end")) {
+ levelCurrent--;
+ }
+ }
+ }
+
+ if (foldComment && IsStreamCommentStyle(style)) {
+ if (!IsStreamCommentStyle(stylePrev)) {
+ levelCurrent++;
+ } else if (!IsStreamCommentStyle(styleNext) && !atEOL) {
+ // Comments don't end at end of line and the next character may be unstyled.
+ levelCurrent--;
+ }
+ }
+
+ if (atEOL) {
+ int lev = levelPrev;
+ if (visibleChars == 0 && foldCompact)
+ lev |= SC_FOLDLEVELWHITEFLAG;
+ if ((levelCurrent > levelPrev) && (visibleChars > 0))
+ lev |= SC_FOLDLEVELHEADERFLAG;
+ if (lev != styler.LevelAt(lineCurrent)) {
+ styler.SetLevel(lineCurrent, lev);
+ }
+ lineCurrent++;
+ levelPrev = levelCurrent;
+ visibleChars = 0;
+ }
+
+ if (!isspacechar(ch))
+ visibleChars++;
}
+
+ // Fill in the real level of the next line, keeping the current flags as they will be filled in later
+ int flagsNext = styler.LevelAt(lineCurrent) & ~SC_FOLDLEVELNUMBERMASK;
+ styler.SetLevel(lineCurrent, levelPrev | flagsNext);
}
-LexerModule lmPascal(SCLEX_PASCAL, ColourisePascalDoc, "pascal");
+LexerModule lmPascal(SCLEX_PASCAL, ColourisePascalDoc, "pascal", FoldPascalDoc);
// Check for a state end
if (sc.state == SCE_P_OPERATOR) {
kwLast = kwOther;
- sc.SetState(SCE_C_DEFAULT);
+ sc.SetState(SCE_P_DEFAULT);
} else if (sc.state == SCE_P_NUMBER) {
if (!IsAWordChar(sc.ch) &&
!(!hexadecimal && ((sc.ch == '+' || sc.ch == '-') && (sc.chPrev == 'e' || sc.chPrev == 'E')))) {
surface->DrawTextClipped(rc, fontForCharacter, rc.bottom - 2,
character, 1, fore.allocated, back.allocated);
+ } else if (markType == SC_MARK_DOTDOTDOT) {
+ int right = centreX - 6;
+ for (int b=0; b<3; b++) {
+ PRectangle rcBlob(right, rc.bottom - 4, right + 2, rc.bottom-2);
+ surface->FillRectangle(rcBlob, fore.allocated);
+ right += 5;
+ }
+ } else if (markType == SC_MARK_ARROWS) {
+ surface->PenColour(fore.allocated);
+ int right = centreX - 2;
+ for (int b=0; b<3; b++) {
+ surface->MoveTo(right - 4, centreY - 4);
+ surface->LineTo(right, centreY);
+ surface->LineTo(right - 5, centreY + 5);
+ right += 4;
+ }
} else { // SC_MARK_SHORTARROW
Point pts[] = {
Point(centreX, centreY + dimOn2),
return false;
}
-static bool iswordsep(char ch, bool onlyLineEnds) {
- if (!isspace(ch))
- return false;
- if (!onlyLineEnds)
- return true;
- return ch == '\r' || ch == '\n';
-}
-
/**
* Creates an array that points into each word in the string and puts \0 terminators
* after each word.
*/
static char **ArrayFromWordList(char *wordlist, int *len, bool onlyLineEnds = false) {
- char prev = '\n';
+ int prev = '\n';
int words = 0;
+ // For rapid determination of whether a character is a separator, build
+ // a look up table.
+ bool wordSeparator[256];
+ for (int i=0;i<256; i++) {
+ wordSeparator[i] = false;
+ }
+ wordSeparator['\r'] = true;
+ wordSeparator['\n'] = true;
+ if (!onlyLineEnds) {
+ wordSeparator[' '] = true;
+ wordSeparator['\t'] = true;
+ }
for (int j = 0; wordlist[j]; j++) {
- if (!iswordsep(wordlist[j], onlyLineEnds) && iswordsep(prev, onlyLineEnds))
+ int curr = static_cast<unsigned char>(wordlist[j]);
+ if (!wordSeparator[curr] && wordSeparator[prev])
words++;
- prev = wordlist[j];
+ prev = curr;
}
- char **keywords = new char * [words + 1];
+ char **keywords = new char *[words + 1];
if (keywords) {
words = 0;
prev = '\0';
size_t slen = strlen(wordlist);
for (size_t k = 0; k < slen; k++) {
- if (!iswordsep(wordlist[k], onlyLineEnds)) {
+ if (!wordSeparator[static_cast<unsigned char>(wordlist[k])]) {
if (!prev) {
keywords[words] = &wordlist[k];
words++;
* Modification history:
*
* $Log$
- * Revision 1.4 2002/09/06 16:58:12 RD
- * Updated to Scintilla from 1.45 to 1.47
+ * Revision 1.5 2002/09/11 00:55:27 RD
+ * Update to Scintilla 1.48
*
* Revision 1.6 2001/04/29 13:32:10 nyamatongwe
* Addition of new target methods - versions of ReplaceTarget that take counted
Editor::AddCharUTF(s, len, treatAsDBCS);
}
if (ac.Active()) {
- AutoCompleteChanged(s[0]);
- // For fill ups add the character after the autocompletion has
+ AutoCompleteCharacterAdded(s[0]);
+ // For fill ups add the character after the autocompletion has
// triggered so containers see the key so can display a calltip.
if (isFillUp) {
Editor::AddCharUTF(s, len, treatAsDBCS);
return 0;
case SCI_DELETEBACK:
DelCharBack(true);
- AutoCompleteChanged();
+ AutoCompleteCharacterDeleted();
EnsureCaretVisible();
return 0;
case SCI_DELETEBACKNOTLINE:
DelCharBack(false);
- AutoCompleteChanged();
+ AutoCompleteCharacterDeleted();
EnsureCaretVisible();
return 0;
case SCI_TAB:
// Make an allowance for large strings in list
rcList.left = pt.x - 5;
rcList.right = rcList.left + widthLB;
- if (((pt.y + vs.lineHeight) >= (rcClient.bottom - heightAlloced)) && // Wont fit below.
- ((pt.y + vs.lineHeight / 2) >= (rcClient.bottom + rcClient.top) / 2)) { // and there is more room above.
+ if (((pt.y + vs.lineHeight) >= (rcClient.bottom - heightAlloced)) && // Wont fit below.
+ ((pt.y + vs.lineHeight / 2) >= (rcClient.bottom + rcClient.top) / 2)) { // and there is more room above.
rcList.top = pt.y - heightAlloced;
} else {
rcList.top = pt.y + vs.lineHeight;
ac.Select(wordCurrent);
}
-void ScintillaBase::AutoCompleteChanged(char ch) {
+void ScintillaBase::AutoCompleteCharacterAdded(char ch) {
if (ac.IsFillUpChar(ch)) {
AutoCompleteCompleted();
- } else if (currentPos <= ac.posStart - ac.startLen) {
+ } else if (ac.IsStopChar(ch)) {
ac.Cancel();
- } else if (ac.cancelAtStartPos && currentPos <= ac.posStart) {
+ } else {
+ AutoCompleteMoveToCurrentWord();
+ }
+}
+
+void ScintillaBase::AutoCompleteCharacterDeleted() {
+ if (currentPos <= ac.posStart - ac.startLen) {
ac.Cancel();
- } else if (ac.IsStopChar(ch)) {
+ } else if (ac.cancelAtStartPos && (currentPos <= ac.posStart)) {
ac.Cancel();
} else {
AutoCompleteMoveToCurrentWord();
void AutoCompleteStart(int lenEntered, const char *list);
void AutoCompleteCancel();
void AutoCompleteMove(int delta);
- void AutoCompleteChanged(char ch=0);
+ void AutoCompleteCharacterAdded(char ch);
+ void AutoCompleteCharacterDeleted();
void AutoCompleteCompleted();
void AutoCompleteMoveToCurrentWord();
static void AutoCompleteDoubleClick(void* p);
selbackset = source.selbackset;
selbackground.desired = source.selbackground.desired;
selbackground2.desired = source.selbackground2.desired;
+ whitespaceForegroundSet = source.whitespaceForegroundSet;
+ whitespaceForeground.desired = source.whitespaceForeground.desired;
+ whitespaceBackgroundSet = source.whitespaceBackgroundSet;
+ whitespaceBackground.desired = source.whitespaceBackground.desired;
selbar.desired = source.selbar.desired;
selbarlight.desired = source.selbarlight.desired;
caretcolour.desired = source.caretcolour.desired;
selbackset = true;
selbackground.desired = ColourDesired(0xc0, 0xc0, 0xc0);
selbackground2.desired = ColourDesired(0xb0, 0xb0, 0xb0);
+ whitespaceForegroundSet = false;
+ whitespaceForeground.desired = ColourDesired(0, 0, 0);
+ whitespaceBackgroundSet = false;
+ whitespaceBackground.desired = ColourDesired(0xff, 0xff, 0xff);
selbar.desired = Platform::Chrome();
selbarlight.desired = Platform::ChromeHighlight();
styles[STYLE_LINENUMBER].fore.desired = ColourDesired(0, 0, 0);
pal.WantFind(selforeground, want);
pal.WantFind(selbackground, want);
pal.WantFind(selbackground2, want);
+ pal.WantFind(whitespaceForeground, want);
+ pal.WantFind(whitespaceBackground, want);
pal.WantFind(selbar, want);
pal.WantFind(selbarlight, want);
pal.WantFind(caretcolour, want);
bool selbackset;
ColourPair selbackground;
ColourPair selbackground2;
+ bool whitespaceForegroundSet;
+ ColourPair whitespaceForeground;
+ bool whitespaceBackgroundSet;
+ ColourPair whitespaceBackground;
ColourPair selbar;
ColourPair selbarlight;
/// Margins are ordered: Line Numbers, Selection Margin, Spacing Margin
return wxColourFromLong(c);
}
+// Set the foreground colour of all whitespace and whether to use this setting.
+void wxStyledTextCtrl::SetWhitespaceForeground(bool useSetting, const wxColour& fore) {
+ SendMsg(2084, useSetting, wxColourAsLong(fore));
+}
+
+// Set the background colour of all whitespace and whether to use this setting.
+void wxStyledTextCtrl::SetWhitespaceBackground(bool useSetting, const wxColour& back) {
+ SendMsg(2085, useSetting, wxColourAsLong(back));
+}
+
// Divide each styling byte into lexical class bits (default: 5) and indicator
// bits (default: 3). If a lexer requires more than 32 lexical states, then this
// is used to expand the possible states.
return SendMsg(2279, line, 0);
}
+// Move caret to first position on display line.
+void wxStyledTextCtrl::HomeDisplay() {
+ SendMsg(2345, 0, 0);
+}
+
+// Move caret to first position on display line extending selection to
+// new caret position.
+void wxStyledTextCtrl::HomeDisplayExtend() {
+ SendMsg(2346, 0, 0);
+}
+
+// Move caret to last position on display line.
+void wxStyledTextCtrl::LineEndDisplay() {
+ SendMsg(2347, 0, 0);
+}
+
+// Move caret to last position on display line extending selection to new
+// caret position.
+void wxStyledTextCtrl::LineEndDisplayExtend() {
+ SendMsg(2348, 0, 0);
+}
+
// Move the caret inside current view if it's not there already.
void wxStyledTextCtrl::MoveCaretInsideView() {
SendMsg(2401, 0, 0);
Added wxBufferedDC.
Upgraded wxSTC from Scintilla 1.40 to Scintilla 1.45, and then again
-to version 1.47.
+to version 1.47, and one more time to 1.48! <wink>
UNICODE!
wxWindows/wxPython can be compiled with unicode support enabled or
elseiff "%1" == "b" then
shift
set CMD=echo Finished!
- call b.bat %VER% h %1 %2 %3 %4 %5 %6 %7 %8 %9
call b.bat %VER% %1 %2 %3 %4 %5 %6 %7 %8 %9
+ call b.bat %VER% h %1 %2 %3 %4 %5 %6 %7 %8 %9
rem (no command arg) --> normal build for development
else
return _resultobj;
}
+#define wxStyledTextCtrl_SetWhitespaceForeground(_swigobj,_swigarg0,_swigarg1) (_swigobj->SetWhitespaceForeground(_swigarg0,_swigarg1))
+static PyObject *_wrap_wxStyledTextCtrl_SetWhitespaceForeground(PyObject *self, PyObject *args, PyObject *kwargs) {
+ PyObject * _resultobj;
+ wxStyledTextCtrl * _arg0;
+ bool _arg1;
+ wxColour * _arg2;
+ PyObject * _argo0 = 0;
+ int tempbool1;
+ wxColour temp;
+ PyObject * _obj2 = 0;
+ char *_kwnames[] = { "self","useSetting","fore", NULL };
+
+ self = self;
+ if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OiO:wxStyledTextCtrl_SetWhitespaceForeground",_kwnames,&_argo0,&tempbool1,&_obj2))
+ return NULL;
+ if (_argo0) {
+ if (_argo0 == Py_None) { _arg0 = NULL; }
+ else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) {
+ PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_SetWhitespaceForeground. Expected _wxStyledTextCtrl_p.");
+ return NULL;
+ }
+ }
+ _arg1 = (bool ) tempbool1;
+{
+ _arg2 = &temp;
+ if (! wxColour_helper(_obj2, &_arg2))
+ return NULL;
+}
+{
+ PyThreadState* __tstate = wxPyBeginAllowThreads();
+ wxStyledTextCtrl_SetWhitespaceForeground(_arg0,_arg1,*_arg2);
+
+ wxPyEndAllowThreads(__tstate);
+ if (PyErr_Occurred()) return NULL;
+} Py_INCREF(Py_None);
+ _resultobj = Py_None;
+ return _resultobj;
+}
+
+#define wxStyledTextCtrl_SetWhitespaceBackground(_swigobj,_swigarg0,_swigarg1) (_swigobj->SetWhitespaceBackground(_swigarg0,_swigarg1))
+static PyObject *_wrap_wxStyledTextCtrl_SetWhitespaceBackground(PyObject *self, PyObject *args, PyObject *kwargs) {
+ PyObject * _resultobj;
+ wxStyledTextCtrl * _arg0;
+ bool _arg1;
+ wxColour * _arg2;
+ PyObject * _argo0 = 0;
+ int tempbool1;
+ wxColour temp;
+ PyObject * _obj2 = 0;
+ char *_kwnames[] = { "self","useSetting","back", NULL };
+
+ self = self;
+ if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OiO:wxStyledTextCtrl_SetWhitespaceBackground",_kwnames,&_argo0,&tempbool1,&_obj2))
+ return NULL;
+ if (_argo0) {
+ if (_argo0 == Py_None) { _arg0 = NULL; }
+ else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) {
+ PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_SetWhitespaceBackground. Expected _wxStyledTextCtrl_p.");
+ return NULL;
+ }
+ }
+ _arg1 = (bool ) tempbool1;
+{
+ _arg2 = &temp;
+ if (! wxColour_helper(_obj2, &_arg2))
+ return NULL;
+}
+{
+ PyThreadState* __tstate = wxPyBeginAllowThreads();
+ wxStyledTextCtrl_SetWhitespaceBackground(_arg0,_arg1,*_arg2);
+
+ wxPyEndAllowThreads(__tstate);
+ if (PyErr_Occurred()) return NULL;
+} Py_INCREF(Py_None);
+ _resultobj = Py_None;
+ return _resultobj;
+}
+
#define wxStyledTextCtrl_SetStyleBits(_swigobj,_swigarg0) (_swigobj->SetStyleBits(_swigarg0))
static PyObject *_wrap_wxStyledTextCtrl_SetStyleBits(PyObject *self, PyObject *args, PyObject *kwargs) {
PyObject * _resultobj;
return _resultobj;
}
+#define wxStyledTextCtrl_HomeDisplay(_swigobj) (_swigobj->HomeDisplay())
+static PyObject *_wrap_wxStyledTextCtrl_HomeDisplay(PyObject *self, PyObject *args, PyObject *kwargs) {
+ PyObject * _resultobj;
+ wxStyledTextCtrl * _arg0;
+ PyObject * _argo0 = 0;
+ char *_kwnames[] = { "self", NULL };
+
+ self = self;
+ if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxStyledTextCtrl_HomeDisplay",_kwnames,&_argo0))
+ return NULL;
+ if (_argo0) {
+ if (_argo0 == Py_None) { _arg0 = NULL; }
+ else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) {
+ PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_HomeDisplay. Expected _wxStyledTextCtrl_p.");
+ return NULL;
+ }
+ }
+{
+ PyThreadState* __tstate = wxPyBeginAllowThreads();
+ wxStyledTextCtrl_HomeDisplay(_arg0);
+
+ wxPyEndAllowThreads(__tstate);
+ if (PyErr_Occurred()) return NULL;
+} Py_INCREF(Py_None);
+ _resultobj = Py_None;
+ return _resultobj;
+}
+
+#define wxStyledTextCtrl_HomeDisplayExtend(_swigobj) (_swigobj->HomeDisplayExtend())
+static PyObject *_wrap_wxStyledTextCtrl_HomeDisplayExtend(PyObject *self, PyObject *args, PyObject *kwargs) {
+ PyObject * _resultobj;
+ wxStyledTextCtrl * _arg0;
+ PyObject * _argo0 = 0;
+ char *_kwnames[] = { "self", NULL };
+
+ self = self;
+ if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxStyledTextCtrl_HomeDisplayExtend",_kwnames,&_argo0))
+ return NULL;
+ if (_argo0) {
+ if (_argo0 == Py_None) { _arg0 = NULL; }
+ else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) {
+ PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_HomeDisplayExtend. Expected _wxStyledTextCtrl_p.");
+ return NULL;
+ }
+ }
+{
+ PyThreadState* __tstate = wxPyBeginAllowThreads();
+ wxStyledTextCtrl_HomeDisplayExtend(_arg0);
+
+ wxPyEndAllowThreads(__tstate);
+ if (PyErr_Occurred()) return NULL;
+} Py_INCREF(Py_None);
+ _resultobj = Py_None;
+ return _resultobj;
+}
+
+#define wxStyledTextCtrl_LineEndDisplay(_swigobj) (_swigobj->LineEndDisplay())
+static PyObject *_wrap_wxStyledTextCtrl_LineEndDisplay(PyObject *self, PyObject *args, PyObject *kwargs) {
+ PyObject * _resultobj;
+ wxStyledTextCtrl * _arg0;
+ PyObject * _argo0 = 0;
+ char *_kwnames[] = { "self", NULL };
+
+ self = self;
+ if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxStyledTextCtrl_LineEndDisplay",_kwnames,&_argo0))
+ return NULL;
+ if (_argo0) {
+ if (_argo0 == Py_None) { _arg0 = NULL; }
+ else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) {
+ PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_LineEndDisplay. Expected _wxStyledTextCtrl_p.");
+ return NULL;
+ }
+ }
+{
+ PyThreadState* __tstate = wxPyBeginAllowThreads();
+ wxStyledTextCtrl_LineEndDisplay(_arg0);
+
+ wxPyEndAllowThreads(__tstate);
+ if (PyErr_Occurred()) return NULL;
+} Py_INCREF(Py_None);
+ _resultobj = Py_None;
+ return _resultobj;
+}
+
+#define wxStyledTextCtrl_LineEndDisplayExtend(_swigobj) (_swigobj->LineEndDisplayExtend())
+static PyObject *_wrap_wxStyledTextCtrl_LineEndDisplayExtend(PyObject *self, PyObject *args, PyObject *kwargs) {
+ PyObject * _resultobj;
+ wxStyledTextCtrl * _arg0;
+ PyObject * _argo0 = 0;
+ char *_kwnames[] = { "self", NULL };
+
+ self = self;
+ if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxStyledTextCtrl_LineEndDisplayExtend",_kwnames,&_argo0))
+ return NULL;
+ if (_argo0) {
+ if (_argo0 == Py_None) { _arg0 = NULL; }
+ else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) {
+ PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_LineEndDisplayExtend. Expected _wxStyledTextCtrl_p.");
+ return NULL;
+ }
+ }
+{
+ PyThreadState* __tstate = wxPyBeginAllowThreads();
+ wxStyledTextCtrl_LineEndDisplayExtend(_arg0);
+
+ wxPyEndAllowThreads(__tstate);
+ if (PyErr_Occurred()) return NULL;
+} Py_INCREF(Py_None);
+ _resultobj = Py_None;
+ return _resultobj;
+}
+
#define wxStyledTextCtrl_MoveCaretInsideView(_swigobj) (_swigobj->MoveCaretInsideView())
static PyObject *_wrap_wxStyledTextCtrl_MoveCaretInsideView(PyObject *self, PyObject *args, PyObject *kwargs) {
PyObject * _resultobj;
{ "wxStyledTextCtrl_BraceHighlight", (PyCFunction) _wrap_wxStyledTextCtrl_BraceHighlight, METH_VARARGS | METH_KEYWORDS },
{ "wxStyledTextCtrl_LineLength", (PyCFunction) _wrap_wxStyledTextCtrl_LineLength, METH_VARARGS | METH_KEYWORDS },
{ "wxStyledTextCtrl_MoveCaretInsideView", (PyCFunction) _wrap_wxStyledTextCtrl_MoveCaretInsideView, METH_VARARGS | METH_KEYWORDS },
+ { "wxStyledTextCtrl_LineEndDisplayExtend", (PyCFunction) _wrap_wxStyledTextCtrl_LineEndDisplayExtend, METH_VARARGS | METH_KEYWORDS },
+ { "wxStyledTextCtrl_LineEndDisplay", (PyCFunction) _wrap_wxStyledTextCtrl_LineEndDisplay, METH_VARARGS | METH_KEYWORDS },
+ { "wxStyledTextCtrl_HomeDisplayExtend", (PyCFunction) _wrap_wxStyledTextCtrl_HomeDisplayExtend, METH_VARARGS | METH_KEYWORDS },
+ { "wxStyledTextCtrl_HomeDisplay", (PyCFunction) _wrap_wxStyledTextCtrl_HomeDisplay, METH_VARARGS | METH_KEYWORDS },
{ "wxStyledTextCtrl_TextHeight", (PyCFunction) _wrap_wxStyledTextCtrl_TextHeight, METH_VARARGS | METH_KEYWORDS },
{ "wxStyledTextCtrl_GetEndAtLastLine", (PyCFunction) _wrap_wxStyledTextCtrl_GetEndAtLastLine, METH_VARARGS | METH_KEYWORDS },
{ "wxStyledTextCtrl_SetEndAtLastLine", (PyCFunction) _wrap_wxStyledTextCtrl_SetEndAtLastLine, METH_VARARGS | METH_KEYWORDS },
{ "wxStyledTextCtrl_SetLineState", (PyCFunction) _wrap_wxStyledTextCtrl_SetLineState, METH_VARARGS | METH_KEYWORDS },
{ "wxStyledTextCtrl_GetStyleBits", (PyCFunction) _wrap_wxStyledTextCtrl_GetStyleBits, METH_VARARGS | METH_KEYWORDS },
{ "wxStyledTextCtrl_SetStyleBits", (PyCFunction) _wrap_wxStyledTextCtrl_SetStyleBits, METH_VARARGS | METH_KEYWORDS },
+ { "wxStyledTextCtrl_SetWhitespaceBackground", (PyCFunction) _wrap_wxStyledTextCtrl_SetWhitespaceBackground, METH_VARARGS | METH_KEYWORDS },
+ { "wxStyledTextCtrl_SetWhitespaceForeground", (PyCFunction) _wrap_wxStyledTextCtrl_SetWhitespaceForeground, METH_VARARGS | METH_KEYWORDS },
{ "wxStyledTextCtrl_IndicatorGetForeground", (PyCFunction) _wrap_wxStyledTextCtrl_IndicatorGetForeground, METH_VARARGS | METH_KEYWORDS },
{ "wxStyledTextCtrl_IndicatorSetForeground", (PyCFunction) _wrap_wxStyledTextCtrl_IndicatorSetForeground, METH_VARARGS | METH_KEYWORDS },
{ "wxStyledTextCtrl_IndicatorGetStyle", (PyCFunction) _wrap_wxStyledTextCtrl_IndicatorGetStyle, METH_VARARGS | METH_KEYWORDS },
PyDict_SetItemString(d,"wxSTC_MARK_CIRCLEMINUS", PyInt_FromLong((long) 20));
PyDict_SetItemString(d,"wxSTC_MARK_CIRCLEMINUSCONNECTED", PyInt_FromLong((long) 21));
PyDict_SetItemString(d,"wxSTC_MARK_BACKGROUND", PyInt_FromLong((long) 22));
+ PyDict_SetItemString(d,"wxSTC_MARK_DOTDOTDOT", PyInt_FromLong((long) 23));
+ PyDict_SetItemString(d,"wxSTC_MARK_ARROWS", PyInt_FromLong((long) 24));
PyDict_SetItemString(d,"wxSTC_MARK_CHARACTER", PyInt_FromLong((long) 10000));
PyDict_SetItemString(d,"wxSTC_MARKNUM_FOLDEREND", PyInt_FromLong((long) 25));
PyDict_SetItemString(d,"wxSTC_MARKNUM_FOLDEROPENMID", PyInt_FromLong((long) 26));
PyDict_SetItemString(d,"wxSTC_CMD_LINESCROLLDOWN", PyInt_FromLong((long) 2342));
PyDict_SetItemString(d,"wxSTC_CMD_LINESCROLLUP", PyInt_FromLong((long) 2343));
PyDict_SetItemString(d,"wxSTC_CMD_DELETEBACKNOTLINE", PyInt_FromLong((long) 2344));
+ PyDict_SetItemString(d,"wxSTC_CMD_HOMEDISPLAY", PyInt_FromLong((long) 2345));
+ PyDict_SetItemString(d,"wxSTC_CMD_HOMEDISPLAYEXTEND", PyInt_FromLong((long) 2346));
+ PyDict_SetItemString(d,"wxSTC_CMD_LINEENDDISPLAY", PyInt_FromLong((long) 2347));
+ PyDict_SetItemString(d,"wxSTC_CMD_LINEENDDISPLAYEXTEND", PyInt_FromLong((long) 2348));
PyDict_SetItemString(d,"wxSTC_EDGE_NONE", PyInt_FromLong((long) 0));
PyDict_SetItemString(d,"wxSTC_EDGE_LINE", PyInt_FromLong((long) 1));
PyDict_SetItemString(d,"wxSTC_EDGE_BACKGROUND", PyInt_FromLong((long) 2));
val = apply(stc_c.wxStyledTextCtrl_IndicatorGetForeground,(self,) + _args, _kwargs)
if val: val = wxColourPtr(val) ; val.thisown = 1
return val
+ def SetWhitespaceForeground(self, *_args, **_kwargs):
+ val = apply(stc_c.wxStyledTextCtrl_SetWhitespaceForeground,(self,) + _args, _kwargs)
+ return val
+ def SetWhitespaceBackground(self, *_args, **_kwargs):
+ val = apply(stc_c.wxStyledTextCtrl_SetWhitespaceBackground,(self,) + _args, _kwargs)
+ return val
def SetStyleBits(self, *_args, **_kwargs):
val = apply(stc_c.wxStyledTextCtrl_SetStyleBits,(self,) + _args, _kwargs)
return val
def TextHeight(self, *_args, **_kwargs):
val = apply(stc_c.wxStyledTextCtrl_TextHeight,(self,) + _args, _kwargs)
return val
+ def HomeDisplay(self, *_args, **_kwargs):
+ val = apply(stc_c.wxStyledTextCtrl_HomeDisplay,(self,) + _args, _kwargs)
+ return val
+ def HomeDisplayExtend(self, *_args, **_kwargs):
+ val = apply(stc_c.wxStyledTextCtrl_HomeDisplayExtend,(self,) + _args, _kwargs)
+ return val
+ def LineEndDisplay(self, *_args, **_kwargs):
+ val = apply(stc_c.wxStyledTextCtrl_LineEndDisplay,(self,) + _args, _kwargs)
+ return val
+ def LineEndDisplayExtend(self, *_args, **_kwargs):
+ val = apply(stc_c.wxStyledTextCtrl_LineEndDisplayExtend,(self,) + _args, _kwargs)
+ return val
def MoveCaretInsideView(self, *_args, **_kwargs):
val = apply(stc_c.wxStyledTextCtrl_MoveCaretInsideView,(self,) + _args, _kwargs)
return val
wxSTC_MARK_CIRCLEMINUS = stc_c.wxSTC_MARK_CIRCLEMINUS
wxSTC_MARK_CIRCLEMINUSCONNECTED = stc_c.wxSTC_MARK_CIRCLEMINUSCONNECTED
wxSTC_MARK_BACKGROUND = stc_c.wxSTC_MARK_BACKGROUND
+wxSTC_MARK_DOTDOTDOT = stc_c.wxSTC_MARK_DOTDOTDOT
+wxSTC_MARK_ARROWS = stc_c.wxSTC_MARK_ARROWS
wxSTC_MARK_CHARACTER = stc_c.wxSTC_MARK_CHARACTER
wxSTC_MARKNUM_FOLDEREND = stc_c.wxSTC_MARKNUM_FOLDEREND
wxSTC_MARKNUM_FOLDEROPENMID = stc_c.wxSTC_MARKNUM_FOLDEROPENMID
wxSTC_CMD_LINESCROLLDOWN = stc_c.wxSTC_CMD_LINESCROLLDOWN
wxSTC_CMD_LINESCROLLUP = stc_c.wxSTC_CMD_LINESCROLLUP
wxSTC_CMD_DELETEBACKNOTLINE = stc_c.wxSTC_CMD_DELETEBACKNOTLINE
+wxSTC_CMD_HOMEDISPLAY = stc_c.wxSTC_CMD_HOMEDISPLAY
+wxSTC_CMD_HOMEDISPLAYEXTEND = stc_c.wxSTC_CMD_HOMEDISPLAYEXTEND
+wxSTC_CMD_LINEENDDISPLAY = stc_c.wxSTC_CMD_LINEENDDISPLAY
+wxSTC_CMD_LINEENDDISPLAYEXTEND = stc_c.wxSTC_CMD_LINEENDDISPLAYEXTEND
wxSTC_EDGE_NONE = stc_c.wxSTC_EDGE_NONE
wxSTC_EDGE_LINE = stc_c.wxSTC_EDGE_LINE
wxSTC_EDGE_BACKGROUND = stc_c.wxSTC_EDGE_BACKGROUND
<html>
<head>
-<title>stc.h</title>
+<title>/home/others/projects/wx2.3/contrib/include/wx/stc/stc.h.html</title>
<meta name="Generator" content="Vim/6.0">
</head>
<body bgcolor="#f5deb3" text="#000000">
<font color="#0000ff">// Invisible mark that only sets the line background color.</font>
<font color="#a020f0">#define wxSTC_MARK_BACKGROUND </font><font color="#ff00ff">22</font>
+<font color="#a020f0">#define wxSTC_MARK_DOTDOTDOT </font><font color="#ff00ff">23</font>
+<font color="#a020f0">#define wxSTC_MARK_ARROWS </font><font color="#ff00ff">24</font>
<font color="#a020f0">#define wxSTC_MARK_CHARACTER </font><font color="#ff00ff">10000</font>
<font color="#0000ff">// Markers used for outlining column.</font>
<font color="#0000ff">// Delete the selection or if no selection, the character before the caret.</font>
<font color="#0000ff">// Will not delete the character before at the start of a line.</font>
<font color="#a020f0">#define wxSTC_CMD_DELETEBACKNOTLINE </font><font color="#ff00ff">2344</font>
+
+<font color="#0000ff">// Move caret to first position on display line.</font>
+<font color="#a020f0">#define wxSTC_CMD_HOMEDISPLAY </font><font color="#ff00ff">2345</font>
+
+<font color="#0000ff">// Move caret to first position on display line extending selection to </font>
+<font color="#0000ff">// new caret position.</font>
+<font color="#a020f0">#define wxSTC_CMD_HOMEDISPLAYEXTEND </font><font color="#ff00ff">2346</font>
+
+<font color="#0000ff">// Move caret to last position on display line.</font>
+<font color="#a020f0">#define wxSTC_CMD_LINEENDDISPLAY </font><font color="#ff00ff">2347</font>
+
+<font color="#0000ff">// Move caret to last position on display line extending selection to new </font>
+<font color="#0000ff">// caret position.</font>
+<font color="#a020f0">#define wxSTC_CMD_LINEENDDISPLAYEXTEND </font><font color="#ff00ff">2348</font>
<font color="#a020f0">#define wxSTC_EDGE_NONE </font><font color="#ff00ff">0</font>
<font color="#a020f0">#define wxSTC_EDGE_LINE </font><font color="#ff00ff">1</font>
<font color="#a020f0">#define wxSTC_EDGE_BACKGROUND </font><font color="#ff00ff">2</font>
<font color="#0000ff">// Retrieve the foreground colour of an indicator.</font>
wxColour IndicatorGetForeground(<font color="#2e8b57"><b>int</b></font> indic);
+ <font color="#0000ff">// Set the foreground colour of all whitespace and whether to use this setting.</font>
+ <font color="#2e8b57"><b>void</b></font> SetWhitespaceForeground(<font color="#2e8b57"><b>bool</b></font> useSetting, <font color="#2e8b57"><b>const</b></font> wxColour& fore);
+
+ <font color="#0000ff">// Set the background colour of all whitespace and whether to use this setting.</font>
+ <font color="#2e8b57"><b>void</b></font> SetWhitespaceBackground(<font color="#2e8b57"><b>bool</b></font> useSetting, <font color="#2e8b57"><b>const</b></font> wxColour& back);
+
<font color="#0000ff">// Divide each styling byte into lexical class bits (default: 5) and indicator</font>
<font color="#0000ff">// bits (default: 3). If a lexer requires more than 32 lexical states, then this</font>
<font color="#0000ff">// is used to expand the possible states.</font>
<font color="#0000ff">// Retrieve the height of a particular line of text in pixels.</font>
<font color="#2e8b57"><b>int</b></font> TextHeight(<font color="#2e8b57"><b>int</b></font> line);
+ <font color="#0000ff">// Move caret to first position on display line.</font>
+ <font color="#2e8b57"><b>void</b></font> HomeDisplay();
+
+ <font color="#0000ff">// Move caret to first position on display line extending selection to </font>
+ <font color="#0000ff">// new caret position.</font>
+ <font color="#2e8b57"><b>void</b></font> HomeDisplayExtend();
+
+ <font color="#0000ff">// Move caret to last position on display line.</font>
+ <font color="#2e8b57"><b>void</b></font> LineEndDisplay();
+
+ <font color="#0000ff">// Move caret to last position on display line extending selection to new </font>
+ <font color="#0000ff">// caret position.</font>
+ <font color="#2e8b57"><b>void</b></font> LineEndDisplayExtend();
+
<font color="#0000ff">// Move the caret inside current view if it's not there already.</font>
<font color="#2e8b57"><b>void</b></font> MoveCaretInsideView();
# flags and values that affect this script
#----------------------------------------------------------------------
-VERSION = "2.3.3pre7"
+VERSION = "2.3.3pre8"
DESCRIPTION = "Cross platform GUI toolkit for Python"
AUTHOR = "Robin Dunn"
AUTHOR_EMAIL = "Robin Dunn <robin@alldunn.com>"
-ver = '2.3.3pre7'
+ver = '2.3.3pre8'