4

Highlighted text in the default gnome terminal incorrectly includes word boundary characters which should be ignored

for example when I double click on

 &freq_domain_magnitude_buffer_a2i 

it should ignore the leading & and just highlight freq_domain_magnitude_buffer_a2i

In the past below technique worked (it has no effect now) to define a set of such word boundary characters

UUID=$(gsettings get org.gnome.Terminal.ProfilesList default |  tr -d "'" ) #  strip off any single quotes

echo $UUID

gsettings set org.gnome.Terminal.Legacy.Profile:/org/gnome/terminal/legacy/profiles:/:${UUID}/ word-char-exceptions '@ms "-#%&+,./:=?@_~"'

Even back when above worked its troubling to see the word legacy ... How to edit the list of word boundary characters ? can this be done using tool dconf-editor ? Is there a better alternative terminal which does support defining word boundary characters ?

This issue goes back years

dconf write word-char-exceptions not taking effect

Can I specify what characters set the double-click selection boundary in GNOME Terminal?

https://unix.stackexchange.com/questions/409017/gnome-terminal-double-click-delimiters

https://bugzilla.redhat.com/show_bug.cgi?id=1165244

On Ubuntu 22.04 gnome terminal (Version 3.44.0 for GNOME 42)

https://wiki.gnome.org/Apps/Terminal

2 Answers2

0

The problem is that gsettings get prints its output within single quotes, i.e. the value of UUID doesn't become the actual UUID that you'd expect but rather that value enclosed in literal apostrophes. You should remove those apostrophes.

It's surely all doable via command line, using either gsettings (as you did) or dconf, and a bit of shell script gluing. However, I find it more convenient to navigate in dconf-editor. As you navigate to /org/gnome/terminal/legacy/profiles:, you'll probably see some of the subfolders already containing apostrophes in their names due to previous runs of the incorrect script that you posted. These are not used by gnome-terminal, you may right-click and "Reset recursively". If you navigate to the given correct profile's word-char-exceptions, you can see the old value or set the new value there.

PS. Don't worry about the word "legacy". I have no idea why it's there, but it's there, it's okay.

egmont
  • 8,990
  • 1
  • 34
  • 47
0

For me (22.04LTS) this setting (word-char-exceptions) works the opposite - the chars it contains are considered the word chars. So try adding anything you would like to be selected by double-click, besides the alpha-numeric default, e.g. to add these chars: -_.^~ use this command:

dconf write /org/gnome/terminal/legacy/profiles:/:`gsettings get org.gnome.Terminal.ProfilesList default | tr -d \'`/word-char-exceptions "@ms '-_.^~'"