Fix backspace/delete bindings to actually do what they say they should, per GNOME Terminal behaviour. Closes LP #511875

This commit is contained in:
Chris Jones 2010-01-24 15:45:47 +00:00
parent 05a61f802d
commit 9f348c349a
3 changed files with 46 additions and 16 deletions

View File

@ -151,6 +151,9 @@
<column type="gchararray"/>
</columns>
<data>
<row>
<col id="0" translatable="yes">Automatic</col>
</row>
<row>
<col id="0" translatable="yes">Control-H</col>
</row>
@ -168,6 +171,9 @@
<column type="gchararray"/>
</columns>
<data>
<row>
<col id="0" translatable="yes">Automatic</col>
</row>
<row>
<col id="0" translatable="yes">Control-H</col>
</row>

View File

@ -414,20 +414,24 @@ class PrefsEditor:
widget = guiget('backspace-binding-combobox')
value = self.config['backspace_binding']
if value == 'control-h':
widget.set_active(0)
elif value == 'escape-sequence':
widget.set_active(2)
else:
widget.set_active(1)
elif value == 'ascii-del':
widget.set_active(2)
elif value == 'escape-sequence':
widget.set_active(3)
else:
widget.set_active(0)
# Delete key
widget = guiget('delete-binding-combobox')
value = self.config['delete_binding']
if value == 'control-h':
widget.set_active(0)
elif value == 'ascii-del':
widget.set_active(1)
else:
elif value == 'ascii-del':
widget.set_active(2)
elif value == 'escape-sequence':
widget.set_active(3)
else:
widget.set_active(0)
# FIXME: Why do we have a profile argument that we don't use?
def store_profile_values(self, profile):
@ -574,20 +578,24 @@ class PrefsEditor:
widget = guiget('backspace-binding-combobox')
selected = widget.get_active()
if selected == 0:
value = 'control-h'
value = 'automatic'
elif selected == 1:
value = 'ascii-del'
value = 'control-h'
elif selected == 2:
value = 'ascii-del'
elif selected == 3:
value == 'escape-sequence'
self.config['backspace_binding'] = value
# Delete key
widget = guiget('delete-binding-combobox')
selected = widget.get_active()
if selected == 0:
value = 'control-h'
valud = 'automatic'
elif selected == 1:
value = 'ascii-del'
value = 'control-h'
elif selected == 2:
value = 'ascii-del'
elif selected == 3:
value = 'escape-sequence'
self.config['delete_binding'] = value
@ -655,9 +663,9 @@ class PrefsEditor:
guiget = self.builder.get_object
widget = guiget('backspace-binding-combobox')
widget.set_active(1)
widget = guiget('delete-binding-combobox')
widget.set_active(2)
widget = guiget('delete-binding-combobox')
widget.set_active(3)
def on_background_type_toggled(self, _widget):
"""The background type was toggled"""

View File

@ -496,22 +496,38 @@ for %s (%s)' % (name, urlplugin.__class__.__name__))
# escape-sequence
try:
if backspace == 'ascii-del':
backbind = vte.ERASE_ASCII_DELETE
elif backspace == 'control-h':
backbind = vte.ERASE_ASCII_BACKSPACE
elif backspace == 'escape-sequence':
backbind = vte.ERASE_DELETE_SEQUENCE
else:
backbind = vte.ERASE_AUTO
except AttributeError:
if backspace == 'ascii-del':
backbind = 2
else:
elif backspace == 'control-h':
backbind = 1
elif backspace == 'escape-sequence':
backbind = 3
else:
backbind = 0
try:
if delete == 'escape-sequence':
if delete == 'ascii-del':
delbind = vte.ERASE_ASCII_DELETE
elif delete == 'control-h':
delbind = vte.ERASE_ASCII_BACKSPACE
elif delete == 'escape-sequence':
delbind = vte.ERASE_DELETE_SEQUENCE
else:
delbind = vte.ERASE_AUTO
except AttributeError:
if delete == 'escape-sequence':
if delete == 'ascii-del':
delbind = 2
elif delete == 'control-h':
delbind = 1
elif delete == 'escape-sequence':
delbind = 3
else:
delbind = 0