Add word chars back in if VTE is 0.40+

This commit is contained in:
Stephen Boddy 2015-11-28 20:28:01 +01:00
parent b5b74e8071
commit 6db2337c56
5 changed files with 60 additions and 0 deletions

View File

@ -442,6 +442,10 @@ Default value: \fBclose\fR
.B palette
Terminals have a 16-colour palette that applications inside the terminal can use. This is that palette, in the form of a colon-separated list of colour names. Colour names should be in hex format e.g. "#FF00FF".
.TP
.B word_chars
These characters are included when selecting text by double clicking.
Default value: \fB',./?%&#:_'\fR
.TP
.B mouse_autohide \fR(boolean)
Controls whether the mouse cursor should be hidden while typing.
Default value: \fBTrue\fR

View File

@ -227,6 +227,7 @@ DEFAULTS = {
'palette' : '#2e3436:#cc0000:#4e9a06:#c4a000:\
#3465a4:#75507b:#06989a:#d3d7cf:#555753:#ef2929:#8ae234:#fce94f:\
#729fcf:#ad7fa8:#34e2e2:#eeeeec',
'word_chars' : ',./?%&#:_',
'mouse_autohide' : True,
'update_records' : True,
'login_shell' : False,

View File

@ -1619,6 +1619,47 @@
<property name="position">5</property>
</packing>
</child>
<child>
<object class="GtkHBox" id="word_chars_hbox">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="spacing">12</property>
<child>
<object class="GtkLabel" id="word_chars_entry_label">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">Select-by-_word characters:</property>
<property name="use_underline">True</property>
<property name="justify">center</property>
<property name="mnemonic_widget">word_chars_entry</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkEntry" id="word_chars_entry">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="invisible_char">•</property>
<signal name="changed" handler="on_word_chars_entry_changed" swapped="no"/>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">6</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>

View File

@ -424,6 +424,12 @@ class PrefsEditor:
# Rewrap on resize
widget = guiget('rewrap_on_resize_checkbutton')
widget.set_active(self.config['rewrap_on_resize'])
# Word chars
widget = guiget('word_chars_entry')
widget.set_text(self.config['word_chars'])
# Word char support was missing from vte 0.38, hide from the UI
if not hasattr(self.term.vte, 'set_word_char_exceptions'):
guiget('word_chars_hbox').hide()
# Cursor shape
widget = guiget('cursor_shape_combobox')
if self.config['cursor_shape'] == 'underline':
@ -929,6 +935,11 @@ class PrefsEditor:
self.config['cursor_shape'] = value
self.config.save()
def on_word_chars_entry_changed(self, widget):
"""Word characters changed"""
self.config['word_chars'] = widget.get_text()
self.config.save()
def on_font_selector_font_set(self, widget):
"""Font changed"""
self.config['font'] = widget.get_font_name()

View File

@ -628,6 +628,9 @@ class Terminal(Gtk.VBox):
if self.custom_encoding != True:
self.vte.set_encoding(self.config['encoding'])
# Word char support was missing from vte 0.38, silently skip this setting
if hasattr(self.vte, 'set_word_char_exceptions'):
self.vte.set_word_char_exceptions(self.config['word_chars'])
self.vte.set_mouse_autohide(self.config['mouse_autohide'])
backspace = self.config['backspace_binding']