Bug 510559 - Copy/paste problems with mouse selection
Summary: Copy/paste problems with mouse selection
Status: REPORTED
Alias: None
Product: konsole
Classification: Applications
Component: copy-paste (other bugs)
Version First Reported In: unspecified
Platform: Debian unstable Linux
: NOR minor
Target Milestone: ---
Assignee: Konsole Developer
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2025-10-13 09:25 UTC by antonio
Modified: 2025-10-13 09:27 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments
1 ok (7.04 KB, image/png)
2025-10-13 09:26 UTC, antonio
Details
2 bad (9.58 KB, image/png)
2025-10-13 09:26 UTC, antonio
Details
3 bad (14.62 KB, image/png)
2025-10-13 09:26 UTC, antonio
Details

Note You need to log in before you can comment on or make changes to this bug.
Description antonio 2025-10-13 09:25:54 UTC
When using Konsole, I sometimes need to select text to copy and paste into other applications. I've noticed that using the mouse selection saves the text to the "clipboard" widget, but I often notice the unwanted "\n" being saved.

I've attached some examples:

If I run this command from Bash, I get:

----
$ echo -e "\n\nline1\nline2\nline3\n\nline4\n\nline5\n\n\n"


line1
line2
line3

line4

line5



----

Now, if I try to select lines 1 through 5 and if I'm very precise with my mouse movements, I get the correct copy (Attachment 1 [details]). Very often, however, just moving the mouse slightly up or down selects unwanted newlines (Attachment 2 [details]), without being visually aware of it, since a blank line contains no text and therefore isn't highlighted with color.

Other times, after copying, another line is automatically copied with only the newline (Annex 3), when the intent was to copy a user name, password, or command, for example, to paste into a web text box or another application.

This may seem harmless, but doing so selects the last copied line, thus the newline (and not the data you were trying to copy), and this creates problems when pasting into the application, ruining the username, password, and everything else. Therefore, you need to check what was actually copied each time and correct it if necessary. Otherwise, you'll have to copy and paste again.

In my opinion, the newlines before and after the text should be removed. This would solve the problem.

It would be even better if there was an option that trims the control codes before and after the copied text. Anyone interested in this feature can enable it.

Thanks,
Antonio

SOFTWARE/OS VERSIONS
Operating System: Debian GNU/Linux 13
KDE Plasma Version: 6.3.6
KDE Frameworks Version: 6.18.0
Qt Version: 6.9.2
Graphics Platform: Wayland
Comment 1 antonio 2025-10-13 09:26:20 UTC
Created attachment 185729 [details]
1 ok
Comment 2 antonio 2025-10-13 09:26:37 UTC
Created attachment 185730 [details]
2 bad
Comment 3 antonio 2025-10-13 09:26:49 UTC
Created attachment 185731 [details]
3 bad