/usr/lib/python2.7/idlelib/RstripExtension.py is in idle-python2.7 2.7.3-0ubuntu3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | '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()
|