diff options
author | Marko Njezic <unknown> | 2012-04-15 17:44:42 +0200 |
---|---|---|
committer | Marko Njezic <unknown> | 2012-04-15 17:44:42 +0200 |
commit | 119aa76054d6aa99a9366fa8d32948d74fac3247 (patch) | |
tree | d68af618f1a7f5876aeb12debf2bab9e5be702f1 | |
parent | 287aa74c80e1d55bd84922f02c013ca3cacfec7e (diff) | |
download | scintilla-mirror-119aa76054d6aa99a9366fa8d32948d74fac3247.tar.gz |
Add an option to draw wrap markers in line number margin. Feature #3518198.
-rw-r--r-- | doc/ScintillaDoc.html | 6 | ||||
-rw-r--r-- | include/Scintilla.h | 1 | ||||
-rw-r--r-- | include/Scintilla.iface | 1 | ||||
-rw-r--r-- | src/Editor.cxx | 45 |
4 files changed, 33 insertions, 20 deletions
diff --git a/doc/ScintillaDoc.html b/doc/ScintillaDoc.html index 6fec8becb..9826e769c 100644 --- a/doc/ScintillaDoc.html +++ b/doc/ScintillaDoc.html @@ -5249,6 +5249,12 @@ sptr_t CallScintilla(unsigned int iMessage, uptr_t wParam, sptr_t lParam){ Subline is indented by at least 1 to make room for the flag.<br /> </td> </tr> + + <tr> + <td align="left"><code>SC_WRAPVISUALFLAG_MARGIN</code></td> + <td align="center">4</td> + <td>Visual flag in line number margin.</td> + </tr> </tbody> </table> diff --git a/include/Scintilla.h b/include/Scintilla.h index 0df0900de..d4da54a9d 100644 --- a/include/Scintilla.h +++ b/include/Scintilla.h @@ -460,6 +460,7 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam, #define SC_WRAPVISUALFLAG_NONE 0x0000 #define SC_WRAPVISUALFLAG_END 0x0001 #define SC_WRAPVISUALFLAG_START 0x0002 +#define SC_WRAPVISUALFLAG_MARGIN 0x0004 #define SCI_SETWRAPVISUALFLAGS 2460 #define SCI_GETWRAPVISUALFLAGS 2461 #define SC_WRAPVISUALFLAGLOC_DEFAULT 0x0000 diff --git a/include/Scintilla.iface b/include/Scintilla.iface index b7f9eede8..42a9bb33c 100644 --- a/include/Scintilla.iface +++ b/include/Scintilla.iface @@ -1152,6 +1152,7 @@ enu WrapVisualFlag=SC_WRAPVISUALFLAG_ val SC_WRAPVISUALFLAG_NONE=0x0000 val SC_WRAPVISUALFLAG_END=0x0001 val SC_WRAPVISUALFLAG_START=0x0002 +val SC_WRAPVISUALFLAG_MARGIN=0x0004 # Set the display mode of visual flags for wrapped lines. set void SetWrapVisualFlags=2460(int wrapVisualFlags,) diff --git a/src/Editor.cxx b/src/Editor.cxx index c75734cae..f5903d87f 100644 --- a/src/Editor.cxx +++ b/src/Editor.cxx @@ -1939,28 +1939,33 @@ void Editor::PaintSelMargin(Surface *surfWindow, PRectangle &rc) { rcMarker.top = yposScreen; rcMarker.bottom = yposScreen + vs.lineHeight; if (vs.ms[margin].style == SC_MARGIN_NUMBER) { - char number[100]; - number[0] = '\0'; - if (firstSubLine) + if (firstSubLine) { + char number[100]; sprintf(number, "%d", lineDoc + 1); - if (foldFlags & SC_FOLDFLAG_LEVELNUMBERS) { - int lev = pdoc->GetLevel(lineDoc); - sprintf(number, "%c%c %03X %03X", - (lev & SC_FOLDLEVELHEADERFLAG) ? 'H' : '_', - (lev & SC_FOLDLEVELWHITEFLAG) ? 'W' : '_', - lev & SC_FOLDLEVELNUMBERMASK, - lev >> 16 - ); + if (foldFlags & SC_FOLDFLAG_LEVELNUMBERS) { + int lev = pdoc->GetLevel(lineDoc); + sprintf(number, "%c%c %03X %03X", + (lev & SC_FOLDLEVELHEADERFLAG) ? 'H' : '_', + (lev & SC_FOLDLEVELWHITEFLAG) ? 'W' : '_', + lev & SC_FOLDLEVELNUMBERMASK, + lev >> 16 + ); + } + PRectangle rcNumber = rcMarker; + // Right justify + XYPOSITION width = surface->WidthText(vs.styles[STYLE_LINENUMBER].font, number, istrlen(number)); + XYPOSITION xpos = rcNumber.right - width - 3; + rcNumber.left = xpos; + surface->DrawTextNoClip(rcNumber, vs.styles[STYLE_LINENUMBER].font, + rcNumber.top + vs.maxAscent, number, istrlen(number), + vs.styles[STYLE_LINENUMBER].fore, + vs.styles[STYLE_LINENUMBER].back); + } else if (wrapVisualFlags & SC_WRAPVISUALFLAG_MARGIN) { + PRectangle rcWrapMarker = rcMarker; + rcWrapMarker.right -= 3; + rcWrapMarker.left = rcWrapMarker.right - vs.styles[STYLE_LINENUMBER].aveCharWidth; + DrawWrapMarker(surface, rcWrapMarker, false, vs.styles[STYLE_LINENUMBER].fore); } - PRectangle rcNumber = rcMarker; - // Right justify - XYPOSITION width = surface->WidthText(vs.styles[STYLE_LINENUMBER].font, number, istrlen(number)); - XYPOSITION xpos = rcNumber.right - width - 3; - rcNumber.left = xpos; - surface->DrawTextNoClip(rcNumber, vs.styles[STYLE_LINENUMBER].font, - rcNumber.top + vs.maxAscent, number, istrlen(number), - vs.styles[STYLE_LINENUMBER].fore, - vs.styles[STYLE_LINENUMBER].back); } else if (vs.ms[margin].style == SC_MARGIN_TEXT || vs.ms[margin].style == SC_MARGIN_RTEXT) { if (firstSubLine) { const StyledText stMargin = pdoc->MarginStyledText(lineDoc); |