Skip to content

Commit 4e6b3c5

Browse files
committed
Fix for [ 782686 ]: new files used \r as the default line separator
instead of os.linesep.
1 parent c0b2b72 commit 4e6b3c5

1 file changed

Lines changed: 8 additions & 13 deletions

File tree

‎Mac/Tools/IDE/PyEdit.py‎

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -57,21 +57,18 @@ def __init__(self, path = "", title = ""):
5757
f.close()
5858
self._creator, filetype = MacOS.GetCreatorAndType(path)
5959
self.addrecentfile(path)
60+
if '\n' in text:
61+
if string.find(text, '\r\n') >= 0:
62+
self._eoln = '\r\n'
63+
else:
64+
self._eoln = '\n'
65+
text = string.replace(text, self._eoln, '\r')
66+
else:
67+
self._eoln = '\r'
6068
else:
6169
raise IOError, "file '%s' does not exist" % path
6270
self.path = path
6371

64-
if '\n' in text:
65-
if string.find(text, '\r\n') >= 0:
66-
self._eoln = '\r\n'
67-
else:
68-
self._eoln = '\n'
69-
text = string.replace(text, self._eoln, '\r')
70-
change = 0
71-
else:
72-
change = 0
73-
self._eoln = '\r'
74-
7572
self.settings = {}
7673
if self.path:
7774
self.readwindowsettings()
@@ -93,8 +90,6 @@ def __init__(self, path = "", title = ""):
9390

9491
W.Window.__init__(self, bounds, self.title, minsize = (330, 120), tabbable = 0)
9592
self.setupwidgets(text)
96-
if change > 0:
97-
self.editgroup.editor.textchanged()
9893

9994
if self.settings.has_key("selection"):
10095
selstart, selend = self.settings["selection"]

0 commit comments

Comments
 (0)