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

2017-10-19 Thread Markus Wichmann
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 stripp

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

2017-10-19 Thread Quentin Rameau
> On Thu, 19 Oct 2017 17:36:15 +0200 > Quentin Rameau wrote: > > Hey Quentin, > > > There's enough pollution on the list. > > that's true, but it was a genuine question both Kamil and I had, and > it served the question. If GNOME for some reason had an internal > ref-counter for objects alloc

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

2017-10-19 Thread Laslo Hunhold
On Thu, 19 Oct 2017 17:36:15 +0200 Quentin Rameau wrote: Hey Quentin, > There's enough pollution on the list. that's true, but it was a genuine question both Kamil and I had, and it served the question. If GNOME for some reason had an internal ref-counter for objects allocated with g_strdup(),

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

2017-10-19 Thread Quentin Rameau
Please folks, don't start yet another endless diverging thread about how *thing* is ugly and all. There's no need to write so much about what g_strdup() is, seriously, were you born yesterday? Keep the threads about what they are initially, start your own apart if you want to diverge from it. Th

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

2017-10-19 Thread Laslo Hunhold
On Thu, 19 Oct 2017 15:17:43 +0200 Laslo Hunhold wrote: > As a small fun part, there's also a function g_malloc0_n() just below > g_malloc_n() which does exactly the same (the code is identical). I > think they created g_malloc0_n() to be a "safe" interface while > keeping g_malloc_n() for "perfo

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

2017-10-19 Thread Anselm Garbe
Hi Laslo, On 19 October 2017 at 15:17, Laslo Hunhold wrote: [..] > Alright, we are now at g_malloc(), and as we can see in line 94 it's > just malloc() with some GNOME-vomit around it. > > TL;DR: g_strdup() == strdup() > > Reading this code is a real pain. It's like diving into a fractal, > where

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

2017-10-19 Thread Silvan Jegen
On Thu, Oct 19, 2017 at 3:43 PM, Kamil Cholewiński wrote: > Nice digging, thanks Laslo. > >> TL;DR: g_strdup() == strdup() > > And this is why the world needs suckless. > > Who cares if it's open source, if the code is incomprehensible? I care, because if it wasn't open source you couldn't see ho

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

2017-10-19 Thread Kamil Cholewiński
Nice digging, thanks Laslo. > TL;DR: g_strdup() == strdup() And this is why the world needs suckless. Who cares if it's open source, if the code is incomprehensible? <3,K.

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

2017-10-19 Thread Laslo Hunhold
On Thu, 19 Oct 2017 11:11:13 +0200 Kamil Cholewiński wrote: Dear Kamil, > > - Arg a = {.v = text }; > > + char *trimed = g_strstrip(g_strdup(text)); > > + Arg a = {.v = trimed }; > > Doesn't this leak memory via strdup on every paste? Or does Gobject do > some automagic ref counting or wh

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

2017-10-19 Thread Quentin Rameau
Hello Jianzhong, > When using ctrl-p to load uri from clipboard, it's better to strip the > leading whitespace. I'm not sure it is. > 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.

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

2017-10-19 Thread Kamil Cholewiński
On Thu, 19 Oct 2017, Kamil Cholewiński wrote: >> - Arg a = {.v = text }; >> + char *trimed = g_strstrip(g_strdup(text)); >> + Arg a = {.v = trimed }; > > Doesn't this leak memory via strdup on every paste? Or does Gobject do > some automagic ref counting or whatnot? (Ignore, didn't see the

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

2017-10-19 Thread Kamil Cholewiński
> - Arg a = {.v = text }; > + char *trimed = g_strstrip(g_strdup(text)); > + Arg a = {.v = trimed }; Doesn't this leak memory via strdup on every paste? Or does Gobject do some automagic ref counting or whatnot?

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

2017-10-19 Thread 黄建忠
在 2017年10月19日 16:00, Hiltjo Posthuma 写道: > 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

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

2017-10-19 Thread Hiltjo Posthuma
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 >