[dev] [surf] [patch] strip uri leading whitespace when ctrl-p

From: 黄建忠 <jianzhong.huang_AT_i-soft.com.cn>
Date: Thu, 19 Oct 2017 12:47:41 +0800

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
_AT_@ -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
Received on Thu Oct 19 2017 - 06:47:41 CEST

This archive was generated by hypermail 2.3.0 : Thu Oct 19 2017 - 07:00:08 CEST