]> git.saurik.com Git - wxWidgets.git/commitdiff
Update to Scintilla 1.48
authorRobin Dunn <robin@alldunn.com>
Wed, 11 Sep 2002 01:00:07 +0000 (01:00 +0000)
committerRobin Dunn <robin@alldunn.com>
Wed, 11 Sep 2002 01:00:07 +0000 (01:00 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@17118 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

51 files changed:
contrib/include/wx/stc/stc.h
contrib/src/stc/gen_iface.py
contrib/src/stc/scintilla/README.txt
contrib/src/stc/scintilla/include/Scintilla.h
contrib/src/stc/scintilla/include/Scintilla.iface
contrib/src/stc/scintilla/src/CellBuffer.cxx
contrib/src/stc/scintilla/src/CellBuffer.h
contrib/src/stc/scintilla/src/Editor.cxx
contrib/src/stc/scintilla/src/Editor.h
contrib/src/stc/scintilla/src/KeyMap.cxx
contrib/src/stc/scintilla/src/LexCPP.cxx
contrib/src/stc/scintilla/src/LexOthers.cxx
contrib/src/stc/scintilla/src/LexPascal.cxx
contrib/src/stc/scintilla/src/LexPython.cxx
contrib/src/stc/scintilla/src/LineMarker.cxx
contrib/src/stc/scintilla/src/PropSet.cxx
contrib/src/stc/scintilla/src/RESearch.cxx
contrib/src/stc/scintilla/src/ScintillaBase.cxx
contrib/src/stc/scintilla/src/ScintillaBase.h
contrib/src/stc/scintilla/src/ViewStyle.cxx
contrib/src/stc/scintilla/src/ViewStyle.h
contrib/src/stc/stc.cpp
include/wx/stc/stc.h
src/stc/gen_iface.py
src/stc/scintilla/README.txt
src/stc/scintilla/include/Scintilla.h
src/stc/scintilla/include/Scintilla.iface
src/stc/scintilla/src/CellBuffer.cxx
src/stc/scintilla/src/CellBuffer.h
src/stc/scintilla/src/Editor.cxx
src/stc/scintilla/src/Editor.h
src/stc/scintilla/src/KeyMap.cxx
src/stc/scintilla/src/LexCPP.cxx
src/stc/scintilla/src/LexOthers.cxx
src/stc/scintilla/src/LexPascal.cxx
src/stc/scintilla/src/LexPython.cxx
src/stc/scintilla/src/LineMarker.cxx
src/stc/scintilla/src/PropSet.cxx
src/stc/scintilla/src/RESearch.cxx
src/stc/scintilla/src/ScintillaBase.cxx
src/stc/scintilla/src/ScintillaBase.h
src/stc/scintilla/src/ViewStyle.cxx
src/stc/scintilla/src/ViewStyle.h
src/stc/stc.cpp
wxPython/CHANGES.txt
wxPython/b.bat
wxPython/contrib/stc/msw/stc_.cpp
wxPython/contrib/stc/msw/stc_.py
wxPython/demo/data/stc.h.html
wxPython/setup.py
wxPython/src/__version__.py

index 92f4484c5b3027272ab6c205f053dfc65fafbe65..640eac8baff4084181d3532c2eebcdfcec79a9cd 100644 (file)
@@ -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.
 // 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();
 
index 8c30ad99e6840c900bcc43a2c3b81385d6c49360..b5342b73e6b4071c70ef7dc3875d8aceb9b1f9e2 100644 (file)
@@ -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),
 
     }
index 3534249c036d54939102db4c83d8eca313c001f9..8538707cdeb85e8ae6419a6d4e24074022a4619a 100644 (file)
@@ -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
 
index 4b8ccd23f458ea4a85ee4d349fa740035601781a..30fcf50fc400e9ab082e3dabde2c36fec57980c1 100644 (file)
@@ -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
index f6e259efc661c6a64a0e7b15d496e1c306222fb1..776fe8f2b78ca44f87969abbd1fab2a3fc1067ac 100644 (file)
@@ -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(,)
 
index b67da81c937132af33d8b1fdb1dc0679b63a6b05..420dee6ff70ed50386f9e0bc914797201fdae91e 100644 (file)
@@ -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);
index b5c90f57a51b4f46433ff4bde1fa091641bebc1d..5cfcbfe1f01fcaac2f1601f029401227dc187f4c 100644 (file)
@@ -53,7 +53,7 @@ struct LineData {
  */
 class LineVector {
 public:
-       enum { growSize = 4000 };
+       int growSize;
        int lines;
        LineData *linesData;
        int size;
index faba66ef55bac5231ad94c1c501a40ecdffcec0e..f2ba9f088b5e70d193cafd5780c504674dc1eb38 100644 (file)
@@ -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; subLine<ll->lines; subLine++) {
+                               if ((posInLine >= ll->LineStart(subLine)) && (posInLine <= ll->LineStart(subLine+1))) {
+                                       if (start) {
+                                               posRet = ll->LineStart(subLine) + posLineStart;
+                                       } else {
+                                               if (subLine == ll->lines - 1)
+                                                       posRet = ll->LineStart(subLine+1) + posLineStart;
+                                               else
+                                                       posRet = ll->LineStart(subLine+1) + posLineStart - 1;
+                                       }
+                               }
+                       }
+               }
+       }
+       llc.Dispose(ll);
+       if (posRet == INVALID_POSITION) {
+               return pos;
+       } else {
+               return posRet;
+       }
+}
+
 int Editor::KeyCommand(unsigned int iMessage) {
        switch (iMessage) {
        case SCI_LINEDOWN:
@@ -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;
index 451f123411e6d44138924706398e2cbe17123441..800630bbb045a11f90f6841b243864c8a4637b28 100644 (file)
@@ -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);
index 761df4c8ff363e376598d2e89f18856ca50466a0..c91e6c6cccb8c50ca003e1d95d2fd233eae37abc 100644 (file)
@@ -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},
index c1bb1ff9a30bace3c31ef25db5c558d9bee2b370..39f458da7397171b0148ce2bed11c2b6c72d13e6 100644 (file)
@@ -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);
                                }
                        }
index 7010591430fff612b4c3c718115287f638cdf89d..babb3a0d3771da2336bbc61dc70633f21ae11815 100644 (file)
@@ -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] == '^'))) {
index 491d968ac99743bfa9404ab64056d5ceeaf5d7ce..37e5e995fb4164ee2009cf553edfbf47e34c6361 100644 (file)
@@ -2,6 +2,7 @@
 /** @file LexPascal.cxx
  ** Lexer for Pascal.
  ** Written by Laurent le Tynevez
+ ** Updated by Simon Steele <s.steele@pnotepad.org> September 2002
  **/
 
 #include <stdlib.h>
 #include "KeyWords.h"
 #include "Scintilla.h"
 #include "SciLexer.h"
+#include "StyleContext.h"
 
-static int classifyWordPascal(unsigned int start, unsigned int end, WordList &keywords, Accessor &styler) {
-       char s[100];
-       for (unsigned int i = 0; i < end - start + 1 && i < 30; i++) {
+static void getRange(unsigned int start,
+               unsigned int end,
+               Accessor &styler,
+               char *s,
+               unsigned int len) {
+       unsigned int i = 0;
+       while ((i < end - start + 1) && (i < len-1)) {
                s[i] = static_cast<char>(tolower(styler[start + i]));
-               s[i + 1] = '\0';
+               i++;
        }
-       int lev= 0;
+       s[i] = '\0';
+}
+
+static bool IsStreamCommentStyle(int style) {
+       return style == SCE_C_COMMENT || 
+               style == SCE_C_COMMENTDOC ||
+               style == SCE_C_COMMENTDOCKEYWORD ||
+               style == SCE_C_COMMENTDOCKEYWORDERROR;
+}
+
+static inline bool IsAWordChar(const int ch) {
+       return (ch < 0x80) && (isalnum(ch) || ch == '.' || ch == '_');
+}
+
+// returns 1 if the item starts a class definition, and -1 if the word is "end".
+static int classifyWordPascal(unsigned int start, unsigned int end, /*WordList &keywords*/WordList *keywordlists[], Accessor &styler, bool bInClass) {
+       int ret = 0;
+
+       WordList& keywords = *keywordlists[0];
+       WordList& classwords = *keywordlists[1];
+       
+       char s[100];
+       getRange(start, end, styler, s, sizeof(s));
+
        char chAttr = SCE_C_IDENTIFIER;
-       if (isdigit(s[0]) || (s[0] == '.')){
+       if (isdigit(s[0]) || (s[0] == '.')) {
                chAttr = SCE_C_NUMBER;
        }
        else {
                if (keywords.InList(s)) {
                        chAttr = SCE_C_WORD;
-                       if (strcmp(s, "begin") == 0 || strcmp(s, "object") == 0)
-                               lev=1;
-                       else if (strcmp(s, "end") == 0)
-                               lev=-1;
+
+                       if(strcmp(s, "class") == 0)
+                               ret = 1;
+                       else if(strcmp(s, "end") == 0)
+                               ret = -1;
+               } else if (bInClass) {
+                       if (classwords.InList(s)) {
+                               chAttr = SCE_C_WORD;
+                       }
                }
        }
        styler.ColourTo(end, chAttr);
+       return ret;
+}
+
+static int classifyFoldPointPascal(const char* s) {
+       int lev = 0;
+       if (!(isdigit(s[0]) || (s[0] == '.'))) {
+               if (strcmp(s, "begin") == 0 ||
+                       strcmp(s, "object") == 0 ||
+                       strcmp(s, "case") == 0 ||
+                       strcmp(s, "class") == 0 ||
+                       strcmp(s, "record") == 0 ||
+                       strcmp(s, "try") == 0) {
+                       lev=1;
+               } else if (strcmp(s, "end") == 0) {
+                       lev=-1;
+               }
+       }
        return lev;
 }
 
 static void ColourisePascalDoc(unsigned int startPos, int length, int initStyle, WordList *keywordlists[],
        Accessor &styler) {
-       WordList &keywords = *keywordlists[0];
 
        styler.StartAt(startPos);
 
-       bool fold = styler.GetPropertyInt("fold") != 0;
-       int lineCurrent = styler.GetLine(startPos);
-       int levelPrev = styler.LevelAt(lineCurrent) & SC_FOLDLEVELNUMBERMASK;
-       int levelCurrent = levelPrev;
-
        int state = initStyle;
        if (state == SCE_C_STRINGEOL)   // Does not leak onto next line
                state = SCE_C_DEFAULT;
@@ -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<endPos) && IsASpaceOrTab(styler.SafeGetCharAt(j))) {
+                                       j++;
+                               }
+                               if (styler.Match(j, "region") || styler.Match(j, "if")) {
+                                       levelCurrent++;
+                               } else if (styler.Match(j, "end")) {
+                                       levelCurrent--;
+                               }
+                       }
+               }
+
+               if (foldComment && IsStreamCommentStyle(style)) {
+                       if (!IsStreamCommentStyle(stylePrev)) {
+                               levelCurrent++;
+                       } else if (!IsStreamCommentStyle(styleNext) && !atEOL) {
+                               // Comments don't end at end of line and the next character may be unstyled.
+                               levelCurrent--;
+                       }
+               }
+
+               if (atEOL) {
+                       int lev = levelPrev;
+                       if (visibleChars == 0 && foldCompact)
+                               lev |= SC_FOLDLEVELWHITEFLAG;
+                       if ((levelCurrent > levelPrev) && (visibleChars > 0))
+                               lev |= SC_FOLDLEVELHEADERFLAG;
+                       if (lev != styler.LevelAt(lineCurrent)) {
+                               styler.SetLevel(lineCurrent, lev);
+                       }
+                       lineCurrent++;
+                       levelPrev = levelCurrent;
+                       visibleChars = 0;
+               }
+               
+               if (!isspacechar(ch))
+                       visibleChars++;
        }
+
+       // Fill in the real level of the next line, keeping the current flags as they will be filled in later
+       int flagsNext = styler.LevelAt(lineCurrent) & ~SC_FOLDLEVELNUMBERMASK;
+       styler.SetLevel(lineCurrent, levelPrev | flagsNext);
 }
 
-LexerModule lmPascal(SCLEX_PASCAL, ColourisePascalDoc, "pascal");
+LexerModule lmPascal(SCLEX_PASCAL, ColourisePascalDoc, "pascal", FoldPascalDoc);
index 01365c1901a2eb0c99f336c133c3a2ae1c5ad62b..bfaa08f0e9daba30327b4f269832a9c0abdc5085 100644 (file)
@@ -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')))) {
index 1b8975d9c03e3fa3e4d774c7d02e4a331309487a..009ea4ea50e869a30542dd1e6b1fa3278c522822 100644 (file)
@@ -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),
index 29679969132f0f3eeabcf9da2c084875303df0a0..b527c385ce15f54beff0d2fb63a006dc2e0b2896 100644 (file)
@@ -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<unsigned char>(wordlist[j]);
+               if (!wordSeparator[curr] && wordSeparator[prev])
                        words++;
-               prev = wordlist[j];
+               prev = curr;
        }
-       char **keywords = new char * [words + 1];
+       char **keywords = new char *[words + 1];
        if (keywords) {
                words = 0;
                prev = '\0';
                size_t slen = strlen(wordlist);
                for (size_t k = 0; k < slen; k++) {
-                       if (!iswordsep(wordlist[k], onlyLineEnds)) {
+                       if (!wordSeparator[static_cast<unsigned char>(wordlist[k])]) {
                                if (!prev) {
                                        keywords[words] = &wordlist[k];
                                        words++;
index 2c63bb95906c369200e6d8190c1702a5487cb520..f176bbf19e02107aac4100a5fc1492f5d4596343 100644 (file)
@@ -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
index 7958661521984f9f4e104d70cf17557ba28dd37f..a5e5a065d19ba9347417ffb7307f276e1757a6cf 100644 (file)
@@ -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();
index 28c089edd2563e9a36cd4dcaf97d66ead96d41b5..e68aeb60841415ac4fb29da25d89b17a29eb0d92 100644 (file)
@@ -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);
index 7937e1fca7995033ccef2d352ffca4768e19cf84..12e1406aa440db3930e2e8d1ae8f51f36b4b8bcc 100644 (file)
@@ -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);
index 7528638c59058075fb5eb44a685b15064699a15b..887170eaac1ee17685c9a17dc174965f9a6c4db6 100644 (file)
@@ -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
index b44aec5667c5bfd8ee807de1f39969dc8e2b3c22..d675e8da9d8e0f7ab0e9786216ec2ead1fef3d73 100644 (file)
@@ -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);
index 92f4484c5b3027272ab6c205f053dfc65fafbe65..640eac8baff4084181d3532c2eebcdfcec79a9cd 100644 (file)
@@ -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.
 // 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();
 
index 8c30ad99e6840c900bcc43a2c3b81385d6c49360..b5342b73e6b4071c70ef7dc3875d8aceb9b1f9e2 100644 (file)
@@ -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),
 
     }
index 3534249c036d54939102db4c83d8eca313c001f9..8538707cdeb85e8ae6419a6d4e24074022a4619a 100644 (file)
@@ -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
 
index 4b8ccd23f458ea4a85ee4d349fa740035601781a..30fcf50fc400e9ab082e3dabde2c36fec57980c1 100644 (file)
@@ -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
index f6e259efc661c6a64a0e7b15d496e1c306222fb1..776fe8f2b78ca44f87969abbd1fab2a3fc1067ac 100644 (file)
@@ -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(,)
 
index b67da81c937132af33d8b1fdb1dc0679b63a6b05..420dee6ff70ed50386f9e0bc914797201fdae91e 100644 (file)
@@ -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);
index b5c90f57a51b4f46433ff4bde1fa091641bebc1d..5cfcbfe1f01fcaac2f1601f029401227dc187f4c 100644 (file)
@@ -53,7 +53,7 @@ struct LineData {
  */
 class LineVector {
 public:
-       enum { growSize = 4000 };
+       int growSize;
        int lines;
        LineData *linesData;
        int size;
index faba66ef55bac5231ad94c1c501a40ecdffcec0e..f2ba9f088b5e70d193cafd5780c504674dc1eb38 100644 (file)
@@ -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; subLine<ll->lines; subLine++) {
+                               if ((posInLine >= ll->LineStart(subLine)) && (posInLine <= ll->LineStart(subLine+1))) {
+                                       if (start) {
+                                               posRet = ll->LineStart(subLine) + posLineStart;
+                                       } else {
+                                               if (subLine == ll->lines - 1)
+                                                       posRet = ll->LineStart(subLine+1) + posLineStart;
+                                               else
+                                                       posRet = ll->LineStart(subLine+1) + posLineStart - 1;
+                                       }
+                               }
+                       }
+               }
+       }
+       llc.Dispose(ll);
+       if (posRet == INVALID_POSITION) {
+               return pos;
+       } else {
+               return posRet;
+       }
+}
+
 int Editor::KeyCommand(unsigned int iMessage) {
        switch (iMessage) {
        case SCI_LINEDOWN:
@@ -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;
index 451f123411e6d44138924706398e2cbe17123441..800630bbb045a11f90f6841b243864c8a4637b28 100644 (file)
@@ -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);
index 761df4c8ff363e376598d2e89f18856ca50466a0..c91e6c6cccb8c50ca003e1d95d2fd233eae37abc 100644 (file)
@@ -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},
index c1bb1ff9a30bace3c31ef25db5c558d9bee2b370..39f458da7397171b0148ce2bed11c2b6c72d13e6 100644 (file)
@@ -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);
                                }
                        }
index 7010591430fff612b4c3c718115287f638cdf89d..babb3a0d3771da2336bbc61dc70633f21ae11815 100644 (file)
@@ -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] == '^'))) {
index 491d968ac99743bfa9404ab64056d5ceeaf5d7ce..37e5e995fb4164ee2009cf553edfbf47e34c6361 100644 (file)
@@ -2,6 +2,7 @@
 /** @file LexPascal.cxx
  ** Lexer for Pascal.
  ** Written by Laurent le Tynevez
+ ** Updated by Simon Steele <s.steele@pnotepad.org> September 2002
  **/
 
 #include <stdlib.h>
 #include "KeyWords.h"
 #include "Scintilla.h"
 #include "SciLexer.h"
+#include "StyleContext.h"
 
-static int classifyWordPascal(unsigned int start, unsigned int end, WordList &keywords, Accessor &styler) {
-       char s[100];
-       for (unsigned int i = 0; i < end - start + 1 && i < 30; i++) {
+static void getRange(unsigned int start,
+               unsigned int end,
+               Accessor &styler,
+               char *s,
+               unsigned int len) {
+       unsigned int i = 0;
+       while ((i < end - start + 1) && (i < len-1)) {
                s[i] = static_cast<char>(tolower(styler[start + i]));
-               s[i + 1] = '\0';
+               i++;
        }
-       int lev= 0;
+       s[i] = '\0';
+}
+
+static bool IsStreamCommentStyle(int style) {
+       return style == SCE_C_COMMENT || 
+               style == SCE_C_COMMENTDOC ||
+               style == SCE_C_COMMENTDOCKEYWORD ||
+               style == SCE_C_COMMENTDOCKEYWORDERROR;
+}
+
+static inline bool IsAWordChar(const int ch) {
+       return (ch < 0x80) && (isalnum(ch) || ch == '.' || ch == '_');
+}
+
+// returns 1 if the item starts a class definition, and -1 if the word is "end".
+static int classifyWordPascal(unsigned int start, unsigned int end, /*WordList &keywords*/WordList *keywordlists[], Accessor &styler, bool bInClass) {
+       int ret = 0;
+
+       WordList& keywords = *keywordlists[0];
+       WordList& classwords = *keywordlists[1];
+       
+       char s[100];
+       getRange(start, end, styler, s, sizeof(s));
+
        char chAttr = SCE_C_IDENTIFIER;
-       if (isdigit(s[0]) || (s[0] == '.')){
+       if (isdigit(s[0]) || (s[0] == '.')) {
                chAttr = SCE_C_NUMBER;
        }
        else {
                if (keywords.InList(s)) {
                        chAttr = SCE_C_WORD;
-                       if (strcmp(s, "begin") == 0 || strcmp(s, "object") == 0)
-                               lev=1;
-                       else if (strcmp(s, "end") == 0)
-                               lev=-1;
+
+                       if(strcmp(s, "class") == 0)
+                               ret = 1;
+                       else if(strcmp(s, "end") == 0)
+                               ret = -1;
+               } else if (bInClass) {
+                       if (classwords.InList(s)) {
+                               chAttr = SCE_C_WORD;
+                       }
                }
        }
        styler.ColourTo(end, chAttr);
+       return ret;
+}
+
+static int classifyFoldPointPascal(const char* s) {
+       int lev = 0;
+       if (!(isdigit(s[0]) || (s[0] == '.'))) {
+               if (strcmp(s, "begin") == 0 ||
+                       strcmp(s, "object") == 0 ||
+                       strcmp(s, "case") == 0 ||
+                       strcmp(s, "class") == 0 ||
+                       strcmp(s, "record") == 0 ||
+                       strcmp(s, "try") == 0) {
+                       lev=1;
+               } else if (strcmp(s, "end") == 0) {
+                       lev=-1;
+               }
+       }
        return lev;
 }
 
 static void ColourisePascalDoc(unsigned int startPos, int length, int initStyle, WordList *keywordlists[],
        Accessor &styler) {
-       WordList &keywords = *keywordlists[0];
 
        styler.StartAt(startPos);
 
-       bool fold = styler.GetPropertyInt("fold") != 0;
-       int lineCurrent = styler.GetLine(startPos);
-       int levelPrev = styler.LevelAt(lineCurrent) & SC_FOLDLEVELNUMBERMASK;
-       int levelCurrent = levelPrev;
-
        int state = initStyle;
        if (state == SCE_C_STRINGEOL)   // Does not leak onto next line
                state = SCE_C_DEFAULT;
@@ -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<endPos) && IsASpaceOrTab(styler.SafeGetCharAt(j))) {
+                                       j++;
+                               }
+                               if (styler.Match(j, "region") || styler.Match(j, "if")) {
+                                       levelCurrent++;
+                               } else if (styler.Match(j, "end")) {
+                                       levelCurrent--;
+                               }
+                       }
+               }
+
+               if (foldComment && IsStreamCommentStyle(style)) {
+                       if (!IsStreamCommentStyle(stylePrev)) {
+                               levelCurrent++;
+                       } else if (!IsStreamCommentStyle(styleNext) && !atEOL) {
+                               // Comments don't end at end of line and the next character may be unstyled.
+                               levelCurrent--;
+                       }
+               }
+
+               if (atEOL) {
+                       int lev = levelPrev;
+                       if (visibleChars == 0 && foldCompact)
+                               lev |= SC_FOLDLEVELWHITEFLAG;
+                       if ((levelCurrent > levelPrev) && (visibleChars > 0))
+                               lev |= SC_FOLDLEVELHEADERFLAG;
+                       if (lev != styler.LevelAt(lineCurrent)) {
+                               styler.SetLevel(lineCurrent, lev);
+                       }
+                       lineCurrent++;
+                       levelPrev = levelCurrent;
+                       visibleChars = 0;
+               }
+               
+               if (!isspacechar(ch))
+                       visibleChars++;
        }
+
+       // Fill in the real level of the next line, keeping the current flags as they will be filled in later
+       int flagsNext = styler.LevelAt(lineCurrent) & ~SC_FOLDLEVELNUMBERMASK;
+       styler.SetLevel(lineCurrent, levelPrev | flagsNext);
 }
 
-LexerModule lmPascal(SCLEX_PASCAL, ColourisePascalDoc, "pascal");
+LexerModule lmPascal(SCLEX_PASCAL, ColourisePascalDoc, "pascal", FoldPascalDoc);
index 01365c1901a2eb0c99f336c133c3a2ae1c5ad62b..bfaa08f0e9daba30327b4f269832a9c0abdc5085 100644 (file)
@@ -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')))) {
index 1b8975d9c03e3fa3e4d774c7d02e4a331309487a..009ea4ea50e869a30542dd1e6b1fa3278c522822 100644 (file)
@@ -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),
index 29679969132f0f3eeabcf9da2c084875303df0a0..b527c385ce15f54beff0d2fb63a006dc2e0b2896 100644 (file)
@@ -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<unsigned char>(wordlist[j]);
+               if (!wordSeparator[curr] && wordSeparator[prev])
                        words++;
-               prev = wordlist[j];
+               prev = curr;
        }
-       char **keywords = new char * [words + 1];
+       char **keywords = new char *[words + 1];
        if (keywords) {
                words = 0;
                prev = '\0';
                size_t slen = strlen(wordlist);
                for (size_t k = 0; k < slen; k++) {
-                       if (!iswordsep(wordlist[k], onlyLineEnds)) {
+                       if (!wordSeparator[static_cast<unsigned char>(wordlist[k])]) {
                                if (!prev) {
                                        keywords[words] = &wordlist[k];
                                        words++;
index 2c63bb95906c369200e6d8190c1702a5487cb520..f176bbf19e02107aac4100a5fc1492f5d4596343 100644 (file)
@@ -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
index 7958661521984f9f4e104d70cf17557ba28dd37f..a5e5a065d19ba9347417ffb7307f276e1757a6cf 100644 (file)
@@ -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();
index 28c089edd2563e9a36cd4dcaf97d66ead96d41b5..e68aeb60841415ac4fb29da25d89b17a29eb0d92 100644 (file)
@@ -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);
index 7937e1fca7995033ccef2d352ffca4768e19cf84..12e1406aa440db3930e2e8d1ae8f51f36b4b8bcc 100644 (file)
@@ -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);
index 7528638c59058075fb5eb44a685b15064699a15b..887170eaac1ee17685c9a17dc174965f9a6c4db6 100644 (file)
@@ -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
index b44aec5667c5bfd8ee807de1f39969dc8e2b3c22..d675e8da9d8e0f7ab0e9786216ec2ead1fef3d73 100644 (file)
@@ -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);
index 453146ea9987c8adc0eb4b43410dd8ba5ba902f6..eefa6256aa174c013d81b02111d40393c0133aa4 100644 (file)
@@ -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! <wink>
 
 UNICODE!
     wxWindows/wxPython can be compiled with unicode support enabled or
index d68095f808007757924f88af1de815e32289f2c6..22f0042c1e34f151c72edbccad389f799a3dc08e 100755 (executable)
@@ -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
index de6110e9573245da6daf40a61a92e1aaa9764c9f..17c9161e1086fd537db63f07f1a301c67db4c606 100644 (file)
@@ -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));
index 4e9ec5fadda31138e098d17b9288d481e43716aa..283ac7527d34a257650e4699a477e7a8e47d3f16 100644 (file)
@@ -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
index 7552679b41c4ec9d68c62be6e45f4feac9c7d734..87f144bf8d9b4d9d125064137dbcb934129a3a90 100644 (file)
@@ -1,6 +1,6 @@
 <html>
 <head>
-<title>stc.h</title>
+<title>/home/others/projects/wx2.3/contrib/include/wx/stc/stc.h.html</title>
 <meta name="Generator" content="Vim/6.0">
 </head>
 <body bgcolor="#f5deb3" text="#000000">
@@ -94,6 +94,8 @@
 
 <font color="#0000ff">// Invisible mark that only sets the line background color.</font>
 <font color="#a020f0">#define wxSTC_MARK_BACKGROUND </font><font color="#ff00ff">22</font>
+<font color="#a020f0">#define wxSTC_MARK_DOTDOTDOT </font><font color="#ff00ff">23</font>
+<font color="#a020f0">#define wxSTC_MARK_ARROWS </font><font color="#ff00ff">24</font>
 <font color="#a020f0">#define wxSTC_MARK_CHARACTER </font><font color="#ff00ff">10000</font>
 
 <font color="#0000ff">// Markers used for outlining column.</font>
 <font color="#0000ff">// Delete the selection or if no selection, the character before the caret.</font>
 <font color="#0000ff">// Will not delete the character before at the start of a line.</font>
 <font color="#a020f0">#define wxSTC_CMD_DELETEBACKNOTLINE </font><font color="#ff00ff">2344</font>
+
+<font color="#0000ff">// Move caret to first position on display line.</font>
+<font color="#a020f0">#define wxSTC_CMD_HOMEDISPLAY </font><font color="#ff00ff">2345</font>
+
+<font color="#0000ff">// Move caret to first position on display line extending selection to </font>
+<font color="#0000ff">// new caret position.</font>
+<font color="#a020f0">#define wxSTC_CMD_HOMEDISPLAYEXTEND </font><font color="#ff00ff">2346</font>
+
+<font color="#0000ff">// Move caret to last position on display line.</font>
+<font color="#a020f0">#define wxSTC_CMD_LINEENDDISPLAY </font><font color="#ff00ff">2347</font>
+
+<font color="#0000ff">// Move caret to last position on display line extending selection to new </font>
+<font color="#0000ff">// caret position.</font>
+<font color="#a020f0">#define wxSTC_CMD_LINEENDDISPLAYEXTEND </font><font color="#ff00ff">2348</font>
 <font color="#a020f0">#define wxSTC_EDGE_NONE </font><font color="#ff00ff">0</font>
 <font color="#a020f0">#define wxSTC_EDGE_LINE </font><font color="#ff00ff">1</font>
 <font color="#a020f0">#define wxSTC_EDGE_BACKGROUND </font><font color="#ff00ff">2</font>
     <font color="#0000ff">// Retrieve the foreground colour of an indicator.</font>
     wxColour IndicatorGetForeground(<font color="#2e8b57"><b>int</b></font> indic);
 
+    <font color="#0000ff">// Set the foreground colour of all whitespace and whether to use this setting.</font>
+    <font color="#2e8b57"><b>void</b></font> SetWhitespaceForeground(<font color="#2e8b57"><b>bool</b></font> useSetting, <font color="#2e8b57"><b>const</b></font> wxColour&amp; fore);
+
+    <font color="#0000ff">// Set the background colour of all whitespace and whether to use this setting.</font>
+    <font color="#2e8b57"><b>void</b></font> SetWhitespaceBackground(<font color="#2e8b57"><b>bool</b></font> useSetting, <font color="#2e8b57"><b>const</b></font> wxColour&amp; back);
+
     <font color="#0000ff">// Divide each styling byte into lexical class bits (default: 5) and indicator</font>
     <font color="#0000ff">// bits (default: 3). If a lexer requires more than 32 lexical states, then this</font>
     <font color="#0000ff">// is used to expand the possible states.</font>
     <font color="#0000ff">// Retrieve the height of a particular line of text in pixels.</font>
     <font color="#2e8b57"><b>int</b></font> TextHeight(<font color="#2e8b57"><b>int</b></font> line);
 
+    <font color="#0000ff">// Move caret to first position on display line.</font>
+    <font color="#2e8b57"><b>void</b></font> HomeDisplay();
+
+    <font color="#0000ff">// Move caret to first position on display line extending selection to </font>
+    <font color="#0000ff">// new caret position.</font>
+    <font color="#2e8b57"><b>void</b></font> HomeDisplayExtend();
+
+    <font color="#0000ff">// Move caret to last position on display line.</font>
+    <font color="#2e8b57"><b>void</b></font> LineEndDisplay();
+
+    <font color="#0000ff">// Move caret to last position on display line extending selection to new </font>
+    <font color="#0000ff">// caret position.</font>
+    <font color="#2e8b57"><b>void</b></font> LineEndDisplayExtend();
+
     <font color="#0000ff">// Move the caret inside current view if it's not there already.</font>
     <font color="#2e8b57"><b>void</b></font> MoveCaretInsideView();
 
index 3ad0cf25d7f535ba549f9ae00c5615bdbb70b28d..7d6a2c6247bed303cb1f26c375db000b322f0847 100755 (executable)
@@ -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 <robin@alldunn.com>"
index 6219c859613d8c402588ad422a564051c053bba3..b846f0cf7f01c3666eb54e7f923e569bc88eaa18 100644 (file)
@@ -1 +1 @@
-ver = '2.3.3pre7'
+ver = '2.3.3pre8'