Custom REPL keymap does not work

I’m trying to create a custom REPL mode with custom keybindings.

Here’s an MVP that demonstrates this issue with prints:

using REPL
using ReplMaker
using REPL.LineEdit: MIState

# Simple parser that echoes input
parser(input) = println("You entered: ", input)

# Create custom keymap with Ctrl+E binding
custom_keymap = Dict{Any,Any}(
    # Ctrl+E
    '\x05' => (s::MIState, o...) -> begin
        println("Ctrl+E pressed!")  # This doesn't print!
        return :ignore
    end
)

# Initialize custom REPL mode
repl = Base.active_repl
initrepl(
    parser;
    prompt_text="DEMO> ",
    prompt_color=:blue,
    start_key=')',
    mode_name=:demo,
    valid_input_checker=Returns(true),
    keymap=custom_keymap,
)

Expected behavior:

  • When Ctrl+E is pressed, “Ctrl+E pressed!” should be printed

Actual behavior:

  • Nothing is printed when Ctrl+E is pressed

Pkgs:

  • Julia: 1.11.2
  • ReplMaker: 0.2.7

Any ideas why the keymap is not working? What am I missing here?

2 Likes

Tried with this:
`keymap=REPL.LineEdit.keymap([custom_keymap, default_keymap, escape_defaults]), ̇

Tried not just CTRL + E but other keys, and seemingly not working. :thinking: