Skip to content

Commit

Permalink
Merge pull request JuliaLang#13 from nick-paul/other-escapes
Browse files Browse the repository at this point in the history
accept \eOx as well as \e[x for escapes (JuliaLang#12)
  • Loading branch information
Nicholas Paul authored Dec 21, 2017
2 parents 7f5b588 + c25b6b8 commit 9a3511a
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 9a3511a

Please sign in to comment.