Send the correct escape code for backspace

This commit is contained in:
Kovid Goyal 2016-11-29 12:36:37 +05:30
parent 83940e0fb6
commit 7fd15be071
2 changed files with 9 additions and 2 deletions

View File

@ -24,7 +24,7 @@ del f
key_map[defines.GLFW_KEY_ESCAPE] = b'\033'
key_map[defines.GLFW_KEY_ENTER] = b'\r'
key_map[defines.GLFW_KEY_BACKSPACE] = b'\x08'
key_map[defines.GLFW_KEY_BACKSPACE] = key_as_bytes('kbs')
key_map[defines.GLFW_KEY_TAB] = b'\t'
SHIFTED_KEYS = {

View File

@ -2,6 +2,7 @@
# vim:fileencoding=utf-8
# License: GPL v3 Copyright: 2016, Kovid Goyal <kovid at kovidgoyal.net>
import re
from binascii import unhexlify, hexlify
names = 'xterm-kitty', 'KovIdTTY'
@ -360,9 +361,15 @@ def generate_terminfo():
return ',\n\t'.join(ans) + ',\n'
octal_escape = re.compile(r'\\([0-7]{3})')
escape_escape = re.compile(r'\\[eE]')
def key_as_bytes(name):
ans = string_capabilities[name]
return ans.replace(r'\E', '\033').encode('ascii')
ans = octal_escape.sub(lambda m: chr(int(m.group(1), 8)), ans)
ans = escape_escape.sub('\033', ans)
return ans.encode('ascii')
def get_capabilities(query_string):