Manish-Jaiswal / mintty

Automatically exported from code.google.com/p/mintty
GNU General Public License v3.0
0 stars 0 forks source link

Improve URL recognition in word selection #276

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
Some URLs do not work.

Like this one:

http://scsys.co.uk:8002/117435

Or this one:

http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=dbsrgits/DBIx-Class-Schema-Loader
.git;a=commitdiff;h=053163c206fd261947174c7990697405c4380f00

It seems colons and semicolons are not detected.

KiTTy and iterm2 have good URL regexes you could steal.

Original issue reported on code.google.com by rkito...@gmail.com on 29 Jun 2011 at 5:26

GoogleCodeExporter commented 8 years ago
Remember that the Ctrl+click feature isn't just designed for URLs, but also 
filenames. 

Colons are included to the left of the click point, but not to the right, and 
the point of that is to pick out filenames in grep output and in messages with 
'<filename>:<line>' style locations. Hence you can get the first URL to work by 
clicking past the colon.

Semicolons so far are excluded because they separate commands (and hence also 
filenames) in the shell. However, I wasn't aware that semicolons could appear 
in URLs in place of ampersands. Therefore I better change it so that they're 
accepted inside a string but not at either end of one, going by the theory that 
a command-separating semicolon would usually be followed by a space.

The word selection logic (which is what's used here) could be more clever by 
making the treatment of colons and semicolons dependent on whether the start of 
the string looks like a URL, but that would require some redesign. It currently 
works by starting at the click position and extending the selection left and 
right character-by-character, looking at each character on its own.

Original comment by andy.koppe on 2 Jul 2011 at 11:26

GoogleCodeExporter commented 8 years ago
I've made the change to include semicolons in r1208.

Original comment by andy.koppe on 2 Jul 2011 at 11:32