diff options
author | Neil <nyamatongwe@gmail.com> | 2019-06-22 10:51:29 +1000 |
---|---|---|
committer | Neil <nyamatongwe@gmail.com> | 2019-06-22 10:51:29 +1000 |
commit | 4c8a1f741c73911eff813a78c08fa88427eec38b (patch) | |
tree | a5b276ee266c723adc22e1afe8fa47f7cb0bb80c | |
parent | 8b8e1f383f0dbabc5e2f4666f4c5aa8860a91848 (diff) | |
download | scintilla-mirror-4c8a1f741c73911eff813a78c08fa88427eec38b.tar.gz |
Backport: Bug [#1924]. Option to allow block carets to trail selection ranges.
Bit flag value is CARETSTYLE_BLOCK_AFTER=256.
Backport of changeset 7609:340a0f51fb3c.
-rw-r--r-- | doc/ScintillaDoc.html | 4 | ||||
-rw-r--r-- | doc/ScintillaHistory.html | 4 | ||||
-rw-r--r-- | include/Scintilla.h | 3 | ||||
-rw-r--r-- | include/Scintilla.iface | 3 | ||||
-rw-r--r-- | src/Editor.cxx | 2 | ||||
-rw-r--r-- | src/ViewStyle.cxx | 5 |
6 files changed, 17 insertions, 4 deletions
diff --git a/doc/ScintillaDoc.html b/doc/ScintillaDoc.html index a1ee1f83c..3252c7823 100644 --- a/doc/ScintillaDoc.html +++ b/doc/ScintillaDoc.html @@ -3256,6 +3256,10 @@ struct Sci_TextToFind { for overtype mode is the bar caret (CARETSTYLE_OVERSTRIKE_BAR=0). You can determine the current caret style setting using <code>SCI_GETCARETSTYLE</code>.</p> + <p>When the caret end of a range is at the end and a block caret style is chosen, the block is + drawn just inside the selection instead of after. + This can be switched with an option (CARETSTYLE_BLOCK_AFTER=256).</p> + <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 diff --git a/doc/ScintillaHistory.html b/doc/ScintillaHistory.html index 9a67db1d8..74ba9a851 100644 --- a/doc/ScintillaHistory.html +++ b/doc/ScintillaHistory.html @@ -576,6 +576,10 @@ <a href="https://sourceforge.net/p/scintilla/feature-requests/1293/">Feature #1293</a>. </li> <li> + Add CARETSTYLE_BLOCK_AFTER option to always display block caret after selection. + <a href="https://sourceforge.net/p/scintilla/bugs/1924/">Bug #1924</a>. + </li> + <li> On Win32, limit text returned from WM_GETTEXT to the length specified in wParam. <a href="https://sourceforge.net/p/scintilla/bugs/2110/">Bug #2110</a>. </li> diff --git a/include/Scintilla.h b/include/Scintilla.h index ce5bb43d6..5d535ae76 100644 --- a/include/Scintilla.h +++ b/include/Scintilla.h @@ -837,8 +837,9 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam, #define CARETSTYLE_LINE 1 #define CARETSTYLE_BLOCK 2 #define CARETSTYLE_OVERSTRIKE_BAR 0 -#define CARETSTYLE_OVERSTRIKE_BLOCK 16 +#define CARETSTYLE_OVERSTRIKE_BLOCK 0x10 #define CARETSTYLE_INS_MASK 0xF +#define CARETSTYLE_BLOCK_AFTER 0x100 #define SCI_SETCARETSTYLE 2512 #define SCI_GETCARETSTYLE 2513 #define SCI_SETINDICATORCURRENT 2500 diff --git a/include/Scintilla.iface b/include/Scintilla.iface index 75582b0af..10ac9091e 100644 --- a/include/Scintilla.iface +++ b/include/Scintilla.iface @@ -2333,8 +2333,9 @@ val CARETSTYLE_INVISIBLE=0 val CARETSTYLE_LINE=1 val CARETSTYLE_BLOCK=2 val CARETSTYLE_OVERSTRIKE_BAR=0 -val CARETSTYLE_OVERSTRIKE_BLOCK=16 +val CARETSTYLE_OVERSTRIKE_BLOCK=0x10 val CARETSTYLE_INS_MASK=0xF +val CARETSTYLE_BLOCK_AFTER=0x100 # Set the style of the caret to be drawn. set void SetCaretStyle=2512(CaretStyle caretStyle,) diff --git a/src/Editor.cxx b/src/Editor.cxx index fd89d1e5e..e963ba339 100644 --- a/src/Editor.cxx +++ b/src/Editor.cxx @@ -7310,7 +7310,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 | CARETSTYLE_OVERSTRIKE_BLOCK)) + if (wParam <= (CARETSTYLE_BLOCK | CARETSTYLE_OVERSTRIKE_BLOCK | CARETSTYLE_BLOCK_AFTER)) vs.caretStyle = static_cast<int>(wParam); else /* Default to the line caret */ diff --git a/src/ViewStyle.cxx b/src/ViewStyle.cxx index c867c2f76..ec6d8e52c 100644 --- a/src/ViewStyle.cxx +++ b/src/ViewStyle.cxx @@ -545,10 +545,13 @@ bool ViewStyle::SetWrapIndentMode(int wrapIndentMode_) noexcept { } bool ViewStyle::IsBlockCaretStyle() const noexcept { - return (caretStyle == CARETSTYLE_BLOCK) || (caretStyle & CARETSTYLE_OVERSTRIKE_BLOCK) != 0; + return ((caretStyle & CARETSTYLE_INS_MASK) == CARETSTYLE_BLOCK) || + (caretStyle & CARETSTYLE_OVERSTRIKE_BLOCK) != 0; } bool ViewStyle::DrawCaretInsideSelection(bool inOverstrike, bool imeCaretBlockOverride) const noexcept { + if (caretStyle & CARETSTYLE_BLOCK_AFTER) + return false; return ((caretStyle & CARETSTYLE_INS_MASK) == CARETSTYLE_BLOCK) || (inOverstrike && (caretStyle & CARETSTYLE_OVERSTRIKE_BLOCK) != 0) || imeCaretBlockOverride; |