diff --git a/scintilla/include/Scintilla.h b/scintilla/include/Scintilla.h index e61c64a5f..03fb201fa 100644 --- a/scintilla/include/Scintilla.h +++ b/scintilla/include/Scintilla.h @@ -257,6 +257,8 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam, #define SCI_GETMAXLINESTATE 2094 #define SCI_GETCARETLINEVISIBLE 2095 #define SCI_SETCARETLINEVISIBLE 2096 +#define SCI_GETCARETLINEVISIBLEALWAYS 3095 +#define SCI_SETCARETLINEVISIBLEALWAYS 3096 #define SCI_GETCARETLINEBACK 2097 #define SCI_SETCARETLINEBACK 2098 #define SCI_STYLESETCHANGEABLE 2099 diff --git a/scintilla/src/Editor.cxx b/scintilla/src/Editor.cxx index fc81ec5fc..8213debf2 100644 --- a/scintilla/src/Editor.cxx +++ b/scintilla/src/Editor.cxx @@ -2247,7 +2247,7 @@ void Editor::DrawLine(Surface *surface, ViewStyle &vsDraw, int line, int lineVis // the color for the highest numbered one is used. bool overrideBackground = false; ColourAllocated background; - if (caret.active && vsDraw.showCaretLineBackground && (vsDraw.caretLineAlpha == SC_ALPHA_NOALPHA) && ll->containsCaret) { + if ((caret.active || vsDraw.showCaretLineBackgroundAlways) && vsDraw.showCaretLineBackground && (vsDraw.caretLineAlpha == SC_ALPHA_NOALPHA) && ll->containsCaret) { overrideBackground = true; background = vsDraw.caretLineBackground.allocated; } @@ -2630,7 +2630,7 @@ void Editor::DrawLine(Surface *surface, ViewStyle &vsDraw, int line, int lineVis // Draw any translucent whole line states rcSegment.left = xStart; rcSegment.right = rcLine.right - 1; - if (caret.active && vsDraw.showCaretLineBackground && ll->containsCaret) { + if ((caret.active || vsDraw.showCaretLineBackgroundAlways) && vsDraw.showCaretLineBackground && ll->containsCaret) { SimpleAlphaRectangle(surface, rcSegment, vsDraw.caretLineBackground.allocated, vsDraw.caretLineAlpha); } int marks = pdoc->GetMark(line); @@ -3174,6 +3174,7 @@ long Editor::FormatRange(bool draw, RangeToFormat *pfr) { vsPrint.whitespaceBackgroundSet = false; vsPrint.whitespaceForegroundSet = false; vsPrint.showCaretLineBackground = false; + vsPrint.showCaretLineBackgroundAlways = false; // Set colours for printing according to users settings for (size_t sty = 0;sty < vsPrint.stylesSize;sty++) { @@ -6983,6 +6984,13 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) { vs.showCaretLineBackground = wParam != 0; InvalidateStyleRedraw(); break; + case SCI_GETCARETLINEVISIBLEALWAYS: + return vs.showCaretLineBackgroundAlways; + case SCI_SETCARETLINEVISIBLEALWAYS: + vs.showCaretLineBackgroundAlways = wParam != 0; + InvalidateStyleRedraw(); + break; + case SCI_GETCARETLINEBACK: return vs.caretLineBackground.desired.AsLong(); case SCI_SETCARETLINEBACK: diff --git a/scintilla/src/ViewStyle.cxx b/scintilla/src/ViewStyle.cxx index d0bac301d..fa24a3a8f 100644 --- a/scintilla/src/ViewStyle.cxx +++ b/scintilla/src/ViewStyle.cxx @@ -118,6 +118,7 @@ ViewStyle::ViewStyle(const ViewStyle &source) { selbarlight.desired = source.selbarlight.desired; caretcolour.desired = source.caretcolour.desired; showCaretLineBackground = source.showCaretLineBackground; + showCaretLineBackgroundAlways = source.showCaretLineBackgroundAlways; caretLineBackground.desired = source.caretLineBackground.desired; caretLineAlpha = source.caretLineAlpha; edgecolour.desired = source.edgecolour.desired; @@ -192,6 +193,7 @@ void ViewStyle::Init(size_t stylesSize_) { styles[STYLE_LINENUMBER].back.desired = Platform::Chrome(); caretcolour.desired = ColourDesired(0, 0, 0); showCaretLineBackground = false; + showCaretLineBackgroundAlways = false; caretLineBackground.desired = ColourDesired(0xff, 0xff, 0); caretLineAlpha = SC_ALPHA_NOALPHA; edgecolour.desired = ColourDesired(0xc0, 0xc0, 0xc0); diff --git a/scintilla/src/ViewStyle.h b/scintilla/src/ViewStyle.h index a2638fb3a..4547def2a 100644 --- a/scintilla/src/ViewStyle.h +++ b/scintilla/src/ViewStyle.h @@ -94,6 +94,7 @@ public: bool showMarkedLines; ColourPair caretcolour; bool showCaretLineBackground; + bool showCaretLineBackgroundAlways; ColourPair caretLineBackground; int caretLineAlpha; ColourPair edgecolour;