Bug 82325 - linefeeds with following space are not removed from mmb-pasted urls
Summary: linefeeds with following space are not removed from mmb-pasted urls
Status: RESOLVED FIXED
Alias: None
Product: konqueror
Classification: Applications
Component: khtml (show other bugs)
Version: unspecified
Platform: Compiled Sources Linux
: NOR normal
Target Milestone: ---
Assignee: Konqueror Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-05-27 19:45 UTC by Leo Savernik
Modified: 2004-06-01 18:41 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Leo Savernik 2004-05-27 19:45:55 UTC
Version:            (using KDE KDE 3.2.2)
Installed from:    Compiled From Sources

In web fora or e-mails of certain MUAs, long urls are often broken across multiple lines.

When mmb-pasting, these URLs contain %0As. Those are removed iff no space follows the linebreak.

However, a khtml selected url will almost always contain linebreaks which have a following space.

F. i.:
http://.../very/lo
ng/url

selected from KHTML will be pasted as

http://.../very/lo%0A ng/url

on mmb. Note the space that is following the line break.

I propose that any space following a linebreak is removed.
Comment 1 Leo Savernik 2004-05-27 23:48:35 UTC
This isn't a wishlist item. The original feature (remove linefeeds from pasted urls) already works. This report is about a special circumstance in which linefeed removal fails.

Maybe the wording in the summary is misleading. I'll change it to reflect the bug-like nature of this report.
Comment 2 Waldo Bastian 2004-06-01 18:41:51 UTC
CVS commit by waba: 

Remove linefeeds and any whitespace surrounding it from pasted URLs (BR82325)
CCMAIL: 82325-done@bugs.kde.org


  M +3 -0      browserextension.cpp   1.63


--- kdelibs/kparts/browserextension.cpp  #1.62:1.63
@@ -25,4 +25,5 @@
 #include <qobjectlist.h>
 #include <qmetaobject.h>
+#include <qregexp.h>
 #include <qstrlist.h>
 #include <qstylesheet.h>
@@ -430,4 +431,6 @@ void BrowserExtension::pasteRequest()
     QCString plain("plain");
     QString url = QApplication::clipboard()->text(plain, QClipboard::Selection).stripWhiteSpace();
+    // Remove linefeeds and any whitespace surrounding it.
+    url.replace(QRegExp("[\\ ]*\\n+[\\ ]*"),"");
 
     // Check if it's a URL