Added backspace compatability.

This commit is contained in:
Michael Lazar
2015-03-04 23:55:21 -08:00
parent 49cc1cba78
commit 77382112d5

View File

@@ -2,9 +2,9 @@ import os
import curses import curses
import time import time
import threading import threading
from curses import textpad
from contextlib import contextmanager
import subprocess import subprocess
from curses import textpad, ascii
from contextlib import contextmanager
from functools import partial from functools import partial
from types import MethodType from types import MethodType
@@ -73,8 +73,14 @@ def text_input(window):
def validate(ch): def validate(ch):
"Filters characters for special key sequences" "Filters characters for special key sequences"
if ch == ESCAPE: if ch == ESCAPE:
raise EscapePressed raise EscapePressed
# Fix backspace for iterm
if ch == ascii.DEL:
ch = curses.KEY_BACKSPACE
return ch return ch
# Wrapping in an exception block so that we can distinguish when the user # Wrapping in an exception block so that we can distinguish when the user