diff --git a/stdlib/REPL/src/LineEdit.jl b/stdlib/REPL/src/LineEdit.jl index 797c4f802be0a..b536471cda75c 100644 --- a/stdlib/REPL/src/LineEdit.jl +++ b/stdlib/REPL/src/LineEdit.jl @@ -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 diff --git a/stdlib/REPL/test/repl.jl b/stdlib/REPL/test/repl.jl index d8ea62c3ba9c4..37b775779b3ba 100644 --- a/stdlib/REPL/test/repl.jl +++ b/stdlib/REPL/test/repl.jl @@ -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) @@ -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