Added Unix Meta-q key binding;
authorGuido van Rossum <guido@python.org>
Mon, 4 Jan 1999 16:34:41 +0000 (16:34 +0000)
committerGuido van Rossum <guido@python.org>
Mon, 4 Jan 1999 16:34:41 +0000 (16:34 +0000)
fix find_paragraph when at start of file.

Tools/idle/FormatParagraph.py

index 729ec93ec47e629ab12e20ad586dc311e882209c..cc1b36a6e72c26c3b82f17688672feddb558fbff 100644 (file)
@@ -14,6 +14,10 @@ class FormatParagraph:
     keydefs = {
         '<<format-paragraph>>': ['<Alt-q>'],
     }
+    
+    unix_keydefs = {
+        '<<format-paragraph>>': ['<Meta-q>'],
+    } 
 
     def __init__(self, editwin):
         self.editwin = editwin
@@ -53,7 +57,7 @@ def find_paragraph(text, mark):
     # Search back to beginning of paragraph
     lineno = first_lineno - 1
     line = text.get("%d.0" % lineno, "%d.0 lineend" % lineno)
-    while not is_all_white(line):
+    while lineno > 0 and not is_all_white(line):
         lineno = lineno - 1
         line = text.get("%d.0" % lineno, "%d.0 lineend" % lineno)
     first = "%d.0" % (lineno+1)