Update Scintilla to version 2.12.

git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@5005 ea778897-0a13-0410-b9d1-a72fbfd435f5
This commit is contained in:
Enrico Tröger 2010-06-06 18:34:26 +00:00
parent 3eb6db8dc2
commit 16a0313b35
48 changed files with 471 additions and 322 deletions

View File

@ -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>

2
NEWS
View File

@ -33,7 +33,7 @@ Geany 0.19 (TBA)
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.

View File

@ -44,9 +44,11 @@ void LineVector::InsertText(int line, int delta) {
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 @@ char CellBuffer::CharAt(int position) const {
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 @@ void CellBuffer::GetCharRange(char *buffer, int position, int lengthRetrieve) {
}
}
char CellBuffer::StyleAt(int position) {
char CellBuffer::StyleAt(int position) const {
return style.ValueAt(position);
}
@ -473,8 +475,8 @@ bool CellBuffer::IsSavePoint() {
// 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 @@ void CellBuffer::BasicInsertString(int position, const char *s, int insertLength
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++;
}
}

View File

@ -37,7 +37,7 @@ public:
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 @@ public:
/// 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 @@ public:
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);

View File

@ -53,6 +53,7 @@ public:
}
bool Contains(int val) const {
PLATFORM_ASSERT(val >= 0);
if (val < 0) return false;
return (val < size) ? bset[val] : valueAfter;
}
};

View File

@ -232,11 +232,11 @@ void ContractionState::ShowAll() {
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;

View File

@ -258,7 +258,7 @@ int Document::SetLevel(int line, int level) {
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 @@ int Document::SetLineState(int line, int state) {
return statePrevious;
}
int Document::GetLineState(int line) {
int Document::GetLineState(int line) const {
return static_cast<LineState *>(perLineData[ldState])->GetLineState(line);
}

View File

@ -32,10 +32,10 @@ public:
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 @@ struct StyledText {
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 @@ public:
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 @@ public:
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 @@ public:
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);

View File

@ -187,7 +187,7 @@ int DocumentAccessor::IndentAmount(int line, int *flags, PFNIsCommentLeader pfnI
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;

View File

@ -38,9 +38,9 @@ protected:
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 @@ public:
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 @@ public:
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);

View File

@ -623,7 +623,7 @@ void Editor::Redraw() {
//wMain.InvalidateAll();
}
void Editor::RedrawSelMargin(int line) {
void Editor::RedrawSelMargin(int line, bool allAfter) {
if (!AbandonPaint()) {
if (vs.maskInLine) {
Redraw();
@ -634,7 +634,8 @@ void Editor::RedrawSelMargin(int line) {
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 @@ SelectionPosition Editor::MovePositionOutsideChar(SelectionPosition pos, int mov
}
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 @@ int Editor::MovePositionTo(SelectionPosition newPos, Selection::selTypes selt, b
}
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 @@ void Editor::ScrollTo(int line, bool moveThumb) {
// Try to optimise small scrolls
int linesToMove = topLine - topLineNew;
SetTopLine(topLineNew);
ShowCaretAtCurrentPosition();
// Perform redraw rather than scroll if many lines would be redrawn anyway.
// 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.
if ((abs(linesToMove) <= 10) && (paintState == notPainting)) {
ScrollText(linesToMove);
} else {
@ -1037,29 +1050,24 @@ slop | strict | jumps | even | Caret can go to the margin | When
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 @@ void Editor::EnsureCaretVisible(bool useMargin, bool vert, bool horiz) {
}
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 @@ void Editor::EnsureCaretVisible(bool useMargin, bool vert, bool horiz) {
}
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 @@ void Editor::EnsureCaretVisible(bool useMargin, bool vert, bool horiz) {
// 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 @@ void Editor::EnsureCaretVisible(bool useMargin, bool vert, bool horiz) {
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 @@ void Editor::EnsureCaretVisible(bool useMargin, bool vert, bool horiz) {
}
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,54 +1219,69 @@ void Editor::EnsureCaretVisible(bool useMargin, bool vert, bool horiz) {
// 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() {
@ -1850,7 +1867,7 @@ bool BadUTF(const char *s, int len, int &trailBytes) {
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 @@ void Editor::Paint(Surface *surfaceWindow, PRectangle rcArea) {
//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 @@ void Editor::Paint(Surface *surfaceWindow, PRectangle rcArea) {
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 @@ void Editor::Paint(Surface *surfaceWindow, PRectangle rcArea) {
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 @@ void Editor::Paint(Surface *surfaceWindow, PRectangle rcArea) {
}
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 @@ void Editor::NotifyModified(Document *, DocModification mh, void *) {
// 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 @@ void Editor::NotifyModified(Document *, DocModification mh, void *) {
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 @@ void Editor::SetFocusState(bool focusState) {
}
}
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;

View File

@ -45,6 +45,26 @@ public:
Idler();
};
/**
* 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 @@ protected: // ScintillaBase subclass needs access to much of Editor
enum { notPainting, painting, paintAbandoned } paintState;
PRectangle rcPaint;
bool paintingAllText;
StyleNeeded styleNeeded;
int modEventMask;
SelectionText drag;
@ -272,7 +293,7 @@ protected: // ScintillaBase subclass needs access to much of Editor
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 @@ protected: // ScintillaBase subclass needs access to much of Editor
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 @@ protected: // ScintillaBase subclass needs access to much of Editor
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);

View File

@ -40,7 +40,7 @@ char **WordListsToStrings(WordList *val[]) {
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 @@ void ExternalLexerModule::SetExternal(ExtLexerFunction fLexer, ExtFoldFunction f
//
//------------------------------------------
LexerLibrary::LexerLibrary(const char* ModuleName) {
LexerLibrary::LexerLibrary(const char *ModuleName) {
// Initialise some members...
first = NULL;
last = NULL;
@ -195,18 +195,15 @@ void LexerLibrary::Release() {
/// 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 @@ LexerManager::~LexerManager() {
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::LoadLexerLibrary(const char* module)
}
}
void LexerManager::Clear()
{
void LexerManager::Clear() {
if (NULL != first) {
LexerLibrary *cur = first;
LexerLibrary *next;
@ -257,8 +255,7 @@ void LexerManager::Clear()
//
//------------------------------------------
LMMinder::~LMMinder()
{
LMMinder::~LMMinder() {
LexerManager::DeleteInstance();
}

View File

@ -23,7 +23,7 @@ typedef void (EXT_LEXER_DECL *ExtLexerFunction)(unsigned int lexer, unsigned int
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 @@ protected:
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 @@ class LexerLibrary {
LexerMinder *last;
public:
LexerLibrary(const char* ModuleName);
LexerLibrary(const char *ModuleName);
~LexerLibrary();
void Release();
LexerLibrary *next;
std::string m_sModuleName;
};
@ -76,18 +76,18 @@ public:
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;
};

View File

@ -248,14 +248,8 @@ static void ColouriseBashDoc(unsigned int startPos, int length, int initStyle,
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 @@ static void ColouriseBashDoc(unsigned int startPos, int length, int initStyle,
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);

View File

@ -59,8 +59,8 @@ static void ColouriseCppDoc(unsigned int startPos, int length, int initStyle, Wo
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 @@ static void ColouriseCppDoc(unsigned int startPos, int length, int initStyle, Wo
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 @@ static void FoldCppDoc(unsigned int startPos, int length, int initStyle,
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 void FoldCppDoc(unsigned int startPos, int length, int initStyle,
}
}
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) {

View File

@ -62,6 +62,7 @@ static void ColouriseCssDoc(unsigned int startPos, int length, int initStyle, Wo
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 @@ static void ColouriseCssDoc(unsigned int startPos, int length, int initStyle, Wo
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 @@ static void ColouriseCssDoc(unsigned int startPos, int length, int initStyle, Wo
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 @@ static void ColouriseCssDoc(unsigned int startPos, int length, int initStyle, Wo
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 @@ static void ColouriseCssDoc(unsigned int startPos, int length, int initStyle, Wo
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 @@ static void ColouriseCssDoc(unsigned int startPos, int length, int initStyle, Wo
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;

View File

@ -430,13 +430,11 @@ void ColouriseCamlDoc(
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[] = {

View File

@ -587,8 +587,6 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
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 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
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 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
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 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
}
// 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 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
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 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
}
// 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 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
if (foldHTMLPreprocessor) {
levelCurrent--;
}
scriptLanguage = eScriptNone;
scriptLanguage = beforeLanguage;
continue;
}

View File

@ -1243,7 +1243,7 @@ static void FoldPerlDoc(unsigned int startPos, int length, int, WordList *[],
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--;

View File

@ -36,7 +36,7 @@ static bool IsPyComment(Accessor &styler, int pos, int len) {
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 @@ static void ColourisePyDoc(unsigned int startPos, int length, int initStyle,
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 @@ static void ColourisePyDoc(unsigned int startPos, int length, int initStyle,
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 @@ static void FoldPyDoc(unsigned int startPos, int length, int /*initStyle - unuse
}
// 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 @@ static void FoldPyDoc(unsigned int startPos, int length, int /*initStyle - unuse
//styler.SetLevel(lineCurrent, indentCurrent);
}
static const char * const pythonWordListDesc[] = {
static const char *const pythonWordListDesc[] = {
"Keywords",
"Highlighted identifiers",
0

View File

@ -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 @@ static void ColouriseVHDLDoc(
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 bool IsCommentLine(int line, Accessor &styler) {
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 @@ static void FoldNoBoxVHDLDoc(
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 @@ static void FoldNoBoxVHDLDoc(
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 @@ static void FoldNoBoxVHDLDoc(
((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 @@ LexerModule lmVHDL(SCLEX_VHDL, ColouriseVHDLDoc, "vhdl", FoldVHDLDoc, VHDLWordLi
// 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
//

View File

@ -150,6 +150,22 @@ static bool IsStreamCommentStyle(int style) {
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 @@ static void FoldNoBoxVerilogDoc(unsigned int startPos, int length, int initStyle
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);

View File

@ -31,7 +31,7 @@ void LineMarker::SetXPM(const char *textForm) {
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 @@ void LineMarker::Draw(Surface *surface, PRectangle &rcWhole, Font &fontForCharac
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

View File

@ -51,7 +51,7 @@ public:
}
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);
};

View File

@ -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.

View File

@ -241,7 +241,7 @@ void LineLevels::Init() {
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 @@ void LineAnnotation::SetText(int line, const char *text) {
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));

View File

@ -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.

View File

@ -347,7 +347,7 @@ static void GenerateFontSpecStrings(const char *fontName, int characterSet,
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 @@ void Font::Release() {
// 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 @@ public:
void SetUnicodeMode(bool unicodeMode_);
void SetDBCSMode(int codePage);
};
#ifdef SCI_NAMESPACE
}
#endif
const char *CharacterSetID(int characterSet) {
switch (characterSet) {

View File

@ -96,7 +96,7 @@ const char *PropSetSimple::Get(const char *key) const {
// 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)))

View File

@ -19,19 +19,19 @@ namespace Scintilla {
*/
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 @@ class SVector {
delete []v;
v = newv;
}
public:
SVector() {
v = 0;
@ -60,7 +60,7 @@ public:
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 @@ public:
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();
}

View File

@ -76,7 +76,7 @@ protected:
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);

View File

@ -256,7 +256,9 @@ private:
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 @@ void ScintillaGTK::StartDrag() {
}
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 @@ static char *ConvertText(int *lenResult, char *s, size_t len, const char *charSe
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 @@ sptr_t ScintillaGTK::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam
#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 @@ void ScintillaGTK::SetTicking(bool on) {
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 @@ CaseFolder *ScintillaGTK::CaseFolderForEncoding() {
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 @@ gint ScintillaGTK::PressThis(GdkEventButton *event) {
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 @@ int ScintillaGTK::TimeOut(ScintillaGTK *sciThis) {
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 @@ int ScintillaGTK::IdleCallback(ScintillaGTK *sciThis) {
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);

View File

@ -127,7 +127,7 @@ bool SelectionRange::Trim(SelectionRange range) {
} else if (start <= startRange) {
// Trim end
end = startRange;
} else { //
} else { //
PLATFORM_ASSERT(end >= endRange);
// Trim start
start = endRange;
@ -267,7 +267,7 @@ void Selection::TrimSelection(SelectionRange range) {
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--;

View File

@ -57,7 +57,7 @@ public:
};
// Ordered range to make drawing simpler
struct SelectionSegment {
struct SelectionSegment {
SelectionPosition start;
SelectionPosition end;
SelectionSegment() {
@ -148,7 +148,7 @@ public:
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;

View File

@ -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@scintilla.org>
@ -97,7 +97,7 @@ public:
/// 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 @@ public:
}
}
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 @@ public:
}
}
/// 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 @@ public:
DeleteRange(0, lengthBody);
}
T* BufferPointer() {
T *BufferPointer() {
RoomFor(1);
GapTo(lengthBody);
body[lengthBody] = 0;

View File

@ -54,7 +54,7 @@ public:
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

View File

@ -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@scintilla.org>
// The License.txt file describes the conditions under which this software may be distributed.

View File

@ -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@scintilla.org>
// The License.txt file describes the conditions under which this software may be distributed.

View File

@ -41,7 +41,7 @@ FontNames::~FontNames() {
}
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 @@ void FontNames::Clear() {
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 @@ const char *FontNames::Save(const char *name) {
// 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() {
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 @@ ViewStyle::ViewStyle(const ViewStyle &source) {
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::Init(size_t stylesSize_) {
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);

View File

@ -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 @@ bool WindowAccessor::InternalIsLeadByte(char ch) {
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 @@ int WindowAccessor::LevelAt(int line) {
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 @@ void WindowAccessor::Flush() {
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 @@ void WindowAccessor::Flush() {
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 @@ int WindowAccessor::IndentAmount(int line, int *flags, PFNIsCommentLeader pfnIsC
}
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;

View File

@ -38,7 +38,7 @@ static size_t MeasureLength(const char *s) {
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 @@ XPM::XPM(const char *textForm) :
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 *textForm) {
}
}
void XPM::Init(const char * const *linesForm) {
void XPM::Init(const char *const *linesForm) {
Clear();
height = 1;
width = 1;
@ -185,7 +185,7 @@ void XPM::Draw(Surface *surface, PRectangle &rc) {
// 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++) {

View File

@ -24,7 +24,7 @@ class XPM {
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];

View File

@ -314,8 +314,8 @@ private:
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 @@ public:
*/
class DynamicLibrary {
public:
virtual ~DynamicLibrary() {};
virtual ~DynamicLibrary() {}
/// @return Pointer to function "name", or NULL on failure.
virtual Function FindFunction(const char *name) = 0;

View File

@ -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

View File

@ -2906,6 +2906,7 @@ val SCE_CSS_PSEUDOELEMENT=18
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_ASSIGN=14
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_IDENTIFIER=15
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

View File

@ -53,7 +53,7 @@ public:
}
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);

View File

@ -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. */