cboody wrote:
... I do not know the code in that area of the program, but will try to contact some folks and see what I can see....
There is funny that source code itself has the same problem (i.e. mixed dos/unix newlines)

.
Also I'm not sure that it is a good idea to open a text file as a binary file - it bring more troubles because of using
os.linesep and/or explicit separating/including '\r' for DOS/Windows:
Quote:
Do not use os.linesep as a line terminator when writing files opened in text mode (the default); use a single '\n' instead, on all platforms.
Which doesn't have to be used when file is opened as text file.
EDIT: I'm not familiar with Python, but this should be minimal solution to me:
Code:
--- easy_abc.py.orig 2012-07-23 18:50:58.000000000 +0200
+++ easy_abc.py 2013-07-08 21:44:44.000000000 +0200
@@ -1862,7 +1862,11 @@
self.tune_list.SetAutoLayout(True)
self.editor = stc.StyledTextCtrl(self, -1)
self.editor.SetCodePage(stc.STC_CP_UTF8)
-
+ if wx.Platform == "__WXMSW__":
+ self.editor.SetEOLMode(stc.STC_EOL_CRLF) # for DOS/Windows
+ else:
+ self.editor.SetEOLMode(stc.STC_EOL_LF) # almost every OS except DOS/Windows
+
self.music_pane = MusicScorePanel(self, lambda: self.zoom_factor, self.settings['can_draw_sharps_and_flats'])
self.music_pane.SetBackgroundColour((255, 255, 255))
self.music_pane.OnNoteSelectionChangedDesc = self.OnNoteSelectionChangedDesc
@@ -3042,12 +3046,13 @@
wx.MessageBox(_("Could not find file.\nIt may have been moved or deleted. Choose File,Open to locate it."), _("File not found"), wx.OK)
return
- if wx.Platform == "__WXMAC__":
- text = text.replace('\r\n', '\r')
- else:
+ # '\r' was used by pre-OS X Mac. All Macs with OS X has '\n' as newline as well as unix(-like) systems (incl. Linux)
+ if wx.Platform == "__WXMSW__":
text = re.sub('\r+', '\r', text)
if not '\n' in text:
- text = text.replace('\r', '\r\n')
+ text = text.replace('\r', '\r\n')
+ else:
+ text = text.replace('\r\n', '\n')
self.current_file = filepath
self.document_name = os.path.basename(filepath)
But still, better should be treat with ABC files as with text files, not binary files.