Skip to content

Commit

Permalink
accept \eOx as well as \e[x for escapes (#12)
Browse files Browse the repository at this point in the history
  • Loading branch information
nick-paul committed Dec 21, 2017
1 parent 6254c9d commit c25b6b8
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions src/util.jl
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ function readKey(stream::IO=STDIN) ::UInt32
stream.buffer.size < 3 && return '\x1b'
esc_b = readNextChar(stream)

if esc_a == '['
if esc_a == '[' || esc_a == 'O'
if esc_b >= '0' && esc_b <= '9'
stream.buffer.size < 4 && return '\x1b'
esc_c = readNextChar(stream)
Expand Down Expand Up @@ -101,12 +101,10 @@ function readKey(stream::IO=STDIN) ::UInt32
return '\x1b'
end
end
elseif esc_a == 'O'
if esc_a == 'H'
return HOME_KEY
elseif esc_a == 'F'
return END_KEY
end
elseif esc_a == 'H'
return HOME_KEY
elseif esc_a == 'F'
return END_KEY
end

return '\x1b'
Expand Down

0 comments on commit c25b6b8

Please sign in to comment.