Skip to content

Commit

Permalink
Fix block caret without CARETSTYLE_BLOCK_AFTER is not shown when sele…
Browse files Browse the repository at this point in the history
…cting lines from margin.

See https://sourceforge.net/p/scintilla/bugs/2145/
  • Loading branch information
zufuliu committed Dec 6, 2019
1 parent f8a80ae commit 3302aba
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions scintilla/src/EditView.cxx
Expand Up @@ -1584,11 +1584,16 @@ void EditView::DrawCarets(Surface *surface, const EditModel &model, const ViewSt
SelectionPosition posCaret = (drawDrag ? model.posDrag : model.sel.Range(r).caret);
if (vsDraw.DrawCaretInsideSelection(model.inOverstrike, imeCaretBlockOverride) &&
!drawDrag && posCaret > model.sel.Range(r).anchor) {
if (posCaret.VirtualSpace() > 0)
if (posCaret.VirtualSpace() > 0) {
posCaret.SetVirtualSpace(posCaret.VirtualSpace() - 1);
else
posCaret.SetPosition(model.pdoc->MovePositionOutsideChar(posCaret.Position() - 1, -1));
} else {
const Sci::Position posBefore = model.pdoc->MovePositionOutsideChar(posCaret.Position() - 1, -1);
if (posBefore >= posLineStart) {
posCaret.SetPosition(posBefore);
}
}
}

const int offset = static_cast<int>(posCaret.Position() - posLineStart);
const XYPOSITION spaceWidth = vsDraw.styles[ll->EndLineStyle()].spaceWidth;
const XYPOSITION virtualOffset = posCaret.VirtualSpace() * spaceWidth;
Expand Down

0 comments on commit 3302aba

Please sign in to comment.