Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
17875773
Commit
17875773
authored
May 29, 2009
by
Raymond Hettinger
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue 5150: Add rstrip() menu option to IDLE.
parent
4c04b67b
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
47 additions
and
0 deletions
+47
-0
Doc/whatsnew/3.1.rst
Doc/whatsnew/3.1.rst
+8
-0
Lib/idlelib/RstripExtension.py
Lib/idlelib/RstripExtension.py
+29
-0
Lib/idlelib/config-extensions.def
Lib/idlelib/config-extensions.def
+6
-0
Misc/ACKS
Misc/ACKS
+1
-0
Misc/NEWS
Misc/NEWS
+3
-0
No files found.
Doc/whatsnew/3.1.rst
View file @
17875773
...
...
@@ -470,6 +470,14 @@ Major performance enhancements have been added:
(Contributed by Jake McGuire and Antoine Pitrou; :issue:`5084`.)
IDLE
====
* IDLE's format menu now provides an option to strip trailing whitespace
from a source file.
(Contributed by Roger D. Serwy; :issue:`5150`.)
Build and C API Changes
=======================
...
...
Lib/idlelib/RstripExtension.py
0 → 100644
View file @
17875773
'Provides "Strip trailing whitespace" under the "Format" menu.'
__author__
=
"Roger D. Serwy <roger.serwy at gmail.com>"
class
RstripExtension
:
menudefs
=
[
(
'format'
,
[
None
,
(
'Strip trailing whitespace'
,
'<<do-rstrip>>'
),
]),]
def
__init__
(
self
,
editwin
):
self
.
editwin
=
editwin
self
.
editwin
.
text
.
bind
(
"<<do-rstrip>>"
,
self
.
do_rstrip
)
def
do_rstrip
(
self
,
event
=
None
):
text
=
self
.
editwin
.
text
undo
=
self
.
editwin
.
undo
undo
.
undo_block_start
()
end_line
=
int
(
float
(
text
.
index
(
'end'
)))
+
1
for
cur
in
range
(
1
,
end_line
):
txt
=
text
.
get
(
'%i.0'
%
cur
,
'%i.0 lineend'
%
cur
)
cut
=
len
(
txt
.
rstrip
())
text
.
delete
(
'%i.%i'
%
(
cur
,
cut
),
'%i.0 lineend'
%
cur
)
undo
.
undo_block_stop
()
Lib/idlelib/config-extensions.def
View file @
17875773
...
...
@@ -86,3 +86,9 @@ bgcolor=LightGray
fgcolor=Black
[CodeContext_bindings]
toggle-code-context=
[RstripExtension]
enable=1
enable_shell=0
enable_editor=1
Misc/ACKS
View file @
17875773
...
...
@@ -658,6 +658,7 @@ Nick Seidenman
Žiga Seilnach
Fred Sells
Jiwon Seo
Roger D, Serwy
Jerry Seutter
Denis Severson
Ian Seyer
...
...
Misc/NEWS
View file @
17875773
...
...
@@ -262,6 +262,9 @@ Library
- Issue #5311: bdist_msi can now build packages that do not depend on a
specific Python version.
- Issue #5150: IDLE's format menu now has an option to strip trailing
whitespace.
- Issue #5940: distutils.command.build_clib.check_library_list was not doing
the right type checkings anymore.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment