Skip to content

Commit

Permalink
REPL prefix search: add ^x "pass through" key (#36173)
Browse files Browse the repository at this point in the history
(cherry picked from commit 0960c9a)
  • Loading branch information
rfourquet authored and KristofferC committed Jul 8, 2020
1 parent b0b9fcf commit 0b851a1
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions stdlib/REPL/src/LineEdit.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2218,6 +2218,7 @@ const prefix_history_keymap = merge!(
match_input(map, s, IOBuffer(c))(s, keymap_data(ps, mode(s)))
end,
# match escape sequences for pass through
"^x*" => "*",
"\e*" => "*",
"\e[*" => "*",
"\eO*" => "*",
Expand Down
7 changes: 7 additions & 0 deletions stdlib/REPL/test/repl.jl
Original file line number Diff line number Diff line change
Expand Up @@ -332,6 +332,13 @@ fake_repl(options = REPL.Options(confirm_exit=false,hascolor=false)) do stdin_wr
@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!)

# "pass through" for ^x^x
write(stdin_write, "\x030x4321\n") # \x03 == ^c
readuntil(stdout_read, "0x4321")
write(stdin_write, "\e[A\x18\x18||\x18\x18||||") # uparrow, ^x^x||^x^x||||
s3 = readuntil(stdout_read, "||||", keep=true)
@test endswith(s3, "||0x4321\r\e[15C||||")

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

0 comments on commit 0b851a1

Please sign in to comment.