From f114b8580b980c54e7b6194fe6494a86cb833907 Mon Sep 17 00:00:00 2001 From: Robin Dunn Date: Wed, 11 Sep 2002 01:00:07 +0000 Subject: [PATCH] Update to Scintilla 1.48 git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@17118 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- contrib/include/wx/stc/stc.h | 36 +++ contrib/src/stc/gen_iface.py | 4 + contrib/src/stc/scintilla/README.txt | 2 +- contrib/src/stc/scintilla/include/Scintilla.h | 8 + .../src/stc/scintilla/include/Scintilla.iface | 22 ++ contrib/src/stc/scintilla/src/CellBuffer.cxx | 3 + contrib/src/stc/scintilla/src/CellBuffer.h | 2 +- contrib/src/stc/scintilla/src/Editor.cxx | 123 +++++++-- contrib/src/stc/scintilla/src/Editor.h | 7 +- contrib/src/stc/scintilla/src/KeyMap.cxx | 5 + contrib/src/stc/scintilla/src/LexCPP.cxx | 2 +- contrib/src/stc/scintilla/src/LexOthers.cxx | 6 +- contrib/src/stc/scintilla/src/LexPascal.cxx | 239 +++++++++++++----- contrib/src/stc/scintilla/src/LexPython.cxx | 2 +- contrib/src/stc/scintilla/src/LineMarker.cxx | 16 ++ contrib/src/stc/scintilla/src/PropSet.cxx | 31 ++- contrib/src/stc/scintilla/src/RESearch.cxx | 4 +- .../src/stc/scintilla/src/ScintillaBase.cxx | 26 +- contrib/src/stc/scintilla/src/ScintillaBase.h | 3 +- contrib/src/stc/scintilla/src/ViewStyle.cxx | 10 + contrib/src/stc/scintilla/src/ViewStyle.h | 4 + contrib/src/stc/stc.cpp | 32 +++ include/wx/stc/stc.h | 36 +++ src/stc/gen_iface.py | 4 + src/stc/scintilla/README.txt | 2 +- src/stc/scintilla/include/Scintilla.h | 8 + src/stc/scintilla/include/Scintilla.iface | 22 ++ src/stc/scintilla/src/CellBuffer.cxx | 3 + src/stc/scintilla/src/CellBuffer.h | 2 +- src/stc/scintilla/src/Editor.cxx | 123 +++++++-- src/stc/scintilla/src/Editor.h | 7 +- src/stc/scintilla/src/KeyMap.cxx | 5 + src/stc/scintilla/src/LexCPP.cxx | 2 +- src/stc/scintilla/src/LexOthers.cxx | 6 +- src/stc/scintilla/src/LexPascal.cxx | 239 +++++++++++++----- src/stc/scintilla/src/LexPython.cxx | 2 +- src/stc/scintilla/src/LineMarker.cxx | 16 ++ src/stc/scintilla/src/PropSet.cxx | 31 ++- src/stc/scintilla/src/RESearch.cxx | 4 +- src/stc/scintilla/src/ScintillaBase.cxx | 26 +- src/stc/scintilla/src/ScintillaBase.h | 3 +- src/stc/scintilla/src/ViewStyle.cxx | 10 + src/stc/scintilla/src/ViewStyle.h | 4 + src/stc/stc.cpp | 32 +++ wxPython/CHANGES.txt | 2 +- wxPython/b.bat | 2 +- wxPython/contrib/stc/msw/stc_.cpp | 202 +++++++++++++++ wxPython/contrib/stc/msw/stc_.py | 24 ++ wxPython/demo/data/stc.h.html | 38 ++- wxPython/setup.py | 2 +- wxPython/src/__version__.py | 2 +- 51 files changed, 1219 insertions(+), 227 deletions(-) diff --git a/contrib/include/wx/stc/stc.h b/contrib/include/wx/stc/stc.h index 92f4484c5b..640eac8baf 100644 --- a/contrib/include/wx/stc/stc.h +++ b/contrib/include/wx/stc/stc.h @@ -87,6 +87,8 @@ // 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. @@ -326,6 +328,20 @@ // 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 @@ -1159,6 +1175,12 @@ public: // 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. @@ -1619,6 +1641,20 @@ public: // 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(); diff --git a/contrib/src/stc/gen_iface.py b/contrib/src/stc/gen_iface.py index 8c30ad99e6..b5342b73e6 100644 --- a/contrib/src/stc/gen_iface.py +++ b/contrib/src/stc/gen_iface.py @@ -216,6 +216,9 @@ methodOverrideMap = { '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), @@ -515,6 +518,7 @@ methodOverrideMap = { 'GetFocus' : ('GetSTCFocus', 0, 0, 0), + '' : ('', 0, 0, 0), } diff --git a/contrib/src/stc/scintilla/README.txt b/contrib/src/stc/scintilla/README.txt index 3534249c03..8538707cde 100644 --- a/contrib/src/stc/scintilla/README.txt +++ b/contrib/src/stc/scintilla/README.txt @@ -3,5 +3,5 @@ scintilla/include directories from the Scintilla/SCiTE source 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 diff --git a/contrib/src/stc/scintilla/include/Scintilla.h b/contrib/src/stc/scintilla/include/Scintilla.h index 4b8ccd23f4..30fcf50fc4 100644 --- a/contrib/src/stc/scintilla/include/Scintilla.h +++ b/contrib/src/stc/scintilla/include/Scintilla.h @@ -109,6 +109,8 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam, #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 @@ -206,6 +208,8 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam, #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 @@ -418,6 +422,10 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam, #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 diff --git a/contrib/src/stc/scintilla/include/Scintilla.iface b/contrib/src/stc/scintilla/include/Scintilla.iface index f6e259efc6..776fe8f2b7 100644 --- a/contrib/src/stc/scintilla/include/Scintilla.iface +++ b/contrib/src/stc/scintilla/include/Scintilla.iface @@ -258,6 +258,8 @@ val SC_MARK_CIRCLEMINUSCONNECTED=21 # 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 @@ -467,6 +469,12 @@ set void IndicSetFore=2082(int indic, colour fore) # 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. @@ -1119,6 +1127,20 @@ fun void LineScrollUp=2343(,) # 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(,) diff --git a/contrib/src/stc/scintilla/src/CellBuffer.cxx b/contrib/src/stc/scintilla/src/CellBuffer.cxx index b67da81c93..420dee6ff7 100644 --- a/contrib/src/stc/scintilla/src/CellBuffer.cxx +++ b/contrib/src/stc/scintilla/src/CellBuffer.cxx @@ -125,6 +125,7 @@ LineVector::LineVector() { levels = 0; sizeLevels = 0; handleCurrent = 1; + growSize = 1000; Init(); } @@ -199,6 +200,8 @@ void LineVector::ClearLevels() { 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); diff --git a/contrib/src/stc/scintilla/src/CellBuffer.h b/contrib/src/stc/scintilla/src/CellBuffer.h index b5c90f57a5..5cfcbfe1f0 100644 --- a/contrib/src/stc/scintilla/src/CellBuffer.h +++ b/contrib/src/stc/scintilla/src/CellBuffer.h @@ -53,7 +53,7 @@ struct LineData { */ class LineVector { public: - enum { growSize = 4000 }; + int growSize; int lines; LineData *linesData; int size; diff --git a/contrib/src/stc/scintilla/src/Editor.cxx b/contrib/src/stc/scintilla/src/Editor.cxx index faba66ef55..f2ba9f088b 100644 --- a/contrib/src/stc/scintilla/src/Editor.cxx +++ b/contrib/src/stc/scintilla/src/Editor.cxx @@ -402,6 +402,7 @@ void Editor::InvalidateStyleData() { } void Editor::InvalidateStyleRedraw() { + NeedWrapping(); InvalidateStyleData(); Redraw(); } @@ -835,7 +836,7 @@ int Editor::MovePositionOutsideChar(int pos, int moveDir, bool checkLineEnd) { 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); @@ -844,7 +845,8 @@ int Editor::MovePositionTo(int newPos, bool extend) { } else { SetEmptySelection(newPos); } - EnsureCaretVisible(); + if (ensureVisible) + EnsureCaretVisible(); ShowCaretAtCurrentPosition(); NotifyMove(newPos); return 0; @@ -908,16 +910,18 @@ void Editor::HorizontalScrollTo(int xPos) { } } -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); } } @@ -1621,12 +1625,15 @@ void Editor::LayoutLine(int line, Surface *surface, ViewStyle &vstyle, LineLayou 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; @@ -1641,12 +1648,13 @@ void Editor::LayoutLine(int line, Surface *surface, ViewStyle &vstyle, LineLayou } 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); } @@ -1802,7 +1810,6 @@ void Editor::DrawLine(Surface *surface, ViewStyle &vsDraw, int line, int lineVis 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; @@ -1826,8 +1833,12 @@ void Editor::DrawLine(Surface *surface, ViewStyle &vsDraw, int line, int lineVis } 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) { @@ -1886,8 +1897,15 @@ void Editor::DrawLine(Surface *surface, ViewStyle &vsDraw, int line, int lineVis 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; @@ -2316,6 +2334,8 @@ long Editor::FormatRange(bool draw, RangeToFormat *pfr) { // 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 @@ -3039,6 +3059,10 @@ void Editor::NotifyMacroRecord(unsigned int iMessage, unsigned long wParam, long 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 @@ -3169,6 +3193,39 @@ void Editor::CursorUpOrDown(int direction, bool extend) { 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; subLinelines; 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: @@ -3179,7 +3236,7 @@ int Editor::KeyCommand(unsigned int iMessage) { break; case SCI_LINESCROLLDOWN: ScrollTo(topLine + 1); - MoveCaretInsideView(); + MoveCaretInsideView(false); break; case SCI_LINEUP: CursorUpOrDown(-1); @@ -3189,7 +3246,7 @@ int Editor::KeyCommand(unsigned int iMessage) { break; case SCI_LINESCROLLUP: ScrollTo(topLine - 1); - MoveCaretInsideView(); + MoveCaretInsideView(false); break; case SCI_CHARLEFT: if (SelectionEmpty()) { @@ -3322,7 +3379,6 @@ int Editor::KeyCommand(unsigned int iMessage) { case SCI_ZOOMIN: if (vs.zoomLevel < 20) { vs.zoomLevel++; - NeedWrapping(); InvalidateStyleRedraw(); NotifyZoom(); } @@ -3330,7 +3386,6 @@ int Editor::KeyCommand(unsigned int iMessage) { case SCI_ZOOMOUT: if (vs.zoomLevel > -10) { vs.zoomLevel--; - NeedWrapping(); InvalidateStyleRedraw(); NotifyZoom(); } @@ -3405,6 +3460,26 @@ int Editor::KeyCommand(unsigned int iMessage) { 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; } @@ -4647,13 +4722,11 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) { case SCI_SETMARGINLEFT: vs.leftMarginWidth = lParam; - NeedWrapping(); InvalidateStyleRedraw(); break; case SCI_SETMARGINRIGHT: vs.rightMarginWidth = lParam; - NeedWrapping(); InvalidateStyleRedraw(); break; @@ -4953,7 +5026,6 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) { case SCI_SETWRAPMODE: wrapState = (wParam == SC_WRAP_WORD) ? eWrapWord : eWrapNone; - NeedWrapping(); xOffset = 0; InvalidateStyleRedraw(); ReconfigureScrollBars(); @@ -5036,6 +5108,7 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) { case SCI_SETCODEPAGE: pdoc->dbcsCodePage = wParam; + InvalidateStyleRedraw(); break; case SCI_GETCODEPAGE: @@ -5117,7 +5190,6 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) { case SCI_SETMARGINWIDTHN: if (ValidMargin(wParam)) { vs.ms[wParam].width = lParam; - NeedWrapping(); InvalidateStyleRedraw(); } break; @@ -5375,6 +5447,18 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) { 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(); @@ -5481,6 +5565,10 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) { 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: @@ -5506,7 +5594,6 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) { case SCI_SETZOOM: vs.zoomLevel = wParam; - NeedWrapping(); InvalidateStyleRedraw(); NotifyZoom(); break; diff --git a/contrib/src/stc/scintilla/src/Editor.h b/contrib/src/stc/scintilla/src/Editor.h index 451f123411..800630bbb0 100644 --- a/contrib/src/stc/scintilla/src/Editor.h +++ b/contrib/src/stc/scintilla/src/Editor.h @@ -322,14 +322,14 @@ protected: // ScintillaBase subclass needs access to much of Editor 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(); @@ -403,9 +403,10 @@ protected: // ScintillaBase subclass needs access to much of Editor 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); diff --git a/contrib/src/stc/scintilla/src/KeyMap.cxx b/contrib/src/stc/scintilla/src/KeyMap.cxx index 761df4c8ff..c91e6c6ccc 100644 --- a/contrib/src/stc/scintilla/src/KeyMap.cxx +++ b/contrib/src/stc/scintilla/src/KeyMap.cxx @@ -85,10 +85,14 @@ const KeyToCommand KeyMap::MapDefault[] = { {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}, @@ -115,6 +119,7 @@ const KeyToCommand KeyMap::MapDefault[] = { {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}, diff --git a/contrib/src/stc/scintilla/src/LexCPP.cxx b/contrib/src/stc/scintilla/src/LexCPP.cxx index c1bb1ff9a3..39f458da73 100644 --- a/contrib/src/stc/scintilla/src/LexCPP.cxx +++ b/contrib/src/stc/scintilla/src/LexCPP.cxx @@ -113,7 +113,7 @@ static void ColouriseCppDoc(unsigned int startPos, int length, int initStyle, Wo sc.SetState(SCE_C_DEFAULT); } } else { - if (sc.atLineEnd) { + if ((sc.atLineEnd) || (sc.Match('/', '*')) || (sc.Match('/', '/'))) { sc.SetState(SCE_C_DEFAULT); } } diff --git a/contrib/src/stc/scintilla/src/LexOthers.cxx b/contrib/src/stc/scintilla/src/LexOthers.cxx index 7010591430..babb3a0d37 100644 --- a/contrib/src/stc/scintilla/src/LexOthers.cxx +++ b/contrib/src/stc/scintilla/src/LexOthers.cxx @@ -346,6 +346,9 @@ static void ColouriseErrorListLine( 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] == '+') { @@ -410,7 +413,8 @@ static void ColouriseErrorListLine( 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] == '^'))) { diff --git a/contrib/src/stc/scintilla/src/LexPascal.cxx b/contrib/src/stc/scintilla/src/LexPascal.cxx index 491d968ac9..37e5e995fb 100644 --- a/contrib/src/stc/scintilla/src/LexPascal.cxx +++ b/contrib/src/stc/scintilla/src/LexPascal.cxx @@ -2,6 +2,7 @@ /** @file LexPascal.cxx ** Lexer for Pascal. ** Written by Laurent le Tynevez + ** Updated by Simon Steele September 2002 **/ #include @@ -17,42 +18,86 @@ #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(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; @@ -60,9 +105,21 @@ static void ColourisePascalDoc(unsigned int startPos, int length, int initStyle, 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')) { @@ -73,17 +130,9 @@ static void ColourisePascalDoc(unsigned int startPos, int length, int initStyle, 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++; @@ -110,9 +159,6 @@ static void ColourisePascalDoc(unsigned int startPos, int length, int initStyle, } 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; @@ -126,7 +172,16 @@ static void ColourisePascalDoc(unsigned int startPos, int length, int initStyle, } } 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 != '&') { @@ -138,14 +193,11 @@ static void ColourisePascalDoc(unsigned int startPos, int length, int initStyle, 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) { @@ -177,30 +229,10 @@ static void ColourisePascalDoc(unsigned int startPos, int length, int initStyle, 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; @@ -210,12 +242,101 @@ static void ColourisePascalDoc(unsigned int startPos, int length, int initStyle, 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 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); diff --git a/contrib/src/stc/scintilla/src/LexPython.cxx b/contrib/src/stc/scintilla/src/LexPython.cxx index 01365c1901..bfaa08f0e9 100644 --- a/contrib/src/stc/scintilla/src/LexPython.cxx +++ b/contrib/src/stc/scintilla/src/LexPython.cxx @@ -163,7 +163,7 @@ static void ColourisePyDoc(unsigned int startPos, int length, int initStyle, // 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')))) { diff --git a/contrib/src/stc/scintilla/src/LineMarker.cxx b/contrib/src/stc/scintilla/src/LineMarker.cxx index 1b8975d9c0..009ea4ea50 100644 --- a/contrib/src/stc/scintilla/src/LineMarker.cxx +++ b/contrib/src/stc/scintilla/src/LineMarker.cxx @@ -239,6 +239,22 @@ void LineMarker::Draw(Surface *surface, PRectangle &rcWhole, Font &fontForCharac 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), diff --git a/contrib/src/stc/scintilla/src/PropSet.cxx b/contrib/src/stc/scintilla/src/PropSet.cxx index 2967996913..b527c385ce 100644 --- a/contrib/src/stc/scintilla/src/PropSet.cxx +++ b/contrib/src/stc/scintilla/src/PropSet.cxx @@ -411,33 +411,38 @@ bool PropSet::GetNext(char ** key, char ** val) { 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(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(wordlist[k])]) { if (!prev) { keywords[words] = &wordlist[k]; words++; diff --git a/contrib/src/stc/scintilla/src/RESearch.cxx b/contrib/src/stc/scintilla/src/RESearch.cxx index 2c63bb9590..f176bbf19e 100644 --- a/contrib/src/stc/scintilla/src/RESearch.cxx +++ b/contrib/src/stc/scintilla/src/RESearch.cxx @@ -30,8 +30,8 @@ * 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 diff --git a/contrib/src/stc/scintilla/src/ScintillaBase.cxx b/contrib/src/stc/scintilla/src/ScintillaBase.cxx index 7958661521..a5e5a065d1 100644 --- a/contrib/src/stc/scintilla/src/ScintillaBase.cxx +++ b/contrib/src/stc/scintilla/src/ScintillaBase.cxx @@ -69,8 +69,8 @@ void ScintillaBase::AddCharUTF(char *s, unsigned int len, bool treatAsDBCS) { 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); @@ -145,12 +145,12 @@ int ScintillaBase::KeyCommand(unsigned int iMessage) { 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: @@ -251,8 +251,8 @@ void ScintillaBase::AutoCompleteStart(int lenEntered, const char *list) { // 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; @@ -283,14 +283,20 @@ void ScintillaBase::AutoCompleteMoveToCurrentWord() { 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(); diff --git a/contrib/src/stc/scintilla/src/ScintillaBase.h b/contrib/src/stc/scintilla/src/ScintillaBase.h index 28c089edd2..e68aeb6084 100644 --- a/contrib/src/stc/scintilla/src/ScintillaBase.h +++ b/contrib/src/stc/scintilla/src/ScintillaBase.h @@ -65,7 +65,8 @@ protected: 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); diff --git a/contrib/src/stc/scintilla/src/ViewStyle.cxx b/contrib/src/stc/scintilla/src/ViewStyle.cxx index 7937e1fca7..12e1406aa4 100644 --- a/contrib/src/stc/scintilla/src/ViewStyle.cxx +++ b/contrib/src/stc/scintilla/src/ViewStyle.cxx @@ -72,6 +72,10 @@ ViewStyle::ViewStyle(const ViewStyle &source) { 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; @@ -120,6 +124,10 @@ void ViewStyle::Init() { 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); @@ -176,6 +184,8 @@ void ViewStyle::RefreshColourPalette(Palette &pal, bool want) { 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); diff --git a/contrib/src/stc/scintilla/src/ViewStyle.h b/contrib/src/stc/scintilla/src/ViewStyle.h index 7528638c59..887170eaac 100644 --- a/contrib/src/stc/scintilla/src/ViewStyle.h +++ b/contrib/src/stc/scintilla/src/ViewStyle.h @@ -53,6 +53,10 @@ public: 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 diff --git a/contrib/src/stc/stc.cpp b/contrib/src/stc/stc.cpp index b44aec5667..d675e8da9d 100644 --- a/contrib/src/stc/stc.cpp +++ b/contrib/src/stc/stc.cpp @@ -643,6 +643,16 @@ wxColour wxStyledTextCtrl::IndicatorGetForeground(int indic) { 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. @@ -1463,6 +1473,28 @@ int wxStyledTextCtrl::TextHeight(int line) { 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); diff --git a/include/wx/stc/stc.h b/include/wx/stc/stc.h index 92f4484c5b..640eac8baf 100644 --- a/include/wx/stc/stc.h +++ b/include/wx/stc/stc.h @@ -87,6 +87,8 @@ // 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. @@ -326,6 +328,20 @@ // 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 @@ -1159,6 +1175,12 @@ public: // 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. @@ -1619,6 +1641,20 @@ public: // 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(); diff --git a/src/stc/gen_iface.py b/src/stc/gen_iface.py index 8c30ad99e6..b5342b73e6 100644 --- a/src/stc/gen_iface.py +++ b/src/stc/gen_iface.py @@ -216,6 +216,9 @@ methodOverrideMap = { '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), @@ -515,6 +518,7 @@ methodOverrideMap = { 'GetFocus' : ('GetSTCFocus', 0, 0, 0), + '' : ('', 0, 0, 0), } diff --git a/src/stc/scintilla/README.txt b/src/stc/scintilla/README.txt index 3534249c03..8538707cde 100644 --- a/src/stc/scintilla/README.txt +++ b/src/stc/scintilla/README.txt @@ -3,5 +3,5 @@ scintilla/include directories from the Scintilla/SCiTE source 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 diff --git a/src/stc/scintilla/include/Scintilla.h b/src/stc/scintilla/include/Scintilla.h index 4b8ccd23f4..30fcf50fc4 100644 --- a/src/stc/scintilla/include/Scintilla.h +++ b/src/stc/scintilla/include/Scintilla.h @@ -109,6 +109,8 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam, #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 @@ -206,6 +208,8 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam, #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 @@ -418,6 +422,10 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam, #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 diff --git a/src/stc/scintilla/include/Scintilla.iface b/src/stc/scintilla/include/Scintilla.iface index f6e259efc6..776fe8f2b7 100644 --- a/src/stc/scintilla/include/Scintilla.iface +++ b/src/stc/scintilla/include/Scintilla.iface @@ -258,6 +258,8 @@ val SC_MARK_CIRCLEMINUSCONNECTED=21 # 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 @@ -467,6 +469,12 @@ set void IndicSetFore=2082(int indic, colour fore) # 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. @@ -1119,6 +1127,20 @@ fun void LineScrollUp=2343(,) # 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(,) diff --git a/src/stc/scintilla/src/CellBuffer.cxx b/src/stc/scintilla/src/CellBuffer.cxx index b67da81c93..420dee6ff7 100644 --- a/src/stc/scintilla/src/CellBuffer.cxx +++ b/src/stc/scintilla/src/CellBuffer.cxx @@ -125,6 +125,7 @@ LineVector::LineVector() { levels = 0; sizeLevels = 0; handleCurrent = 1; + growSize = 1000; Init(); } @@ -199,6 +200,8 @@ void LineVector::ClearLevels() { 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); diff --git a/src/stc/scintilla/src/CellBuffer.h b/src/stc/scintilla/src/CellBuffer.h index b5c90f57a5..5cfcbfe1f0 100644 --- a/src/stc/scintilla/src/CellBuffer.h +++ b/src/stc/scintilla/src/CellBuffer.h @@ -53,7 +53,7 @@ struct LineData { */ class LineVector { public: - enum { growSize = 4000 }; + int growSize; int lines; LineData *linesData; int size; diff --git a/src/stc/scintilla/src/Editor.cxx b/src/stc/scintilla/src/Editor.cxx index faba66ef55..f2ba9f088b 100644 --- a/src/stc/scintilla/src/Editor.cxx +++ b/src/stc/scintilla/src/Editor.cxx @@ -402,6 +402,7 @@ void Editor::InvalidateStyleData() { } void Editor::InvalidateStyleRedraw() { + NeedWrapping(); InvalidateStyleData(); Redraw(); } @@ -835,7 +836,7 @@ int Editor::MovePositionOutsideChar(int pos, int moveDir, bool checkLineEnd) { 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); @@ -844,7 +845,8 @@ int Editor::MovePositionTo(int newPos, bool extend) { } else { SetEmptySelection(newPos); } - EnsureCaretVisible(); + if (ensureVisible) + EnsureCaretVisible(); ShowCaretAtCurrentPosition(); NotifyMove(newPos); return 0; @@ -908,16 +910,18 @@ void Editor::HorizontalScrollTo(int xPos) { } } -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); } } @@ -1621,12 +1625,15 @@ void Editor::LayoutLine(int line, Surface *surface, ViewStyle &vstyle, LineLayou 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; @@ -1641,12 +1648,13 @@ void Editor::LayoutLine(int line, Surface *surface, ViewStyle &vstyle, LineLayou } 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); } @@ -1802,7 +1810,6 @@ void Editor::DrawLine(Surface *surface, ViewStyle &vsDraw, int line, int lineVis 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; @@ -1826,8 +1833,12 @@ void Editor::DrawLine(Surface *surface, ViewStyle &vsDraw, int line, int lineVis } 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) { @@ -1886,8 +1897,15 @@ void Editor::DrawLine(Surface *surface, ViewStyle &vsDraw, int line, int lineVis 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; @@ -2316,6 +2334,8 @@ long Editor::FormatRange(bool draw, RangeToFormat *pfr) { // 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 @@ -3039,6 +3059,10 @@ void Editor::NotifyMacroRecord(unsigned int iMessage, unsigned long wParam, long 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 @@ -3169,6 +3193,39 @@ void Editor::CursorUpOrDown(int direction, bool extend) { 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; subLinelines; 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: @@ -3179,7 +3236,7 @@ int Editor::KeyCommand(unsigned int iMessage) { break; case SCI_LINESCROLLDOWN: ScrollTo(topLine + 1); - MoveCaretInsideView(); + MoveCaretInsideView(false); break; case SCI_LINEUP: CursorUpOrDown(-1); @@ -3189,7 +3246,7 @@ int Editor::KeyCommand(unsigned int iMessage) { break; case SCI_LINESCROLLUP: ScrollTo(topLine - 1); - MoveCaretInsideView(); + MoveCaretInsideView(false); break; case SCI_CHARLEFT: if (SelectionEmpty()) { @@ -3322,7 +3379,6 @@ int Editor::KeyCommand(unsigned int iMessage) { case SCI_ZOOMIN: if (vs.zoomLevel < 20) { vs.zoomLevel++; - NeedWrapping(); InvalidateStyleRedraw(); NotifyZoom(); } @@ -3330,7 +3386,6 @@ int Editor::KeyCommand(unsigned int iMessage) { case SCI_ZOOMOUT: if (vs.zoomLevel > -10) { vs.zoomLevel--; - NeedWrapping(); InvalidateStyleRedraw(); NotifyZoom(); } @@ -3405,6 +3460,26 @@ int Editor::KeyCommand(unsigned int iMessage) { 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; } @@ -4647,13 +4722,11 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) { case SCI_SETMARGINLEFT: vs.leftMarginWidth = lParam; - NeedWrapping(); InvalidateStyleRedraw(); break; case SCI_SETMARGINRIGHT: vs.rightMarginWidth = lParam; - NeedWrapping(); InvalidateStyleRedraw(); break; @@ -4953,7 +5026,6 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) { case SCI_SETWRAPMODE: wrapState = (wParam == SC_WRAP_WORD) ? eWrapWord : eWrapNone; - NeedWrapping(); xOffset = 0; InvalidateStyleRedraw(); ReconfigureScrollBars(); @@ -5036,6 +5108,7 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) { case SCI_SETCODEPAGE: pdoc->dbcsCodePage = wParam; + InvalidateStyleRedraw(); break; case SCI_GETCODEPAGE: @@ -5117,7 +5190,6 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) { case SCI_SETMARGINWIDTHN: if (ValidMargin(wParam)) { vs.ms[wParam].width = lParam; - NeedWrapping(); InvalidateStyleRedraw(); } break; @@ -5375,6 +5447,18 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) { 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(); @@ -5481,6 +5565,10 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) { 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: @@ -5506,7 +5594,6 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) { case SCI_SETZOOM: vs.zoomLevel = wParam; - NeedWrapping(); InvalidateStyleRedraw(); NotifyZoom(); break; diff --git a/src/stc/scintilla/src/Editor.h b/src/stc/scintilla/src/Editor.h index 451f123411..800630bbb0 100644 --- a/src/stc/scintilla/src/Editor.h +++ b/src/stc/scintilla/src/Editor.h @@ -322,14 +322,14 @@ protected: // ScintillaBase subclass needs access to much of Editor 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(); @@ -403,9 +403,10 @@ protected: // ScintillaBase subclass needs access to much of Editor 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); diff --git a/src/stc/scintilla/src/KeyMap.cxx b/src/stc/scintilla/src/KeyMap.cxx index 761df4c8ff..c91e6c6ccc 100644 --- a/src/stc/scintilla/src/KeyMap.cxx +++ b/src/stc/scintilla/src/KeyMap.cxx @@ -85,10 +85,14 @@ const KeyToCommand KeyMap::MapDefault[] = { {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}, @@ -115,6 +119,7 @@ const KeyToCommand KeyMap::MapDefault[] = { {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}, diff --git a/src/stc/scintilla/src/LexCPP.cxx b/src/stc/scintilla/src/LexCPP.cxx index c1bb1ff9a3..39f458da73 100644 --- a/src/stc/scintilla/src/LexCPP.cxx +++ b/src/stc/scintilla/src/LexCPP.cxx @@ -113,7 +113,7 @@ static void ColouriseCppDoc(unsigned int startPos, int length, int initStyle, Wo sc.SetState(SCE_C_DEFAULT); } } else { - if (sc.atLineEnd) { + if ((sc.atLineEnd) || (sc.Match('/', '*')) || (sc.Match('/', '/'))) { sc.SetState(SCE_C_DEFAULT); } } diff --git a/src/stc/scintilla/src/LexOthers.cxx b/src/stc/scintilla/src/LexOthers.cxx index 7010591430..babb3a0d37 100644 --- a/src/stc/scintilla/src/LexOthers.cxx +++ b/src/stc/scintilla/src/LexOthers.cxx @@ -346,6 +346,9 @@ static void ColouriseErrorListLine( 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] == '+') { @@ -410,7 +413,8 @@ static void ColouriseErrorListLine( 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] == '^'))) { diff --git a/src/stc/scintilla/src/LexPascal.cxx b/src/stc/scintilla/src/LexPascal.cxx index 491d968ac9..37e5e995fb 100644 --- a/src/stc/scintilla/src/LexPascal.cxx +++ b/src/stc/scintilla/src/LexPascal.cxx @@ -2,6 +2,7 @@ /** @file LexPascal.cxx ** Lexer for Pascal. ** Written by Laurent le Tynevez + ** Updated by Simon Steele September 2002 **/ #include @@ -17,42 +18,86 @@ #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(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; @@ -60,9 +105,21 @@ static void ColourisePascalDoc(unsigned int startPos, int length, int initStyle, 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')) { @@ -73,17 +130,9 @@ static void ColourisePascalDoc(unsigned int startPos, int length, int initStyle, 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++; @@ -110,9 +159,6 @@ static void ColourisePascalDoc(unsigned int startPos, int length, int initStyle, } 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; @@ -126,7 +172,16 @@ static void ColourisePascalDoc(unsigned int startPos, int length, int initStyle, } } 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 != '&') { @@ -138,14 +193,11 @@ static void ColourisePascalDoc(unsigned int startPos, int length, int initStyle, 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) { @@ -177,30 +229,10 @@ static void ColourisePascalDoc(unsigned int startPos, int length, int initStyle, 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; @@ -210,12 +242,101 @@ static void ColourisePascalDoc(unsigned int startPos, int length, int initStyle, 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 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); diff --git a/src/stc/scintilla/src/LexPython.cxx b/src/stc/scintilla/src/LexPython.cxx index 01365c1901..bfaa08f0e9 100644 --- a/src/stc/scintilla/src/LexPython.cxx +++ b/src/stc/scintilla/src/LexPython.cxx @@ -163,7 +163,7 @@ static void ColourisePyDoc(unsigned int startPos, int length, int initStyle, // 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')))) { diff --git a/src/stc/scintilla/src/LineMarker.cxx b/src/stc/scintilla/src/LineMarker.cxx index 1b8975d9c0..009ea4ea50 100644 --- a/src/stc/scintilla/src/LineMarker.cxx +++ b/src/stc/scintilla/src/LineMarker.cxx @@ -239,6 +239,22 @@ void LineMarker::Draw(Surface *surface, PRectangle &rcWhole, Font &fontForCharac 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), diff --git a/src/stc/scintilla/src/PropSet.cxx b/src/stc/scintilla/src/PropSet.cxx index 2967996913..b527c385ce 100644 --- a/src/stc/scintilla/src/PropSet.cxx +++ b/src/stc/scintilla/src/PropSet.cxx @@ -411,33 +411,38 @@ bool PropSet::GetNext(char ** key, char ** val) { 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(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(wordlist[k])]) { if (!prev) { keywords[words] = &wordlist[k]; words++; diff --git a/src/stc/scintilla/src/RESearch.cxx b/src/stc/scintilla/src/RESearch.cxx index 2c63bb9590..f176bbf19e 100644 --- a/src/stc/scintilla/src/RESearch.cxx +++ b/src/stc/scintilla/src/RESearch.cxx @@ -30,8 +30,8 @@ * 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 diff --git a/src/stc/scintilla/src/ScintillaBase.cxx b/src/stc/scintilla/src/ScintillaBase.cxx index 7958661521..a5e5a065d1 100644 --- a/src/stc/scintilla/src/ScintillaBase.cxx +++ b/src/stc/scintilla/src/ScintillaBase.cxx @@ -69,8 +69,8 @@ void ScintillaBase::AddCharUTF(char *s, unsigned int len, bool treatAsDBCS) { 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); @@ -145,12 +145,12 @@ int ScintillaBase::KeyCommand(unsigned int iMessage) { 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: @@ -251,8 +251,8 @@ void ScintillaBase::AutoCompleteStart(int lenEntered, const char *list) { // 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; @@ -283,14 +283,20 @@ void ScintillaBase::AutoCompleteMoveToCurrentWord() { 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(); diff --git a/src/stc/scintilla/src/ScintillaBase.h b/src/stc/scintilla/src/ScintillaBase.h index 28c089edd2..e68aeb6084 100644 --- a/src/stc/scintilla/src/ScintillaBase.h +++ b/src/stc/scintilla/src/ScintillaBase.h @@ -65,7 +65,8 @@ protected: 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); diff --git a/src/stc/scintilla/src/ViewStyle.cxx b/src/stc/scintilla/src/ViewStyle.cxx index 7937e1fca7..12e1406aa4 100644 --- a/src/stc/scintilla/src/ViewStyle.cxx +++ b/src/stc/scintilla/src/ViewStyle.cxx @@ -72,6 +72,10 @@ ViewStyle::ViewStyle(const ViewStyle &source) { 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; @@ -120,6 +124,10 @@ void ViewStyle::Init() { 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); @@ -176,6 +184,8 @@ void ViewStyle::RefreshColourPalette(Palette &pal, bool want) { 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); diff --git a/src/stc/scintilla/src/ViewStyle.h b/src/stc/scintilla/src/ViewStyle.h index 7528638c59..887170eaac 100644 --- a/src/stc/scintilla/src/ViewStyle.h +++ b/src/stc/scintilla/src/ViewStyle.h @@ -53,6 +53,10 @@ public: 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 diff --git a/src/stc/stc.cpp b/src/stc/stc.cpp index b44aec5667..d675e8da9d 100644 --- a/src/stc/stc.cpp +++ b/src/stc/stc.cpp @@ -643,6 +643,16 @@ wxColour wxStyledTextCtrl::IndicatorGetForeground(int indic) { 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. @@ -1463,6 +1473,28 @@ int wxStyledTextCtrl::TextHeight(int line) { 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); diff --git a/wxPython/CHANGES.txt b/wxPython/CHANGES.txt index 453146ea99..eefa6256aa 100644 --- a/wxPython/CHANGES.txt +++ b/wxPython/CHANGES.txt @@ -34,7 +34,7 @@ Updated XRCed from Roman Rolinsky 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! UNICODE! wxWindows/wxPython can be compiled with unicode support enabled or diff --git a/wxPython/b.bat b/wxPython/b.bat index d68095f808..22f0042c1e 100755 --- a/wxPython/b.bat +++ b/wxPython/b.bat @@ -100,8 +100,8 @@ rem "b" --> both debug and hybrid builds 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 diff --git a/wxPython/contrib/stc/msw/stc_.cpp b/wxPython/contrib/stc/msw/stc_.cpp index de6110e957..17c9161e10 100644 --- a/wxPython/contrib/stc/msw/stc_.cpp +++ b/wxPython/contrib/stc/msw/stc_.cpp @@ -2820,6 +2820,84 @@ static PyObject *_wrap_wxStyledTextCtrl_IndicatorGetForeground(PyObject *self, P 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; @@ -7132,6 +7210,118 @@ static PyObject *_wrap_wxStyledTextCtrl_TextHeight(PyObject *self, PyObject *arg 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; @@ -10896,6 +11086,10 @@ static PyMethodDef stc_cMethods[] = { { "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 }, @@ -11037,6 +11231,8 @@ static PyMethodDef stc_cMethods[] = { { "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 }, @@ -11287,6 +11483,8 @@ SWIGEXPORT(void) initstc_c() { 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)); @@ -11407,6 +11605,10 @@ SWIGEXPORT(void) initstc_c() { 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)); diff --git a/wxPython/contrib/stc/msw/stc_.py b/wxPython/contrib/stc/msw/stc_.py index 4e9ec5fadd..283ac7527d 100644 --- a/wxPython/contrib/stc/msw/stc_.py +++ b/wxPython/contrib/stc/msw/stc_.py @@ -370,6 +370,12 @@ class wxStyledTextCtrlPtr(wxControlPtr): 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 @@ -795,6 +801,18 @@ class wxStyledTextCtrlPtr(wxControlPtr): 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 @@ -1220,6 +1238,8 @@ wxSTC_MARK_CIRCLEPLUSCONNECTED = stc_c.wxSTC_MARK_CIRCLEPLUSCONNECTED 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 @@ -1340,6 +1360,10 @@ wxSTC_CMD_UPPERCASE = stc_c.wxSTC_CMD_UPPERCASE 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 diff --git a/wxPython/demo/data/stc.h.html b/wxPython/demo/data/stc.h.html index 7552679b41..87f144bf8d 100644 --- a/wxPython/demo/data/stc.h.html +++ b/wxPython/demo/data/stc.h.html @@ -1,6 +1,6 @@ -stc.h +/home/others/projects/wx2.3/contrib/include/wx/stc/stc.h.html @@ -94,6 +94,8 @@ // 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. @@ -333,6 +335,20 @@ // 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 @@ -1166,6 +1182,12 @@ // 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. @@ -1626,6 +1648,20 @@ // 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(); diff --git a/wxPython/setup.py b/wxPython/setup.py index 3ad0cf25d7..7d6a2c6247 100755 --- a/wxPython/setup.py +++ b/wxPython/setup.py @@ -13,7 +13,7 @@ from my_distutils import run_swig, contrib_copy_tree # 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 " diff --git a/wxPython/src/__version__.py b/wxPython/src/__version__.py index 6219c85961..b846f0cf7f 100644 --- a/wxPython/src/__version__.py +++ b/wxPython/src/__version__.py @@ -1 +1 @@ -ver = '2.3.3pre7' +ver = '2.3.3pre8' -- 2.45.2