From 8b8e1f383f0dbabc5e2f4666f4c5aa8860a91848 Mon Sep 17 00:00:00 2001 From: Neil Date: Fri, 21 Jun 2019 07:16:45 +1000 Subject: Backport: Bug [#2106]. Place line caret in correct location for line caret with block OVR. That is for CARETSTYLE_LINE | CARETSTYLE_BLOCK mode. Backport of changeset 7608:b725657be4ae. --- doc/ScintillaHistory.html | 4 ++++ src/EditView.cxx | 4 +++- src/ViewStyle.cxx | 6 ++++++ src/ViewStyle.h | 1 + 4 files changed, 14 insertions(+), 1 deletion(-) diff --git a/doc/ScintillaHistory.html b/doc/ScintillaHistory.html index fae258457..9a67db1d8 100644 --- a/doc/ScintillaHistory.html +++ b/doc/ScintillaHistory.html @@ -580,6 +580,10 @@ Bug #2110.
  • + Fix position of line caret when overstrike caret set to block. + Bug #2106. +
  • +
  • On GTK, reset IME when mouse is clicked. Bug #2111.
  • diff --git a/src/EditView.cxx b/src/EditView.cxx index fdcd9f287..6850d0964 100644 --- a/src/EditView.cxx +++ b/src/EditView.cxx @@ -1334,7 +1334,9 @@ void EditView::DrawCarets(Surface *surface, const EditModel &model, const ViewSt for (size_t r = 0; (r model.sel.Range(r).anchor) { + if ((vsDraw.DrawCaretInsideSelection(model.inOverstrike, imeCaretBlockOverride)) && + !drawDrag && + posCaret > model.sel.Range(r).anchor) { if (posCaret.VirtualSpace() > 0) posCaret.SetVirtualSpace(posCaret.VirtualSpace() - 1); else diff --git a/src/ViewStyle.cxx b/src/ViewStyle.cxx index ddebf862b..c867c2f76 100644 --- a/src/ViewStyle.cxx +++ b/src/ViewStyle.cxx @@ -548,6 +548,12 @@ bool ViewStyle::IsBlockCaretStyle() const noexcept { return (caretStyle == CARETSTYLE_BLOCK) || (caretStyle & CARETSTYLE_OVERSTRIKE_BLOCK) != 0; } +bool ViewStyle::DrawCaretInsideSelection(bool inOverstrike, bool imeCaretBlockOverride) const noexcept { + return ((caretStyle & CARETSTYLE_INS_MASK) == CARETSTYLE_BLOCK) || + (inOverstrike && (caretStyle & CARETSTYLE_OVERSTRIKE_BLOCK) != 0) || + imeCaretBlockOverride; +} + ViewStyle::CaretShape ViewStyle::CaretShapeForMode(bool inOverstrike) const noexcept { if (inOverstrike) { return (caretStyle & CARETSTYLE_OVERSTRIKE_BLOCK) ? CaretShape::block : CaretShape::bar; diff --git a/src/ViewStyle.h b/src/ViewStyle.h index 587eb976a..0235b3651 100644 --- a/src/ViewStyle.h +++ b/src/ViewStyle.h @@ -201,6 +201,7 @@ public: enum class CaretShape { invisible, line, block, bar }; bool IsBlockCaretStyle() const noexcept; + bool DrawCaretInsideSelection(bool inOverstrike, bool imeCaretBlockOverride) const noexcept; CaretShape CaretShapeForMode(bool inOverstrike) const noexcept; private: -- cgit v1.2.3