Skip to content

Commit

Permalink
Fix #59 , support HOME/END for <Esc>OH/F
Browse files Browse the repository at this point in the history
  • Loading branch information
chzyer committed Jun 21, 2016
1 parent 3717d7c commit 683bf8f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
2 changes: 1 addition & 1 deletion terminal.go
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ func (t *Terminal) ioloop() {
isEscapeEx = true
continue
}
r = escapeKey(r)
r = escapeKey(r, buf)
} else if isEscapeEx {
isEscapeEx = false
r = escapeExKey(r, buf)
Expand Down
12 changes: 11 additions & 1 deletion utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ func escapeExKey(r rune, reader *bufio.Reader) rune {
}

// translate EscX to Meta+X
func escapeKey(r rune) rune {
func escapeKey(r rune, reader *bufio.Reader) rune {
switch r {
case 'b':
r = MetaBackward
Expand All @@ -105,6 +105,16 @@ func escapeKey(r rune) rune {
r = MetaTranspose
case CharBackspace:
r = MetaBackspace
case 'O':
d, _, _ := reader.ReadRune()
switch d {
case 'H':
r = CharLineStart
case 'F':
r = CharLineEnd
default:
reader.UnreadRune()
}
case CharEsc:

}
Expand Down

0 comments on commit 683bf8f

Please sign in to comment.