diff options
-rw-r--r-- | include/Scintilla.h | 2 | ||||
-rw-r--r-- | include/Scintilla.iface | 10 | ||||
-rw-r--r-- | src/Editor.cxx | 24 | ||||
-rw-r--r-- | src/ViewStyle.cxx | 2 | ||||
-rw-r--r-- | src/ViewStyle.h | 1 |
5 files changed, 33 insertions, 6 deletions
diff --git a/include/Scintilla.h b/include/Scintilla.h index ca81d135b..07fa3d925 100644 --- a/include/Scintilla.h +++ b/include/Scintilla.h @@ -260,6 +260,8 @@ typedef long (*SciFnDirect)(long ptr, unsigned int iMessage, unsigned long wPara #define SCI_GETDIRECTPOINTER 2185 #define SCI_SETOVERTYPE 2186 #define SCI_GETOVERTYPE 2187 +#define SCI_SETCARETWIDTH 2188 +#define SCI_GETCARETWIDTH 2189 #define SCI_CALLTIPSHOW 2200 #define SCI_CALLTIPCANCEL 2201 #define SCI_CALLTIPACTIVE 2202 diff --git a/include/Scintilla.iface b/include/Scintilla.iface index 052af92c4..c5518c4c5 100644 --- a/include/Scintilla.iface +++ b/include/Scintilla.iface @@ -581,13 +581,13 @@ fun int GetLine=2153(int line, stringresult text) get int GetLineCount=2154(,) # Sets the size in pixels of the left margin. -set void SetMarginLeft=2155(, int width) +set void SetMarginLeft=2155(, int pixelWidth) # Returns the size in pixels of the left margin. get int GetMarginLeft=2156(,) # Sets the size in pixels of the right margin. -set void SetMarginRight=2157(, int width) +set void SetMarginRight=2157(, int pixelWidth) # Returns the size in pixels of the right margin. get int GetMarginRight=2158(,) @@ -683,6 +683,12 @@ set void SetOvertype=2186(bool overtype,) # Returns true if overtype mode is active otherwise false is returned. get bool GetOvertype=2187(,) +# Set the width of the insert mode caret +set void SetCaretWidth=2188(int pixelWidth,) + +# Returns the width of the insert mode caret +get int GetCaretWidth=2189(,) + # Show a call tip containing a definition near position pos. fun void CallTipShow=2200(position pos, string definition) diff --git a/src/Editor.cxx b/src/Editor.cxx index 6d2676ffb..c33c69fd0 100644 --- a/src/Editor.cxx +++ b/src/Editor.cxx @@ -1241,17 +1241,20 @@ void Editor::Paint(Surface *surfaceWindow, PRectangle rcArea) { widthOverstrikeCaret = 3; if (((caret.active && caret.on) || (posDrag >= 0)) && xposCaret >= 0) { PRectangle rcCaret = rcLine; + int caretWidthOffset = 0; + if ((offset > 0) && (vs.caretWidth > 1)) + caretWidthOffset = 1; // Move back so overlaps both character cells. if (posDrag >= 0) { - rcCaret.left = xposCaret; - rcCaret.right = xposCaret + 1; + rcCaret.left = xposCaret - caretWidthOffset; + rcCaret.right = rcCaret.left + vs.caretWidth; } else { if (inOverstrike) { rcCaret.top = rcCaret.bottom - 2; rcCaret.left = xposCaret + 1; rcCaret.right = rcCaret.left + widthOverstrikeCaret - 1; } else { - rcCaret.left = xposCaret; - rcCaret.right = xposCaret + 1; + rcCaret.left = xposCaret - caretWidthOffset; + rcCaret.right = rcCaret.left + vs.caretWidth; } } surface->FillRectangle(rcCaret, vs.caretcolour.allocated); @@ -4066,6 +4069,19 @@ long Editor::WndProc(unsigned int iMessage, unsigned long wParam, long lParam) { case SCI_GETCARETFORE: return vs.caretcolour.desired.AsLong(); + case SCI_SETCARETWIDTH: + if (wParam <= 1) + vs.caretWidth = 1; + else if (wParam >= 3) + vs.caretWidth = 3; + else + vs.caretWidth = wParam; + InvalidateStyleRedraw(); + break; + + case SCI_GETCARETWIDTH: + return vs.caretWidth; + case SCI_ASSIGNCMDKEY: kmap.AssignCmdKey(Platform::LowShortFromLong(wParam), Platform::HighShortFromLong(wParam), lParam); diff --git a/src/ViewStyle.cxx b/src/ViewStyle.cxx index 9b7a8535e..4d6cf20c8 100644 --- a/src/ViewStyle.cxx +++ b/src/ViewStyle.cxx @@ -75,6 +75,7 @@ ViewStyle::ViewStyle(const ViewStyle &source) { caretcolour.desired = source.caretcolour.desired; edgecolour.desired = source.edgecolour.desired; edgeState = source.edgeState; + caretWidth = source.caretWidth; leftMarginWidth = source.leftMarginWidth; rightMarginWidth = source.rightMarginWidth; for (int i=0;i < margins; i++) { @@ -123,6 +124,7 @@ void ViewStyle::Init() { caretcolour.desired = Colour(0, 0, 0); edgecolour.desired = Colour(0xc0, 0xc0, 0xc0); edgeState = EDGE_NONE; + caretWidth = 1; leftMarginWidth = 1; rightMarginWidth = 1; diff --git a/src/ViewStyle.h b/src/ViewStyle.h index 5b0ab1925..79ad82670 100644 --- a/src/ViewStyle.h +++ b/src/ViewStyle.h @@ -61,6 +61,7 @@ public: ColourPair caretcolour; ColourPair edgecolour; int edgeState; + int caretWidth; ViewStyle(); ViewStyle(const ViewStyle &source); |