Skip to content

Commit

Permalink
REPL: prefix search: more "pass through" keys (JuliaLang#33805)
Browse files Browse the repository at this point in the history
  • Loading branch information
rfourquet authored Nov 17, 2019
1 parent 98d01b7 commit 74f2de1
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
2 changes: 2 additions & 0 deletions stdlib/REPL/src/LineEdit.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2222,6 +2222,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
14 changes: 11 additions & 3 deletions stdlib/REPL/test/repl.jl
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,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 @@ -324,8 +324,16 @@ fake_repl() do stdin_write, stdout_read, repl
write(stdin_write, "\e[B\n")
readuntil(stdout_read, s2)

# Close REPL ^D
write(stdin_write, '\x04')
# 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!)

# Delete line (^U) and close REPL (^D)
write(stdin_write, "\x15\x04")
Base.wait(repltask)

nothing
Expand Down

0 comments on commit 74f2de1

Please sign in to comment.