Skip to content

Commit 4154228

Browse files
rfourquetKristofferC
authored andcommitted
REPL: prefix search: more "pass through" keys (#33805)
1 parent 8769d15 commit 4154228

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

stdlib/REPL/src/LineEdit.jl

+2
Original file line numberDiff line numberDiff line change
@@ -2222,6 +2222,8 @@ const prefix_history_keymap = merge!(
22222222
"\e[*" => "*",
22232223
"\eO*" => "*",
22242224
"\e[1;5*" => "*", # Ctrl-Arrow
2225+
"\e[1;2*" => "*", # Shift-Arrow
2226+
"\e[1;3*" => "*", # Meta-Arrow
22252227
"\e[200~" => "*"
22262228
),
22272229
# VT220 editing commands

stdlib/REPL/test/repl.jl

+11-3
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,8 +324,16 @@ fake_repl() do stdin_write, stdout_read, repl
324324
write(stdin_write, "\e[B\n")
325325
readuntil(stdout_read, s2)
326326

327-
# Close REPL ^D
328-
write(stdin_write, '\x04')
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+
335+
# Delete line (^U) and close REPL (^D)
336+
write(stdin_write, "\x15\x04")
329337
Base.wait(repltask)
330338

331339
nothing

0 commit comments

Comments
 (0)