aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--doc/ScintillaHistory.html4
-rw-r--r--src/EditView.cxx4
-rw-r--r--src/ViewStyle.cxx6
-rw-r--r--src/ViewStyle.h1
4 files changed, 14 insertions, 1 deletions
diff --git a/doc/ScintillaHistory.html b/doc/ScintillaHistory.html
index 203911a90..dc7bae1fa 100644
--- a/doc/ScintillaHistory.html
+++ b/doc/ScintillaHistory.html
@@ -591,6 +591,10 @@
<a href="https://sourceforge.net/p/scintilla/bugs/2110/">Bug #2110</a>.
</li>
<li>
+ Fix position of line caret when overstrike caret set to block.
+ <a href="https://sourceforge.net/p/scintilla/bugs/2106/">Bug #2106</a>.
+ </li>
+ <li>
On GTK, reset IME when mouse is clicked.
<a href="https://sourceforge.net/p/scintilla/bugs/2111/">Bug #2111</a>.
</li>
diff --git a/src/EditView.cxx b/src/EditView.cxx
index f3185ecc8..887e7754e 100644
--- a/src/EditView.cxx
+++ b/src/EditView.cxx
@@ -1424,7 +1424,9 @@ void EditView::DrawCarets(Surface *surface, const EditModel &model, const ViewSt
for (size_t r = 0; (r<model.sel.Count()) || drawDrag; r++) {
const bool mainCaret = r == model.sel.Main();
SelectionPosition posCaret = (drawDrag ? model.posDrag : model.sel.Range(r).caret);
- if ((vsDraw.IsBlockCaretStyle() || imeCaretBlockOverride) && !drawDrag && posCaret > 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 6b24e15fb..65c4f2f8e 100644
--- a/src/ViewStyle.cxx
+++ b/src/ViewStyle.cxx
@@ -549,6 +549,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: