diff options
author | John Ehresman <unknown> | 2017-01-22 19:45:45 +1100 |
---|---|---|
committer | John Ehresman <unknown> | 2017-01-22 19:45:45 +1100 |
commit | ed3a51fa704071682545f084e3ab52d86200519c (patch) | |
tree | cafa810b6a7ecf33298064d94b177903bc2aeea5 | |
parent | 013bf48bff4164a02137b2e790bbed8b32c4e98e (diff) | |
download | scintilla-mirror-ed3a51fa704071682545f084e3ab52d86200519c.tar.gz |
Display block caret over the character at the end of a selection to be similar
to other editors.
-rw-r--r-- | doc/ScintillaHistory.html | 4 | ||||
-rw-r--r-- | src/EditView.cxx | 8 |
2 files changed, 11 insertions, 1 deletions
diff --git a/doc/ScintillaHistory.html b/doc/ScintillaHistory.html index 0972070d6..fd62d8376 100644 --- a/doc/ScintillaHistory.html +++ b/doc/ScintillaHistory.html @@ -525,6 +525,10 @@ Released 30 December 2016. </li> <li> + Display block caret over the character at the end of a selection to be similar + to other editors. + </li> + <li> The Diff lexer recognizes deleted lines that start with "--- ". </li> <li> diff --git a/src/EditView.cxx b/src/EditView.cxx index a35a46b54..48991e480 100644 --- a/src/EditView.cxx +++ b/src/EditView.cxx @@ -1288,7 +1288,13 @@ void EditView::DrawCarets(Surface *surface, const EditModel &model, const ViewSt // For each selection draw for (size_t r = 0; (r<model.sel.Count()) || drawDrag; r++) { const bool mainCaret = r == model.sel.Main(); - const SelectionPosition posCaret = (drawDrag ? model.posDrag : model.sel.Range(r).caret); + SelectionPosition posCaret = (drawDrag ? model.posDrag : model.sel.Range(r).caret); + if (vsDraw.caretStyle == CARETSTYLE_BLOCK && !drawDrag && posCaret > model.sel.Range(r).anchor) { + if (posCaret.VirtualSpace() > 0) + posCaret.SetVirtualSpace(posCaret.VirtualSpace() - 1); + else + posCaret.SetPosition(model.pdoc->MovePositionOutsideChar(posCaret.Position()-1, -1)); + } const int offset = posCaret.Position() - posLineStart; const XYPOSITION spaceWidth = vsDraw.styles[ll->EndLineStyle()].spaceWidth; const XYPOSITION virtualOffset = posCaret.VirtualSpace() * spaceWidth; |