mirror of
https://github.com/python/cpython.git
synced 2025-11-09 14:06:30 +00:00
Added Unix Meta-q key binding;
fix find_paragraph when at start of file.
This commit is contained in:
parent
16b91f89b5
commit
e911c3e20c
1 changed files with 5 additions and 1 deletions
|
|
@ -14,6 +14,10 @@ class FormatParagraph:
|
||||||
keydefs = {
|
keydefs = {
|
||||||
'<<format-paragraph>>': ['<Alt-q>'],
|
'<<format-paragraph>>': ['<Alt-q>'],
|
||||||
}
|
}
|
||||||
|
|
||||||
|
unix_keydefs = {
|
||||||
|
'<<format-paragraph>>': ['<Meta-q>'],
|
||||||
|
}
|
||||||
|
|
||||||
def __init__(self, editwin):
|
def __init__(self, editwin):
|
||||||
self.editwin = editwin
|
self.editwin = editwin
|
||||||
|
|
@ -53,7 +57,7 @@ def find_paragraph(text, mark):
|
||||||
# Search back to beginning of paragraph
|
# Search back to beginning of paragraph
|
||||||
lineno = first_lineno - 1
|
lineno = first_lineno - 1
|
||||||
line = text.get("%d.0" % lineno, "%d.0 lineend" % lineno)
|
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
|
lineno = lineno - 1
|
||||||
line = text.get("%d.0" % lineno, "%d.0 lineend" % lineno)
|
line = text.get("%d.0" % lineno, "%d.0 lineend" % lineno)
|
||||||
first = "%d.0" % (lineno+1)
|
first = "%d.0" % (lineno+1)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue