After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 727743 - Use the same defaults for word-chars as gnome-terminal and possibly remove the API
Use the same defaults for word-chars as gnome-terminal and possibly remove th...
Status: RESOLVED FIXED
Product: vte
Classification: Core
Component: general
unspecified
Other All
: Normal normal
: ---
Assigned To: VTE Maintainers
VTE Maintainers
Depends on:
Blocks:
 
 
Reported: 2014-04-07 13:18 UTC by Debarshi Ray
Modified: 2021-01-26 21:39 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
widget: Use the same default for word-chars as gnome-terminal (1.22 KB, patch)
2014-04-07 13:20 UTC, Debarshi Ray
committed Details | Review
widget: Remove word-chars property and related API (6.58 KB, patch)
2014-04-07 13:21 UTC, Debarshi Ray
committed Details | Review
Remove colon from WORD_CHARS (768 bytes, patch)
2014-11-18 14:47 UTC, Nick Stoughton
committed Details | Review

Description Debarshi Ray 2014-04-07 13:18:11 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.
Comment 1 Debarshi Ray 2014-04-07 13:20:08 UTC
Created attachment 273703 [details] [review]
widget: Use the same default for word-chars as gnome-terminal
Comment 2 Debarshi Ray 2014-04-07 13:21:18 UTC
Created attachment 273704 [details] [review]
widget: Remove word-chars property and related API
Comment 3 Debarshi Ray 2014-04-07 13:55:48 UTC
Thanks for the review, Christian!
Comment 4 Oskari Saarenmaa 2014-09-24 15:20:33 UTC
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):
Comment 5 Joachim Breitner 2014-11-06 10:26:48 UTC
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.
Comment 6 Joachim Breitner 2014-11-06 10:29:14 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.

Note that he actually suggested to use the \w regex, which would not include :

$ echo "test:bar"|grep -Eo '\w+'
test
bar
Comment 7 Joachim Breitner 2014-11-06 11:53:02 UTC
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.
Comment 8 Nick Stoughton 2014-11-17 22:26:10 UTC
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)?
Comment 9 Nick Stoughton 2014-11-18 14:47:13 UTC
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.
Comment 10 Egmont Koblinger 2014-11-18 18:23:43 UTC
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.
Comment 11 Egmont Koblinger 2014-12-12 11:46:19 UTC
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)!
Comment 12 Sven Anders 2015-01-14 12:56:50 UTC
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?!
Comment 13 Dominique Leuenberger 2015-02-18 16:34:15 UTC
(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.
Comment 14 Nick Stoughton 2015-02-18 16:42:45 UTC
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.
Comment 15 Egmont Koblinger 2015-02-18 16:46:52 UTC
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.
Comment 16 Joachim Breitner 2015-02-18 18:07:10 UTC
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.
Comment 17 Marius Gedminas 2015-04-30 06:16:04 UTC
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).
Comment 18 Joachim Breitner 2015-04-30 06:52:05 UTC
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?
Comment 19 Egmont Koblinger 2015-04-30 08:37:12 UTC
In gnome-terminal 3.16 / vte 0.40 it's configurable again, see https://bugzilla.gnome.org/show_bug.cgi?id=730632#c33.
Comment 20 John W 2021-01-26 21:39:24 UTC
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.