Skip to content

Commit

Permalink
Fix moving up and down in REPL (#350)
Browse files Browse the repository at this point in the history
  • Loading branch information
huangyxi committed Jun 29, 2024
1 parent 434e7d7 commit 81d45af
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/repl.jl
Original file line number Diff line number Diff line change
Expand Up @@ -286,10 +286,13 @@ end
NEW_KEYBINDINGS = create_keybindings()

function insert_keybindings(repl = Base.active_repl)
mirepl = isdefined(repl,:mi) ? repl.mi : repl
main_mode = mirepl.interface.modes[1]
p = mirepl.interface.modes[5]
mirepl = isdefined(repl,:mistate) ? repl.mistate : repl
interface_modes = mirepl.interface.modes
main_mode = interface_modes[1]
php_idx = findfirst(Base.Fix2(isa, LineEdit.PrefixHistoryPrompt), interface_modes)
p = interface_modes[php_idx]

# Up Arrow
NEW_KEYBINDINGS["\e[A"] = (s,o...)-> begin
LineEdit.edit_move_up(buffer(s)) || LineEdit.enter_prefix_search(s, p, true)
Prompt.rewrite_with_ANSI(s)
Expand Down

0 comments on commit 81d45af

Please sign in to comment.