diff options
author | Marko Njezic <devnull@localhost> | 2012-04-15 17:44:42 +0200 |
---|---|---|
committer | Marko Njezic <devnull@localhost> | 2012-04-15 17:44:42 +0200 |
commit | 423f81b9e19da08af4992aca9acdf8cfa121413a (patch) | |
tree | 46d50fd43b5b019342ab8e7662502140c1f1c123 /src | |
parent | 8ebe86f15bd3de9a87c1ce3bb3f150bb197e1ea8 (diff) | |
download | scintilla-mirror-423f81b9e19da08af4992aca9acdf8cfa121413a.tar.gz |
Add an option to draw wrap markers in line number margin. Feature #3518198.
Diffstat (limited to 'src')
-rw-r--r-- | src/Editor.cxx | 45 |
1 files changed, 25 insertions, 20 deletions
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); |