ia64/xen-unstable

changeset 14615:ff6a1607c17b

Editing long lines in pygrub interactively could lead to tracebacks.
Attached patch fixes things.

Signed-off-by: Jeremy Katz <katzj@redhat.com>
author Tim Deegan <Tim.Deegan@xensource.com>
date Wed Mar 28 09:12:16 2007 +0000 (2007-03-28)
parents b7c1b412c472
children 3d7a4ac397b1 0b2794d3320f
files tools/pygrub/src/pygrub
line diff
     1.1 --- a/tools/pygrub/src/pygrub	Wed Mar 28 10:05:03 2007 +0100
     1.2 +++ b/tools/pygrub/src/pygrub	Wed Mar 28 09:12:16 2007 +0000
     1.3 @@ -125,16 +125,13 @@ class GrubLineEditor(curses.textpad.Text
     1.4          is that we can handle lines longer than the window."""
     1.5  
     1.6          self.win.clear()
     1.7 -        if self.pos > 70:
     1.8 -            if self.pos > 130:
     1.9 -                off = 120
    1.10 -            else:
    1.11 -                off = 55
    1.12 -            l = [ "<" ] + self.line[off:]
    1.13 -            p = self.pos - off
    1.14 -        else:
    1.15 -            l = self.line[:70]
    1.16 -            p = self.pos
    1.17 +        p = self.pos
    1.18 +        off = 0
    1.19 +        while p > 70:
    1.20 +            p -= 55
    1.21 +            off += 55
    1.22 +
    1.23 +        l = self.line[off:off+70]
    1.24          self.win.addstr(0, 0, string.join(l, ("")))
    1.25          if self.pos > 70:
    1.26              self.win.addch(0, 0, curses.ACS_LARROW)