aboutsummaryrefslogtreecommitdiffstats
path: root/tools/pygrub
diff options
context:
space:
mode:
authorTim Deegan <Tim.Deegan@xensource.com>2007-03-28 09:12:16 +0000
committerTim Deegan <Tim.Deegan@xensource.com>2007-03-28 09:12:16 +0000
commitd3454d2db9d79cb51165377673ca286ca4d01fc6 (patch)
tree18db2fa4606a2fbf6b05b14cef860a215112560b /tools/pygrub
parent493cba058fbc438a86e76fc9c75c257dee57f83d (diff)
downloadxen-d3454d2db9d79cb51165377673ca286ca4d01fc6.tar.gz
xen-d3454d2db9d79cb51165377673ca286ca4d01fc6.tar.bz2
xen-d3454d2db9d79cb51165377673ca286ca4d01fc6.zip
Editing long lines in pygrub interactively could lead to tracebacks.
Attached patch fixes things. Signed-off-by: Jeremy Katz <katzj@redhat.com>
Diffstat (limited to 'tools/pygrub')
-rw-r--r--tools/pygrub/src/pygrub17
1 files changed, 7 insertions, 10 deletions
diff --git a/tools/pygrub/src/pygrub b/tools/pygrub/src/pygrub
index 9b3d15f675..8f4e3473f7 100644
--- a/tools/pygrub/src/pygrub
+++ b/tools/pygrub/src/pygrub
@@ -125,16 +125,13 @@ class GrubLineEditor(curses.textpad.Textbox):
is that we can handle lines longer than the window."""
self.win.clear()
- if self.pos > 70:
- if self.pos > 130:
- off = 120
- else:
- off = 55
- l = [ "<" ] + self.line[off:]
- p = self.pos - off
- else:
- l = self.line[:70]
- p = self.pos
+ p = self.pos
+ off = 0
+ while p > 70:
+ p -= 55
+ off += 55
+
+ l = self.line[off:off+70]
self.win.addstr(0, 0, string.join(l, ("")))
if self.pos > 70:
self.win.addch(0, 0, curses.ACS_LARROW)