Skip to content

Commit ca3e779

Browse files
committed
REPL: prefix search: more "pass through" keys
1 parent 6eebbbe commit ca3e779

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
@@ -2201,6 +2201,8 @@ const prefix_history_keymap = merge!(
22012201
"\e[*" => "*",
22022202
"\eO*" => "*",
22032203
"\e[1;5*" => "*", # Ctrl-Arrow
2204+
"\e[1;2*" => "*", # Shift-Arrow
2205+
"\e[1;3*" => "*", # Meta-Arrow
22042206
"\e[200~" => "*"
22052207
),
22062208
# VT220 editing commands

stdlib/REPL/test/repl.jl

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ fake_repl() do stdin_write, stdout_read, repl
221221
write(stdin_write, ";")
222222
readuntil(stdout_read, "shell> ")
223223
Base.print_shell_escaped(stdin_write, Base.julia_cmd().exec..., special=Base.shell_special)
224-
write(stdin_write, """ -e "println(\\"HI\\")\"""")
224+
write(stdin_write, """ -e "println(\\"HI\\")\" """)
225225
readuntil(stdout_read, ")\"")
226226
proc_stdout_read, proc_stdout = redirect_stdout()
227227
get_stdout = @async read(proc_stdout_read, String)
@@ -299,6 +299,14 @@ fake_repl() do stdin_write, stdout_read, repl
299299
write(stdin_write, "\e[B\n")
300300
readuntil(stdout_read, s2)
301301

302+
# test that prefix history search "passes through" key bindings to parent mode
303+
write(stdin_write, "0x321\n")
304+
readuntil(stdout_read, "0x321")
305+
write(stdin_write, "\e[A\e[1;3C|||") # uparrow (go up history) and then Meta-rightarrow (indent right)
306+
s2 = readuntil(stdout_read, "|||", keep=true)
307+
@test endswith(s2, " 0x321\r\e[13C|||") # should have a space (from Meta-rightarrow) and not
308+
# have a spurious C before ||| (the one here is not spurious!)
309+
302310
# Close REPL ^D
303311
write(stdin_write, '\x04')
304312
Base.wait(repltask)

0 commit comments

Comments
 (0)