SF.net SVN: geany:[5005] trunk
eht16 at users.sourceforge.net
eht16 at xxxxx
Sun Jun 6 18:34:27 UTC 2010
Revision: 5005
http://geany.svn.sourceforge.net/geany/?rev=5005&view=rev
Author: eht16
Date: 2010-06-06 18:34:26 +0000 (Sun, 06 Jun 2010)
Log Message:
-----------
Update Scintilla to version 2.12.
Modified Paths:
--------------
trunk/ChangeLog
trunk/NEWS
trunk/scintilla/CellBuffer.cxx
trunk/scintilla/CellBuffer.h
trunk/scintilla/CharacterSet.h
trunk/scintilla/ContractionState.cxx
trunk/scintilla/Document.cxx
trunk/scintilla/Document.h
trunk/scintilla/DocumentAccessor.cxx
trunk/scintilla/DocumentAccessor.h
trunk/scintilla/Editor.cxx
trunk/scintilla/Editor.h
trunk/scintilla/ExternalLexer.cxx
trunk/scintilla/ExternalLexer.h
trunk/scintilla/LexBash.cxx
trunk/scintilla/LexCPP.cxx
trunk/scintilla/LexCSS.cxx
trunk/scintilla/LexCaml.cxx
trunk/scintilla/LexHTML.cxx
trunk/scintilla/LexPerl.cxx
trunk/scintilla/LexPython.cxx
trunk/scintilla/LexVHDL.cxx
trunk/scintilla/LexVerilog.cxx
trunk/scintilla/LineMarker.cxx
trunk/scintilla/LineMarker.h
trunk/scintilla/Partitioning.h
trunk/scintilla/PerLine.cxx
trunk/scintilla/PerLine.h
trunk/scintilla/PlatGTK.cxx
trunk/scintilla/PropSet.cxx
trunk/scintilla/SVector.h
trunk/scintilla/ScintillaBase.h
trunk/scintilla/ScintillaGTK.cxx
trunk/scintilla/Selection.cxx
trunk/scintilla/Selection.h
trunk/scintilla/SplitVector.h
trunk/scintilla/Style.h
trunk/scintilla/UniConversion.cxx
trunk/scintilla/UniConversion.h
trunk/scintilla/ViewStyle.cxx
trunk/scintilla/WindowAccessor.cxx
trunk/scintilla/XPM.cxx
trunk/scintilla/XPM.h
trunk/scintilla/include/Platform.h
trunk/scintilla/include/SciLexer.h
trunk/scintilla/include/Scintilla.iface
trunk/scintilla/include/WindowAccessor.h
trunk/src/plugindata.h
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog 2010-06-06 18:02:49 UTC (rev 5004)
+++ trunk/ChangeLog 2010-06-06 18:34:26 UTC (rev 5005)
@@ -8,6 +8,8 @@
* src/symbols.c:
Fix crash when trying to sort NULL pointers as tags in the Symbols
list (closes #3011986).
+ * NEWS, scintilla/*, scintilla/include/*, src/plugindata.h:
+ Update Scintilla to version 2.12.
2010-06-04 Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com>
Modified: trunk/NEWS
===================================================================
--- trunk/NEWS 2010-06-06 18:02:49 UTC (rev 5004)
+++ trunk/NEWS 2010-06-06 18:34:26 UTC (rev 5005)
@@ -33,7 +33,7 @@
Arshinov).
Editor:
- * Update Scintilla to 2.11.
+ * Update Scintilla to 2.12.
* Add preference and support for virtual spaces.
* Add word part autocompletion for the current selected item when
pressing keybinding (default Tab) - Enter still completes normally.
Modified: trunk/scintilla/CellBuffer.cxx
===================================================================
--- trunk/scintilla/CellBuffer.cxx 2010-06-06 18:02:49 UTC (rev 5004)
+++ trunk/scintilla/CellBuffer.cxx 2010-06-06 18:34:26 UTC (rev 5005)
@@ -44,9 +44,11 @@
starts.InsertText(line, delta);
}
-void LineVector::InsertLine(int line, int position) {
+void LineVector::InsertLine(int line, int position, bool lineStart) {
starts.InsertPartition(line, position);
if (perLine) {
+ if ((line > 0) && lineStart)
+ line--;
perLine->InsertLine(line);
}
}
@@ -339,7 +341,7 @@
return substance.ValueAt(position);
}
-void CellBuffer::GetCharRange(char *buffer, int position, int lengthRetrieve) {
+void CellBuffer::GetCharRange(char *buffer, int position, int lengthRetrieve) const {
if (lengthRetrieve < 0)
return;
if (position < 0)
@@ -355,7 +357,7 @@
}
}
-char CellBuffer::StyleAt(int position) {
+char CellBuffer::StyleAt(int position) const {
return style.ValueAt(position);
}
@@ -473,8 +475,8 @@
// Without undo
-void CellBuffer::InsertLine(int line, int position) {
- lv.InsertLine(line, position);
+void CellBuffer::InsertLine(int line, int position, bool lineStart) {
+ lv.InsertLine(line, position, lineStart);
}
void CellBuffer::RemoveLine(int line) {
@@ -490,27 +492,28 @@
style.InsertValue(position, insertLength, 0);
int lineInsert = lv.LineFromPosition(position) + 1;
+ bool atLineStart = lv.LineStart(lineInsert-1) == position;
// Point all the lines after the insertion point further along in the buffer
lv.InsertText(lineInsert-1, insertLength);
char chPrev = substance.ValueAt(position - 1);
char chAfter = substance.ValueAt(position + insertLength);
if (chPrev == '\r' && chAfter == '\n') {
// Splitting up a crlf pair at position
- InsertLine(lineInsert, position);
+ InsertLine(lineInsert, position, false);
lineInsert++;
}
char ch = ' ';
for (int i = 0; i < insertLength; i++) {
ch = s[i];
if (ch == '\r') {
- InsertLine(lineInsert, (position + i) + 1);
+ InsertLine(lineInsert, (position + i) + 1, atLineStart);
lineInsert++;
} else if (ch == '\n') {
if (chPrev == '\r') {
// Patch up what was end of line
lv.SetLineStart(lineInsert - 1, (position + i) + 1);
} else {
- InsertLine(lineInsert, (position + i) + 1);
+ InsertLine(lineInsert, (position + i) + 1, atLineStart);
lineInsert++;
}
}
Modified: trunk/scintilla/CellBuffer.h
===================================================================
--- trunk/scintilla/CellBuffer.h 2010-06-06 18:02:49 UTC (rev 5004)
+++ trunk/scintilla/CellBuffer.h 2010-06-06 18:34:26 UTC (rev 5005)
@@ -37,7 +37,7 @@
void SetPerLine(PerLine *pl);
void InsertText(int line, int delta);
- void InsertLine(int line, int position);
+ void InsertLine(int line, int position, bool lineStart);
void SetLineStart(int line, int position);
void RemoveLine(int line);
int Lines() const {
@@ -149,8 +149,8 @@
/// Retrieving positions outside the range of the buffer works and returns 0
char CharAt(int position) const;
- void GetCharRange(char *buffer, int position, int lengthRetrieve);
- char StyleAt(int position);
+ void GetCharRange(char *buffer, int position, int lengthRetrieve) const;
+ char StyleAt(int position) const;
const char *BufferPointer();
int Length() const;
@@ -159,7 +159,7 @@
int Lines() const;
int LineStart(int line) const;
int LineFromPosition(int pos) const { return lv.LineFromPosition(pos); }
- void InsertLine(int line, int position);
+ void InsertLine(int line, int position, bool lineStart);
void RemoveLine(int line);
const char *InsertString(int position, const char *s, int insertLength, bool &startSequence);
Modified: trunk/scintilla/CharacterSet.h
===================================================================
--- trunk/scintilla/CharacterSet.h 2010-06-06 18:02:49 UTC (rev 5004)
+++ trunk/scintilla/CharacterSet.h 2010-06-06 18:34:26 UTC (rev 5005)
@@ -53,6 +53,7 @@
}
bool Contains(int val) const {
PLATFORM_ASSERT(val >= 0);
+ if (val < 0) return false;
return (val < size) ? bset[val] : valueAfter;
}
};
Modified: trunk/scintilla/ContractionState.cxx
===================================================================
--- trunk/scintilla/ContractionState.cxx 2010-06-06 18:02:49 UTC (rev 5004)
+++ trunk/scintilla/ContractionState.cxx 2010-06-06 18:34:26 UTC (rev 5005)
@@ -232,11 +232,11 @@
void ContractionState::Check() const {
#ifdef CHECK_CORRECTNESS
- for (int vline = 0;vline < LinesDisplayed(); vline++) {
+ for (int vline = 0; vline < LinesDisplayed(); vline++) {
const int lineDoc = DocFromDisplay(vline);
PLATFORM_ASSERT(GetVisible(lineDoc));
}
- for (int lineDoc = 0;lineDoc < LinesInDoc(); lineDoc++) {
+ for (int lineDoc = 0; lineDoc < LinesInDoc(); lineDoc++) {
const int displayThis = DisplayFromDoc(lineDoc);
const int displayNext = DisplayFromDoc(lineDoc + 1);
const int height = displayNext - displayThis;
Modified: trunk/scintilla/Document.cxx
===================================================================
--- trunk/scintilla/Document.cxx 2010-06-06 18:02:49 UTC (rev 5004)
+++ trunk/scintilla/Document.cxx 2010-06-06 18:34:26 UTC (rev 5005)
@@ -258,7 +258,7 @@
return prev;
}
-int Document::GetLevel(int line) {
+int Document::GetLevel(int line) const {
return static_cast<LineLevels *>(perLineData[ldLevels])->GetLevel(line);
}
@@ -1367,7 +1367,7 @@
return statePrevious;
}
-int Document::GetLineState(int line) {
+int Document::GetLineState(int line) const {
return static_cast<LineState *>(perLineData[ldState])->GetLineState(line);
}
Modified: trunk/scintilla/Document.h
===================================================================
--- trunk/scintilla/Document.h 2010-06-06 18:02:49 UTC (rev 5004)
+++ trunk/scintilla/Document.h 2010-06-06 18:34:26 UTC (rev 5005)
@@ -32,10 +32,10 @@
Range(Position pos=0) :
start(pos), end(pos) {
- };
+ }
Range(Position start_, Position end_) :
start(start_), end(end_) {
- };
+ }
bool Valid() const {
return (start != invalidPosition) && (end != invalidPosition);
@@ -118,7 +118,7 @@
class CaseFolder {
public:
virtual ~CaseFolder() {
- };
+ }
virtual size_t Fold(char *folded, size_t sizeFolded, const char *mixed, size_t lenMixed) = 0;
};
@@ -243,10 +243,10 @@
void DelCharBack(int pos);
char CharAt(int position) { return cb.CharAt(position); }
- void GetCharRange(char *buffer, int position, int lengthRetrieve) {
+ void GetCharRange(char *buffer, int position, int lengthRetrieve) const {
cb.GetCharRange(buffer, position, lengthRetrieve);
}
- char StyleAt(int position) { return cb.StyleAt(position); }
+ char StyleAt(int position) const { return cb.StyleAt(position); }
int GetMark(int line);
int AddMark(int line, int markerNum);
void AddMarkSet(int line, int valueSet);
@@ -261,7 +261,7 @@
int VCHomePosition(int position) const;
int SetLevel(int line, int level);
- int GetLevel(int line);
+ int GetLevel(int line) const;
void ClearLevels();
int GetLastChild(int lineParent, int level=-1);
int GetFoldParent(int line);
@@ -294,7 +294,7 @@
void DecorationFillRange(int position, int value, int fillLength);
int SetLineState(int line, int state);
- int GetLineState(int line);
+ int GetLineState(int line) const;
int GetMaxLineState();
StyledText MarginStyledText(int line);
Modified: trunk/scintilla/DocumentAccessor.cxx
===================================================================
--- trunk/scintilla/DocumentAccessor.cxx 2010-06-06 18:02:49 UTC (rev 5004)
+++ trunk/scintilla/DocumentAccessor.cxx 2010-06-06 18:34:26 UTC (rev 5005)
@@ -187,7 +187,7 @@
indent += SC_FOLDLEVELBASE;
// if completely empty line or the start of a comment...
if ((ch == ' ' || ch == '\t' || ch == '\n' || ch == '\r') ||
- (pfnIsCommentLeader && (*pfnIsCommentLeader)(*this, pos, end-pos)) )
+ (pfnIsCommentLeader && (*pfnIsCommentLeader)(*this, pos, end-pos)))
return indent | SC_FOLDLEVELWHITEFLAG;
else
return indent;
Modified: trunk/scintilla/DocumentAccessor.h
===================================================================
--- trunk/scintilla/DocumentAccessor.h 2010-06-06 18:02:49 UTC (rev 5004)
+++ trunk/scintilla/DocumentAccessor.h 2010-06-06 18:34:26 UTC (rev 5005)
@@ -38,9 +38,9 @@
void Fill(int position);
public:
- DocumentAccessor(Document *pdoc_, PropertyGet &props_, WindowID id_=0) :
+ DocumentAccessor(Document *pdoc_, PropertyGet &props_, WindowID id_=0) :
Accessor(), pdoc(pdoc_), props(props_), id(id_),
- lenDoc(-1), validLen(0), chFlags(0), chWhile(0),
+ lenDoc(-1), validLen(0), chFlags(0), chWhile(0),
startSeg(0), startPosStyling(0),
mask(127) { // Initialize the mask to be big enough for any lexer.
}
@@ -54,8 +54,8 @@
void Flush();
int GetLineState(int line);
int SetLineState(int line, int state);
- int GetPropertyInt(const char *key, int defaultValue=0) {
- return props.GetInt(key, defaultValue);
+ int GetPropertyInt(const char *key, int defaultValue=0) {
+ return props.GetInt(key, defaultValue);
}
char *GetProperties() {
return props.ToString();
@@ -63,7 +63,7 @@
WindowID GetWindow() { return id; }
void StartAt(unsigned int start, char chMask=31);
- void SetFlags(char chFlags_, char chWhile_) {chFlags = chFlags_; chWhile = chWhile_; };
+ void SetFlags(char chFlags_, char chWhile_) {chFlags = chFlags_; chWhile = chWhile_; }
unsigned int GetStartSegment() { return startSeg; }
void StartSegment(unsigned int pos);
void ColourTo(unsigned int pos, int chAttr);
Modified: trunk/scintilla/Editor.cxx
===================================================================
--- trunk/scintilla/Editor.cxx 2010-06-06 18:02:49 UTC (rev 5004)
+++ trunk/scintilla/Editor.cxx 2010-06-06 18:34:26 UTC (rev 5005)
@@ -623,7 +623,7 @@
//wMain.InvalidateAll();
}
-void Editor::RedrawSelMargin(int line) {
+void Editor::RedrawSelMargin(int line, bool allAfter) {
if (!AbandonPaint()) {
if (vs.maskInLine) {
Redraw();
@@ -634,7 +634,8 @@
int position = pdoc->LineStart(line);
PRectangle rcLine = RectangleFromRange(position, position);
rcSelMargin.top = rcLine.top;
- rcSelMargin.bottom = rcLine.bottom;
+ if (!allAfter)
+ rcSelMargin.bottom = rcLine.bottom;
}
wMain.InvalidateRectangle(rcSelMargin);
}
@@ -849,6 +850,9 @@
}
int Editor::MovePositionTo(SelectionPosition newPos, Selection::selTypes selt, bool ensureVisible) {
+ bool simpleCaret = (sel.Count() == 1) && sel.Empty();
+ SelectionPosition spCaret = sel.Last();
+
int delta = newPos.Position() - sel.MainCaret();
newPos = ClampPositionIntoDocument(newPos);
newPos = MovePositionOutsideChar(newPos, delta);
@@ -874,7 +878,14 @@
}
ShowCaretAtCurrentPosition();
if (ensureVisible) {
- EnsureCaretVisible();
+ XYScrollPosition newXY = XYScrollToMakeVisible(true, true, true);
+ if (simpleCaret && (newXY.xOffset == xOffset)) {
+ // simple vertical scroll then invalidate
+ ScrollTo(newXY.topLine);
+ InvalidateSelection(SelectionRange(spCaret), true);
+ } else {
+ SetXYScroll(newXY);
+ }
}
return 0;
}
@@ -925,9 +936,11 @@
// Try to optimise small scrolls
int linesToMove = topLine - topLineNew;
SetTopLine(topLineNew);
- ShowCaretAtCurrentPosition();
+ // Optimize by styling the view as this will invalidate any needed area
+ // which could abort the initial paint if discovered later.
+ StyleToPositionInView(PositionAfterArea(GetClientRectangle()));
+#ifndef UNDER_CE
// Perform redraw rather than scroll if many lines would be redrawn anyway.
-#ifndef UNDER_CE
if ((abs(linesToMove) <= 10) && (paintState == notPainting)) {
ScrollText(linesToMove);
} else {
@@ -1037,29 +1050,24 @@
1 | 1 | 0 | 1 | No, kept out of UZ | moved by one position
1 | 1 | 1 | 1 | No, kept out of UZ | moved to put caret at 3UZ of the margin
*/
-void Editor::EnsureCaretVisible(bool useMargin, bool vert, bool horiz) {
- //Platform::DebugPrintf("EnsureCaretVisible %d %s\n", xOffset, useMargin ? " margin" : " ");
+
+Editor::XYScrollPosition Editor::XYScrollToMakeVisible(const bool useMargin, const bool vert, const bool horiz) {
PRectangle rcClient = GetTextRectangle();
- //int rcClientFullWidth = rcClient.Width();
- SelectionPosition posCaret = sel.RangeMain().caret;
- if (posDrag.IsValid()) {
- posCaret = posDrag;
- }
- Point pt = LocationFromPosition(posCaret);
- Point ptBottomCaret = pt;
- ptBottomCaret.y += vs.lineHeight - 1;
- int lineCaret = DisplayFromPosition(posCaret.Position());
- bool bSlop, bStrict, bJump, bEven;
+ const SelectionPosition posCaret = posDrag.IsValid() ? posDrag : sel.RangeMain().caret;
+ const Point pt = LocationFromPosition(posCaret);
+ const Point ptBottomCaret(pt.x, pt.y + vs.lineHeight - 1);
+ const int lineCaret = DisplayFromPosition(posCaret.Position());
+ XYScrollPosition newXY(xOffset, topLine);
+
// Vertical positioning
if (vert && (pt.y < rcClient.top || ptBottomCaret.y > rcClient.bottom || (caretYPolicy & CARET_STRICT) != 0)) {
- int linesOnScreen = LinesOnScreen();
- int halfScreen = Platform::Maximum(linesOnScreen - 1, 2) / 2;
- int newTopLine = topLine;
- bSlop = (caretYPolicy & CARET_SLOP) != 0;
- bStrict = (caretYPolicy & CARET_STRICT) != 0;
- bJump = (caretYPolicy & CARET_JUMPS) != 0;
- bEven = (caretYPolicy & CARET_EVEN) != 0;
+ const int linesOnScreen = LinesOnScreen();
+ const int halfScreen = Platform::Maximum(linesOnScreen - 1, 2) / 2;
+ const bool bSlop = (caretYPolicy & CARET_SLOP) != 0;
+ const bool bStrict = (caretYPolicy & CARET_STRICT) != 0;
+ const bool bJump = (caretYPolicy & CARET_JUMPS) != 0;
+ const bool bEven = (caretYPolicy & CARET_EVEN) != 0;
// It should be possible to scroll the window to show the caret,
// but this fails to remove the caret on GTK+
@@ -1092,10 +1100,10 @@
}
if (lineCaret < topLine + yMarginT) {
// Caret goes too high
- newTopLine = lineCaret - yMoveT;
+ newXY.topLine = lineCaret - yMoveT;
} else if (lineCaret > topLine + linesOnScreen - 1 - yMarginB) {
// Caret goes too low
- newTopLine = lineCaret - linesOnScreen + 1 + yMoveB;
+ newXY.topLine = lineCaret - linesOnScreen + 1 + yMoveB;
}
} else { // Not strict
yMoveT = bJump ? caretYSlop * 3 : caretYSlop;
@@ -1107,10 +1115,10 @@
}
if (lineCaret < topLine) {
// Caret goes too high
- newTopLine = lineCaret - yMoveT;
+ newXY.topLine = lineCaret - yMoveT;
} else if (lineCaret > topLine + linesOnScreen - 1) {
// Caret goes too low
- newTopLine = lineCaret - linesOnScreen + 1 + yMoveB;
+ newXY.topLine = lineCaret - linesOnScreen + 1 + yMoveB;
}
}
} else { // No slop
@@ -1118,41 +1126,35 @@
// Minimal move
if (lineCaret < topLine) {
// Caret goes too high
- newTopLine = lineCaret;
+ newXY.topLine = lineCaret;
} else if (lineCaret > topLine + linesOnScreen - 1) {
// Caret goes too low
if (bEven) {
- newTopLine = lineCaret - linesOnScreen + 1;
+ newXY.topLine = lineCaret - linesOnScreen + 1;
} else {
- newTopLine = lineCaret;
+ newXY.topLine = lineCaret;
}
}
} else { // Strict or going out of display
if (bEven) {
// Always center caret
- newTopLine = lineCaret - halfScreen;
+ newXY.topLine = lineCaret - halfScreen;
} else {
// Always put caret on top of display
- newTopLine = lineCaret;
+ newXY.topLine = lineCaret;
}
}
}
- newTopLine = Platform::Clamp(newTopLine, 0, MaxScrollPos());
- if (newTopLine != topLine) {
- Redraw();
- SetTopLine(newTopLine);
- SetVerticalScrollPos();
- }
+ newXY.topLine = Platform::Clamp(newXY.topLine, 0, MaxScrollPos());
}
// Horizontal positioning
if (horiz && (wrapState == eWrapNone)) {
- int halfScreen = Platform::Maximum(rcClient.Width() - 4, 4) / 2;
- int xOffsetNew = xOffset;
- bSlop = (caretXPolicy & CARET_SLOP) != 0;
- bStrict = (caretXPolicy & CARET_STRICT) != 0;
- bJump = (caretXPolicy & CARET_JUMPS) != 0;
- bEven = (caretXPolicy & CARET_EVEN) != 0;
+ const int halfScreen = Platform::Maximum(rcClient.Width() - 4, 4) / 2;
+ const bool bSlop = (caretXPolicy & CARET_SLOP) != 0;
+ const bool bStrict = (caretXPolicy & CARET_STRICT) != 0;
+ const bool bJump = (caretXPolicy & CARET_JUMPS) != 0;
+ const bool bEven = (caretXPolicy & CARET_EVEN) != 0;
if (bSlop) { // A margin is defined
int xMoveL, xMoveR;
@@ -1181,18 +1183,18 @@
if (pt.x < rcClient.left + xMarginL) {
// Caret is on the left of the display
if (bJump && bEven) {
- xOffsetNew -= xMoveL;
+ newXY.xOffset -= xMoveL;
} else {
// Move just enough to allow to display the caret
- xOffsetNew -= (rcClient.left + xMarginL) - pt.x;
+ newXY.xOffset -= (rcClient.left + xMarginL) - pt.x;
}
} else if (pt.x >= rcClient.right - xMarginR) {
// Caret is on the right of the display
if (bJump && bEven) {
- xOffsetNew += xMoveR;
+ newXY.xOffset += xMoveR;
} else {
// Move just enough to allow to display the caret
- xOffsetNew += pt.x - (rcClient.right - xMarginR) + 1;
+ newXY.xOffset += pt.x - (rcClient.right - xMarginR) + 1;
}
}
} else { // Not strict
@@ -1205,10 +1207,10 @@
}
if (pt.x < rcClient.left) {
// Caret is on the left of the display
- xOffsetNew -= xMoveL;
+ newXY.xOffset -= xMoveL;
} else if (pt.x >= rcClient.right) {
// Caret is on the right of the display
- xOffsetNew += xMoveR;
+ newXY.xOffset += xMoveR;
}
}
} else { // No slop
@@ -1217,56 +1219,71 @@
// Strict or going out of display
if (bEven) {
// Center caret
- xOffsetNew += pt.x - rcClient.left - halfScreen;
+ newXY.xOffset += pt.x - rcClient.left - halfScreen;
} else {
// Put caret on right
- xOffsetNew += pt.x - rcClient.right + 1;
+ newXY.xOffset += pt.x - rcClient.right + 1;
}
} else {
// Move just enough to allow to display the caret
if (pt.x < rcClient.left) {
// Caret is on the left of the display
if (bEven) {
- xOffsetNew -= rcClient.left - pt.x;
+ newXY.xOffset -= rcClient.left - pt.x;
} else {
- xOffsetNew += pt.x - rcClient.right + 1;
+ newXY.xOffset += pt.x - rcClient.right + 1;
}
} else if (pt.x >= rcClient.right) {
// Caret is on the right of the display
- xOffsetNew += pt.x - rcClient.right + 1;
+ newXY.xOffset += pt.x - rcClient.right + 1;
}
}
}
// In case of a jump (find result) largely out of display, adjust the offset to display the caret
- if (pt.x + xOffset < rcClient.left + xOffsetNew) {
- xOffsetNew = pt.x + xOffset - rcClient.left;
- } else if (pt.x + xOffset >= rcClient.right + xOffsetNew) {
- xOffsetNew = pt.x + xOffset - rcClient.right + 1;
+ if (pt.x + xOffset < rcClient.left + newXY.xOffset) {
+ newXY.xOffset = pt.x + xOffset - rcClient.left;
+ } else if (pt.x + xOffset >= rcClient.right + newXY.xOffset) {
+ newXY.xOffset = pt.x + xOffset - rcClient.right + 1;
if (vs.caretStyle == CARETSTYLE_BLOCK) {
// Ensure we can see a good portion of the block caret
- xOffsetNew += vs.aveCharWidth;
+ newXY.xOffset += vs.aveCharWidth;
}
}
- if (xOffsetNew < 0) {
- xOffsetNew = 0;
+ if (newXY.xOffset < 0) {
+ newXY.xOffset = 0;
}
- if (xOffset != xOffsetNew) {
- xOffset = xOffsetNew;
- if (xOffsetNew > 0) {
+ }
+
+ return newXY;
+}
+
+void Editor::SetXYScroll(XYScrollPosition newXY) {
+ if ((newXY.topLine != topLine) || (newXY.xOffset != xOffset)) {
+ if (newXY.topLine != topLine) {
+ SetTopLine(newXY.topLine);
+ SetVerticalScrollPos();
+ }
+ if (newXY.xOffset != xOffset) {
+ xOffset = newXY.xOffset;
+ if (newXY.xOffset > 0) {
PRectangle rcText = GetTextRectangle();
if (horizontalScrollBarVisible &&
- rcText.Width() + xOffset > scrollWidth) {
+ rcText.Width() + xOffset > scrollWidth) {
scrollWidth = xOffset + rcText.Width();
SetScrollBars();
}
}
SetHorizontalScrollPos();
- Redraw();
}
+ Redraw();
+ UpdateSystemCaret();
}
- UpdateSystemCaret();
}
+void Editor::EnsureCaretVisible(bool useMargin, bool vert, bool horiz) {
+ SetXYScroll(XYScrollToMakeVisible(useMargin, vert, horiz));
+}
+
void Editor::ShowCaretAtCurrentPosition() {
if (hasFocus) {
caret.active = true;
@@ -1850,7 +1867,7 @@
return true;
if (GoodTrailByte(us[1]) && GoodTrailByte(us[2]) && GoodTrailByte(us[3])) {
if (*us == 0xf4) {
- // Chcek if encoding a value beyond the last Unicode character 10FFFF
+ // Check if encoding a value beyond the last Unicode character 10FFFF
if (us[1] > 0x8f) {
return true;
} else if (us[1] == 0x8f) {
@@ -3229,6 +3246,8 @@
//Platform::DebugPrintf("Paint:%1d (%3d,%3d) ... (%3d,%3d)\n",
// paintingAllText, rcArea.left, rcArea.top, rcArea.right, rcArea.bottom);
+ StyleToPositionInView(PositionAfterArea(rcArea));
+
pixmapLine->Release();
RefreshStyleData();
RefreshPixMaps(surfaceWindow);
@@ -3241,13 +3260,6 @@
pixmapLine->SetPalette(&palette, !hasFocus);
int screenLinePaintFirst = rcArea.top / vs.lineHeight;
- // The area to be painted plus one extra line is styled.
- // The extra line is to determine when a style change, such as starting a comment flows on to other lines.
- int lineStyleLast = topLine + (rcArea.bottom - 1) / vs.lineHeight + 1;
- //Platform::DebugPrintf("Paint lines = %d .. %d\n", topLine + screenLinePaintFirst, lineStyleLast);
- int endPosPaint = pdoc->Length();
- if (lineStyleLast < cs.LinesDisplayed())
- endPosPaint = pdoc->LineStart(cs.DocFromDisplay(lineStyleLast) + 1);
int xStart = vs.fixedColumnWidth - xOffset;
int ypos = 0;
@@ -3255,8 +3267,6 @@
ypos += screenLinePaintFirst * vs.lineHeight;
int yposScreen = screenLinePaintFirst * vs.lineHeight;
- // Ensure we are styled as far as we are painting.
- pdoc->EnsureStyledTo(endPosPaint);
bool paintAbandonedByStyling = paintState == paintAbandoned;
if (needUpdateUI) {
// Deselect palette by selecting a temporary palette
@@ -3288,12 +3298,14 @@
}
PLATFORM_ASSERT(pixmapSelPattern->Initialised());
- PaintSelMargin(surfaceWindow, rcArea);
+ if (paintState != paintAbandoned) {
+ PaintSelMargin(surfaceWindow, rcArea);
- PRectangle rcRightMargin = rcClient;
- rcRightMargin.left = rcRightMargin.right - vs.rightMarginWidth;
- if (rcArea.Intersects(rcRightMargin)) {
- surfaceWindow->FillRectangle(rcRightMargin, vs.styles[STYLE_DEFAULT].back.allocated);
+ PRectangle rcRightMargin = rcClient;
+ rcRightMargin.left = rcRightMargin.right - vs.rightMarginWidth;
+ if (rcArea.Intersects(rcRightMargin)) {
+ surfaceWindow->FillRectangle(rcRightMargin, vs.styles[STYLE_DEFAULT].back.allocated);
+ }
}
if (paintState == paintAbandoned) {
@@ -4346,12 +4358,14 @@
// TODO: could invalidate from mh.startModification to end of screen
//InvalidateRange(mh.position, mh.position + mh.length);
if (paintState == notPainting && !CanDeferToLastStep(mh)) {
+ QueueStyling(pdoc->Length());
Redraw();
}
} else {
//Platform::DebugPrintf("** %x Line Changed %d .. %d\n", this,
// mh.position, mh.position + mh.length);
if (paintState == notPainting && mh.length && !CanEliminate(mh)) {
+ QueueStyling(mh.position + mh.length);
InvalidateRange(mh.position, mh.position + mh.length);
}
}
@@ -4365,7 +4379,7 @@
if ((paintState == notPainting) || !PaintContainsMargin()) {
if (mh.modificationType & SC_MOD_CHANGEFOLD) {
// Fold changes can affect the drawing of following lines so redraw whole margin
- RedrawSelMargin();
+ RedrawSelMargin(mh.line-1, true);
} else {
RedrawSelMargin(mh.line);
}
@@ -6199,6 +6213,48 @@
}
}
+int Editor::PositionAfterArea(PRectangle rcArea) {
+ // The start of the document line after the display line after the area
+ // This often means that the line after a modification is restyled which helps
+ // detect multiline comment additions and heals single line comments
+ int lineAfter = topLine + (rcArea.bottom - 1) / vs.lineHeight + 1;
+ if (lineAfter < cs.LinesDisplayed())
+ return pdoc->LineStart(cs.DocFromDisplay(lineAfter) + 1);
+ else
+ return pdoc->Length();
+}
+
+// Style to a position within the view. If this causes a change at end of last line then
+// affects later lines so style all the viewed text.
+void Editor::StyleToPositionInView(Position pos) {
+ int endWindow = PositionAfterArea(GetClientRectangle());
+ if (pos > endWindow)
+ pos = endWindow;
+ int styleAtEnd = pdoc->StyleAt(pos-1);
+ pdoc->EnsureStyledTo(pos);
+ if ((endWindow > pos) && (styleAtEnd != pdoc->StyleAt(pos-1))) {
+ // Style at end of line changed so is multi-line change like starting a comment
+ // so require rest of window to be styled.
+ pdoc->EnsureStyledTo(endWindow);
+ }
+}
+
+void Editor::IdleStyling() {
+ // Style the line after the modification as this allows modifications that change just the
+ // line of the modification to heal instead of propagating to the rest of the window.
+ StyleToPositionInView(pdoc->LineStart(pdoc->LineFromPosition(styleNeeded.upTo) + 2));
+
+ if (needUpdateUI) {
+ NotifyUpdateUI();
+ needUpdateUI = false;
+ }
+ styleNeeded.Reset();
+}
+
+void Editor::QueueStyling(int upTo) {
+ styleNeeded.NeedUpTo(upTo);
+}
+
bool Editor::PaintContains(PRectangle rc) {
if (rc.Empty()) {
return true;
Modified: trunk/scintilla/Editor.h
===================================================================
--- trunk/scintilla/Editor.h 2010-06-06 18:02:49 UTC (rev 5004)
+++ trunk/scintilla/Editor.h 2010-06-06 18:34:26 UTC (rev 5005)
@@ -46,6 +46,26 @@
};
/**
+ * When platform has a way to generate an event before painting,
+ * accumulate needed styling range in StyleNeeded to avoid unnecessary work.
+ */
+class StyleNeeded {
+public:
+ bool active;
+ Position upTo;
+
+ StyleNeeded() : active(false), upTo(0) {}
+ void Reset() {
+ active = false;
+ upTo = 0;
+ }
+ void NeedUpTo(Position pos) {
+ if (upTo < pos)
+ upTo = pos;
+ }
+};
+
+/**
* Hold a piece of text selected for copying or dragging.
* The text is expected to hold a terminating '\0' and this is counted in len.
*/
@@ -197,7 +217,8 @@
enum { notPainting, painting, paintAbandoned } paintState;
PRectangle rcPaint;
bool paintingAllText;
-
+ StyleNeeded styleNeeded;
+
int modEventMask;
SelectionText drag;
@@ -272,7 +293,7 @@
bool AbandonPaint();
void RedrawRect(PRectangle rc);
void Redraw();
- void RedrawSelMargin(int line=-1);
+ void RedrawSelMargin(int line=-1, bool allAfter=false);
PRectangle RectangleFromRange(int start, int end);
void InvalidateRange(int start, int end);
@@ -308,6 +329,14 @@
void HorizontalScrollTo(int xPos);
void MoveCaretInsideView(bool ensureVisible=true);
int DisplayFromPosition(int pos);
+
+ struct XYScrollPosition {
+ int xOffset;
+ int topLine;
+ XYScrollPosition(int xOffset_, int topLine_) : xOffset(xOffset_), topLine(topLine_) {}
+ };
+ XYScrollPosition XYScrollToMakeVisible(const bool useMargin, const bool vert, const bool horiz);
+ void SetXYScroll(XYScrollPosition newXY);
void EnsureCaretVisible(bool useMargin=true, bool vert=true, bool horiz=true);
void ShowCaretAtCurrentPosition();
void DropCaret();
@@ -460,6 +489,11 @@
virtual bool HaveMouseCapture() = 0;
void SetFocusState(bool focusState);
+ int PositionAfterArea(PRectangle rcArea);
+ void StyleToPositionInView(Position pos);
+ void IdleStyling();
+ virtual void QueueStyling(int upTo);
+
virtual bool PaintContains(PRectangle rc);
bool PaintContainsMargin();
void CheckForChangeOutsidePaint(Range r);
Modified: trunk/scintilla/ExternalLexer.cxx
===================================================================
--- trunk/scintilla/ExternalLexer.cxx 2010-06-06 18:02:49 UTC (rev 5004)
+++ trunk/scintilla/ExternalLexer.cxx 2010-06-06 18:34:26 UTC (rev 5005)
@@ -40,7 +40,7 @@
while (val[dim])
dim++;
char **wls = new char * [dim + 1];
- for (int i = 0;i < dim;i++) {
+ for (int i = 0; i < dim; i++) {
std::string words;
words = "";
for (int n = 0; n < val[i]->len; n++) {
@@ -114,7 +114,7 @@
//
//------------------------------------------
-LexerLibrary::LexerLibrary(const char* ModuleName) {
+LexerLibrary::LexerLibrary(const char *ModuleName) {
// Initialise some members...
first = NULL;
last = NULL;
@@ -195,18 +195,15 @@
/// Return the single LexerManager instance...
LexerManager *LexerManager::GetInstance() {
- if(!theInstance)
+ if (!theInstance)
theInstance = new LexerManager;
return theInstance;
}
/// Delete any LexerManager instance...
-void LexerManager::DeleteInstance()
-{
- if(theInstance) {
- delete theInstance;
- theInstance = NULL;
- }
+void LexerManager::DeleteInstance() {
+ delete theInstance;
+ theInstance = NULL;
}
/// protected constructor - this is a singleton...
@@ -219,13 +216,15 @@
Clear();
}
-void LexerManager::Load(const char* path)
-{
+void LexerManager::Load(const char *path) {
LoadLexerLibrary(path);
}
-void LexerManager::LoadLexerLibrary(const char* module)
-{
+void LexerManager::LoadLexerLibrary(const char *module) {
+ for (LexerLibrary *ll = first; ll; ll= ll->next) {
+ if (strcmp(ll->m_sModuleName.c_str(), module) == 0)
+ return;
+ }
LexerLibrary *lib = new LexerLibrary(module);
if (NULL != first) {
last->next = lib;
@@ -236,8 +235,7 @@
}
}
-void LexerManager::Clear()
-{
+void LexerManager::Clear() {
if (NULL != first) {
LexerLibrary *cur = first;
LexerLibrary *next;
@@ -257,8 +255,7 @@
//
//------------------------------------------
-LMMinder::~LMMinder()
-{
+LMMinder::~LMMinder() {
LexerManager::DeleteInstance();
}
Modified: trunk/scintilla/ExternalLexer.h
===================================================================
--- trunk/scintilla/ExternalLexer.h 2010-06-06 18:02:49 UTC (rev 5004)
+++ trunk/scintilla/ExternalLexer.h 2010-06-06 18:34:26 UTC (rev 5005)
@@ -23,7 +23,7 @@
char *words[], WindowID window, char *props);
typedef void (EXT_LEXER_DECL *ExtFoldFunction)(unsigned int lexer, unsigned int startPos, int length, int initStyle,
char *words[], WindowID window, char *props);
-typedef void* (EXT_LEXER_DECL *GetLexerFunction)(unsigned int Index);
+typedef void*(EXT_LEXER_DECL *GetLexerFunction)(unsigned int Index);
typedef int (EXT_LEXER_DECL *GetLexerCountFn)();
typedef void (EXT_LEXER_DECL *GetLexerNameFn)(unsigned int Index, char *name, int buflength);
@@ -37,12 +37,12 @@
int externalLanguage;
char name[100];
public:
- ExternalLexerModule(int language_, LexerFunction fnLexer_,
- const char *languageName_=0, LexerFunction fnFolder_=0) : LexerModule(language_, fnLexer_, 0, fnFolder_){
+ ExternalLexerModule(int language_, LexerFunction fnLexer_,
+ const char *languageName_=0, LexerFunction fnFolder_=0) : LexerModule(language_, fnLexer_, 0, fnFolder_) {
strncpy(name, languageName_, sizeof(name));
name[sizeof(name)-1] = '\0';
languageName = name;
- };
+ }
virtual void Lex(unsigned int startPos, int lengthDoc, int initStyle,
WordList *keywordlists[], Accessor &styler) const;
virtual void Fold(unsigned int startPos, int lengthDoc, int initStyle,
@@ -64,10 +64,10 @@
LexerMinder *last;
public:
- LexerLibrary(const char* ModuleName);
+ LexerLibrary(const char *ModuleName);
~LexerLibrary();
void Release();
-
+
LexerLibrary *next;
std::string m_sModuleName;
};
@@ -76,18 +76,18 @@
class LexerManager {
public:
~LexerManager();
-
+
static LexerManager *GetInstance();
static void DeleteInstance();
-
- void Load(const char* path);
+
+ void Load(const char *path);
void Clear();
private:
LexerManager();
static LexerManager *theInstance;
- void LoadLexerLibrary(const char* module);
+ void LoadLexerLibrary(const char *module);
LexerLibrary *first;
LexerLibrary *last;
};
Modified: trunk/scintilla/LexBash.cxx
===================================================================
--- trunk/scintilla/LexBash.cxx 2010-06-06 18:02:49 UTC (rev 5004)
+++ trunk/scintilla/LexBash.cxx 2010-06-06 18:34:26 UTC (rev 5005)
@@ -248,14 +248,8 @@
sc.SetState(SCE_SH_DEFAULT);
break;
case SCE_SH_COMMENTLINE:
- if (sc.ch == '\\' && (sc.chNext == '\r' || sc.chNext == '\n')) {
- // comment continuation
- sc.Forward();
- if (sc.ch == '\r' && sc.chNext == '\n') {
- sc.Forward();
- }
- } else if (sc.atLineEnd) {
- sc.ForwardSetState(SCE_SH_DEFAULT);
+ if (sc.atLineEnd && sc.chPrev != '\\') {
+ sc.SetState(SCE_SH_DEFAULT);
}
break;
case SCE_SH_HERE_DELIM:
@@ -294,23 +288,14 @@
HereDoc.State = 1;
}
} else if (HereDoc.State == 1) { // collect the delimiter
- if (HereDoc.Quoted) { // a quoted here-doc delimiter
- if (sc.ch == HereDoc.Quote) { // closing quote => end of delimiter
- sc.ForwardSetState(SCE_SH_DEFAULT);
- } else {
- if (sc.ch == '\\' && sc.chNext == HereDoc.Quote) { // escaped quote
- sc.Forward();
- }
- HereDoc.Append(sc.ch);
- }
- } else { // an unquoted here-doc delimiter
- if (setHereDoc2.Contains(sc.ch)) {
- HereDoc.Append(sc.ch);
- } else if (sc.ch == '\\') {
- // skip escape prefix
- } else {
- sc.SetState(SCE_SH_DEFAULT);
- }
+ if (setHereDoc2.Contains(sc.ch) || sc.chPrev == '\\') {
+ HereDoc.Append(sc.ch);
+ } else if (HereDoc.Quoted && sc.ch == HereDoc.Quote) { // closing quote => end of delimiter
+ sc.ForwardSetState(SCE_SH_DEFAULT);
+ } else if (sc.ch == '\\') {
+ // skip escape prefix
+ } else {
+ sc.SetState(SCE_SH_DEFAULT);
}
if (HereDoc.DelimiterLength >= HERE_DELIM_MAX - 1) { // force blowup
sc.SetState(SCE_SH_ERROR);
Modified: trunk/scintilla/LexCPP.cxx
===================================================================
--- trunk/scintilla/LexCPP.cxx 2010-06-06 18:02:49 UTC (rev 5004)
+++ trunk/scintilla/LexCPP.cxx 2010-06-06 18:34:26 UTC (rev 5005)
@@ -59,8 +59,8 @@
WordList &keywords4 = *keywordlists[3];
// property styling.within.preprocessor
- // For C++ code, determines whether all preprocessor code is styled in the preprocessor style (0, the default)
- // or only from the initial # to the end of the command word(1).
+ // For C++ code, determines whether all preprocessor code is styled in the preprocessor style (0, the default)
+ // or only from the initial # to the end of the command word(1).
bool stylingWithinPreprocessor = styler.GetPropertyInt("styling.within.preprocessor") != 0;
CharacterSet setOKBeforeRE(CharacterSet::setNone, "([{=,:;!%^&*|?~+-");
@@ -72,7 +72,7 @@
CharacterSet setWord(CharacterSet::setAlphaNum, "._", 0x80, true);
// property lexer.cpp.allow.dollars
- // Set to 0 to disallow the '$' character in identifiers with the cpp lexer.
+ // Set to 0 to disallow the '$' character in identifiers with the cpp lexer.
if (styler.GetPropertyInt("lexer.cpp.allow.dollars", 1) != 0) {
setWordStart.Add('$');
setWord.Add('$');
@@ -379,20 +379,20 @@
WordList *[], Accessor &styler) {
// property fold.comment
- // This option enables folding multi-line comments and explicit fold points when using the C++ lexer.
- // Explicit fold points allows adding extra folding by placing a //{ comment at the start and a //}
- // at the end of a section that should fold.
+ // This option enables folding multi-line comments and explicit fold points when using the C++ lexer.
+ // Explicit fold points allows adding extra folding by placing a //{ comment at the start and a //}
+ // at the end of a section that should fold.
bool foldComment = styler.GetPropertyInt("fold.comment") != 0;
// property fold.preprocessor
- // This option enables folding preprocessor directives when using the C++ lexer.
- // Includes C#'s explicit #region and #endregion folding directives.
+ // This option enables folding preprocessor directives when using the C++ lexer.
+ // Includes C#'s explicit #region and #endregion folding directives.
bool foldPreprocessor = styler.GetPropertyInt("fold.preprocessor") != 0;
bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0;
- // property fold.at.else
- // This option enables C++ folding on a "} else {" line of an if statement.
+ // property fold.at.else
+ // This option enables C++ folding on a "} else {" line of an if statement.
bool foldAtElse = styler.GetPropertyInt("fold.at.else", 0) != 0;
unsigned int endPos = startPos + length;
@@ -483,14 +483,14 @@
}
}
-static const char * const cppWordLists[] = {
+static const char *const cppWordLists[] = {
"Primary keywords and identifiers",
"Secondary keywords and identifiers",
"Documentation comment keywords",
"Unused",
"Global classes and typedefs",
0,
- };
+};
static void ColouriseCppDocSensitive(unsigned int startPos, int length, int initStyle, WordList *keywordlists[],
Accessor &styler) {
Modified: trunk/scintilla/LexCSS.cxx
===================================================================
--- trunk/scintilla/LexCSS.cxx 2010-06-06 18:02:49 UTC (rev 5004)
+++ trunk/scintilla/LexCSS.cxx 2010-06-06 18:34:26 UTC (rev 5005)
@@ -62,6 +62,7 @@
int lastState = -1; // before operator
int lastStateC = -1; // before comment
+ int lastStateS = -1; // before single-quoted/double-quoted string
int op = ' '; // last operator
int opPrev = ' '; // last operator
@@ -105,7 +106,7 @@
i--;
if ((sc.currentPos - i) % 2 == 1)
continue;
- sc.ForwardSetState(SCE_CSS_VALUE);
+ sc.ForwardSetState(lastStateS);
}
if (sc.state == SCE_CSS_OPERATOR) {
@@ -140,9 +141,9 @@
sc.SetState(SCE_CSS_TAG);
break;
case '{':
- if (lastState == SCE_CSS_DIRECTIVE)
+ if (lastState == SCE_CSS_MEDIA)
sc.SetState(SCE_CSS_DEFAULT);
- else if (lastState == SCE_CSS_TAG)
+ else if (lastState == SCE_CSS_TAG || lastState == SCE_CSS_DIRECTIVE)
sc.SetState(SCE_CSS_IDENTIFIER);
break;
case '}':
@@ -219,7 +220,8 @@
sc.state == SCE_CSS_PSEUDOCLASS || sc.state == SCE_CSS_PSEUDOELEMENT ||
sc.state == SCE_CSS_EXTENDED_PSEUDOCLASS || sc.state == SCE_CSS_EXTENDED_PSEUDOELEMENT ||
sc.state == SCE_CSS_UNKNOWN_PSEUDOCLASS ||
- sc.state == SCE_CSS_IMPORTANT
+ sc.state == SCE_CSS_IMPORTANT ||
+ sc.state == SCE_CSS_DIRECTIVE
)) {
char s[100];
sc.GetCurrentLowered(s, sizeof(s));
@@ -263,6 +265,10 @@
if (strcmp(s2, "important") != 0)
sc.ChangeState(SCE_CSS_VALUE);
break;
+ case SCE_CSS_DIRECTIVE:
+ if (op == '@' && strcmp(s2, "media") == 0)
+ sc.ChangeState(SCE_CSS_MEDIA);
+ break;
}
}
@@ -280,12 +286,14 @@
lastStateC = sc.state;
sc.SetState(SCE_CSS_COMMENT);
sc.Forward();
- } else if (sc.state == SCE_CSS_VALUE && (sc.ch == '\"' || sc.ch == '\'')) {
+ } else if ((sc.state == SCE_CSS_VALUE || sc.state == SCE_CSS_ATTRIBUTE)
+ && (sc.ch == '\"' || sc.ch == '\'')) {
+ lastStateS = sc.state;
sc.SetState((sc.ch == '\"' ? SCE_CSS_DOUBLESTRING : SCE_CSS_SINGLESTRING));
} else if (IsCssOperator(sc.ch)
&& (sc.state != SCE_CSS_ATTRIBUTE || sc.ch == ']')
&& (sc.state != SCE_CSS_VALUE || sc.ch == ';' || sc.ch == '}' || sc.ch == '!')
- && (sc.state != SCE_CSS_DIRECTIVE || sc.ch == ';' || sc.ch == '{')
+ && ((sc.state != SCE_CSS_DIRECTIVE && sc.state != SCE_CSS_MEDIA) || sc.ch == ';' || sc.ch == '{')
) {
if (sc.state != SCE_CSS_OPERATOR)
lastState = sc.state;
Modified: trunk/scintilla/LexCaml.cxx
===================================================================
--- trunk/scintilla/LexCaml.cxx 2010-06-06 18:02:49 UTC (rev 5004)
+++ trunk/scintilla/LexCaml.cxx 2010-06-06 18:34:26 UTC (rev 5005)
@@ -430,13 +430,11 @@
static
#endif /* BUILD_AS_EXTERNAL_LEXER */
void FoldCamlDoc(
- unsigned int startPos, int length,
- int initStyle,
- WordList *keywordlists[],
- Accessor &styler)
+ unsigned int, int,
+ int,
+ WordList *[],
+ Accessor &)
{
- // below useless evaluation(s) to supress "not used" warnings
- startPos || length || initStyle || keywordlists[0] || styler.Length();
}
static const char * const camlWordListDesc[] = {
Modified: trunk/scintilla/LexHTML.cxx
===================================================================
--- trunk/scintilla/LexHTML.cxx 2010-06-06 18:02:49 UTC (rev 5004)
+++ trunk/scintilla/LexHTML.cxx 2010-06-06 18:34:26 UTC (rev 5005)
@@ -587,8 +587,6 @@
styler.StartAt(startPos, static_cast<char>(STYLE_MAX));
char prevWord[200];
prevWord[0] = '\0';
- char nextWord[200];
- nextWord[0] = '\0';
char phpStringDelimiter[200]; // PHP is not limited in length, we are
phpStringDelimiter[0] = '\0';
int StateToPrint = initStyle;
@@ -644,6 +642,7 @@
if (inScriptType == eNonHtmlScript && state == SCE_H_COMMENT) {
scriptLanguage = eScriptComment;
}
+ script_type beforeLanguage = ScriptOfState(beforePreProc);
// property fold.html
// Folding is turned on or off for HTML and XML files with this option.
@@ -683,7 +682,7 @@
const bool isMako = styler.GetPropertyInt("lexer.html.mako", 0) != 0;
// property lexer.html.django
- // Set to 1 to enable the django template language.
+ // Set to 1 to enable the django template language.
const bool isDjango = styler.GetPropertyInt("lexer.html.django", 0) != 0;
const CharacterSet setHTMLWord(CharacterSet::setAlphaNum, ".-_:!#", 0x80, true);
@@ -950,7 +949,7 @@
}
// handle the start Django template code
- else if (isDjango && scriptLanguage == eScriptNone && (ch == '{' && (chNext == '%' || chNext == '{'))) {
+ else if (isDjango && scriptLanguage != eScriptPython && (ch == '{' && (chNext == '%' || chNext == '{'))) {
if (chNext == '%')
strcpy(djangoBlockType, "%");
else
@@ -965,6 +964,7 @@
i += 1;
visibleChars += 1;
state = SCE_HP_START;
+ beforeLanguage = scriptLanguage;
scriptLanguage = eScriptPython;
styler.ColourTo(i, SCE_H_ASP);
if (foldHTMLPreprocessor && chNext == '%')
@@ -1074,8 +1074,8 @@
}
// handle the end of Django template code
- else if (isDjango &&
- ((inScriptType == eNonHtmlPreProc) || (inScriptType == eNonHtmlScriptPreProc)) &&
+ else if (isDjango &&
+ ((inScriptType == eNonHtmlPreProc) || (inScriptType == eNonHtmlScriptPreProc)) &&
(scriptLanguage != eScriptNone) && stateAllowsTermination(state) &&
isDjangoBlockEnd(ch, chNext, djangoBlockType)) {
if (state == SCE_H_ASPAT) {
@@ -1098,7 +1098,7 @@
if (foldHTMLPreprocessor) {
levelCurrent--;
}
- scriptLanguage = eScriptNone;
+ scriptLanguage = beforeLanguage;
continue;
}
Modified: trunk/scintilla/LexPerl.cxx
===================================================================
--- trunk/scintilla/LexPerl.cxx 2010-06-06 18:02:49 UTC (rev 5004)
+++ trunk/scintilla/LexPerl.cxx 2010-06-06 18:34:26 UTC (rev 5005)
@@ -1243,7 +1243,7 @@
else if (styler.Match(i, "=head"))
isPodHeading = true;
} else if (style == SCE_PL_DATASECTION) {
- if (ch == '=' && isalpha(chNext) && levelCurrent == SC_FOLDLEVELBASE)
+ if (ch == '=' && isascii(chNext) && isalpha(chNext) && levelCurrent == SC_FOLDLEVELBASE)
levelCurrent++;
else if (styler.Match(i, "=cut") && levelCurrent > SC_FOLDLEVELBASE)
levelCurrent--;
Modified: trunk/scintilla/LexPython.cxx
===================================================================
--- trunk/scintilla/LexPython.cxx 2010-06-06 18:02:49 UTC (rev 5004)
+++ trunk/scintilla/LexPython.cxx 2010-06-06 18:34:26 UTC (rev 5005)
@@ -36,7 +36,7 @@
enum literalsAllowed { litNone=0, litU=1, litB=2};
static bool IsPyStringTypeChar(int ch, literalsAllowed allowed) {
- return
+ return
((allowed & litB) && (ch == 'b' || ch == 'B')) ||
((allowed & litU) && (ch == 'u' || ch == 'U'));
}
@@ -136,13 +136,13 @@
WordList &keywords2 = *keywordlists[1];
// property tab.timmy.whinge.level
- // For Python code, checks whether indenting is consistent.
- // The default, 0 turns off indentation checking,
- // 1 checks whether each line is potentially inconsistent with the previous line,
- // 2 checks whether any space characters occur before a tab character in the indentation,
- // 3 checks whether any spaces are in the indentation, and
+ // For Python code, checks whether indenting is consistent.
+ // The default, 0 turns off indentation checking,
+ // 1 checks whether each line is potentially inconsistent with the previous line,
+ // 2 checks whether any space characters occur before a tab character in the indentation,
+ // 3 checks whether any spaces are in the indentation, and
// 4 checks for any tab characters in the indentation.
- // 1 is a good level to use.
+ // 1 is a good level to use.
const int whingeLevel = styler.GetPropertyInt("tab.timmy.whinge.level");
// property lexer.python.literals.binary
@@ -353,7 +353,7 @@
if (sc.ch == '0' && (sc.chNext == 'x' || sc.chNext == 'X')) {
base_n_number = true;
sc.SetState(SCE_P_NUMBER);
- } else if (sc.ch == '0' &&
+ } else if (sc.ch == '0' &&
(sc.chNext == 'o' || sc.chNext == 'O' || sc.chNext == 'b' || sc.chNext == 'B')) {
if (base2or8Literals) {
base_n_number = true;
@@ -538,7 +538,7 @@
}
// Set fold header on non-quote/non-comment line
- if (!quote && !comment && !(indentCurrent & SC_FOLDLEVELWHITEFLAG) ) {
+ if (!quote && !comment && !(indentCurrent & SC_FOLDLEVELWHITEFLAG)) {
if ((indentCurrent & SC_FOLDLEVELNUMBERMASK) < (indentNext & SC_FOLDLEVELNUMBERMASK))
lev |= SC_FOLDLEVELHEADERFLAG;
}
@@ -558,7 +558,7 @@
//styler.SetLevel(lineCurrent, indentCurrent);
}
-static const char * const pythonWordListDesc[] = {
+static const char *const pythonWordListDesc[] = {
"Keywords",
"Highlighted identifiers",
0
Modified: trunk/scintilla/LexVHDL.cxx
===================================================================
--- trunk/scintilla/LexVHDL.cxx 2010-06-06 18:02:49 UTC (rev 5004)
+++ trunk/scintilla/LexVHDL.cxx 2010-06-06 18:34:26 UTC (rev 5005)
@@ -1,9 +1,9 @@
// Scintilla source code edit control
/** @file LexVHDL.cxx
** Lexer for VHDL
- ** Written by Phil Reid,
+ ** Written by Phil Reid,
** Based on:
- ** - The Verilog Lexer by Avi Yegudin
+ ** - The Verilog Lexer by Avi Yegudin
** - The Fortran Lexer by Chuan-jian Shen
** - The C++ lexer by Neil Hodgson
**/
@@ -126,7 +126,7 @@
sc.SetState(SCE_VHDL_IDENTIFIER);
} else if (sc.Match('-', '-')) {
sc.SetState(SCE_VHDL_COMMENT);
- sc.Forward();
+ sc.Forward();
} else if (sc.Match('-', '-')) {
if (sc.Match("--!")) // Nice to have a different comment style
sc.SetState(SCE_VHDL_COMMENTLINEBANG);
@@ -161,7 +161,7 @@
static void FoldNoBoxVHDLDoc(
unsigned int startPos,
int length,
- int initStyle,
+ int,
Accessor &styler)
{
// Decided it would be smarter to have the lexer have all keywords included. Therefore I
@@ -249,7 +249,6 @@
char chPrev = '\0';
char chNextNonBlank;
int styleNext = styler.StyleAt(startPos);
- int style = initStyle;
//Platform::DebugPrintf("Line[%04d] Prev[%20s] ************************* Level[%x]\n", lineCurrent+1, prevWord, levelCurrent);
/***************************************/
@@ -265,16 +264,16 @@
j ++ ;
chNextNonBlank = styler.SafeGetCharAt(j);
}
- style = styleNext;
+ int style = styleNext;
styleNext = styler.StyleAt(i + 1);
bool atEOL = (ch == '\r' && chNext != '\n') || (ch == '\n');
- if (foldComment && atEOL && IsCommentLine(lineCurrent, styler))
+ if (foldComment && atEOL && IsCommentLine(lineCurrent, styler))
{
if(!IsCommentLine(lineCurrent-1, styler) && IsCommentLine(lineCurrent+1, styler))
{
levelNext++;
- }
+ }
else if(IsCommentLine(lineCurrent-1, styler) && !IsCommentLine(lineCurrent+1, styler))
{
levelNext--;
@@ -380,7 +379,7 @@
((strcmp(s, "begin") == 0) && (strcmp(prevWord, "function") == 0)) ||
((strcmp(s, "begin") == 0) && (strcmp(prevWord, "procedure") == 0)))
{
- levelMinCurrentBegin = levelNext - 1;
+ levelMinCurrentBegin = levelNext - 1;
}
//Platform::DebugPrintf("Line[%04d] Prev[%20s] Cur[%20s] Level[%x]\n", lineCurrent+1, prevWord, s, levelCurrent);
strcpy(prevWord, s);
@@ -444,34 +443,34 @@
// Keyword:
-// access after alias all architecture array assert attribute begin block body buffer bus case component
-// configuration constant disconnect downto else elsif end entity exit file for function generate generic
-// group guarded if impure in inertial inout is label library linkage literal loop map new next null of
-// on open others out package port postponed procedure process pure range record register reject report
-// return select severity shared signal subtype then to transport type unaffected units until use variable
+// access after alias all architecture array assert attribute begin block body buffer bus case component
+// configuration constant disconnect downto else elsif end entity exit file for function generate generic
+// group guarded if impure in inertial inout is label library linkage literal loop map new next null of
+// on open others out package port postponed procedure process pure range record register reject report
+// return select severity shared signal subtype then to transport type unaffected units until use variable
// wait when while with
//
// Operators:
// abs and mod nand nor not or rem rol ror sla sll sra srl xnor xor
//
// Attributes:
-// left right low high ascending image value pos val succ pred leftof rightof base range reverse_range
-// length delayed stable quiet transaction event active last_event last_active last_value driving
+// left right low high ascending image value pos val succ pred leftof rightof base range reverse_range
+// length delayed stable quiet transaction event active last_event last_active last_value driving
// driving_value simple_name path_name instance_name
//
// Std Functions:
-// now readline read writeline write endfile resolved to_bit to_bitvector to_stdulogic to_stdlogicvector
-// to_stdulogicvector to_x01 to_x01z to_UX01 rising_edge falling_edge is_x shift_left shift_right rotate_left
+// now readline read writeline write endfile resolved to_bit to_bitvector to_stdulogic to_stdlogicvector
+// to_stdulogicvector to_x01 to_x01z to_UX01 rising_edge falling_edge is_x shift_left shift_right rotate_left
// rotate_right resize to_integer to_unsigned to_signed std_match to_01
//
// Std Packages:
-// std ieee work standard textio std_logic_1164 std_logic_arith std_logic_misc std_logic_signed
-// std_logic_textio std_logic_unsigned numeric_bit numeric_std math_complex math_real vital_primitives
+// std ieee work standard textio std_logic_1164 std_logic_arith std_logic_misc std_logic_signed
+// std_logic_textio std_logic_unsigned numeric_bit numeric_std math_complex math_real vital_primitives
// vital_timing
//
// Std Types:
-// boolean bit character severity_level integer real time delay_length natural positive string bit_vector
-// file_open_kind file_open_status line text side width std_ulogic std_ulogic_vector std_logic
+// boolean bit character severity_level integer real time delay_length natural positive string bit_vector
+// file_open_kind file_open_status line text side width std_ulogic std_ulogic_vector std_logic
// std_logic_vector X01 X01Z UX01 UX01Z unsigned signed
//
Modified: trunk/scintilla/LexVerilog.cxx
===================================================================
--- trunk/scintilla/LexVerilog.cxx 2010-06-06 18:02:49 UTC (rev 5004)
+++ trunk/scintilla/LexVerilog.cxx 2010-06-06 18:34:26 UTC (rev 5005)
@@ -150,6 +150,22 @@
return style == SCE_V_COMMENT;
}
+static bool IsCommentLine(int line, Accessor &styler) {
+ int pos = styler.LineStart(line);
+ int eolPos = styler.LineStart(line + 1) - 1;
+ for (int i = pos; i < eolPos; i++) {
+ char ch = styler[i];
+ char chNext = styler.SafeGetCharAt(i + 1);
+ int style = styler.StyleAt(i);
+ if (ch == '/' && chNext == '/' &&
+ (style == SCE_V_COMMENTLINE || style == SCE_V_COMMENTLINEBANG)) {
+ return true;
+ } else if (!IsASpaceOrTab(ch)) {
+ return false;
+ }
+ }
+ return false;
+}
// Store both the current line's fold level and the next lines in the
// level store to make it easy to pick up with each increment
// and to make it possible to fiddle the current level for "} else {".
@@ -195,6 +211,15 @@
levelNext--;
}
}
+ if (foldComment && atEOL && IsCommentLine(lineCurrent, styler))
+ {
+ if (!IsCommentLine(lineCurrent - 1, styler)
+ && IsCommentLine(lineCurrent + 1, styler))
+ levelNext++;
+ else if (IsCommentLine(lineCurrent - 1, styler)
+ && !IsCommentLine(lineCurrent+1, styler))
+ levelNext--;
+ }
if (foldComment && (style == SCE_V_COMMENTLINE)) {
if ((ch == '/') && (chNext == '/')) {
char chNext2 = styler.SafeGetCharAt(i + 2);
Modified: trunk/scintilla/LineMarker.cxx
===================================================================
--- trunk/scintilla/LineMarker.cxx 2010-06-06 18:02:49 UTC (rev 5004)
+++ trunk/scintilla/LineMarker.cxx 2010-06-06 18:34:26 UTC (rev 5005)
@@ -31,7 +31,7 @@
markType = SC_MARK_PIXMAP;
}
-void LineMarker::SetXPM(const char * const *linesForm) {
+void LineMarker::SetXPM(const char *const *linesForm) {
delete pxpm;
pxpm = new XPM(linesForm);
markType = SC_MARK_PIXMAP;
@@ -154,7 +154,7 @@
rcSmall.bottom = rc.bottom - 2;
surface->RectangleDraw(rcSmall, fore.allocated, back.allocated);
- } else if (markType == SC_MARK_EMPTY || markType == SC_MARK_BACKGROUND ||
+ } else if (markType == SC_MARK_EMPTY || markType == SC_MARK_BACKGROUND ||
markType == SC_MARK_UNDERLINE || markType == SC_MARK_AVAILABLE) {
// An invisible marker so don't draw anything
Modified: trunk/scintilla/LineMarker.h
===================================================================
--- trunk/scintilla/LineMarker.h 2010-06-06 18:02:49 UTC (rev 5004)
+++ trunk/scintilla/LineMarker.h 2010-06-06 18:34:26 UTC (rev 5005)
@@ -51,7 +51,7 @@
}
void RefreshColourPalette(Palette &pal, bool want);
void SetXPM(const char *textForm);
- void SetXPM(const char * const *linesForm);
+ void SetXPM(const char *const *linesForm);
void Draw(Surface *surface, PRectangle &rc, Font &fontForCharacter);
};
Modified: trunk/scintilla/Partitioning.h
===================================================================
--- trunk/scintilla/Partitioning.h 2010-06-06 18:02:49 UTC (rev 5004)
+++ trunk/scintilla/Partitioning.h 2010-06-06 18:34:26 UTC (rev 5005)
@@ -8,7 +8,7 @@
#ifndef PARTITIONING_H
#define PARTITIONING_H
-/// A split vector of integers with a method for adding a value to all elements
+/// A split vector of integers with a method for adding a value to all elements
/// in a range.
/// Used by the Partitioning class.
Modified: trunk/scintilla/PerLine.cxx
===================================================================
--- trunk/scintilla/PerLine.cxx 2010-06-06 18:02:49 UTC (rev 5004)
+++ trunk/scintilla/PerLine.cxx 2010-06-06 18:34:26 UTC (rev 5005)
@@ -241,7 +241,7 @@
void LineLevels::InsertLine(int line) {
if (levels.Length()) {
int level = SC_FOLDLEVELBASE;
- if ((line > 0) && (line < levels.Length())) {
+ if ((line > 0) && (line < levels.Length())) {
level = levels[line-1] & ~SC_FOLDLEVELWHITEFLAG;
}
levels.InsertValue(line, 1, level);
@@ -421,7 +421,7 @@
delete []annotations[line];
}
annotations[line] = AllocateAnnotation(strlen(text), style);
- AnnotationHeader *pah = reinterpret_cast<AnnotationHeader*>(annotations[line]);
+ AnnotationHeader *pah = reinterpret_cast<AnnotationHeader *>(annotations[line]);
pah->style = static_cast<short>(style);
pah->length = strlen(text);
pah->lines = static_cast<short>(NumberLines(text));
Modified: trunk/scintilla/PerLine.h
===================================================================
--- trunk/scintilla/PerLine.h 2010-06-06 18:02:49 UTC (rev 5004)
+++ trunk/scintilla/PerLine.h 2010-06-06 18:34:26 UTC (rev 5005)
@@ -11,7 +11,7 @@
#ifdef SCI_NAMESPACE
namespace Scintilla {
#endif
-
+
/**
* This holds the marker identifier and the marker type to display.
* MarkerHandleNumbers are members of lists.
Modified: trunk/scintilla/PlatGTK.cxx
===================================================================
--- trunk/scintilla/PlatGTK.cxx 2010-06-06 18:02:49 UTC (rev 5004)
+++ trunk/scintilla/PlatGTK.cxx 2010-06-06 18:34:26 UTC (rev 5005)
@@ -347,7 +347,7 @@
d2 = strchr(d1 + 1, '-');
if (d2)
d3 = strchr(d2 + 1, '-');
- if (d3) {
+ if (d3 && d2) {
// foundary-fontface-isoxxx-x
*d2 = '\0';
foundary[0] = '-';
@@ -667,11 +667,9 @@
// Required on OS X
#ifdef SCI_NAMESPACE
-class Scintilla::SurfaceImpl : public Surface
-#else
-class SurfaceImpl : public Surface
+namespace Scintilla {
#endif
-{
+class SurfaceImpl : public Surface {
encodingType et;
GdkDrawable *drawable;
GdkGC *gc;
@@ -731,6 +729,9 @@
void SetUnicodeMode(bool unicodeMode_);
void SetDBCSMode(int codePage);
};
+#ifdef SCI_NAMESPACE
+}
+#endif
const char *CharacterSetID(int characterSet) {
switch (characterSet) {
Modified: trunk/scintilla/PropSet.cxx
===================================================================
--- trunk/scintilla/PropSet.cxx 2010-06-06 18:02:49 UTC (rev 5004)
+++ trunk/scintilla/PropSet.cxx 2010-06-06 18:34:26 UTC (rev 5005)
@@ -96,7 +96,7 @@
// for that, through a recursive function and a simple chain of pointers.
struct VarChain {
- VarChain(const char*var_=NULL, const VarChain *link_=NULL): var(var_), link(link_) {}
+ VarChain(const char *var_=NULL, const VarChain *link_=NULL): var(var_), link(link_) {}
bool contains(const char *testVar) const {
return (var && (0 == strcmp(var, testVar)))
Modified: trunk/scintilla/SVector.h
===================================================================
--- trunk/scintilla/SVector.h 2010-06-06 18:02:49 UTC (rev 5004)
+++ trunk/scintilla/SVector.h 2010-06-06 18:34:26 UTC (rev 5005)
@@ -19,19 +19,19 @@
*/
class SVector {
enum { allocSize = 4000 };
-
+
int *v; ///< The vector
unsigned int size; ///< Number of elements allocated
unsigned int len; ///< Number of elements used in vector
-
+
/** Internally allocate more elements than the user wants
* to avoid thrashing the memory allocator. */
void SizeTo(int newSize) {
if (newSize < allocSize)
newSize += allocSize;
- else
+ else
newSize = (newSize * 3) / 2;
- int* newv = new int[newSize];
+ int *newv = new int[newSize];
size = newSize;
unsigned int i=0;
for (; i<len; i++) {
@@ -43,7 +43,7 @@
delete []v;
v = newv;
}
-
+
public:
SVector() {
v = 0;
@@ -60,7 +60,7 @@
size = 0;
if (other.Length() > 0) {
SizeTo(other.Length());
- for (int i=0;i<other.Length();i++)
+ for (int i=0; i<other.Length(); i++)
v[i] = other.v[i];
len = other.Length();
}
@@ -74,7 +74,7 @@
size = 0;
if (other.Length() > 0) {
SizeTo(other.Length());
- for (int i=0;i<other.Length();i++)
+ for (int i=0; i<other.Length(); i++)
v[i] = other.v[i];
len = other.Length();
}
Modified: trunk/scintilla/ScintillaBase.h
===================================================================
--- trunk/scintilla/ScintillaBase.h 2010-06-06 18:02:49 UTC (rev 5004)
+++ trunk/scintilla/ScintillaBase.h 2010-06-06 18:34:26 UTC (rev 5005)
@@ -76,7 +76,7 @@
void AutoCompleteCharacterDeleted();
void AutoCompleteCompleted();
void AutoCompleteMoveToCurrentWord();
- static void AutoCompleteDoubleClick(void* p);
+ static void AutoCompleteDoubleClick(void *p);
void CallTipClick();
void CallTipShow(Point pt, const char *defn);
Modified: trunk/scintilla/ScintillaGTK.cxx
===================================================================
--- trunk/scintilla/ScintillaGTK.cxx 2010-06-06 18:02:49 UTC (rev 5004)
+++ trunk/scintilla/ScintillaGTK.cxx 2010-06-06 18:34:26 UTC (rev 5005)
@@ -256,7 +256,9 @@
static void DragDataGet(GtkWidget *widget, GdkDragContext *context,
GtkSelectionData *selection_data, guint info, guint time);
static gint TimeOut(ScintillaGTK *sciThis);
- static gint IdleCallback(ScintillaGTK *sciThis);
+ static gboolean IdleCallback(ScintillaGTK *sciThis);
+ static gboolean StyleIdle(ScintillaGTK *sciThis);
+ virtual void QueueStyling(int upTo);
static void PopUpCB(ScintillaGTK *sciThis, guint action, GtkWidget *widget);
gint ExposeTextThis(GtkWidget *widget, GdkEventExpose *ose);
@@ -701,7 +703,7 @@
}
static char *ConvertText(int *lenResult, char *s, size_t len, const char *charSetDest,
- const char *charSetSource, bool transliterations) {
+ const char *charSetSource, bool transliterations, bool silent=false) {
// s is not const because of different versions of iconv disagreeing about const
*lenResult = 0;
char *destForm = 0;
@@ -714,7 +716,9 @@
size_t outLeft = len*3+1;
size_t conversions = conv.Convert(&pin, &inLeft, &pout, &outLeft);
if (conversions == ((size_t)(-1))) {
-fprintf(stderr, "iconv %s->%s failed for %s\n", charSetSource, charSetDest, static_cast<char *>(s));
+ if (!silent)
+ fprintf(stderr, "iconv %s->%s failed for %s\n",
+ charSetSource, charSetDest, static_cast<char *>(s));
delete []destForm;
destForm = 0;
} else {
@@ -826,7 +830,7 @@
#ifdef SCI_LEXER
case SCI_LOADLEXERLIBRARY:
- LexerManager::GetInstance()->Load(reinterpret_cast<const char*>(wParam));
+ LexerManager::GetInstance()->Load(reinterpret_cast<const char*>(lParam));
break;
#endif
case SCI_TARGETASUTF8:
@@ -873,16 +877,17 @@
bool ScintillaGTK::SetIdle(bool on) {
if (on) {
// Start idler, if it's not running.
- if (idler.state == false) {
+ if (!idler.state) {
idler.state = true;
- idler.idlerID = reinterpret_cast<IdlerID>
- (gtk_idle_add((GtkFunction)IdleCallback, this));
+ idler.idlerID = reinterpret_cast<IdlerID>(
+ g_idle_add_full(G_PRIORITY_DEFAULT_IDLE,
+ reinterpret_cast<GSourceFunc>(IdleCallback), this, NULL));
}
} else {
// Stop idler, if it's running
- if (idler.state == true) {
+ if (idler.state) {
idler.state = false;
- gtk_idle_remove(GPOINTER_TO_UINT(idler.idlerID));
+ g_source_remove(GPOINTER_TO_UINT(idler.idlerID));
}
}
return true;
@@ -1104,7 +1109,7 @@
if (mapped) {
int mappedLength = strlen(mapped);
const char *mappedBack = ConvertText(&mappedLength, mapped,
- mappedLength, charSetBuffer, "UTF-8", false);
+ mappedLength, charSetBuffer, "UTF-8", false, true);
if (mappedBack && (strlen(mappedBack) == 1) && (mappedBack[0] != sCharacter[0])) {
pcf->SetTranslation(sCharacter[0], mappedBack[0]);
}
@@ -1612,6 +1617,7 @@
if (OwnPrimarySelection() && primary.s == NULL)
CopySelectionRange(&primary);
+ sel.Clear();
SetSelection(pos, pos);
atomSought = atomUTF8;
gtk_selection_convert(GTK_WIDGET(PWidget(wMain)), GDK_SELECTION_PRIMARY,
@@ -2308,8 +2314,8 @@
return 1;
}
-int ScintillaGTK::IdleCallback(ScintillaGTK *sciThis) {
- // Idler will be automatically stoped, if there is nothing
+gboolean ScintillaGTK::IdleCallback(ScintillaGTK *sciThis) {
+ // Idler will be automatically stopped, if there is nothing
// to do while idle.
bool ret = sciThis->Idle();
if (ret == false) {
@@ -2321,6 +2327,22 @@
return ret;
}
+gboolean ScintillaGTK::StyleIdle(ScintillaGTK *sciThis) {
+ sciThis->IdleStyling();
+ // Idler will be automatically stopped
+ return FALSE;
+}
+
+void ScintillaGTK::QueueStyling(int upTo) {
+ Editor::QueueStyling(upTo);
+ if (!styleNeeded.active) {
+ // Only allow one style needed to be queued
+ styleNeeded.active = true;
+ g_idle_add_full(G_PRIORITY_HIGH_IDLE,
+ reinterpret_cast<GSourceFunc>(StyleIdle), this, NULL);
+ }
+}
+
void ScintillaGTK::PopUpCB(ScintillaGTK *sciThis, guint action, GtkWidget *) {
if (action) {
sciThis->Command(action);
Modified: trunk/scintilla/Selection.cxx
===================================================================
--- trunk/scintilla/Selection.cxx 2010-06-06 18:02:49 UTC (rev 5004)
+++ trunk/scintilla/Selection.cxx 2010-06-06 18:34:26 UTC (rev 5005)
@@ -127,7 +127,7 @@
} else if (start <= startRange) {
// Trim end
end = startRange;
- } else { //
+ } else { //
PLATFORM_ASSERT(end >= endRange);
// Trim start
start = endRange;
@@ -267,7 +267,7 @@
for (size_t i=0; i<ranges.size();) {
if ((i != mainRange) && (ranges[i].Trim(range))) {
// Trimmed to empty so remove
- for (size_t j=i;j<ranges.size()-1;j++) {
+ for (size_t j=i; j<ranges.size()-1; j++) {
ranges[j] = ranges[j+1];
if (j == mainRange-1)
mainRange--;
Modified: trunk/scintilla/Selection.h
===================================================================
--- trunk/scintilla/Selection.h 2010-06-06 18:02:49 UTC (rev 5004)
+++ trunk/scintilla/Selection.h 2010-06-06 18:34:26 UTC (rev 5005)
@@ -57,7 +57,7 @@
};
// Ordered range to make drawing simpler
-struct SelectionSegment {
+struct SelectionSegment {
SelectionPosition start;
SelectionPosition end;
SelectionSegment() {
@@ -148,7 +148,7 @@
int MainAnchor() const;
SelectionRange &Rectangular();
SelectionSegment Limits() const;
- // This is for when you want to move the caret in response to a
+ // This is for when you want to move the caret in response to a
// user direction command - for rectangular selections, use the range
// that covers all selected text otherwise return the main selection.
SelectionSegment LimitsForRectangularElseMain() const;
Modified: trunk/scintilla/SplitVector.h
===================================================================
--- trunk/scintilla/SplitVector.h 2010-06-06 18:02:49 UTC (rev 5004)
+++ trunk/scintilla/SplitVector.h 2010-06-06 18:34:26 UTC (rev 5005)
@@ -1,6 +1,6 @@
// Scintilla source code edit control
/** @file SplitVector.h
- ** Main data structure for holding arrays that handle insertions
+ ** Main data structure for holding arrays that handle insertions
** and deletions efficiently.
**/
// Copyright 1998-2007 by Neil Hodgson <neilh at scintilla.org>
@@ -97,7 +97,7 @@
/// Retrieve the character at a particular position.
/// Retrieving positions outside the range of the buffer returns 0.
- /// The assertions here are disabled since calling code can be
+ /// The assertions here are disabled since calling code can be
/// simpler if out of range access works and returns 0.
T ValueAt(int position) const {
if (position < part1Length) {
@@ -135,7 +135,7 @@
}
}
- T& operator[](int position) const {
+ T &operator[](int position) const {
PLATFORM_ASSERT(position >= 0 && position < lengthBody);
if (position < part1Length) {
return body[position];
@@ -182,14 +182,14 @@
}
}
- /// Ensure at least length elements allocated,
+ /// Ensure at least length elements allocated,
/// appending zero valued elements if needed.
void EnsureLength(int wantedLength) {
if (Length() < wantedLength) {
InsertValue(Length(), wantedLength - Length(), 0);
}
}
-
+
/// Insert text into the buffer from an array.
void InsertFromArray(int positionToInsert, const T s[], int positionFrom, int insertLength) {
PLATFORM_ASSERT((positionToInsert >= 0) && (positionToInsert <= lengthBody));
@@ -238,7 +238,7 @@
DeleteRange(0, lengthBody);
}
- T* BufferPointer() {
+ T *BufferPointer() {
RoomFor(1);
GapTo(lengthBody);
body[lengthBody] = 0;
Modified: trunk/scintilla/Style.h
===================================================================
--- trunk/scintilla/Style.h 2010-06-06 18:02:49 UTC (rev 5004)
+++ trunk/scintilla/Style.h 2010-06-06 18:34:26 UTC (rev 5005)
@@ -54,7 +54,7 @@
void ClearTo(const Style &source);
bool EquivalentFontTo(const Style *other) const;
void Realise(Surface &surface, int zoomLevel, Style *defaultStyle = 0, int extraFontFlag = 0);
- bool IsProtected() const { return !(changeable && visible);};
+ bool IsProtected() const { return !(changeable && visible);}
};
#ifdef SCI_NAMESPACE
Modified: trunk/scintilla/UniConversion.cxx
===================================================================
--- trunk/scintilla/UniConversion.cxx 2010-06-06 18:02:49 UTC (rev 5004)
+++ trunk/scintilla/UniConversion.cxx 2010-06-06 18:34:26 UTC (rev 5005)
@@ -1,6 +1,6 @@
// Scintilla source code edit control
/** @file UniConversion.cxx
- ** Functions to handle UFT-8 and UCS-2 strings.
+ ** Functions to handle UTF-8 and UTF-16 strings.
**/
// Copyright 1998-2001 by Neil Hodgson <neilh at scintilla.org>
// The License.txt file describes the conditions under which this software may be distributed.
Modified: trunk/scintilla/UniConversion.h
===================================================================
--- trunk/scintilla/UniConversion.h 2010-06-06 18:02:49 UTC (rev 5004)
+++ trunk/scintilla/UniConversion.h 2010-06-06 18:34:26 UTC (rev 5005)
@@ -1,6 +1,6 @@
// Scintilla source code edit control
/** @file UniConversion.h
- ** Functions to handle UFT-8 and UCS-2 strings.
+ ** Functions to handle UTF-8 and UTF-16 strings.
**/
// Copyright 1998-2001 by Neil Hodgson <neilh at scintilla.org>
// The License.txt file describes the conditions under which this software may be distributed.
Modified: trunk/scintilla/ViewStyle.cxx
===================================================================
--- trunk/scintilla/ViewStyle.cxx 2010-06-06 18:02:49 UTC (rev 5004)
+++ trunk/scintilla/ViewStyle.cxx 2010-06-06 18:34:26 UTC (rev 5005)
@@ -41,7 +41,7 @@
}
void FontNames::Clear() {
- for (int i=0;i<max;i++) {
+ for (int i=0; i<max; i++) {
delete []names[i];
}
max = 0;
@@ -50,7 +50,7 @@
const char *FontNames::Save(const char *name) {
if (!name)
return 0;
- for (int i=0;i<max;i++) {
+ for (int i=0; i<max; i++) {
if (strcmp(names[i], name) == 0) {
return names[i];
}
@@ -59,7 +59,7 @@
// Grow array
int sizeNew = size * 2;
char **namesNew = new char *[sizeNew];
- for (int j=0;j<max;j++) {
+ for (int j=0; j<max; j++) {
namesNew[j] = names[j];
}
delete []names;
@@ -78,15 +78,15 @@
ViewStyle::ViewStyle(const ViewStyle &source) {
Init(source.stylesSize);
- for (unsigned int sty=0;sty<source.stylesSize;sty++) {
+ for (unsigned int sty=0; sty<source.stylesSize; sty++) {
styles[sty] = source.styles[sty];
// Can't just copy fontname as its lifetime is relative to its owning ViewStyle
styles[sty].fontName = fontNames.Save(source.styles[sty].fontName);
}
- for (int mrk=0;mrk<=MARKER_MAX;mrk++) {
+ for (int mrk=0; mrk<=MARKER_MAX; mrk++) {
markers[mrk] = source.markers[mrk];
}
- for (int ind=0;ind<=INDIC_MAX;ind++) {
+ for (int ind=0; ind<=INDIC_MAX; ind++) {
indicators[ind] = source.indicators[ind];
}
@@ -131,7 +131,7 @@
someStylesProtected = false;
leftMarginWidth = source.leftMarginWidth;
rightMarginWidth = source.rightMarginWidth;
- for (int i=0;i < margins; i++) {
+ for (int i=0; i < margins; i++) {
ms[i] = source.ms[i];
}
symbolMargin = source.symbolMargin;
@@ -257,14 +257,14 @@
void ViewStyle::RefreshColourPalette(Palette &pal, bool want) {
unsigned int i;
- for (i=0;i<stylesSize;i++) {
+ for (i=0; i<stylesSize; i++) {
pal.WantFind(styles[i].fore, want);
pal.WantFind(styles[i].back, want);
}
- for (i=0;i<(sizeof(indicators)/sizeof(indicators[0]));i++) {
+ for (i=0; i<(sizeof(indicators)/sizeof(indicators[0])); i++) {
pal.WantFind(indicators[i].fore, want);
}
- for (i=0;i<(sizeof(markers)/sizeof(markers[0]));i++) {
+ for (i=0; i<(sizeof(markers)/sizeof(markers[0])); i++) {
markers[i].RefreshColourPalette(pal, want);
}
pal.WantFind(selforeground, want);
Modified: trunk/scintilla/WindowAccessor.cxx
===================================================================
--- trunk/scintilla/WindowAccessor.cxx 2010-06-06 18:02:49 UTC (rev 5004)
+++ trunk/scintilla/WindowAccessor.cxx 2010-06-06 18:34:26 UTC (rev 5005)
@@ -7,7 +7,7 @@
#include <stdlib.h>
#include <string.h>
-#include <ctype.h>
+#include <ctype.h>
#include <stdio.h>
#include "Platform.h"
@@ -28,7 +28,7 @@
if (SC_CP_UTF8 == codePage)
// For lexing, all characters >= 0x80 are treated the
// same so none is considered a lead byte.
- return false;
+ return false;
else
return Platform::IsDBCSLeadByte(codePage, ch);
}
@@ -75,10 +75,10 @@
return Platform::SendScintilla(id, SCI_GETFOLDLEVEL, line, 0);
}
-int WindowAccessor::Length() {
- if (lenDoc == -1)
+int WindowAccessor::Length() {
+ if (lenDoc == -1)
lenDoc = Platform::SendScintilla(id, SCI_GETTEXTLENGTH, 0, 0);
- return lenDoc;
+ return lenDoc;
}
int WindowAccessor::GetLineState(int line) {
@@ -129,7 +129,7 @@
startPos = extremePosition;
lenDoc = -1;
if (validLen > 0) {
- Platform::SendScintillaPointer(id, SCI_SETSTYLINGEX, validLen,
+ Platform::SendScintillaPointer(id, SCI_SETSTYLINGEX, validLen,
styleBuf);
validLen = 0;
}
@@ -138,12 +138,12 @@
int WindowAccessor::IndentAmount(int line, int *flags, PFNIsCommentLeader pfnIsCommentLeader) {
int end = Length();
int spaceFlags = 0;
-
- // Determines the indentation level of the current line and also checks for consistent
+
+ // Determines the indentation level of the current line and also checks for consistent
// indentation compared to the previous line.
- // Indentation is judged consistent when the indentation whitespace of each line lines
+ // Indentation is judged consistent when the indentation whitespace of each line lines
// the same or the indentation of one line is a prefix of the other.
-
+
int pos = LineStart(line);
char ch = (*this)[pos];
int indent = 0;
@@ -170,11 +170,11 @@
}
ch = (*this)[++pos];
}
-
+
*flags = spaceFlags;
indent += SC_FOLDLEVELBASE;
// if completely empty line or the start of a comment...
- if (isspace(ch) || (pfnIsCommentLeader && (*pfnIsCommentLeader)(*this, pos, end-pos)) )
+ if (isspace(ch) || (pfnIsCommentLeader && (*pfnIsCommentLeader)(*this, pos, end-pos)))
return indent | SC_FOLDLEVELWHITEFLAG;
else
return indent;
Modified: trunk/scintilla/XPM.cxx
===================================================================
--- trunk/scintilla/XPM.cxx 2010-06-06 18:02:49 UTC (rev 5004)
+++ trunk/scintilla/XPM.cxx 2010-06-06 18:34:26 UTC (rev 5005)
@@ -38,7 +38,7 @@
return i;
}
-ColourAllocated XPM::ColourFromCode(int ch) {
+ColourAllocated XPM::ColourFromCode(int ch) const {
return colourCodeTable[ch]->allocated;
#ifdef SLOW
for (int i=0; i<nColours; i++) {
@@ -62,7 +62,7 @@
Init(textForm);
}
-XPM::XPM(const char * const *linesForm) :
+XPM::XPM(const char *const *linesForm) :
data(0), codes(0), colours(0), lines(0) {
Init(linesForm);
}
@@ -88,7 +88,7 @@
}
}
-void XPM::Init(const char * const *linesForm) {
+void XPM::Init(const char *const *linesForm) {
Clear();
height = 1;
width = 1;
@@ -185,7 +185,7 @@
// Centre the pixmap
int startY = rc.top + (rc.Height() - height) / 2;
int startX = rc.left + (rc.Width() - width) / 2;
- for (int y=0;y<height;y++) {
+ for (int y=0; y<height; y++) {
int prevCode = 0;
int xStartRun = 0;
for (int x=0; x<width; x++) {
Modified: trunk/scintilla/XPM.h
===================================================================
--- trunk/scintilla/XPM.h 2010-06-06 18:02:49 UTC (rev 5004)
+++ trunk/scintilla/XPM.h 2010-06-06 18:34:26 UTC (rev 5005)
@@ -24,7 +24,7 @@
char codeTransparent;
char *codes;
ColourPair *colours;
- ColourAllocated ColourFromCode(int ch);
+ ColourAllocated ColourFromCode(int ch) const;
void FillRun(Surface *surface, int code, int startX, int y, int x);
char **lines;
ColourPair *colourCodeTable[256];
Modified: trunk/scintilla/include/Platform.h
===================================================================
--- trunk/scintilla/include/Platform.h 2010-06-06 18:02:49 UTC (rev 5004)
+++ trunk/scintilla/include/Platform.h 2010-06-06 18:34:26 UTC (rev 5005)
@@ -314,8 +314,8 @@
Surface(const Surface &) {}
Surface &operator=(const Surface &) { return *this; }
public:
- Surface() {};
- virtual ~Surface() {};
+ Surface() {}
+ virtual ~Surface() {}
static Surface *Allocate();
virtual void Init(WindowID wid)=0;
@@ -474,7 +474,7 @@
*/
class DynamicLibrary {
public:
- virtual ~DynamicLibrary() {};
+ virtual ~DynamicLibrary() {}
/// @return Pointer to function "name", or NULL on failure.
virtual Function FindFunction(const char *name) = 0;
Modified: trunk/scintilla/include/SciLexer.h
===================================================================
--- trunk/scintilla/include/SciLexer.h 2010-06-06 18:02:49 UTC (rev 5004)
+++ trunk/scintilla/include/SciLexer.h 2010-06-06 18:34:26 UTC (rev 5005)
@@ -637,6 +637,7 @@
#define SCE_CSS_EXTENDED_IDENTIFIER 19
#define SCE_CSS_EXTENDED_PSEUDOCLASS 20
#define SCE_CSS_EXTENDED_PSEUDOELEMENT 21
+#define SCE_CSS_MEDIA 22
#define SCE_POV_DEFAULT 0
#define SCE_POV_COMMENT 1
#define SCE_POV_COMMENTLINE 2
@@ -1081,11 +1082,19 @@
#define SCE_FS_DATE 16
#define SCE_FS_STRINGEOL 17
#define SCE_FS_CONSTANT 18
-#define SCE_FS_ASM 19
-#define SCE_FS_LABEL 20
-#define SCE_FS_ERROR 21
-#define SCE_FS_HEXNUMBER 22
-#define SCE_FS_BINNUMBER 23
+#define SCE_FS_WORDOPERATOR 19
+#define SCE_FS_DISABLEDCODE 20
+#define SCE_FS_DEFAULT_C 21
+#define SCE_FS_COMMENTDOC_C 22
+#define SCE_FS_COMMENTLINEDOC_C 23
+#define SCE_FS_KEYWORD_C 24
+#define SCE_FS_KEYWORD2_C 25
+#define SCE_FS_NUMBER_C 26
+#define SCE_FS_STRING_C 27
+#define SCE_FS_PREPROCESSOR_C 28
+#define SCE_FS_OPERATOR_C 29
+#define SCE_FS_IDENTIFIER_C 30
+#define SCE_FS_STRINGEOL_C 31
#define SCE_CSOUND_DEFAULT 0
#define SCE_CSOUND_COMMENT 1
#define SCE_CSOUND_NUMBER 2
Modified: trunk/scintilla/include/Scintilla.iface
===================================================================
--- trunk/scintilla/include/Scintilla.iface 2010-06-06 18:02:49 UTC (rev 5004)
+++ trunk/scintilla/include/Scintilla.iface 2010-06-06 18:34:26 UTC (rev 5005)
@@ -2906,6 +2906,7 @@
val SCE_CSS_EXTENDED_IDENTIFIER=19
val SCE_CSS_EXTENDED_PSEUDOCLASS=20
val SCE_CSS_EXTENDED_PSEUDOELEMENT=21
+val SCE_CSS_MEDIA=22
# Lexical states for SCLEX_POV
lex POV=SCLEX_POV SCE_POV_
val SCE_POV_DEFAULT=0
@@ -3388,7 +3389,7 @@
val SCE_ST_CHARACTER=15
val SCE_ST_SPEC_SEL=16
# Lexical states for SCLEX_FLAGSHIP (clipper)
-lex FlagShip=SCLEX_FLAGSHIP SCE_B_
+lex FlagShip=SCLEX_FLAGSHIP SCE_FS_
val SCE_FS_DEFAULT=0
val SCE_FS_COMMENT=1
val SCE_FS_COMMENTLINE=2
@@ -3408,11 +3409,19 @@
val SCE_FS_DATE=16
val SCE_FS_STRINGEOL=17
val SCE_FS_CONSTANT=18
-val SCE_FS_ASM=19
-val SCE_FS_LABEL=20
-val SCE_FS_ERROR=21
-val SCE_FS_HEXNUMBER=22
-val SCE_FS_BINNUMBER=23
+val SCE_FS_WORDOPERATOR=19
+val SCE_FS_DISABLEDCODE=20
+val SCE_FS_DEFAULT_C=21
+val SCE_FS_COMMENTDOC_C=22
+val SCE_FS_COMMENTLINEDOC_C=23
+val SCE_FS_KEYWORD_C=24
+val SCE_FS_KEYWORD2_C=25
+val SCE_FS_NUMBER_C=26
+val SCE_FS_STRING_C=27
+val SCE_FS_PREPROCESSOR_C=28
+val SCE_FS_OPERATOR_C=29
+val SCE_FS_IDENTIFIER_C=30
+val SCE_FS_STRINGEOL_C=31
# Lexical states for SCLEX_CSOUND
lex Csound=SCLEX_CSOUND SCE_CSOUND_
val SCE_CSOUND_DEFAULT=0
Modified: trunk/scintilla/include/WindowAccessor.h
===================================================================
--- trunk/scintilla/include/WindowAccessor.h 2010-06-06 18:02:49 UTC (rev 5004)
+++ trunk/scintilla/include/WindowAccessor.h 2010-06-06 18:34:26 UTC (rev 5005)
@@ -53,7 +53,7 @@
}
void StartAt(unsigned int start, char chMask=31);
- void SetFlags(char chFlags_, char chWhile_) {chFlags = chFlags_; chWhile = chWhile_; };
+ void SetFlags(char chFlags_, char chWhile_) {chFlags = chFlags_; chWhile = chWhile_; }
unsigned int GetStartSegment() { return startSeg; }
void StartSegment(unsigned int pos);
void ColourTo(unsigned int pos, int chAttr);
Modified: trunk/src/plugindata.h
===================================================================
--- trunk/src/plugindata.h 2010-06-06 18:02:49 UTC (rev 5004)
+++ trunk/src/plugindata.h 2010-06-06 18:34:26 UTC (rev 5005)
@@ -50,7 +50,7 @@
enum {
/** The Application Programming Interface (API) version, incremented
* whenever any plugin data types are modified or appended to. */
- GEANY_API_VERSION = 188,
+ GEANY_API_VERSION = 189,
/** The Application Binary Interface (ABI) version, incremented whenever
* existing fields in the plugin data types have to be changed or reordered. */
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Commits
mailing list