aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorNeil <nyamatongwe@gmail.com>2015-12-04 10:23:09 +1100
committerNeil <nyamatongwe@gmail.com>2015-12-04 10:23:09 +1100
commit0eb69bbc10850c00e0ed006705c55ab9f6d33ce5 (patch)
treee9c9ed01c09bfac6bdf601ed153d4c74361ee7e2
parent960d4fb6b6582363867e73f1a0428b6eacf0d758 (diff)
downloadscintilla-mirror-0eb69bbc10850c00e0ed006705c55ab9f6d33ce5.tar.gz
Bug [#1784]. Highlight whole run for hover indicator when wrapped.
Less efficient now as redraws all text when hover position changes.
-rw-r--r--src/EditView.cxx7
-rw-r--r--src/Editor.cxx5
2 files changed, 4 insertions, 8 deletions
diff --git a/src/EditView.cxx b/src/EditView.cxx
index 692740b7c..db6b34fe0 100644
--- a/src/EditView.cxx
+++ b/src/EditView.cxx
@@ -986,11 +986,10 @@ static void DrawIndicators(Surface *surface, const EditModel &model, const ViewS
startPos = deco->rs.EndRun(startPos);
}
while ((startPos < posLineEnd) && (deco->rs.ValueAt(startPos))) {
- int endPos = deco->rs.EndRun(startPos);
- if (endPos > posLineEnd)
- endPos = posLineEnd;
+ const Range rangeRun(deco->rs.StartRun(startPos), deco->rs.EndRun(startPos));
+ const int endPos = std::min(rangeRun.end, posLineEnd);
const bool hover = vsDraw.indicators[deco->indicator].IsDynamic() &&
- ((hoverIndicatorPos >= startPos) && (hoverIndicatorPos <= endPos));
+ rangeRun.ContainsCharacter(hoverIndicatorPos);
const int value = deco->rs.ValueAt(startPos);
Indicator::DrawState drawState = hover ? Indicator::drawHover : Indicator::drawNormal;
DrawIndicator(deco->indicator, startPos - posLineStart, endPos - posLineStart,
diff --git a/src/Editor.cxx b/src/Editor.cxx
index 742fb41d4..5014b2abb 100644
--- a/src/Editor.cxx
+++ b/src/Editor.cxx
@@ -4585,10 +4585,7 @@ void Editor::SetHoverIndicatorPosition(int position) {
}
}
if (hoverIndicatorPosPrev != hoverIndicatorPos) {
- if (hoverIndicatorPosPrev != INVALID_POSITION)
- InvalidateRange(hoverIndicatorPosPrev, hoverIndicatorPosPrev + 1);
- if (hoverIndicatorPos != INVALID_POSITION)
- InvalidateRange(hoverIndicatorPos, hoverIndicatorPos + 1);
+ Redraw();
}
}