OhmNomNom / thyme

A fork of mintty, for the modern world
GNU General Public License v3.0
0 stars 0 forks source link

User control of characters selected by a double-click #120

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Please add an option for determining which characters delimit words when a 
user double-clicks.  This can typically be customized, e.g., via 
the "charClass" resource in xterm, the "cutchars" resource in rxvt, or 
the "select-by-word characters" text field in gnome-terminal.

Original issue reported on code.google.com by rob.r...@ymail.com on 14 Jun 2009 at 10:41

GoogleCodeExporter commented 9 years ago
How would you want to customise this, i.e. what's wrong with the current set? 
I'd
rather fix that then introduce a little-used option.

Original comment by andy.koppe on 16 Jun 2009 at 12:14

GoogleCodeExporter commented 9 years ago
I would like a text box where I can specify which characters should be grouped 
together with alphanumeric characters after a double-click.  Personally, I 
would set 
it to "-./_~" so I could quickly select a typical file name along with its path 
and 
nothing else.  On the other hand, I accept that someone else may prefer a 
different 
set and may even want to change it throughout the day to better match their 
current 
task.  Since it's subjective, there's nothing wrong with the current set but my 
biggest annoyance is the inclusion of the double quote character.  Since it's 
customizable in so many terminals, I don't agree that it's a little-used option 
but, 
having read the xterm man page, I do appreciate your concern.  Nonetheless, I 
think 
that it would be a worthwhile option.

Original comment by rob.r...@ymail.com on 21 Jun 2009 at 6:29

GoogleCodeExporter commented 9 years ago
Oops, the double quote not being treated as a separator was due to a rather 
silly
mistake. Fixed in r394 on 0.4 branch.

Still not convinced about the need for an option for this, but I'll leave the 
issue
open to see whether it garners additional support.

Btw, the current MinTTY code as well as xterm have support for multiple 
different
character classes for word selection. Do you think that's useful or would a 
simple
distinction between separators and non-separators be sufficient?

Original comment by andy.koppe on 21 Jun 2009 at 7:50

GoogleCodeExporter commented 9 years ago
Thank you for making the double quote a separator.  Please do the same for "*" 
to 
make it easier to select executable file names after commands such as "ls -F".  
Regarding the number of character classes, I think that two is the best balance 
between simplicity and flexibility.  The primary reason why separators should 
be 
customizable is to avoid surprising and discouraging users with different 
notions of 
what the separators should be.  Even if there was universal agreement, the 
ability 
to change the separators can make mouse selections faster and more convenient.  
For 
example, treating "." as a non-separator is good for tasks such as selecting an 
entire file name or number with a decimal but not good for tasks such as 
selecting 
the last word of a sentence or just the "field" part of "object.field".  Here, 
users 
may benefit by changing the class of "." depending on the type of tasks they 
tend to 
perform.

Original comment by rob.r...@ymail.com on 25 Jun 2009 at 7:58

GoogleCodeExporter commented 9 years ago
Changed the classification in r402. Now only #+-./\_~ are in the same class as
letters and digits.

I take your point about requiring different character sets in different context,
however, an option dialog setting doesn't address that terribly well, because 
it's
too awkward to change the set every time you change context.

Perhaps a control sequence would be better for this? That would let one change 
it
e.g. in vim or emacs scripts, so it could even be set depending on file type. 
And it
could be included in PS1 to always set it back to something appropriate for the 
shell.

Original comment by andy.koppe on 28 Jun 2009 at 5:37

GoogleCodeExporter commented 9 years ago
Thanks again.  A control sequence would be much better.

Original comment by rob.r...@ymail.com on 29 Jun 2009 at 4:19

GoogleCodeExporter commented 9 years ago
I tweaked word selection further on 0.5, by adding $%:@ back into the 
recognised set. 

Furthermore, the characters ./@ are no longer included in a selection when they
appear at the end of a word. This helps with directories and links in 'ls -F' 
and
with periods at the end of a sentence.

Finally, the colon is only included when it appears to the left of the character
being double-clicked. This way, when clicking on the filname in something like
"filename:123: error", only the filename is selected. Yet when clicking to the 
right
of the colon in a URL like "http://www.cygwin.com", the "http" is included in 
the
selection. Similarly with scp addresses such as "user@server:/path/to/file".

This now hopefully catches the majority of use cases. It would not be 
straightforward
to capture this sort of logic in options or control sequences, and they would 
hardly
be used anyway, hence I don't think I'll implement them after all. 
(If there was some sort of standard control sequence for this, I'd of course 
reconsider.)

Original comment by andy.koppe on 5 Sep 2009 at 3:20

GoogleCodeExporter commented 9 years ago
What do you think about a double-click option with only two choices: "Smart 
mode" 
which behaves like the current trunk and "Simple mode" which behaves like r402 
(comment 5)?  "Simple mode" would benefit users who want consistent behavior 
when 
switching back and forth between mintty in Windows and *term* in *nix.  Also, 
it 
would cover cases where "Smart mode" guesses wrong, e.g., selecting dirs from 
the 
result of "echo $PATH".

Original comment by rob.r...@ymail.com on 5 Jun 2010 at 3:40

GoogleCodeExporter commented 9 years ago
I don't think such an option would be worthwhile, in fact I suspect it would 
increase 
the number of questions about this topic and raise expectations regarding the 
mind-
reading powers of "smart mode".

It's a best-effort compromise, no more, no less, and in the relatively few 
cases 
where it doesn't do the right thing, there's an easy alternative: click'n'drag.

If you do feel strongly about this, there's always the option of hacking the 
source: 
the smartness, such as it is, consists of a few lines of code at the top of 
sel_spread_word() in termmouse.c.

Original comment by andy.koppe on 5 Jun 2010 at 8:37

GoogleCodeExporter commented 9 years ago
Ok.  Thanks for considering it and for producing such a wonderful terminal.

Original comment by rob.r...@ymail.com on 7 Jun 2010 at 12:49

GoogleCodeExporter commented 9 years ago
I tried to reply to the discussion in the discuss list for this...but the topic 
seems to be closed. I'd be happy with a simple environment variable or two to 
control the behaviour here. No need to complicate the GUI necessarily.

Original comment by msharpe...@gmail.com on 14 Aug 2010 at 4:47

GoogleCodeExporter commented 9 years ago
I guess I'll need to ponder this one again. Here's msharpe's request in full:

"This is a feature from putty I have missed too. Whilst I agree with the idea 
of keeping things simple, there times where it is useful to be able to specify 
the character classes too.  I think the putty way of doing things was difficult 
in this area too. The double click selection right now is a real pain for c++ 
programmers. If I double click a method name I get the prepended class too. 
e.g. MyClass::myMethod() {...} double clicking myMethod takes too much.

Refering to structures foo.myMember takes too much if you double click foo or 
myMember. The main reason I use mintty is for programming (wanted a decent 
terminal for VIM) and these too cases catch me all the time. Even when 
selecting files I tend to find that I always want the base name of the file 
instead of the file and extension....usually because I am renaming a file.

Whilst not going so far as putty did where you can assign each character a 
class, it would be nice to have a field which does allow one to specify which 
characters should be included in a selection (or which characters should not be 
included).

By the way when I used puttycyg I would often have one Putty config for 
programming and one for general commandline usage and I would have different 
character class mappings for each so that in one I could favor file names and 
urls etc and the other I could favor c++isms or perlisms etc."

Original comment by andy.koppe on 14 Aug 2010 at 8:16

GoogleCodeExporter commented 9 years ago
I've added a 'WordChars' config file option for overriding the "smart" 
algorithm with a set of characters. Alphanumeric characters are always 
included, so sticking 'WordChars=_' into .minttyrc to add the underscore allows 
picking out C-style programming language identifiers. This is in r975 on trunk.

Original comment by andy.koppe on 15 Aug 2010 at 8:06

GoogleCodeExporter commented 9 years ago

Original comment by andy.koppe on 3 Oct 2010 at 3:46