(gtk3) Cleanup regex lboundry/rboundry and posix/gnu
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Terminator |
Fix Released
|
Undecided
|
MattRose |
Bug Description
Bringing over from bug 1030562 comments 59-71.
There's a "FIXME FOR GTK3" in the source: There's a complicated boolean "try_posix_regexp" being platform dependant, and then based on this some weird values are assigned to lboundry/rboundry, which are later overwritten to be empty because that's how it seemed to work for me.
Probably this whole thing can be thrown out.
Or at least it should be fixed – I changed these for a reason, they don't work in their current form.
It's really ugly to guess the engine behind GLib based on the platform, you just can't guarantee to get it right. Regexps that aren't compatible across engines should hence be avoided.
The goal I believe is to make sure the URL is an entire "word", so that http://
Another tricky but often occurring case is that the string "See http://
Actually: now it looks to me that the "posix" definition of l/rboundry works for me (at least on my GLib) too, so we don't need the try_posix_regexp variable and the branch, just this "[[:<:]]" and "[[:>:]]" definition of l/rboundry and we're hopefully good.
See http://
Also see bug 1514578 and the gnome-terminal regex rewrite bug referred from that. Note that gnome-terminal doesn't care if the URL is prefixed by alphanumerical stuff and still recognizes the URL – hmmmm, I might think about refusing them as per terminator-gtk2.
Action plan for now: Remove the boolean, go for the 'posix'-kind of definition of l/rboundry and see if it breaks.
Related branches
description: | updated |
Changed in terminator: | |
status: | New → Fix Committed |
Changed in terminator: | |
status: | Fix Committed → Fix Released |
I tried the action plan. The "posix" definition for l/r boundry breaks how I would think url detection should work.
Got rid of l/r boundry and any kind of try_posix_regexes references.
According to my reading of Glib documentation, this will use gnulib and/or PCRE regexes if they have been compiled into Glib, if not they will fall back to using posix extended regexes.
All the code that recognizes basic urls is written with posix-compatible regexes. There are some plugins that use PCRE style \b regexes, but those would never have worked.
I'll throw a patch in tonight. I've tested it and it works great.