Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

copy and paste of long lines

2009-06-08
2013-10-17
  • James Bigler
    James Bigler
    2009-06-08

    If I have a command that wraps the line, when I try to paste it back in console I get the newline in it:

    [131] $ echo "this is a really long command that keeps going and going and going and going and going and goi
    ng and going and going"
    this is a really long command that keeps going and going and going and going and going and going and going and going

    [132] $ echo "this is a really long command that keeps going and going and going and going and going and goi
    > ng and going and going"
    this is a really long command that keeps going and going and going and going and going and goi
    ng and going and going

    I've tried checking and unchecking "Don't wrap long lines" and "Trim trailing spaces", but no combination of those options seems to help.

    I'm using 2.00.144

     
    • James Bigler
      James Bigler
      2009-07-10

      OK, I think I discovered a little more information.

      First off this seems to affect the cygwin terminal much more than the cmd.exe terminal, because the defaults used for cygwin put an extra space at the end of each command line while type.  When you copy the text, Console2 sees the space and turns it into a newline.

      Is there no way to determine what is a space and what is a newline from the terminal buffer?

       
  • Scott Columbus
    Scott Columbus
    2010-11-19

    A workaround that did the trick for me:

    Add

    export TERM=linux

    to your .bashrc under cygwin. This way, bash doesn't leave a blank at the end of each screen buffer line and "Don't wrap long lines" works much better (I didn't analyze why bash does that, I just discovered that by accident and was happy that it worked :-).

    You still will have problems with long lines that contain spaces and those spaces being located just at the end of a screen buffer line. Maybe the Console2's "wrapping algorithm" could be changed to detect a line break only if there are 3 or more spaces at the end of a screen buffer line. I built a "hacked" version of Console2 that does this and it works great for me, no problems with cutting/pasting long command lines any more. Maybe one could integrate this into the "real" Console2 source?

    Best regards,
    Scott

     
    • CSandwith
      CSandwith
      2013-10-17

      This worked fantastically for me. I realize that I'm straight Necromancing an old discussion, but, seriously guys, how is this fix not in Console yet?

      (Not trying to be mean. Console is one of the greatest Utility apps I've ever found, and makes Cygwin significantly more usable...But I just burned 45 minutes working with a lowly QA guy trying to figure out why a curl command was failing...and it was because of a CRLF in the middle of a line I copied for him. I added "export TERM=linux" to my .bashrc and hey look, problem solved.)