GNOME Bugzilla – Bug 727743
Use the same defaults for word-chars as gnome-terminal and possibly remove the API
Last modified: 2021-01-26 21:39:24 UTC
In bug 724110 chpe suggested that the default value used for word-chars in gnome-terminal is good enough and we can hard-code it in vte.
Created attachment 273703 [details] [review] widget: Use the same default for word-chars as gnome-terminal
Created attachment 273704 [details] [review] widget: Remove word-chars property and related API
Thanks for the review, Christian!
Can the API be added back? I've always removed : from the list of word chars to make it easier to copy and paste filenames from output of commands like grep which add a colon to the end of the filename: % git grep word_chars ChangeLog.pre-git: (vte_terminal_set_word_chars): ChangeLog.pre-git: (vte_terminal_set_word_chars), (process_timeout), ChangeLog.pre-git: (vte_terminal_set_word_chars): ChangeLog.pre-git: (vte_terminal_set_word_chars): ChangeLog.pre-git: (vte_terminal_set_word_chars): ChangeLog.pre-git: word_chars array doesn't exist. ChangeLog.pre-git: * src/vte.c(vte_terminal_set_word_chars,vte_terminal_is_word_char):
I agree that the inclusion of : in the list is unfortunate, and I also used to remove it. Like Oskari, my main motivation is copying the output from grep. Note that it is easier to select more than initially if you want to (double-click-drag works fine), but it is not possible to remove the last character after using double-click.
> In bug 724110 chpe suggested that the default value used for word-chars in gnome-terminal is good enough and we can hard-code it in vte. Note that he actually suggested to use the \w regex, which would not include : $ echo "test:bar"|grep -Eo '\w+' test bar
Ok, looking at the code I notice that the current logic is: A word char is either alphanum or punctuation. Does do you include punctuation in words? Here are some counter-intuitive selections: pvt->scrollback_lines double click on pvt selects pvt- vte_terminal_set_word_chars(terminal, WORD_CHARS); double click on terminal selects terminal, I’d suggest removing g_unichar_ispunct(c) in _vte_terminal_is_word_char. But I guess I should open a separate ticket for that.
Like the others commenting here, I always remove : from the word chars, for the same reasons. Can this bug be re-opened to, at least, remove <colon> from the WORD_CHAR definition (src/vte.c line 85)?
Created attachment 290914 [details] [review] Remove colon from WORD_CHARS This patch simply removes ":" from the WORD_CHARS list; this is a minimal work-around for the functionality requested by many. Better would be to add the original dialog back.
See also bug 730632. I myself also remove ":" by patching vte for myself, for pretty much the same reason you mentioned at https://bugzilla.redhat.com/show_bug.cgi?id=1165244. If nobody objects, I'll apply this patch.
Soon after I applied this patch I started working with .ini files so I patched it again for myself to remove the '=' sign. This is crazy. Let's bring back the config option (at least a hidden dconf one)!
Please bring back this option. I do not want to use another terminal application just because the feature is removed! This is really crazy! I thought we learned from the past?!
(In reply to Nick Stoughton from comment #8) > Like the others commenting here, I always remove : from the word chars, for > the same reasons. > > Can this bug be re-opened to, at least, remove <colon> from the WORD_CHAR > definition (src/vte.c line 85)? This has a very ugly side effect: - I use irssi a lot (either in a gnome-terminal or even more frequent inside vinagre/ssh); this resulted in URL's being pasted in irssi no longer being able to be double clicked and copied to a browser... REALLY nnoying.
And this is exactly why there is no "right" answer without giving the user a choice. What constitutes a word for a given user varies depending on the type of applications that user mostly interacts with. Trying to do this programmatically will be wrong as often as it is right. See https://bugzilla.gnome.org/show_bug.cgi?id=730632 for the current discussion.
In gnome-terminal you can use Ctrl+click to open the url, without even highlighting or copy-pasting it. Not sure about vinagre. That being said, the feature really should be user configurable, there's been recent work (not yet finished) in bug 730632 to bring it back.
While there might not be an optimal setting for everyone, note the following: If you want to hightlight all of thisisword1:thisisword2 and : is not a word character, you can still easily do so by double clicking-and-hold somewhere on thisisword1, moving to thisisword2 and releasing. (Most likely you can verify that behavior with your browser right now). But if you want to highlight only thisisword1 in thisisword1:thisisword2 and : is a word character, then you have to carefully select all the characters in the word, which is where the annoyance comes from. So not having : as a word character hurts less than the other way around. BTW, as Egmont says, URLs are not a valid argument here. You can click on them, and if you need to copy them, there is Right-click → Copy address.
Double-clicking URLs is rather convenient when you don't want to open them but want to paste them into IRC or an email, or an ssh session where you want to wget something. Right-click -> Copy address is a horrible alternative: the option you want is on the other side of the menu when the link you want to copy is near the bottom of the terminal, where most of the action is. It's easier to double-click and drag left to include the missing 'http:'. Another place where I miss colon being a word character is copying timestamps (HH:MM or HH:MM:SS).
Hi Marius. I’m not sure what’s wrong with Right Click→Copy, I do it all the time. I’m also not sure whether you are in favor or against including : as a word character. As you say: Double-Click-Drag is always a way to _include_ : in a selection, where there is no easy way to _exclude_ it. So you agree that it should be left out?
In gnome-terminal 3.16 / vte 0.40 it's configurable again, see https://bugzilla.gnome.org/show_bug.cgi?id=730632#c33.
It seems obvious that there are cases where having ":" in the list of "word characters" is sub-optimal and others where *not* having it is sub-optimal. Therefore, to achieve a balance, have the code not include ":" at the end of a "word", but otherwise include it.