aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/Editor.cxx
diff options
context:
space:
mode:
authorNeil <nyamatongwe@gmail.com>2014-05-24 09:29:24 +1000
committerNeil <nyamatongwe@gmail.com>2014-05-24 09:29:24 +1000
commitaff335283c4ea47a38375ef6950ee2c285ddee70 (patch)
tree75a325ff0bef9f0bf7c121774fd8067fb869ac6b /src/Editor.cxx
parent524a5429eaae34e45769c39e44f1c7c10b1c5eff (diff)
downloadscintilla-mirror-aff335283c4ea47a38375ef6950ee2c285ddee70.tar.gz
Removing style byte indicators.
Diffstat (limited to 'src/Editor.cxx')
-rw-r--r--src/Editor.cxx78
1 files changed, 17 insertions, 61 deletions
diff --git a/src/Editor.cxx b/src/Editor.cxx
index 4966d8efd..7fbe39c38 100644
--- a/src/Editor.cxx
+++ b/src/Editor.cxx
@@ -885,9 +885,8 @@ bool Editor::RangeContainsProtected(int start, int end) const {
start = end;
end = t;
}
- int mask = pdoc->stylingBitsMask;
for (int pos = start; pos < end; pos++) {
- if (vs.styles[pdoc->StyleAt(pos) & mask].IsProtected())
+ if (vs.styles[pdoc->StyleAt(pos)].IsProtected())
return true;
}
}
@@ -916,17 +915,16 @@ SelectionPosition Editor::MovePositionOutsideChar(SelectionPosition pos, int mov
if (posMoved != pos.Position())
pos.SetPosition(posMoved);
if (vs.ProtectionActive()) {
- int mask = pdoc->stylingBitsMask;
if (moveDir > 0) {
- if ((pos.Position() > 0) && vs.styles[pdoc->StyleAt(pos.Position() - 1) & mask].IsProtected()) {
+ if ((pos.Position() > 0) && vs.styles[pdoc->StyleAt(pos.Position() - 1)].IsProtected()) {
while ((pos.Position() < pdoc->Length()) &&
- (vs.styles[pdoc->StyleAt(pos.Position()) & mask].IsProtected()))
+ (vs.styles[pdoc->StyleAt(pos.Position())].IsProtected()))
pos.Add(1);
}
} else if (moveDir < 0) {
- if (vs.styles[pdoc->StyleAt(pos.Position()) & mask].IsProtected()) {
+ if (vs.styles[pdoc->StyleAt(pos.Position())].IsProtected()) {
while ((pos.Position() > 0) &&
- (vs.styles[pdoc->StyleAt(pos.Position() - 1) & mask].IsProtected()))
+ (vs.styles[pdoc->StyleAt(pos.Position() - 1)].IsProtected()))
pos.Add(-1);
}
}
@@ -2178,7 +2176,6 @@ void Editor::LayoutLine(int line, Surface *surface, ViewStyle &vstyle, LineLayou
if (lineLength == ll->numCharsInLine) {
// See if chars, styles, indicators, are all the same
bool allSame = true;
- const int styleMask = pdoc->stylingBitsMask;
// Check base line layout
char styleByte = 0;
int numCharsInLine = 0;
@@ -2187,9 +2184,7 @@ void Editor::LayoutLine(int line, Surface *surface, ViewStyle &vstyle, LineLayou
char chDoc = pdoc->CharAt(charInDoc);
styleByte = pdoc->StyleAt(charInDoc);
allSame = allSame &&
- (ll->styles[numCharsInLine] == static_cast<unsigned char>(styleByte & styleMask));
- allSame = allSame &&
- (ll->indicators[numCharsInLine] == static_cast<char>(styleByte & ~styleMask));
+ (ll->styles[numCharsInLine] == static_cast<unsigned char>(styleByte));
if (vstyle.styles[ll->styles[numCharsInLine]].caseForce == Style::caseMixed)
allSame = allSame &&
(ll->chars[numCharsInLine] == chDoc);
@@ -2223,8 +2218,6 @@ void Editor::LayoutLine(int line, Surface *surface, ViewStyle &vstyle, LineLayou
ll->edgeColumn = -1;
}
- const int styleMask = pdoc->stylingBitsMask;
- ll->styleBitsSet = 0;
// Fill base line layout
const int lineLength = posLineEnd - posLineStart;
pdoc->GetCharRange(ll->chars, posLineStart, lineLength);
@@ -2233,11 +2226,9 @@ void Editor::LayoutLine(int line, Surface *surface, ViewStyle &vstyle, LineLayou
const int numCharsInLine = (vstyle.viewEOL) ? lineLength : numCharsBeforeEOL;
for (int styleInLine = 0; styleInLine < numCharsInLine; styleInLine++) {
const unsigned char styleByte = ll->styles[styleInLine];
- ll->styleBitsSet |= styleByte;
- ll->styles[styleInLine] = styleByte & styleMask;
- ll->indicators[styleInLine] = static_cast<char>(styleByte & ~styleMask);
+ ll->styles[styleInLine] = styleByte;
}
- const unsigned char styleByteLast = ((lineLength > 0) ? ll->styles[lineLength-1] : 0) & styleMask;
+ const unsigned char styleByteLast = (lineLength > 0) ? ll->styles[lineLength-1] : 0;
if (vstyle.someStylesForceCase) {
for (int charInLine = 0; charInLine<lineLength; charInLine++) {
char chDoc = ll->chars[charInLine];
@@ -2251,7 +2242,6 @@ void Editor::LayoutLine(int line, Surface *surface, ViewStyle &vstyle, LineLayou
// Extra element at the end of the line to hold end x position and act as
ll->chars[numCharsInLine] = 0; // Also triggers processing in the loops as this is a control character
ll->styles[numCharsInLine] = styleByteLast; // For eolFilled
- ll->indicators[numCharsInLine] = 0;
// Layout the line, determining the position of each character,
// with an extra element at the end for the end of the line.
@@ -2508,7 +2498,6 @@ void Editor::DrawEOL(Surface *surface, ViewStyle &vsDraw, PRectangle rcLine, Lin
bool drawWrapMarkEnd, ColourDesired wrapColour) {
const int posLineStart = pdoc->LineStart(line);
- const int styleMask = pdoc->stylingBitsMask;
PRectangle rcSegment = rcLine;
const bool lastSubLine = subLine == (ll->lines - 1);
@@ -2523,7 +2512,7 @@ void Editor::DrawEOL(Surface *surface, ViewStyle &vsDraw, PRectangle rcLine, Lin
if (virtualSpace) {
rcSegment.left = xEol + xStart;
rcSegment.right = xEol + xStart + virtualSpace;
- surface->FillRectangle(rcSegment, overrideBackground ? background : vsDraw.styles[ll->styles[ll->numCharsInLine] & styleMask].back);
+ surface->FillRectangle(rcSegment, overrideBackground ? background : vsDraw.styles[ll->styles[ll->numCharsInLine]].back);
if (!hideSelection && ((vsDraw.selAlpha == SC_ALPHA_NOALPHA) || (vsDraw.selAdditionalAlpha == SC_ALPHA_NOALPHA))) {
SelectionSegment virtualSpaceRange(SelectionPosition(pdoc->LineEnd(line)), SelectionPosition(pdoc->LineEnd(line), sel.VirtualSpaceFor(pdoc->LineEnd(line))));
for (size_t r=0; r<sel.Count(); r++) {
@@ -2607,9 +2596,9 @@ void Editor::DrawEOL(Surface *surface, ViewStyle &vsDraw, PRectangle rcLine, Lin
if (overrideBackground) {
surface->FillRectangle(rcSegment, background);
} else if (line < pdoc->LinesTotal() - 1) {
- surface->FillRectangle(rcSegment, vsDraw.styles[ll->styles[ll->numCharsInLine] & styleMask].back);
- } else if (vsDraw.styles[ll->styles[ll->numCharsInLine] & styleMask].eolFilled) {
- surface->FillRectangle(rcSegment, vsDraw.styles[ll->styles[ll->numCharsInLine] & styleMask].back);
+ surface->FillRectangle(rcSegment, vsDraw.styles[ll->styles[ll->numCharsInLine]].back);
+ } else if (vsDraw.styles[ll->styles[ll->numCharsInLine]].eolFilled) {
+ surface->FillRectangle(rcSegment, vsDraw.styles[ll->styles[ll->numCharsInLine]].back);
} else {
surface->FillRectangle(rcSegment, vsDraw.styles[STYLE_DEFAULT].back);
}
@@ -2629,8 +2618,8 @@ void Editor::DrawEOL(Surface *surface, ViewStyle &vsDraw, PRectangle rcLine, Lin
} else {
if (overrideBackground) {
surface->FillRectangle(rcSegment, background);
- } else if (vsDraw.styles[ll->styles[ll->numCharsInLine] & styleMask].eolFilled) {
- surface->FillRectangle(rcSegment, vsDraw.styles[ll->styles[ll->numCharsInLine] & styleMask].back);
+ } else if (vsDraw.styles[ll->styles[ll->numCharsInLine]].eolFilled) {
+ surface->FillRectangle(rcSegment, vsDraw.styles[ll->styles[ll->numCharsInLine]].back);
} else {
surface->FillRectangle(rcSegment, vsDraw.styles[STYLE_DEFAULT].back);
}
@@ -2672,38 +2661,6 @@ void Editor::DrawIndicators(Surface *surface, ViewStyle &vsDraw, int line, int x
const int lineStart = ll->LineStart(subLine);
const int posLineEnd = posLineStart + lineEnd;
- if (!under) {
- // Draw indicators
- // foreach indicator...
- for (int indicnum = 0, mask = 1 << pdoc->stylingBits; mask < 0x100; indicnum++) {
- if (!(mask & ll->styleBitsSet)) {
- mask <<= 1;
- continue;
- }
- int startPos = -1;
- // foreach style pos in line...
- for (int indicPos = lineStart; indicPos <= lineEnd; indicPos++) {
- // look for starts...
- if (startPos < 0) {
- // NOT in indicator run, looking for START
- if (indicPos < lineEnd && (ll->indicators[indicPos] & mask))
- startPos = indicPos;
- }
- // ... or ends
- if (startPos >= 0) {
- // IN indicator run, looking for END
- if (indicPos >= lineEnd || !(ll->indicators[indicPos] & mask)) {
- // AT end of indicator run, DRAW it!
- DrawIndicator(indicnum, startPos, indicPos, surface, vsDraw, xStart, rcLine, ll, subLine);
- // RESET control var
- startPos = -1;
- }
- }
- }
- mask <<= 1;
- }
- }
-
for (Decoration *deco = pdoc->decorations.root; deco; deco = deco->next) {
if (under == vsDraw.indicators[deco->indicator].under) {
int startPos = posLineStart + lineStart;
@@ -6536,7 +6493,7 @@ void Editor::ButtonDown(Point pt, unsigned int curTime, bool shift, bool ctrl, b
}
bool Editor::PositionIsHotspot(int position) const {
- return vs.styles[pdoc->StyleAt(position) & pdoc->stylingBitsMask].hotspot;
+ return vs.styles[pdoc->StyleAt(position)].hotspot;
}
bool Editor::PointIsHotspot(Point pt) {
@@ -8647,12 +8604,11 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) {
InvalidateStyleRedraw();
break;
case SCI_SETSTYLEBITS:
- vs.EnsureStyle((1 << wParam) - 1);
- pdoc->SetStylingBits(static_cast<int>(wParam));
+ vs.EnsureStyle(0xff);
break;
case SCI_GETSTYLEBITS:
- return pdoc->stylingBits;
+ return 8;
case SCI_SETLINESTATE:
return pdoc->SetLineState(static_cast<int>(wParam), static_cast<int>(lParam));