none
How to return to Plain Text in a Post After Using Code Formatting Tool RRS feed

  • Question

  • This is probably something incredibly simple, but it totally escapes me.

    When I reply to a forum post and use the code formatting tool to put sample code in the post, text I attempt to add after the code block always appears in a new outline block (like another code block). Each time I hit Enter to start a new paragraph, a new block outline appears.

    Like this (ignore code, it's here for illustration only):

     

    #include <iostream>
    #include <string>
    #include <sstream>
    
    using namespace std;
    
    int main() 
    {
    
    	 string input = "";
    
    	 // How to get a number.
    	 int myNumber = 0;
    
    	 while (true) 
    	 {
    		 cout << "Please enter a valid number: ";
    		 getline(cin, input);
    
    		 // This code converts from string to number safely.
    		 stringstream myStream(input);
    		 string zz = myStream.str();
    		 //int zzz = myStream;
    		 cout << zz << " " << myStream << endl;
    		 if (myStream >> myNumber)
    			break;
    		 cout << "Invalid number, please try again" << endl;
    	 }
    	 cout << "You entered: " << myNumber << endl << endl;
    	 char cont;
    	 cout << "Hit Enter to quit." << endl;
    	 cont = cin.get();
    }
    
    Now I want to go back to text input, but what I type is in a block outline.
    
    And again!
    
    How to escape?
    

    Now, when I edit, I'm back in text mode, and I realize it *looks* OK when posted. But, when trying to type text after a code block, the line wrap no longer works and I have to hit enter to go to a new line.  



    • Edited by pvdg42 Wednesday, May 11, 2011 12:42 AM typo
    Wednesday, May 11, 2011 12:36 AM

Answers

  • here is an example
    #include <iostream>
    #include <string>
    #include <sstream>
    
    using namespace std;
    
    int main() 
    {
    
    
    You are right, you can't easily do this...I have logged a bug. To work around this, after inserting the code you can go into html mode (the html toolbar in the editor) and type after the </pre> element. Sorry about this, it is annoying for sure.

    Community Forums Program Manager
    • Proposed as answer by Brent SerbusEditor Wednesday, May 11, 2011 4:45 PM
    • Marked as answer by pvdg42 Wednesday, May 11, 2011 6:31 PM
    Wednesday, May 11, 2011 4:39 PM
    Answerer

All replies

  • You should use the Community NNTP bridge to avoid such problems ;)
    http://communitybridge.codeplex.com/


    Jochen Kalmbach (MVP VC++)
    Wednesday, May 11, 2011 7:19 AM
  • here is an example
    #include <iostream>
    #include <string>
    #include <sstream>
    
    using namespace std;
    
    int main() 
    {
    
    
    You are right, you can't easily do this...I have logged a bug. To work around this, after inserting the code you can go into html mode (the html toolbar in the editor) and type after the </pre> element. Sorry about this, it is annoying for sure.

    Community Forums Program Manager
    • Proposed as answer by Brent SerbusEditor Wednesday, May 11, 2011 4:45 PM
    • Marked as answer by pvdg42 Wednesday, May 11, 2011 6:31 PM
    Wednesday, May 11, 2011 4:39 PM
    Answerer
  • Thanks, Brent!

    I appreciate the response and the bug report.

    Wednesday, May 11, 2011 6:33 PM
  • I've noticed this problem also and my solution was the same as suggested by Brad. I guess I should have also complained.
    For every expert, there is an equal and opposite expert. - Becker's Law


    My blog
    Wednesday, May 11, 2011 11:18 PM
    Moderator
  • I notice that if I remove any trailing carriage return after the last line of code, I do not have this problem. I always make sure the insertion point is at the end of the last line of code (not on the next line) before clicking insert. Then I always position the insertion point at the end and enter a carriage return. Otherwise, there is no space between the code block and my next comment or my signature.

     


    Richard Mueller - MVP Directory Services
    Friday, May 13, 2011 3:39 PM
    Moderator