aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/Editor.cxx
diff options
context:
space:
mode:
authorNeil <nyamatongwe@gmail.com>2015-12-07 11:08:40 +1100
committerNeil <nyamatongwe@gmail.com>2015-12-07 11:08:40 +1100
commit18f8f63fb079b084323def219126836f23f5c2b4 (patch)
tree36a54cbfbc6a72621399e2cbc6923e1f11cc545a /src/Editor.cxx
parent7b5476dae723cc94adeae1460c068aa686f4583b (diff)
downloadscintilla-mirror-18f8f63fb079b084323def219126836f23f5c2b4.tar.gz
Prefer StyleIndexAt over StyleAt to avoid problems with out-of-bounds access for
styles > 0x7f.
Diffstat (limited to 'src/Editor.cxx')
-rw-r--r--src/Editor.cxx8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/Editor.cxx b/src/Editor.cxx
index 170f6a931..9c2703ab0 100644
--- a/src/Editor.cxx
+++ b/src/Editor.cxx
@@ -764,7 +764,7 @@ bool Editor::RangeContainsProtected(int start, int end) const {
end = t;
}
for (int pos = start; pos < end; pos++) {
- if (vs.styles[pdoc->StyleAt(pos)].IsProtected())
+ if (vs.styles[pdoc->StyleIndexAt(pos)].IsProtected())
return true;
}
}
@@ -4560,7 +4560,7 @@ void Editor::ButtonDown(Point pt, unsigned int curTime, bool shift, bool ctrl, b
}
bool Editor::PositionIsHotspot(int position) const {
- return vs.styles[static_cast<unsigned char>(pdoc->StyleAt(position))].hotspot;
+ return vs.styles[pdoc->StyleIndexAt(position)].hotspot;
}
bool Editor::PointIsHotspot(Point pt) {
@@ -4994,9 +4994,9 @@ void Editor::StyleToPositionInView(Position pos) {
int endWindow = PositionAfterArea(GetClientDrawingRectangle());
if (pos > endWindow)
pos = endWindow;
- int styleAtEnd = pdoc->StyleAt(pos-1);
+ const int styleAtEnd = pdoc->StyleIndexAt(pos-1);
pdoc->EnsureStyledTo(pos);
- if ((endWindow > pos) && (styleAtEnd != pdoc->StyleAt(pos-1))) {
+ if ((endWindow > pos) && (styleAtEnd != pdoc->StyleIndexAt(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.
DiscardOverdraw(); // Prepared bitmaps may be invalid