Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix moving up and down in REPL #350

Merged
merged 3 commits into from
Jun 29, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions src/repl.jl
Original file line number Diff line number Diff line change
Expand Up @@ -283,10 +283,12 @@ end
NEW_KEYBINDINGS = create_keybindings()

function insert_keybindings(repl = Base.active_repl)
mirepl = isdefined(repl,:mi) ? repl.mi : repl
mirepl = isdefined(repl,:mistate) ? repl.mistate : repl
main_mode = mirepl.interface.modes[1]
p = mirepl.interface.modes[5]
php_idx = VERSION >= v"1.11.0-rc1" ? 6 : 5
p = mirepl.interface.modes[php_idx]::LineEdit.PrefixHistoryPrompt
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems brittle. Better to find first?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. I have improved the implementation by using findfirst. (8b6dc6f)


# 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