[issue19042] Idle: add option to autosave 'Untitled' edit window
perilbrain
report at bugs.python.org
Wed Nov 2 23:11:40 EDT 2016
perilbrain added the comment:
I have signed the CA. Meantime a came across one more problem in function tabnanny(encoding issue) so I am attaching the new version of ScriptBinding.py.
Summary:-
def tabnanny(self, source, encoding = None):
# XXX: tabnanny should work on binary files as well
#print(encoding)
f = io.StringIO(source.decode(encoding) if encoding else source)
def source_from_file(self, filename):
with open(filename, 'rb') as f:
source = f.read()
encoding = tokenize.detect_encoding(f.readline)[0]
....
return source, encoding
def _run_module_event(self, event):
...
if not filename:
self.no_save = True
source = self.source_from_editor()
filename = self.editwin.top.wm_title()
else:
source, encoding = self.source_from_file(filename)
self.no_save = False
code = self.checksyntax(source, filename)
if not code:
return 'break'
if not self.tabnanny(source, encoding):
return 'break'
....
----------
Added file: http://bugs.python.org/file45328/ScriptBinding.py
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue19042>
_______________________________________
More information about the Python-bugs-list
mailing list