mirror of
https://github.com/python/cpython.git
synced 2025-11-02 11:08:57 +00:00
Fix for [ 782686 ]: new files used \r as the default line separator
instead of os.linesep.
This commit is contained in:
parent
c0b2b72702
commit
4e6b3c55d0
1 changed files with 8 additions and 13 deletions
|
|
@ -57,21 +57,18 @@ class Editor(W.Window):
|
||||||
f.close()
|
f.close()
|
||||||
self._creator, filetype = MacOS.GetCreatorAndType(path)
|
self._creator, filetype = MacOS.GetCreatorAndType(path)
|
||||||
self.addrecentfile(path)
|
self.addrecentfile(path)
|
||||||
|
if '\n' in text:
|
||||||
|
if string.find(text, '\r\n') >= 0:
|
||||||
|
self._eoln = '\r\n'
|
||||||
|
else:
|
||||||
|
self._eoln = '\n'
|
||||||
|
text = string.replace(text, self._eoln, '\r')
|
||||||
|
else:
|
||||||
|
self._eoln = '\r'
|
||||||
else:
|
else:
|
||||||
raise IOError, "file '%s' does not exist" % path
|
raise IOError, "file '%s' does not exist" % path
|
||||||
self.path = path
|
self.path = path
|
||||||
|
|
||||||
if '\n' in text:
|
|
||||||
if string.find(text, '\r\n') >= 0:
|
|
||||||
self._eoln = '\r\n'
|
|
||||||
else:
|
|
||||||
self._eoln = '\n'
|
|
||||||
text = string.replace(text, self._eoln, '\r')
|
|
||||||
change = 0
|
|
||||||
else:
|
|
||||||
change = 0
|
|
||||||
self._eoln = '\r'
|
|
||||||
|
|
||||||
self.settings = {}
|
self.settings = {}
|
||||||
if self.path:
|
if self.path:
|
||||||
self.readwindowsettings()
|
self.readwindowsettings()
|
||||||
|
|
@ -93,8 +90,6 @@ class Editor(W.Window):
|
||||||
|
|
||||||
W.Window.__init__(self, bounds, self.title, minsize = (330, 120), tabbable = 0)
|
W.Window.__init__(self, bounds, self.title, minsize = (330, 120), tabbable = 0)
|
||||||
self.setupwidgets(text)
|
self.setupwidgets(text)
|
||||||
if change > 0:
|
|
||||||
self.editgroup.editor.textchanged()
|
|
||||||
|
|
||||||
if self.settings.has_key("selection"):
|
if self.settings.has_key("selection"):
|
||||||
selstart, selend = self.settings["selection"]
|
selstart, selend = self.settings["selection"]
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue