Skip to content

Commit 7b38472

Browse files
committed
REPL: prefix search: more "pass through" keys
1 parent b29d951 commit 7b38472

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

stdlib/REPL/src/LineEdit.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2197,6 +2197,8 @@ const prefix_history_keymap = merge!(
21972197
"\e[*" => "*",
21982198
"\eO*" => "*",
21992199
"\e[1;5*" => "*", # Ctrl-Arrow
2200+
"\e[1;2*" => "*", # Shift-Arrow
2201+
"\e[1;3*" => "*", # Meta-Arrow
22002202
"\e[200~" => "*"
22012203
),
22022204
# VT220 editing commands

stdlib/REPL/test/repl.jl

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ fake_repl() do stdin_write, stdout_read, repl
246246
write(stdin_write, ";")
247247
readuntil(stdout_read, "shell> ")
248248
Base.print_shell_escaped(stdin_write, Base.julia_cmd().exec..., special=Base.shell_special)
249-
write(stdin_write, """ -e "println(\\"HI\\")\"""")
249+
write(stdin_write, """ -e "println(\\"HI\\")\" """)
250250
readuntil(stdout_read, ")\"")
251251
proc_stdout_read, proc_stdout = redirect_stdout()
252252
get_stdout = @async read(proc_stdout_read, String)
@@ -324,6 +324,14 @@ fake_repl() do stdin_write, stdout_read, repl
324324
write(stdin_write, "\e[B\n")
325325
readuntil(stdout_read, s2)
326326

327+
# test that prefix history search "passes through" key bindings to parent mode
328+
write(stdin_write, "0x321\n")
329+
readuntil(stdout_read, "0x321")
330+
write(stdin_write, "\e[A\e[1;3C|||") # uparrow (go up history) and then Meta-rightarrow (indent right)
331+
s2 = readuntil(stdout_read, "|||", keep=true)
332+
@test endswith(s2, " 0x321\r\e[13C|||") # should have a space (from Meta-rightarrow) and not
333+
# have a spurious C before ||| (the one here is not spurious!)
334+
327335
# Close REPL ^D
328336
write(stdin_write, '\x04')
329337
Base.wait(repltask)

0 commit comments

Comments
 (0)