This nightly still has the bug of inserting extra lines in abbreviations.
It looks like I made one to many assumptions in optimizing the patch for revision 8434 (http://svn.berlios.de/wsvn/codeblocks/?op=revision&rev=8434&peg=8484).
Well I just tried and I cannot reproduce.
This behavior will only occur during use of a custom abbreviation, and only if it was created with CR LF line endings.
The "correct" solution is probably to simply save in the format expected for input:
Index: src/plugins/abbreviations/abbreviations.cpp
===================================================================
--- src/plugins/abbreviations/abbreviations.cpp (revision 8478)
+++ src/plugins/abbreviations/abbreviations.cpp (working copy)
@@ -279,7 +279,6 @@
continue;
// convert non-printable chars to printable
code.Replace(_T("\\n"), _T("\n"));
- code.Replace(_T("\\r"), _T("\r"));
code.Replace(_T("\\t"), _T("\t"));
m_AutoCompleteMap[name] = code;
}
@@ -349,8 +348,9 @@
{
wxString code = it->second;
// convert non-printable chars to printable
+ code.Replace(_T("\r\n"), _T("\\n"));
code.Replace(_T("\n"), _T("\\n"));
- code.Replace(_T("\r"), _T("\\r"));
+ code.Replace(_T("\r"), _T("\\n"));
code.Replace(_T("\t"), _T("\\t"));
++count;
However, settings would still create problems if not converted:
Index: src/plugins/abbreviations/abbreviations.cpp
===================================================================
--- src/plugins/abbreviations/abbreviations.cpp (revision 8478)
+++ src/plugins/abbreviations/abbreviations.cpp (working copy)
@@ -279,8 +279,11 @@
continue;
// convert non-printable chars to printable
code.Replace(_T("\\n"), _T("\n"));
- code.Replace(_T("\\r"), _T("\r"));
+ code.Replace(_T("\\r"), _T("\r")); // should not exist ...
code.Replace(_T("\\t"), _T("\t"));
+ // ... but remove if it does (EOL style is matched just before code generation)
+ code.Replace(_T("\r\n"), _T("\n"));
+ code.Replace(_T("\r"), _T("\n"));
m_AutoCompleteMap[name] = code;
}
@@ -349,8 +352,9 @@
{
wxString code = it->second;
// convert non-printable chars to printable
+ code.Replace(_T("\r\n"), _T("\\n"));
code.Replace(_T("\n"), _T("\\n"));
- code.Replace(_T("\r"), _T("\\r"));
+ code.Replace(_T("\r"), _T("\\n"));
code.Replace(_T("\t"), _T("\\t"));
++count;
I've applied that one.
It looks like application might have been partial? Literal "\\r" strings from previous saves must be removed.
Index: src/plugins/abbreviations/abbreviations.cpp
===================================================================
--- src/plugins/abbreviations/abbreviations.cpp (revision 8485)
+++ src/plugins/abbreviations/abbreviations.cpp (working copy)
@@ -278,11 +278,11 @@
if (name.IsEmpty())
continue;
// convert non-printable chars to printable
- code.Replace(_T("\\n"), _T("\n"));
- code.Replace(_T("\\t"), _T("\t"));
- // ... but remove if it does (EOL style is matched just before code generation)
- code.Replace(_T("\r\n"), _T("\n"));
- code.Replace(_T("\r"), _T("\n"));
+ code.Replace(_T("\\n"), _T("\n"));
+ code.Replace(_T("\\t"), _T("\t"));
+ // should not exist, but remove if it does (EOL style is matched just before code generation)
+ code.Replace(_T("\\r\n"), _T("\n"));
+ code.Replace(_T("\\r"), _T("\n"));
m_AutoCompleteMap[name] = code;
}
@@ -351,9 +351,9 @@
{
wxString code = it->second;
// convert non-printable chars to printable
- code.Replace(_T("\r\n"), _T("\\n"));
+ code.Replace(_T("\r\n"), _T("\\n")); // EOL style will be matched just before code generation
code.Replace(_T("\n"), _T("\\n"));
- code.Replace(_T("\r"), _T("\\n")); // should not exist ...
+ code.Replace(_T("\r"), _T("\\n"));
code.Replace(_T("\t"), _T("\\t"));
++count;