From 9cc096e3f7deb6f10512e30da3e589eed927fdd5 Mon Sep 17 00:00:00 2001 From: Zufu Liu Date: Sat, 2 Feb 2019 10:26:58 +1100 Subject: Backport: Feature [feature-requests:#1217]. Implement CARETSTYLE_BLOCK_ALWAYS. Backport of changeset 7248:aba09a1c7c63. --- src/EditView.cxx | 6 +++--- src/EditView.h | 2 +- src/Editor.cxx | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/EditView.cxx b/src/EditView.cxx index 3143134d2..8eaaee32c 100644 --- a/src/EditView.cxx +++ b/src/EditView.cxx @@ -1331,7 +1331,7 @@ void EditView::DrawCarets(Surface *surface, const EditModel &model, const ViewSt for (size_t r = 0; (r model.sel.Range(r).anchor) { + if ((vsDraw.caretStyle == CARETSTYLE_BLOCK || vsDraw.caretStyle == CARETSTYLE_BLOCK_ALWAYS) && !drawDrag && posCaret > model.sel.Range(r).anchor) { if (posCaret.VirtualSpace() > 0) posCaret.SetVirtualSpace(posCaret.VirtualSpace() - 1); else @@ -1378,12 +1378,12 @@ void EditView::DrawCarets(Surface *surface, const EditModel &model, const ViewSt /* Dragging text, use a line caret */ rcCaret.left = round(xposCaret - caretWidthOffset); rcCaret.right = rcCaret.left + vsDraw.caretWidth; - } else if (model.inOverstrike && drawOverstrikeCaret) { + } else if ((model.inOverstrike && vsDraw.caretStyle != CARETSTYLE_BLOCK_ALWAYS) && drawOverstrikeCaret) { /* Overstrike (insert mode), use a modified bar caret */ rcCaret.top = rcCaret.bottom - 2; rcCaret.left = xposCaret + 1; rcCaret.right = rcCaret.left + widthOverstrikeCaret - 1; - } else if ((vsDraw.caretStyle == CARETSTYLE_BLOCK) || imeCaretBlockOverride) { + } else if ((vsDraw.caretStyle == CARETSTYLE_BLOCK || vsDraw.caretStyle == CARETSTYLE_BLOCK_ALWAYS) || imeCaretBlockOverride) { /* Block caret */ rcCaret.left = xposCaret; if (!caretAtEOL && !caretAtEOF && (ll->chars[offset] != '\t') && !(IsControlCharacter(ll->chars[offset]))) { diff --git a/src/EditView.h b/src/EditView.h index f649f7c87..300dc92a9 100644 --- a/src/EditView.h +++ b/src/EditView.h @@ -54,7 +54,7 @@ public: int tabWidthMinimumPixels; bool hideSelection; - bool drawOverstrikeCaret; + bool drawOverstrikeCaret; // used by the curses platform /** In bufferedDraw mode, graphics operations are drawn to a pixmap and then copied to * the screen. This avoids flashing but is about 30% slower. */ diff --git a/src/Editor.cxx b/src/Editor.cxx index 563b3a665..f48ba333b 100644 --- a/src/Editor.cxx +++ b/src/Editor.cxx @@ -1351,7 +1351,7 @@ Editor::XYScrollPosition Editor::XYScrollToMakeVisible(const SelectionRange &ran newXY.xOffset = static_cast(pt.x + xOffset - rcClient.left) - 2; } else if (pt.x + xOffset >= rcClient.right + newXY.xOffset) { newXY.xOffset = static_cast(pt.x + xOffset - rcClient.right) + 2; - if ((vs.caretStyle == CARETSTYLE_BLOCK) || view.imeCaretBlockOverride) { + if ((vs.caretStyle == CARETSTYLE_BLOCK || vs.caretStyle == CARETSTYLE_BLOCK_ALWAYS) || view.imeCaretBlockOverride) { // Ensure we can see a good portion of the block caret newXY.xOffset += static_cast(vs.aveCharWidth); } @@ -7277,7 +7277,7 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) { return vs.caretcolour.AsInteger(); case SCI_SETCARETSTYLE: - if (wParam <= CARETSTYLE_BLOCK) + if (wParam <= CARETSTYLE_BLOCK_ALWAYS) vs.caretStyle = static_cast(wParam); else /* Default to the line caret */ -- cgit v1.2.3