News:

When registered with our forums, feel free to send a "here I am" post here to differ human beings from SPAM bots.

Main Menu

The 23 October 2012 build (8476) is out.

Started by killerbot, October 23, 2012, 09:43:17 PM

Previous topic - Next topic

stefanos_

#15
Can someone see this old issue http://forums.next.codeblocks.org/index.php/topic,16560.msg112659.html#msg112659 :/ ? It's still there and I cannot work like this. The hint is really annoying like that!

Version: svn-8477 (self-compiled as always)
OS: GNU / Linux Debian wheezy (32-bit)
Compiler: GCC-4.6

carra

Quote from: MortenMacFly on October 27, 2012, 05:20:58 PMWe will take care... (maybe its already resolved in SVN...)
Glad to hear that Morten :)

MortenMacFly

Quote from: carra on October 27, 2012, 10:41:39 PM
Glad to hear that Morten :)
Well I just tried and I cannot reproduce. There has been a patch applied recently - if you are willing, try with t self-compiled version from trunk (to wait for the next nightly). Nag me again if it isn't resolved.

Maybe in between state again exactly what to do to reproduce, including:
- version of C::B
- platform
- editor settings
- abbreviations
- steps you do to achieve the unwanted result.

BTW: Are you sure your abbreviations are setup correctly? I.e. are the line feeds OK there, too?
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: [url="https://www.codeblocks.org/docs/main_codeblocks_en.html"]https://www.codeblocks.org/docs/main_codeblocks_en.html[/url]
C::B FAQ: [url="https://wiki.codeblocks.org/index.php?title=FAQ"]https://wiki.codeblocks.org/index.php?title=FAQ[/url]

Alpha

Quote from: carra on October 27, 2012, 10:55:05 AM
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.
Quote from: MortenMacFly on October 27, 2012, 10:49:19 PM
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;

carra

Quote from: Alpha on October 28, 2012, 02:56:40 AMThis behavior will only occur during use of a custom abbreviation, and only if it was created with CR LF line endings.
Yes, this makes sense: I'm under Windows and my abbreviations are custom  :D

MortenMacFly

Quote from: Alpha on October 28, 2012, 02:56:40 AM
The "correct" solution is probably to simply save in the format expected for input:
This sounds reasonable and also explains why I was unable to reproduce. I've applied that one. Thanks! :-)
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: [url="https://www.codeblocks.org/docs/main_codeblocks_en.html"]https://www.codeblocks.org/docs/main_codeblocks_en.html[/url]
C::B FAQ: [url="https://wiki.codeblocks.org/index.php?title=FAQ"]https://wiki.codeblocks.org/index.php?title=FAQ[/url]

MortenMacFly

Quote from: carra on October 28, 2012, 01:20:16 PM
Yes, this makes sense: I'm under Windows and my abbreviations are custom  :D
The next nightly (not the one of today) is worth a try for you... or you self-compile is from trunk now.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: [url="https://www.codeblocks.org/docs/main_codeblocks_en.html"]https://www.codeblocks.org/docs/main_codeblocks_en.html[/url]
C::B FAQ: [url="https://wiki.codeblocks.org/index.php?title=FAQ"]https://wiki.codeblocks.org/index.php?title=FAQ[/url]

Alpha

Quote from: MortenMacFly on October 28, 2012, 02:45:14 PM
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;

oBFusCATed

If you ask me the best solution is to always save it in \n or \n\r mode and apply the proper mode when displaying, applying the abbreviation.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Alpha

Quote from: oBFusCATed on October 29, 2012, 07:24:57 PM
If you ask me the best solution is to always save it in \n or \n\r mode and apply the proper mode when displaying, applying the abbreviation.
Um... if I understand you correctly, I think that is exactly what I did?

oBFusCATed

(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]