Bug 412479

Summary: "trim leading spaces" eats empty lines
Product: [Applications] konsole Reporter: Oswald Buddenhagen <ossi>
Component: copy-pasteAssignee: Konsole Developer <konsole-devel>
Status: RESOLVED FIXED    
Severity: normal CC: mglb
Priority: NOR    
Version: 19.08.1   
Target Milestone: ---   
Platform: Debian unstable   
OS: Linux   
Latest Commit: Version Fixed In: 19.08.2

Description Oswald Buddenhagen 2019-09-30 10:39:10 UTC
enabling "trim leading spaces" in the profile leads to empty lines between paragraphs being discarded from the selection, which is certainly not expected for an option with this name.

i also found it somewhat unhelpful that it eats leading spaces on each line rather than just the first one, but that's at least technically correct, as it's consistent with what "trim trailing spaces" does.
Comment 1 Mariusz Glebocki 2019-10-01 05:32:31 UTC
Confirmed on master
Comment 2 Kurt Hindenburg 2019-10-05 16:51:58 UTC
I wonder if something in Qt changed since this went in.

This appears to work - we don't want newlines \xa to be counted as spaces.

-            if (!QChar(characterBuffer[spacesCount].character).isSpace()) {
+            const QChar currentChar = characterBuffer[spacesCount].character;
+            if (currentChar == QChar(QLatin1Char('\xa')) || !currentChar.isSpace()) {
Comment 3 Mariusz Glebocki 2019-10-05 17:19:19 UTC
QChar::isSpace includes new lines at least since Qt4.

Fix: https://invent.kde.org/kde/konsole/merge_requests/37
Comment 4 Kurt Hindenburg 2019-10-05 18:09:53 UTC
thanks - there should be tests for these so they don't get overlooked - not even sure that's possible ATM
Comment 5 Mariusz Glebocki 2019-10-05 20:15:08 UTC
Git commit ce2029ed75b624a9f9abb5e27428bcb51ad1e5b5 by Mariusz Glebocki.
Committed on 05/10/2019 at 17:13.
Pushed by mglebocki into branch 'master'.

Keep empty lines when "trim leading spaces" is enabled

M  +1    -1    src/Screen.cpp

https://invent.kde.org/kde/konsole/commit/ce2029ed75b624a9f9abb5e27428bcb51ad1e5b5
Comment 6 Mariusz Glebocki 2019-10-05 20:15:12 UTC
Git commit ce2029ed75b624a9f9abb5e27428bcb51ad1e5b5 by Mariusz Glebocki.
Committed on 05/10/2019 at 17:13.
Pushed by scmsync into branch 'master'.

Keep empty lines when "trim leading spaces" is enabled

M  +1    -1    src/Screen.cpp

https://commits.kde.org/konsole/ce2029ed75b624a9f9abb5e27428bcb51ad1e5b5
Comment 7 Kurt Hindenburg 2019-10-05 21:12:45 UTC
Git commit 67a29e4134ff80cb64291b84ebeea27a1b247fd5 by Kurt Hindenburg, on behalf of Mariusz Glebocki.
Committed on 05/10/2019 at 21:09.
Pushed by hindenburg into branch 'Applications/19.08'.

Keep empty lines when "trim leading spaces" is enabled
(cherry picked from commit ce2029ed75b624a9f9abb5e27428bcb51ad1e5b5)

M  +1    -1    src/Screen.cpp

https://invent.kde.org/kde/konsole/commit/67a29e4134ff80cb64291b84ebeea27a1b247fd5
Comment 8 Kurt Hindenburg 2019-10-05 21:12:49 UTC
Git commit 67a29e4134ff80cb64291b84ebeea27a1b247fd5 by Kurt Hindenburg, on behalf of Mariusz Glebocki.
Committed on 05/10/2019 at 21:09.
Pushed by scmsync into branch 'Applications/19.08'.

Keep empty lines when "trim leading spaces" is enabled
(cherry picked from commit ce2029ed75b624a9f9abb5e27428bcb51ad1e5b5)

M  +1    -1    src/Screen.cpp

https://commits.kde.org/konsole/67a29e4134ff80cb64291b84ebeea27a1b247fd5