Bug 69403

Summary: copy/paste sometimes inserts newlines when it shouldn't
Product: [Applications] konsole Reporter: rfc469
Component: generalAssignee: Konsole Developer <konsole-devel>
Status: RESOLVED NOT A BUG    
Severity: normal CC: bugz57
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Gentoo Packages   
OS: Linux   
Latest Commit: Version Fixed In:

Description rfc469 2003-11-30 23:32:34 UTC
Version:            (using KDE KDE 3.1.4)
Installed from:    Gentoo Packages
OS:          Linux

When copying a line of text from one konsole that wraps (it is longer than my width which is 80 chars) and pasting into another konsole, in some cases there is an extra newline inserted- so that the single long line becomes 2 lines.

When running vim in both konsoles, this always happens when my TERM is set to linux.  It doesn't happen if my TERM is set to vt100 or xterm.

When copying the output of "more" or "less" in one konsole, and pasting into vim in the second konsole, this always happens.

This doesn't happen with gnome-terminal.

I apologize if this isn't specifically a konsole problem.  Thanks!
Comment 1 Thiago Macieira 2003-12-01 01:01:04 UTC
For the less part, konsole doesn't know it's a single long line because less does the breaking.

I don't know Konsole code internally, but it seems to me that it knows internally which lines were wrapped by itself and what got line-wrapped by a LF.

In other words, less sends a line-break, so Konsole isn't wrong in giving you two distinct lines.
Comment 2 Thorsten Holtkaemper 2004-03-05 14:42:46 UTC
Bug seems to be a duplicate of Bug 64295 or vice versa.
Comment 3 Tommi Tervo 2004-03-05 15:03:01 UTC
*** Bug 64295 has been marked as a duplicate of this bug. ***
Comment 4 Holger Joest 2004-04-15 12:06:57 UTC
Maybe that less sends a line-break and that Konsole isn't wrong to paste
that line-break. But the same problem occurs with many other terminal
applications (including vim), and if I run those in xterm, pasting wrapped
lines works perfectly well. I'm not absolutely sure, but I believe to
remember that even Konsole could do that better in previous versions.
Comment 5 rfc469 2004-05-16 18:32:25 UTC
Updating the bug report, as requested.  This is still a problem in KDE 2.2.2.  Thanks.
Comment 6 rfc469 2004-05-16 18:40:46 UTC
Argh I mean KDE 3.2.2 of course.  Thanks.
Comment 7 Kurt Hindenburg 2004-06-07 05:33:20 UTC
This also works for me.  Perhaps some screenshots would help clarify the bug.

A 100% reproducable case would be helpful as well.
Comment 8 rfc469 2004-06-13 21:01:17 UTC
>When running vim in both konsoles, this always happens when my TERM is set to
>linux.  It doesn't happen if my TERM is set to vt100 or xterm.

I just tried this again and it still occurs for me.  I'm not sure I understand- you're saying you don't observe this behavior?

1. Open 2 konsoles, set TERM=linux in both and run vim in both.
2. From the vim session in konsole #1 copy and paste a wrapped line into the vim session in konsole #2.  There will be an extra newline inserted in konsole #2.

I'm not sure what this means, other than the TERM setting is possibly involved.

>When copying the output of "more" or "less" in one konsole, and pasting into
>vim in the second konsole, this always happens.

Again I'm not sure I understand- you don't observe this?  As other people have pointed out, "more" and "less" are sending a line-break.

1. Open 2 konsoles.  In konsole #1 "less" a file with a wrapped line and in konsole #2 run vim.
2. Copy and paste a wrapped line from konsole #1 into the vim session in konsole #2.  There will be a newline inserted.

Perhaps this behavior of konsole is technically correct- but gnome-terminal is smart enough to NOT insert a newline.  This is something people do all the time, copy and paste from "more" or "less" into a vim session.

>This doesn't happen with gnome-terminal.

And unfortunately I can't test this anymore as I don't have gnome installed.  Perhaps someone else with gnome-terminal installed could confirm this?

Thanks!
Comment 9 Volker Kuhlmann 2004-06-24 11:22:13 UTC
> Perhaps this behavior of konsole is technically correct- but
> gnome-terminal is smart enough to NOT insert a newline.  This is
> something people do all the time, copy and paste from "more" or "less"
> into a vim session.

Copy or paste into anything else, it doesn't have to be a vim session.
Any other editor window will do. Whether konsole's behaviour is
technically correct is the wrong approach, it's a pain. The old xterm
never had any problems with this, konsole ought to not be worse than
xterm. Dunno how xterm does it though.

Volker

Comment 10 Jozef Kosoru 2004-09-16 22:16:36 UTC
I can reproduce this bug in kconsole in KDE 3.2.3, but I believe that this is a new bug. I didn't encouter this grave problem before.
Comment 11 Kurt Hindenburg 2005-01-26 16:44:50 UTC
From Help file:
"Normally, new-line characters are inserted at the end of each line selected. This is best for cut and paste of source code, or the output of a particular command. For ordinary text, the line breaks are often not important. One might prefer, however, for the text to be a stream of characters that will be automatically re-formatted when pasted into another application. To select in text-stream mode, hold down the Ctrl key while selecting normally."

There is also a 'tip of the day' about this...
"...that pressing Ctrl while selecting text will let Konsole ignore line breaks? "
Comment 12 Matthew Woehlke 2008-03-03 18:18:12 UTC
*** Bug 64295 has been marked as a duplicate of this bug. ***