Skip to content

Commit

Permalink
REPL: prefix search: more "pass through" keys
Browse files Browse the repository at this point in the history
  • Loading branch information
rfourquet committed Nov 10, 2019
1 parent 6eebbbe commit ca3e779
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
2 changes: 2 additions & 0 deletions stdlib/REPL/src/LineEdit.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2201,6 +2201,8 @@ const prefix_history_keymap = merge!(
"\e[*" => "*",
"\eO*" => "*",
"\e[1;5*" => "*", # Ctrl-Arrow
"\e[1;2*" => "*", # Shift-Arrow
"\e[1;3*" => "*", # Meta-Arrow
"\e[200~" => "*"
),
# VT220 editing commands
Expand Down
10 changes: 9 additions & 1 deletion stdlib/REPL/test/repl.jl
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ fake_repl() do stdin_write, stdout_read, repl
write(stdin_write, ";")
readuntil(stdout_read, "shell> ")
Base.print_shell_escaped(stdin_write, Base.julia_cmd().exec..., special=Base.shell_special)
write(stdin_write, """ -e "println(\\"HI\\")\"""")
write(stdin_write, """ -e "println(\\"HI\\")\" """)
readuntil(stdout_read, ")\"")
proc_stdout_read, proc_stdout = redirect_stdout()
get_stdout = @async read(proc_stdout_read, String)
Expand Down Expand Up @@ -299,6 +299,14 @@ fake_repl() do stdin_write, stdout_read, repl
write(stdin_write, "\e[B\n")
readuntil(stdout_read, s2)

# test that prefix history search "passes through" key bindings to parent mode
write(stdin_write, "0x321\n")
readuntil(stdout_read, "0x321")
write(stdin_write, "\e[A\e[1;3C|||") # uparrow (go up history) and then Meta-rightarrow (indent right)
s2 = readuntil(stdout_read, "|||", keep=true)
@test endswith(s2, " 0x321\r\e[13C|||") # should have a space (from Meta-rightarrow) and not
# have a spurious C before ||| (the one here is not spurious!)

# Close REPL ^D
write(stdin_write, '\x04')
Base.wait(repltask)
Expand Down

0 comments on commit ca3e779

Please sign in to comment.