aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/EditView.cxx
diff options
context:
space:
mode:
authorZufu Liu <unknown>2021-08-24 11:14:20 +1000
committerZufu Liu <unknown>2021-08-24 11:14:20 +1000
commit02914e8e53c3e72e9fc3a05f8e75078cad4eb0f6 (patch)
treeb7894f557a313bad18445d13eca2b82039b8c9f9 /src/EditView.cxx
parent3ef8c4b037c622f910a0d13bba91657df1f78d9d (diff)
downloadscintilla-mirror-02914e8e53c3e72e9fc3a05f8e75078cad4eb0f6.tar.gz
Feature [feature-requests:#841] SCI_SETCARETLINEHIGHLIGHTSUBLINE enables
highlighting just the subline with the caret when wrapping is on.
Diffstat (limited to 'src/EditView.cxx')
-rw-r--r--src/EditView.cxx16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/EditView.cxx b/src/EditView.cxx
index e32e791ec..8a303faea 100644
--- a/src/EditView.cxx
+++ b/src/EditView.cxx
@@ -951,19 +951,19 @@ static void DrawCaretLineFramed(Surface *surface, const ViewStyle &vsDraw, const
// Avoid double drawing the corners by removing the left and right sides when drawing top and bottom borders
const PRectangle rcWithoutLeftRight = rcLine.Inset(Point(width, 0.0));
- if (subLine == 0 || ll->wrapIndent == 0 || vsDraw.caretLine.layer != Layer::Base) {
+ if (subLine == 0 || ll->wrapIndent == 0 || vsDraw.caretLine.layer != Layer::Base || vsDraw.caretLine.subLine) {
// Left
surface->FillRectangleAligned(Side(rcLine, Edge::left, width), colourFrame);
}
- if (subLine == 0) {
+ if (subLine == 0 || vsDraw.caretLine.subLine) {
// Top
surface->FillRectangleAligned(Side(rcWithoutLeftRight, Edge::top, width), colourFrame);
}
- if (subLine == ll->lines - 1 || vsDraw.caretLine.layer != Layer::Base) {
+ if (subLine == ll->lines - 1 || vsDraw.caretLine.layer != Layer::Base || vsDraw.caretLine.subLine) {
// Right
surface->FillRectangleAligned(Side(rcLine, Edge::right, width), colourFrame);
}
- if (subLine == ll->lines - 1) {
+ if (subLine == ll->lines - 1 || vsDraw.caretLine.subLine) {
// Bottom
surface->FillRectangleAligned(Side(rcWithoutLeftRight, Edge::bottom, width), colourFrame);
}
@@ -2340,10 +2340,9 @@ void EditView::PaintText(Surface *surfaceWindow, const EditModel &model, PRectan
const int screenLinePaintFirst = static_cast<int>(rcArea.top) / vsDraw.lineHeight;
const int xStart = vsDraw.textStart - model.xOffset + static_cast<int>(ptOrigin.x);
- SelectionPosition posCaret = model.sel.RangeMain().caret;
- if (model.posDrag.IsValid())
- posCaret = model.posDrag;
+ const SelectionPosition posCaret = model.posDrag.IsValid() ? model.posDrag : model.sel.RangeMain().caret;
const Sci::Line lineCaret = model.pdoc->SciLineFromPosition(posCaret.Position());
+ const int caretOffset = static_cast<int>(posCaret.Position() - model.pdoc->LineStart(lineCaret));
PRectangle rcTextArea = rcClient;
if (vsDraw.marginInside) {
@@ -2410,7 +2409,8 @@ void EditView::PaintText(Surface *surfaceWindow, const EditModel &model, PRectan
durLayout += ep.Duration(true);
#endif
if (ll) {
- ll->containsCaret = !hideSelection && (lineDoc == lineCaret);
+ ll->containsCaret = !hideSelection && (lineDoc == lineCaret)
+ && (ll->lines == 1 || !vsDraw.caretLine.subLine || ll->InLine(caretOffset, subLine));
ll->hotspot = model.GetHotSpotRange();
PRectangle rcLine = rcTextArea;