aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authornyamatongwe <devnull@localhost>2011-11-30 17:10:33 +1100
committernyamatongwe <devnull@localhost>2011-11-30 17:10:33 +1100
commit0aa61bd2cf4f0cc0fab306c505cf7eebe291964b (patch)
treeeffedb230e66c0b526e943a0557425432ebbaf64 /src
parent52d8e9410d53595a9635a5ece86cee2fe5de6885 (diff)
downloadscintilla-mirror-0aa61bd2cf4f0cc0fab306c505cf7eebe291964b.tar.gz
Clip margin drawing to the paint area.
Diffstat (limited to 'src')
-rw-r--r--src/Editor.cxx11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/Editor.cxx b/src/Editor.cxx
index 8c939fdb1..66103fc93 100644
--- a/src/Editor.cxx
+++ b/src/Editor.cxx
@@ -1761,6 +1761,12 @@ void Editor::PaintSelMargin(Surface *surfWindow, PRectangle &rc) {
surface = surfWindow;
}
+ // Clip vertically to paint area to avoid drawing line numbers
+ if (rcMargin.bottom > rc.bottom)
+ rcMargin.bottom = rc.bottom;
+ if (rcMargin.top < rc.top)
+ rcMargin.top = rc.top;
+
PRectangle rcSelMargin = rcMargin;
rcSelMargin.right = rcMargin.left;
@@ -1793,8 +1799,9 @@ void Editor::PaintSelMargin(Surface *surfWindow, PRectangle &rc) {
surface->FillRectangle(rcSelMargin, vs.styles[STYLE_LINENUMBER].back);
}
- int visibleLine = topLine;
- int yposScreen = 0;
+ const int lineStartPaint = rcMargin.top / vs.lineHeight;
+ int visibleLine = topLine + lineStartPaint;
+ int yposScreen = lineStartPaint * vs.lineHeight;
// Work out whether the top line is whitespace located after a
// lessening of fold level which implies a 'fold tail' but which should not
// be displayed until the last of a sequence of whitespace.