diff options
-rw-r--r-- | doc/ScintillaDoc.html | 11 | ||||
-rw-r--r-- | include/Scintilla.h | 4 | ||||
-rw-r--r-- | include/Scintilla.iface | 10 | ||||
-rw-r--r-- | src/Editor.cxx | 11 | ||||
-rw-r--r-- | src/ViewStyle.cxx | 2 | ||||
-rw-r--r-- | src/ViewStyle.h | 1 |
6 files changed, 37 insertions, 2 deletions
diff --git a/doc/ScintillaDoc.html b/doc/ScintillaDoc.html index d01d3df03..8ed6dd9d1 100644 --- a/doc/ScintillaDoc.html +++ b/doc/ScintillaDoc.html @@ -2753,6 +2753,8 @@ struct Sci_TextToFind { <a class="message" href="#SCI_MARGINTEXTCLEARALL">SCI_MARGINTEXTCLEARALL</a><br /> <a class="message" href="#SCI_MARGINSETSTYLEOFFSET">SCI_MARGINSETSTYLEOFFSET(int style)</a><br /> <a class="message" href="#SCI_MARGINGETSTYLEOFFSET">SCI_MARGINGETSTYLEOFFSET</a><br /> + <a class="message" href="#SCI_SETMARGINOPTIONS">SCI_SETMARGINOPTIONS(int marginOptions)</a><br /> + <a class="message" href="#SCI_GETMARGINOPTIONS">SCI_GETMARGINOPTIONS</a><br /> </code> <p><b id="SCI_SETMARGINTYPEN">SCI_SETMARGINTYPEN(int margin, int iType)</b><br /> @@ -2860,6 +2862,15 @@ struct Sci_TextToFind { 256 upto 511 so they do not overlap styles set by lexers. Each style number set with <code>SCI_MARGINSETSTYLE</code> or <code>SCI_MARGINSETSTYLES</code> has the offset added before looking up the style. </p> + <p> + <b id="SCI_SETMARGINOPTIONS">SCI_SETMARGINOPTIONS(int marginOptions)</b><br /> + <b id="SCI_GETMARGINOPTIONS">SCI_GETMARGINOPTIONS</b><br /> + Define margin options by enabling appropriate bit flags. At the moment, only one flag is available + <code>SC_MARGINOPTION_SUBLINESELECT</code>=1, which controls how wrapped lines are selected when clicking + on margin in front of them. If <code>SC_MARGINOPTION_SUBLINESELECT</code> is set only sub line of wrapped + line is selected, otherwise whole wrapped line is selected. Margin options are set to + <code>SC_MARGINOPTION_NONE</code>=0 by default. + </p> <h2 id="Annotations">Annotations</h2> diff --git a/include/Scintilla.h b/include/Scintilla.h index 54fcb3f38..8819b1b0c 100644 --- a/include/Scintilla.h +++ b/include/Scintilla.h @@ -730,6 +730,10 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam, #define SCI_MARGINTEXTCLEARALL 2536 #define SCI_MARGINSETSTYLEOFFSET 2537 #define SCI_MARGINGETSTYLEOFFSET 2538 +#define SC_MARGINOPTION_NONE 0 +#define SC_MARGINOPTION_SUBLINESELECT 1 +#define SCI_SETMARGINOPTIONS 2539 +#define SCI_GETMARGINOPTIONS 2557 #define SCI_ANNOTATIONSETTEXT 2540 #define SCI_ANNOTATIONGETTEXT 2541 #define SCI_ANNOTATIONSETSTYLE 2542 diff --git a/include/Scintilla.iface b/include/Scintilla.iface index 0fe9ca876..773e29427 100644 --- a/include/Scintilla.iface +++ b/include/Scintilla.iface @@ -1947,6 +1947,16 @@ set void MarginSetStyleOffset=2537(int style,) # Get the start of the range of style numbers used for margin text get int MarginGetStyleOffset=2538(,) +enu MarginOption=SC_MARGINOPTION_ +val SC_MARGINOPTION_NONE=0 +val SC_MARGINOPTION_SUBLINESELECT=1 + +# Set the margin options. +set void SetMarginOptions=2539(int marginOptions,) + +# Get the margin options. +get int GetMarginOptions=2557(,) + # Set the annotation text for a line set void AnnotationSetText=2540(int line, string text) diff --git a/src/Editor.cxx b/src/Editor.cxx index 6b86987fa..79c9f6c0f 100644 --- a/src/Editor.cxx +++ b/src/Editor.cxx @@ -6195,7 +6195,7 @@ void Editor::ButtonDown(Point pt, unsigned int curTime, bool shift, bool ctrl, b if (!shift) { // Single click in margin: select whole line or only subline if word wrap is enabled lineAnchorPos = newPos.Position(); - selectionType = (wrapState != eWrapNone) ? selSubLine : selWholeLine; + selectionType = ((wrapState != eWrapNone) && (vs.marginOptions & SC_MARGINOPTION_SUBLINESELECT)) ? selSubLine : selWholeLine; LineSelection(lineAnchorPos, lineAnchorPos, selectionType == selWholeLine); } else { // Single shift+click in margin: select from line anchor to clicked line @@ -6208,7 +6208,7 @@ void Editor::ButtonDown(Point pt, unsigned int curTime, bool shift, bool ctrl, b // Otherwise, if there's a non empty selection, reset selection type only if it differs from selSubLine and selWholeLine. // This ensures that we continue selecting in the same selection mode. if (sel.Empty() || (selectionType != selSubLine && selectionType != selWholeLine)) - selectionType = (wrapState != eWrapNone) ? selSubLine : selWholeLine; + selectionType = ((wrapState != eWrapNone) && (vs.marginOptions & SC_MARGINOPTION_SUBLINESELECT)) ? selSubLine : selWholeLine; LineSelection(newPos.Position(), lineAnchorPos, selectionType == selWholeLine); } @@ -8797,6 +8797,13 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) { case SCI_MARGINGETSTYLEOFFSET: return vs.marginStyleOffset; + case SCI_SETMARGINOPTIONS: + vs.marginOptions = wParam; + break; + + case SCI_GETMARGINOPTIONS: + return vs.marginOptions; + case SCI_MARGINSETTEXT: pdoc->MarginSetText(wParam, CharPtrFromSPtr(lParam)); break; diff --git a/src/ViewStyle.cxx b/src/ViewStyle.cxx index 03a2fb42f..78b13b8da 100644 --- a/src/ViewStyle.cxx +++ b/src/ViewStyle.cxx @@ -187,6 +187,7 @@ ViewStyle::ViewStyle(const ViewStyle &source) { someStylesForceCase = false; leftMarginWidth = source.leftMarginWidth; rightMarginWidth = source.rightMarginWidth; + marginOptions = source.marginOptions; for (int i=0; i < margins; i++) { ms[i] = source.ms[i]; } @@ -287,6 +288,7 @@ void ViewStyle::Init(size_t stylesSize_) { leftMarginWidth = 1; rightMarginWidth = 1; + marginOptions = SC_MARGINOPTION_NONE; ms[0].style = SC_MARGIN_NUMBER; ms[0].width = 0; ms[0].mask = 0; diff --git a/src/ViewStyle.h b/src/ViewStyle.h index b038a9b54..f62529adf 100644 --- a/src/ViewStyle.h +++ b/src/ViewStyle.h @@ -102,6 +102,7 @@ public: enum { margins=5 }; int leftMarginWidth; ///< Spacing margin on left of text int rightMarginWidth; ///< Spacing margin on left of text + int marginOptions; bool symbolMargin; int maskInLine; ///< Mask for markers to be put into text because there is nowhere for them to go in margin MarginStyle ms[margins]; |