On Thu, Oct 19, 2017 at 12:19:13PM +0200, Quentin Rameau wrote: > Hello Jianzhong, > > It's easy for keyboard selection, but for mouse selection, precise > > positioning is a little bit difficult. > > I'd suggest you manage this outside of surf, either by training your > mouse skills, or by stripping those leading whitespaces in your > selecting application. >
No. For one thing, if he actually did this, I foresee a patch in the near future, this time for st, to strip white space off of the selection, and it will be rejected by you or someone like you, saying "this should be handled by the target application". Sending people from Pontius to Pilate like that is not very nice. For two, in this case the target application is the one that knows something about the text to be pasted, namely, that it's a URI. Since those never start with white space, surf is actually in the better position to perform any string manipulation, that if some other application had to try and guess at the intent of the user. > I'd suggest a simpler approach like this : > > diff --git a/surf.c b/surf.c > index 0f8b9c9..8a40a3b 100644 > --- a/surf.c > +++ b/surf.c > @@ -1685,9 +1685,14 @@ destroywin(GtkWidget* w, Client *c) > void > pasteuri(GtkClipboard *clipboard, const char *text, gpointer d) > { > - Arg a = {.v = text }; > - if (text) > + Arg a; > + > + if (text) { > + for (; *text && (*text == ' ' || *text == '\t'); ++text) > + ; > + a.v = text; > loaduri((Client *) d, &a); > + } > } > Thanks. I already thought the simple loop solution was never coming up. Ciao, Markus