1.1 --- a/ipython/NumberedTextControl.py Fri Jul 10 12:48:26 2009 -0400
1.2 +++ b/ipython/NumberedTextControl.py Fri Jul 17 11:34:51 2009 -0400
1.3 @@ -18,7 +18,7 @@
1.4 self.linenowidth = 30
1.5 self.InitializeComponents()
1.6 self.SetStyle(ControlStyles.DoubleBuffer | ControlStyles.UserPaint |
1.7 - ControlStyles.AllPaintingInWmPaint, True)
1.8 + ControlStyles.AllPaintingInWmPaint, True)
1.9 self.UpdateStyles()
1.10
1.11 def InitializeComponents(self):
1.12 @@ -40,8 +40,17 @@
1.13 return
1.14 rtb = self.richtextbox
1.15 g = e.Graphics
1.16 - fh = rtb.GetPositionFromCharIndex(rtb.GetFirstCharIndexFromLine(2)).Y
1.17 - fh = fh - rtb.GetPositionFromCharIndex(rtb.GetFirstCharIndexFromLine(1)).Y
1.18 + lentx = rtb.Text.Length
1.19 + fci = rtb.GetFirstCharIndexFromLine(2)
1.20 + if fci < 0:
1.21 + fh = 0.0
1.22 + else:
1.23 + fh = rtb.GetPositionFromCharIndex(fci).Y
1.24 + fcj = rtb.GetFirstCharIndexFromLine(1)
1.25 + if fcj < 0:
1.26 + fh = 0.0
1.27 + else:
1.28 + fh = fh - rtb.GetPositionFromCharIndex(rtb.GetFirstCharIndexFromLine(1)).Y
1.29 if fh <= 0.0:
1.30 fh = rtb.Font.GetHeight() * rtb.ZoomFactor
1.31 fi = rtb.GetCharIndexFromPosition(Point(0, g.VisibleClipBounds.Y + fh / 3))
1.32 @@ -51,7 +60,6 @@
1.33 g.Clear(self.BackColor)
1.34 i = fl
1.35 y = 0
1.36 - lentx = rtb.Text.Length
1.37 while y < g.VisibleClipBounds.Y + g.VisibleClipBounds.Height:
1.38 y = fly + 2 + fh * (i - fl - 1) + offset
1.39 if (i != 0 and (lentx > 0 and i <= rtb.Lines.Length)) or (lentx == 0 and i == 1):