Skip to content

Commit

Permalink
Added Unix Meta-q key binding;
Browse files Browse the repository at this point in the history
fix find_paragraph when at start of file.
  • Loading branch information
gvanrossum committed Jan 4, 1999
1 parent 16b91f8 commit e911c3e
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion Tools/idle/FormatParagraph.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ class FormatParagraph:
keydefs = {
'<<format-paragraph>>': ['<Alt-q>'],
}

unix_keydefs = {
'<<format-paragraph>>': ['<Meta-q>'],
}

def __init__(self, editwin):
self.editwin = editwin
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit e911c3e

Please sign in to comment.