Bug 352616

Summary: konsole sometimes copies long text as a single line
Product: [Applications] konsole Reporter: Paul Pogonyshev <pogonyshev>
Component: copy-pasteAssignee: Konsole Developer <konsole-devel>
Status: RESOLVED FIXED    
Severity: minor CC: mglb
Priority: NOR    
Version: 16.08.2   
Target Milestone: ---   
Platform: Debian testing   
OS: Linux   
Latest Commit: Version Fixed In: 18.04

Description Paul Pogonyshev 2015-09-12 12:44:19 UTC
This seems to happen only if copied text spans several pages.  I.e. if I use Ctrl+Shift+A to select everything and Ctrl+Shift+C to copy it to the clipboard, sometimes clipboard would contain one very long line instead of several pages (hunderds of lines) of text I see in Konsole.

Might have something to do with "Clear Scrollback and Reset" command I use often.

This is also a very old bug: I have a much older system at work and there it also sometimes happens.

Reproducible: Sometimes

Steps to Reproduce:
I can't spot a pattern when exactly it happens.
Comment 1 Paul Pogonyshev 2017-01-15 14:22:18 UTC
Certain way to reproduce it.

Make sure that "Select All" has a shortcut, e.g. Ctrl+Shift+A.

1. Open a new Konsole tab, window, or start a new application instance.
2. Type Enter so that there are two lines with the shell prompt.
3. Press Ctrl+Shift+A, i.e. the shortcut for "Select All".
4. Press Ctrl+Shift+C, i.e. the shortcut for "Copy".
5. Paste the copied text somewhere else.

The pasted text contains *single line* with two times the shell prompt at the beginning and many-many spaces at the end.
Comment 2 Mariusz Glebocki 2018-04-02 23:23:47 UTC
Confirming on master (fb812c75).

Select All starts working properly after any manual selection.
Comment 3 Kurt Hindenburg 2018-04-10 13:33:41 UTC
Git commit 10a41f41b090a485b041c83b891c78aacf034f80 by Kurt Hindenburg, on behalf of Mariusz Glebocki.
Committed on 10/04/2018 at 13:33.
Pushed by hindenburg into branch 'master'.

Always preserve line breaks on "Select All" action

Summary:
`_preserveLineBreaks` was set/reset only in mousePressEvent, and was
initially disabled. This led to use of the last setting from mouse
selection, or initial value, by "Select All".

Test Plan:
* Start Konsole
* Run `seq 100`
* (optional, test should give the same effect with and without this step)
  Press {key Ctrl} and select some text
* Edit → Select All
* Copy
* Paste in any text editor

**Expected result:** text should be in multiple lines (like on
    Konsole screen)
**Actual result:** text is pasted as one line

=== Regression tests ===

* Run `seq 100`
* Select few lines using mouse
* Copy
* Paste in any text editor

**Expected result:** text should be in multiple lines (like on
   Konsole screen)

* Run `seq 100`
* Press {key Ctrl} and select few lines using mouse
* Copy
* Paste in any text editor

**Expected result:** text should be pasted as one line

Reviewers: #konsole, hindenburg

Reviewed By: #konsole, hindenburg

Subscribers: hindenburg, #konsole

Tags: #konsole

Differential Revision: https://phabricator.kde.org/D12058

M  +1    -3    src/SessionController.cpp
M  +12   -1    src/TerminalDisplay.cpp
M  +5    -0    src/TerminalDisplay.h

https://commits.kde.org/konsole/10a41f41b090a485b041c83b891c78aacf034f80
Comment 4 Kurt Hindenburg 2018-04-10 14:09:17 UTC
Git commit 9fa8c11d1feab41ec5f114757e3acf27a428a117 by Kurt Hindenburg, on behalf of Mariusz Glebocki.
Committed on 10/04/2018 at 14:05.
Pushed by hindenburg into branch 'Applications/18.04'.

Always preserve line breaks on "Select All" action

Summary:
`_preserveLineBreaks` was set/reset only in mousePressEvent, and was
initially disabled. This led to use of the last setting from mouse
selection, or initial value, by "Select All".

Test Plan:
* Start Konsole
* Run `seq 100`
* (optional, test should give the same effect with and without this step)
  Press {key Ctrl} and select some text
* Edit → Select All
* Copy
* Paste in any text editor

**Expected result:** text should be in multiple lines (like on
    Konsole screen)
**Actual result:** text is pasted as one line

=== Regression tests ===

* Run `seq 100`
* Select few lines using mouse
* Copy
* Paste in any text editor

**Expected result:** text should be in multiple lines (like on
   Konsole screen)

* Run `seq 100`
* Press {key Ctrl} and select few lines using mouse
* Copy
* Paste in any text editor

**Expected result:** text should be pasted as one line

Reviewers: #konsole, hindenburg

Reviewed By: #konsole, hindenburg

Subscribers: hindenburg, #konsole

Tags: #konsole

Differential Revision: https://phabricator.kde.org/D12058

(cherry picked from commit 10a41f41b090a485b041c83b891c78aacf034f80)

M  +1    -3    src/SessionController.cpp
M  +12   -1    src/TerminalDisplay.cpp
M  +5    -0    src/TerminalDisplay.h

https://commits.kde.org/konsole/9fa8c11d1feab41ec5f114757e3acf27a428a117