[Patch] Launching URLs in gnome-terminal

I've added a feature to gnome-terminal that allows a right-click on a
URL to launch the URL (using gnome_url_show) through an item in the
popup menu.  I added a "Launch URL" command to the popup menu and made
it disabled (not sensitive) when the click was not on a valid URL.

I made a number of attempts to pass the URL to be launched to the
callback function for the menu item using user_data, but I couldn't get
it to work, so I just did it using a global variable.  If there is a
better way to do this, I'm certainly curious to hear it.  (In the
current patch there's an extra variable, launch_url, that remains from
those attempts, and should be removed if there isn't a better way.)

I think I'm done tinkering with the URL finding mechanism for now.  It
finds both URLs within text.  (It is quite liberal on what it considers
a URL, since I think it is gnome_url_show's job, or the browser's, to
decide what is a valid URL scheme.)  It uses whitespace and the
characters "<> as delimiters to mark the ends of a URL (' is valid
within a URL so I can't use that!).  It also finds URLs within <URL:
... > as described in the appendix of RFC 1738.  These can be spread
over multiple lines, and whitespace is collapsed to nothing.  It
currently only checks 5 lines on each side (how long can URLs be?).

The only problem I currently know of is that it doesn't handle tab
characters very well when figuring out what text was clicked on, since
it assumes they only take up one character.  However, I don't think
this is serious because tabs aren't sent raw very often (i.e., you'd
need to use cat rather than less to display raw tabs).  I don't really
want to fix this, but I probably could.

Since I don't want to fill up people's mailboxes, the patch is
currently at


(And I just right clicked on the URL to make sure it is correct. :-)

I hope you find this patch useful and consider including it in
gnome-terminal.  I don't have much programming experience, so it
should be looked at carefully.  However, I do find it very useful.


L. David Baron     Rising Sophomore, Harvard     dbaron@fas.harvard.edu
Links, SatPix, CSS, etc.        < http://www.fas.harvard.edu/~dbaron/ >
Summer Intern, Netscape - however, opinions are entirely my own, etc.
WSP CSS AC                         < http://www.webstandards.org/css/ >

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]