summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1999-01-04 16:34:41 (GMT)
committerGuido van Rossum <guido@python.org>1999-01-04 16:34:41 (GMT)
commite911c3e20cfa324e95f49d033cfe636543cce8cb (patch)
treefbf40c70ff48c9a87a341d73adbc4500ac925052
parent16b91f89b5afc450736861dd92e4638fe52eaeeb (diff)
downloadcpython-e911c3e20cfa324e95f49d033cfe636543cce8cb.zip
cpython-e911c3e20cfa324e95f49d033cfe636543cce8cb.tar.gz
cpython-e911c3e20cfa324e95f49d033cfe636543cce8cb.tar.bz2
Added Unix Meta-q key binding;
fix find_paragraph when at start of file.
-rw-r--r--Tools/idle/FormatParagraph.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/Tools/idle/FormatParagraph.py b/Tools/idle/FormatParagraph.py
index 729ec93..cc1b36a 100644
--- a/Tools/idle/FormatParagraph.py
+++ b/Tools/idle/FormatParagraph.py
@@ -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)