summaryrefslogtreecommitdiffstats
path: root/Mac/Tools
diff options
context:
space:
mode:
authorJust van Rossum <just@letterror.com>2003-11-18 22:41:16 (GMT)
committerJust van Rossum <just@letterror.com>2003-11-18 22:41:16 (GMT)
commit4e6b3c55d0a045e37725a0eb6c7a0dfcd4d4084b (patch)
tree7305116fe415cb3401350fd177b75d466b5150ee /Mac/Tools
parentc0b2b72702bb7f671489e2addb6f9794bdad9243 (diff)
downloadcpython-4e6b3c55d0a045e37725a0eb6c7a0dfcd4d4084b.zip
cpython-4e6b3c55d0a045e37725a0eb6c7a0dfcd4d4084b.tar.gz
cpython-4e6b3c55d0a045e37725a0eb6c7a0dfcd4d4084b.tar.bz2
Fix for [ 782686 ]: new files used \r as the default line separator
instead of os.linesep.
Diffstat (limited to 'Mac/Tools')
-rw-r--r--Mac/Tools/IDE/PyEdit.py21
1 files changed, 8 insertions, 13 deletions
diff --git a/Mac/Tools/IDE/PyEdit.py b/Mac/Tools/IDE/PyEdit.py
index 502f7c4..0ad7a8a 100644
--- a/Mac/Tools/IDE/PyEdit.py
+++ b/Mac/Tools/IDE/PyEdit.py
@@ -57,21 +57,18 @@ class Editor(W.Window):
f.close()
self._creator, filetype = MacOS.GetCreatorAndType(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:
raise IOError, "file '%s' does not exist" % 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 = {}
if self.path:
self.readwindowsettings()
@@ -93,8 +90,6 @@ class Editor(W.Window):
W.Window.__init__(self, bounds, self.title, minsize = (330, 120), tabbable = 0)
self.setupwidgets(text)
- if change > 0:
- self.editgroup.editor.textchanged()
if self.settings.has_key("selection"):
selstart, selend = self.settings["selection"]