From 1c411ac48cff1de664c5f62ed0c86b1733859153 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Prist=C3=A1=C5=A1=20Michal?= Date: Fri, 23 Oct 2015 13:16:45 +0200 Subject: [PATCH] changes completed --- terminal.go | 6 ++++++ utils.go | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/terminal.go b/terminal.go index 7afb025..cc66629 100644 --- a/terminal.go +++ b/terminal.go @@ -108,6 +108,12 @@ func (t *Terminal) ioloop() { } else if isEscapeEx { isEscapeEx = false r = escapeExKey(r) + // if hw delete button is pressed it is specified as set ot 4 runes [27,91,51,126]. we are now at 51 + if r == CharDelete { + if d, _, err := buf.ReadRune(); err != nil || d != 126 { + buf.UnreadRune() + } + } } expectNextChar = true diff --git a/utils.go b/utils.go index 5f09bfd..f7d4adc 100644 --- a/utils.go +++ b/utils.go @@ -40,6 +40,8 @@ func IsPrintable(key rune) bool { // translate Esc[X func escapeExKey(r rune) rune { switch r { + case 51: + r = CharDeleteKey case 'D': r = CharBackward case 'C': @@ -48,6 +50,10 @@ func escapeExKey(r rune) rune { r = CharPrev case 'B': r = CharNext + case 'H': + r = CharLineStart + case 'F': + r = CharLineEnd } return r }