diff options
-rw-r--r-- | doc/ScintillaDoc.html | 8 | ||||
-rw-r--r-- | doc/ScintillaHistory.html | 4 | ||||
-rw-r--r-- | include/Scintilla.h | 1 | ||||
-rw-r--r-- | include/Scintilla.iface | 1 | ||||
-rw-r--r-- | src/EditView.cxx | 6 | ||||
-rw-r--r-- | src/EditView.h | 2 | ||||
-rw-r--r-- | src/Editor.cxx | 4 |
7 files changed, 17 insertions, 9 deletions
diff --git a/doc/ScintillaDoc.html b/doc/ScintillaDoc.html index d1ce91a31..1e274a138 100644 --- a/doc/ScintillaDoc.html +++ b/doc/ScintillaDoc.html @@ -3213,11 +3213,13 @@ struct Sci_TextToFind { <p><b id="SCI_SETCARETSTYLE">SCI_SETCARETSTYLE(int caretStyle)</b><br /> <b id="SCI_GETCARETSTYLE">SCI_GETCARETSTYLE → int</b><br /> The style of the caret can be set with <code>SCI_SETCARETSTYLE</code> to be a line caret - (CARETSTYLE_LINE=1), a block caret (CARETSTYLE_BLOCK=2) or to not draw at all - (CARETSTYLE_INVISIBLE=0). The default value is the line caret (CARETSTYLE_LINE=1). + (CARETSTYLE_LINE=1, insert mode), a block caret (CARETSTYLE_BLOCK=2, insert mode), + a block caret in both insert and overtype mode (CARETSTYLE_BLOCK_ALWAYS=3) or to not draw at all + (CARETSTYLE_INVISIBLE=0, insert mode). The default value for insert mode is the line caret (CARETSTYLE_LINE=1), + for overtype mode is the bar caret. You can determine the current caret style setting using <code>SCI_GETCARETSTYLE</code>.</p> - <p>The block character draws most combining and multibyte character sequences successfully, + <p>The block caret draws most combining and multibyte character sequences successfully, though some fonts like Thai Fonts (and possibly others) can sometimes appear strange when the cursor is positioned at these characters, which may result in only drawing a part of the cursor character sequence. This is most notable on Windows platforms.</p> diff --git a/doc/ScintillaHistory.html b/doc/ScintillaHistory.html index 579ce0f37..4ce3afd68 100644 --- a/doc/ScintillaHistory.html +++ b/doc/ScintillaHistory.html @@ -564,6 +564,10 @@ <a href="https://sourceforge.net/p/scintilla/bugs/1548/">Bug #1548</a>. </li> <li> + Block caret in both insert and overtype mode SCI_SETCARETSTYLE(CARETSTYLE_BLOCK_ALWAYS). + <a href="https://sourceforge.net/p/scintilla/feature-requests/1217/">Feature #1217</a>. + </li> + <li> The C++ lexer, with styling.within.preprocessor on, now interprets "(" in preprocessor "#if(" as an operator instead of part of the directive. This improves folding as well which could become unbalanced. diff --git a/include/Scintilla.h b/include/Scintilla.h index ea8654ce8..8128c55a1 100644 --- a/include/Scintilla.h +++ b/include/Scintilla.h @@ -827,6 +827,7 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam, #define CARETSTYLE_INVISIBLE 0 #define CARETSTYLE_LINE 1 #define CARETSTYLE_BLOCK 2 +#define CARETSTYLE_BLOCK_ALWAYS 3 #define SCI_SETCARETSTYLE 2512 #define SCI_GETCARETSTYLE 2513 #define SCI_SETINDICATORCURRENT 2500 diff --git a/include/Scintilla.iface b/include/Scintilla.iface index 9986f4c2c..13ba1cbef 100644 --- a/include/Scintilla.iface +++ b/include/Scintilla.iface @@ -2171,6 +2171,7 @@ enu CaretStyle=CARETSTYLE_ val CARETSTYLE_INVISIBLE=0 val CARETSTYLE_LINE=1 val CARETSTYLE_BLOCK=2 +val CARETSTYLE_BLOCK_ALWAYS=3 # Set the style of the caret to be drawn. set void SetCaretStyle=2512(int caretStyle,) diff --git a/src/EditView.cxx b/src/EditView.cxx index 6356dac63..b5dce037b 100644 --- a/src/EditView.cxx +++ b/src/EditView.cxx @@ -1421,7 +1421,7 @@ 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.caretStyle == CARETSTYLE_BLOCK && !drawDrag && posCaret > 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 @@ -1480,12 +1480,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 4fa7807d3..f81634cac 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 efae01a4d..800037501 100644 --- a/src/Editor.cxx +++ b/src/Editor.cxx @@ -1354,7 +1354,7 @@ Editor::XYScrollPosition Editor::XYScrollToMakeVisible(const SelectionRange &ran newXY.xOffset = static_cast<int>(pt.x + xOffset - rcClient.left) - 2; } else if (pt.x + xOffset >= rcClient.right + newXY.xOffset) { newXY.xOffset = static_cast<int>(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<int>(vs.aveCharWidth); } @@ -7290,7 +7290,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<int>(wParam); else /* Default to the line caret */ |