Fix edit_insert MethodError in debug-mode keymap fallback on Julia 1.12 - #421
Open
mattlie82 wants to merge 1 commit into
Open
Fix edit_insert MethodError in debug-mode keymap fallback on Julia 1.12#421mattlie82 wants to merge 1 commit into
mattlie82 wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Title: Fix
MethodErrorin debug-mode keymap fallback on Julia 1.12Body:
Summary
Fixes #420.
On Julia 1.12, loading Debugger and then typing a character that Debugger's
)-keymap intercepts (but isn't handling directly, e.g. the cursor isn't at position 0) throws:Root cause
In
install_repl_mode, the fallback action for the)key defaults to the rawLineEdit.edit_insertfunction when nothing else is already bound to that key:This is later called with the keymap dispatch's calling convention,
key_action(s, args...), which passes(state, repl, char)— 3 arguments. On older Julia versions,edit_insertapparently had a 3-argument method compatible with this convention, so the raw function happened to work. Julia 1.12 only defines 2-argument methods foredit_insert((state, char)), plus an unrelatedMIStatecatch-all, so the 3-argument call now fails.Fix
Wrap the fallback in a small closure that matches the keymap's actual
(state, repl, char)calling convention, and have it forward only(state, char)to the realedit_insert:If
)is already bound to some other action inmain_mode.keymap_dict(e.g. by another package), that binding is used unchanged — this only changes the default fallback.Testing
using Debuggerno longer errors on load, and typing)both entersdebug>mode at an empty prompt and inserts the character normally elsewhere.