Bug 389163

Summary: UrlFilter does not handle leading whitespace well
Product: [Applications] konsole Reporter: Kai Uwe Broulik <kde>
Component: generalAssignee: Konsole Developer <konsole-devel>
Status: RESOLVED FIXED    
Severity: normal CC: martin.sandsmark
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed In:
Attachments: Wrong underline

Description Kai Uwe Broulik 2018-01-18 14:19:28 UTC
Created attachment 109968 [details]
Wrong underline

When a line of text that contains a URL starts with spaces, the underline is incorrectly rendered and copying the URL doesn't copy the full URL.

To reproduce:
Open vi and type
"    http://www.example.com/"

Now hover the URL, note how the underline starts at the beginning of the line and is a lot shorter than it should be. The hover area is also placed incorrectly.
Copy the URL and note how it only copied "http://www.example"

This is especially noticeable in git log and Phabricator URLs. Git log indents the commit message and you cannot properly copy the "Differential Revision" URL.
Comment 1 Kurt Hindenburg 2018-01-21 22:35:18 UTC
Martin, do you have time to look at this?
Comment 2 Kurt Hindenburg 2018-02-12 18:41:38 UTC
2e86be05dc36189830c681fc476936ec65008e96 to trim leading whitespace caused this issue.  It happens regardless of if the option is set.
Comment 3 Kurt Hindenburg 2018-02-12 19:19:08 UTC
+    decoder.setLeadingWhitespace(false);


in Filter.cpp is the issue; changing it to true fixes this issue and the trimming still works.
Comment 4 Kurt Hindenburg 2018-02-13 21:36:33 UTC
Git commit f268b33d8440186fe51b712713830eb87f78b48e by Kurt Hindenburg.
Committed on 13/02/2018 at 21:34.
Pushed by hindenburg into branch 'master'.

Change defaults of keeping whitespace to true

Without this, any links that are on a line with leading spaces are
incorrectly handled.

M  +2    -2    src/Filter.cpp

https://commits.kde.org/konsole/f268b33d8440186fe51b712713830eb87f78b48e