When using ctrl-p to load uri from clipboard, it's better to strip the
leading whitespace.

For example, to select/copy a uri  from text in terminal and paste to
surf, currently it need to be very careful not to include any whitespace
before the uri.

It's easy for keyboard selection, but for mouse selection, precise
positioning is a little bit difficult.


patch as below:

diff -Nur surf/surf.c surfn/surf.c
--- surf/surf.c 2017-10-17 13:58:00.636699137 +0800
+++ surfn/surf.c    2017-10-17 13:58:29.440798516 +0800
@@ -1707,7 +1707,8 @@
 void
 pasteuri(GtkClipboard *clipboard, const char *text, gpointer d)
 {
-   Arg a = {.v = text };
+   char *trimed = g_strstrip(g_strdup(text));
+   Arg a = {.v = trimed };
    if (text)
        loaduri((Client *) d, &a);
 }


-- 
Huang JianZhong





Reply via email to