diff options
-rw-r--r-- | src/EditView.cxx | 2 | ||||
-rw-r--r-- | src/ViewStyle.cxx | 4 | ||||
-rw-r--r-- | src/ViewStyle.h | 1 |
3 files changed, 6 insertions, 1 deletions
diff --git a/src/EditView.cxx b/src/EditView.cxx index 887e7754e..9d8b6117b 100644 --- a/src/EditView.cxx +++ b/src/EditView.cxx @@ -1456,7 +1456,7 @@ void EditView::DrawCarets(Surface *surface, const EditModel &model, const ViewSt } const bool caretBlinkState = (model.caret.active && model.caret.on) || (!additionalCaretsBlink && !mainCaret); const bool caretVisibleState = additionalCaretsVisible || mainCaret; - if ((xposCaret >= 0) && (vsDraw.caretWidth > 0) && (vsDraw.caretStyle != CARETSTYLE_INVISIBLE) && + if ((xposCaret >= 0) && vsDraw.IsCaretVisible() && (drawDrag || (caretBlinkState && caretVisibleState))) { bool caretAtEOF = false; bool caretAtEOL = false; diff --git a/src/ViewStyle.cxx b/src/ViewStyle.cxx index e75184488..30a77f872 100644 --- a/src/ViewStyle.cxx +++ b/src/ViewStyle.cxx @@ -550,6 +550,10 @@ bool ViewStyle::IsBlockCaretStyle() const noexcept { (caretStyle & CARETSTYLE_OVERSTRIKE_BLOCK) != 0; } +bool ViewStyle::IsCaretVisible() const noexcept { + return caretWidth > 0 && caretStyle != CARETSTYLE_INVISIBLE; +} + bool ViewStyle::DrawCaretInsideSelection(bool inOverstrike, bool imeCaretBlockOverride) const noexcept { if (caretStyle & CARETSTYLE_BLOCK_AFTER) return false; diff --git a/src/ViewStyle.h b/src/ViewStyle.h index 0235b3651..7f6853f13 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 IsCaretVisible() const noexcept; bool DrawCaretInsideSelection(bool inOverstrike, bool imeCaretBlockOverride) const noexcept; CaretShape CaretShapeForMode(bool inOverstrike) const noexcept; |