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:
parent
3eb6db8dc2
commit
16a0313b35
@ -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
2
NEWS
@ -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.
|
||||
|
@ -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++;
|
||||
}
|
||||
}
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
};
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
|
@ -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,6 +634,7 @@ void Editor::RedrawSelMargin(int line) {
|
||||
int position = pdoc->LineStart(line);
|
||||
PRectangle rcLine = RectangleFromRange(position, position);
|
||||
rcSelMargin.top = rcLine.top;
|
||||
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,42 +1219,53 @@ 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) {
|
||||
@ -1261,10 +1274,14 @@ void Editor::EnsureCaretVisible(bool useMargin, bool vert, bool horiz) {
|
||||
}
|
||||
}
|
||||
SetHorizontalScrollPos();
|
||||
}
|
||||
Redraw();
|
||||
}
|
||||
}
|
||||
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,6 +3298,7 @@ void Editor::Paint(Surface *surfaceWindow, PRectangle rcArea) {
|
||||
}
|
||||
PLATFORM_ASSERT(pixmapSelPattern->Initialised());
|
||||
|
||||
if (paintState != paintAbandoned) {
|
||||
PaintSelMargin(surfaceWindow, rcArea);
|
||||
|
||||
PRectangle rcRightMargin = rcClient;
|
||||
@ -3295,6 +3306,7 @@ void Editor::Paint(Surface *surfaceWindow, PRectangle rcArea) {
|
||||
if (rcArea.Intersects(rcRightMargin)) {
|
||||
surfaceWindow->FillRectangle(rcRightMargin, vs.styles[STYLE_DEFAULT].back.allocated);
|
||||
}
|
||||
}
|
||||
|
||||
if (paintState == paintAbandoned) {
|
||||
// Either styling or NotifyUpdateUI noticed that painting is needed
|
||||
@ -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;
|
||||
|
@ -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,6 +217,7 @@ protected: // ScintillaBase subclass needs access to much of Editor
|
||||
enum { notPainting, painting, paintAbandoned } paintState;
|
||||
PRectangle rcPaint;
|
||||
bool paintingAllText;
|
||||
StyleNeeded styleNeeded;
|
||||
|
||||
int modEventMask;
|
||||
|
||||
@ -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);
|
||||
|
@ -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) {
|
||||
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();
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
|
||||
@ -38,11 +38,11 @@ protected:
|
||||
char name[100];
|
||||
public:
|
||||
ExternalLexerModule(int language_, LexerFunction fnLexer_,
|
||||
const char *languageName_=0, LexerFunction fnFolder_=0) : LexerModule(language_, fnLexer_, 0, fnFolder_){
|
||||
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,7 +64,7 @@ class LexerLibrary {
|
||||
LexerMinder *last;
|
||||
|
||||
public:
|
||||
LexerLibrary(const char* ModuleName);
|
||||
LexerLibrary(const char *ModuleName);
|
||||
~LexerLibrary();
|
||||
void Release();
|
||||
|
||||
@ -80,14 +80,14 @@ public:
|
||||
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;
|
||||
};
|
||||
|
@ -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,24 +288,15 @@ 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
|
||||
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 == '\\' && 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 (HereDoc.DelimiterLength >= HERE_DELIM_MAX - 1) { // force blowup
|
||||
sc.SetState(SCE_SH_ERROR);
|
||||
HereDoc.State = 0;
|
||||
|
@ -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) {
|
||||
|
@ -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;
|
||||
|
@ -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[] = {
|
||||
|
@ -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.
|
||||
@ -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 == '%')
|
||||
@ -1098,7 +1098,7 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
|
||||
if (foldHTMLPreprocessor) {
|
||||
levelCurrent--;
|
||||
}
|
||||
scriptLanguage = eScriptNone;
|
||||
scriptLanguage = beforeLanguage;
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -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--;
|
||||
|
@ -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
|
||||
|
@ -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,7 +264,7 @@ 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');
|
||||
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
};
|
||||
|
||||
|
@ -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));
|
||||
|
@ -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) {
|
||||
|
@ -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)))
|
||||
|
@ -31,7 +31,7 @@ class SVector {
|
||||
newSize += allocSize;
|
||||
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++) {
|
||||
@ -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();
|
||||
}
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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--;
|
||||
|
@ -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];
|
||||
@ -238,7 +238,7 @@ public:
|
||||
DeleteRange(0, lengthBody);
|
||||
}
|
||||
|
||||
T* BufferPointer() {
|
||||
T *BufferPointer() {
|
||||
RoomFor(1);
|
||||
GapTo(lengthBody);
|
||||
body[lengthBody] = 0;
|
||||
|
@ -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
|
||||
|
@ -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.
|
||||
|
@ -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.
|
||||
|
@ -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);
|
||||
|
@ -174,7 +174,7 @@ int WindowAccessor::IndentAmount(int line, int *flags, PFNIsCommentLeader pfnIsC
|
||||
*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;
|
||||
|
@ -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++) {
|
||||
|
@ -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];
|
||||
|
@ -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;
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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);
|
||||
|
@ -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. */
|
||||
|
Loading…
x
Reference in New Issue
Block a user