summaryrefslogtreecommitdiffstats
path: root/scintilla/src/Editor.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'scintilla/src/Editor.cxx')
-rw-r--r--scintilla/src/Editor.cxx83
1 files changed, 45 insertions, 38 deletions
diff --git a/scintilla/src/Editor.cxx b/scintilla/src/Editor.cxx
index 5479ac5..03f17c0 100644
--- a/scintilla/src/Editor.cxx
+++ b/scintilla/src/Editor.cxx
@@ -478,44 +478,48 @@ void Editor::Redraw() {
}
void Editor::RedrawSelMargin(int line, bool allAfter) {
- bool abandonDraw = false;
- if (!wMargin.GetID()) // Margin in main window so may need to abandon and retry
- abandonDraw = AbandonPaint();
- if (!abandonDraw) {
- if (vs.maskInLine) {
- Redraw();
- } else {
- PRectangle rcSelMargin = GetClientRectangle();
- rcSelMargin.right = rcSelMargin.left + vs.fixedColumnWidth;
- if (line != -1) {
- PRectangle rcLine = RectangleFromRange(Range(pdoc->LineStart(line)), 0);
-
- // Inflate line rectangle if there are image markers with height larger than line height
- if (vs.largestMarkerHeight > vs.lineHeight) {
- int delta = (vs.largestMarkerHeight - vs.lineHeight + 1) / 2;
- rcLine.top -= delta;
- rcLine.bottom += delta;
- if (rcLine.top < rcSelMargin.top)
- rcLine.top = rcSelMargin.top;
- if (rcLine.bottom > rcSelMargin.bottom)
- rcLine.bottom = rcSelMargin.bottom;
- }
-
- rcSelMargin.top = rcLine.top;
- if (!allAfter)
- rcSelMargin.bottom = rcLine.bottom;
- if (rcSelMargin.Empty())
- return;
- }
- if (wMargin.GetID()) {
- Point ptOrigin = GetVisibleOriginInMain();
- rcSelMargin.Move(-ptOrigin.x, -ptOrigin.y);
- wMargin.InvalidateRectangle(rcSelMargin);
- } else {
- wMain.InvalidateRectangle(rcSelMargin);
- }
+ const bool markersInText = vs.maskInLine || vs.maskDrawInText;
+ if (!wMargin.GetID() || markersInText) { // May affect text area so may need to abandon and retry
+ if (AbandonPaint()) {
+ return;
}
}
+ if (wMargin.GetID() && markersInText) {
+ Redraw();
+ return;
+ }
+ PRectangle rcMarkers = GetClientRectangle();
+ if (!markersInText) {
+ // Normal case: just draw the margin
+ rcMarkers.right = rcMarkers.left + vs.fixedColumnWidth;
+ }
+ if (line != -1) {
+ PRectangle rcLine = RectangleFromRange(Range(pdoc->LineStart(line)), 0);
+
+ // Inflate line rectangle if there are image markers with height larger than line height
+ if (vs.largestMarkerHeight > vs.lineHeight) {
+ int delta = (vs.largestMarkerHeight - vs.lineHeight + 1) / 2;
+ rcLine.top -= delta;
+ rcLine.bottom += delta;
+ if (rcLine.top < rcMarkers.top)
+ rcLine.top = rcMarkers.top;
+ if (rcLine.bottom > rcMarkers.bottom)
+ rcLine.bottom = rcMarkers.bottom;
+ }
+
+ rcMarkers.top = rcLine.top;
+ if (!allAfter)
+ rcMarkers.bottom = rcLine.bottom;
+ if (rcMarkers.Empty())
+ return;
+ }
+ if (wMargin.GetID()) {
+ Point ptOrigin = GetVisibleOriginInMain();
+ rcMarkers.Move(-ptOrigin.x, -ptOrigin.y);
+ wMargin.InvalidateRectangle(rcMarkers);
+ } else {
+ wMain.InvalidateRectangle(rcMarkers);
+ }
}
PRectangle Editor::RectangleFromRange(Range r, int overlap) {
@@ -6279,7 +6283,10 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) {
break;
case SCI_SETSTYLING:
- pdoc->SetStyleFor(static_cast<int>(wParam), static_cast<char>(lParam));
+ if (static_cast<int>(wParam) < 0)
+ errorStatus = SC_STATUS_FAILURE;
+ else
+ pdoc->SetStyleFor(static_cast<int>(wParam), static_cast<char>(lParam));
break;
case SCI_SETSTYLINGEX: // Specify a complete styling buffer
@@ -7930,7 +7937,7 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) {
case SCI_SWAPMAINANCHORCARET:
InvalidateSelection(sel.RangeMain());
- sel.RangeMain() = SelectionRange(sel.RangeMain().anchor, sel.RangeMain().caret);
+ sel.RangeMain().Swap();
break;
case SCI_MULTIPLESELECTADDNEXT: