+ // Detect the EOL: we use just the first line because there is not
+ // much we can do if the file uses inconsistent EOLs anyhow, we'd
+ // need to ask the user about the one we should really use and we
+ // don't currently provide a way to do it.
+ //
+ // We also only check for Unix and DOS EOLs but not classic Mac
+ // CR-only one as it's obsolete by now.
+ const wxString::size_type posLF = text.find('\n');
+ if ( posLF != wxString::npos )
+ {
+ // Set EOL mode to ensure that the new lines inserted into the
+ // text use the same EOLs as the existing ones.
+ if ( posLF > 0 && text[posLF - 1] == '\r' )
+ SetEOLMode(wxSTC_EOL_CRLF);
+ else
+ SetEOLMode(wxSTC_EOL_LF);
+ }
+ //else: Use the default EOL for the current platform.
+