On Thu, Oct 19, 2017 at 12:47:41PM +0800, 黄建忠 wrote: > 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 > >
Hey, Doesn't this leak memory? (NOTE: for single-use programs it is ok to not free memory at the end). -- Kind regards, Hiltjo