[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen-unstable] Editing long lines in pygrub interactively could lead to tracebacks.



# HG changeset patch
# User Tim Deegan <Tim.Deegan@xxxxxxxxxxxxx>
# Date 1175073136 0
# Node ID ff6a1607c17b2e1f2e8b09e8722097f50e16c715
# Parent  b7c1b412c4727ad8c8e190d8c053ab78a09e390e
Editing long lines in pygrub interactively could lead to tracebacks.
Attached patch fixes things.

Signed-off-by: Jeremy Katz <katzj@xxxxxxxxxx>
---
 tools/pygrub/src/pygrub |   17 +++++++----------
 1 files changed, 7 insertions(+), 10 deletions(-)

diff -r b7c1b412c472 -r ff6a1607c17b tools/pygrub/src/pygrub
--- a/tools/pygrub/src/pygrub   Wed Mar 28 10:05:03 2007 +0100
+++ b/tools/pygrub/src/pygrub   Wed Mar 28 09:12:16 2007 +0000
@@ -125,16 +125,13 @@ class GrubLineEditor(curses.textpad.Text
         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)

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.