Why Rebugger.keybinding use this strange strings (anti-human)?

Hi, I was trying to configure the keymap functions of Rebugger. Following is the code I put in the file startup.jl

# This file should contain site-specific commands to be executed on Julia startup;
# Users may store their own personal commands in `~/.julia/config/startup.jl`.
atreplinit() do repl
    try
        @eval using Revise
        @async Revise.wait_steal_repl_backend()
    catch
        @warn "Could not load Revise."
    end

    try
        @eval using Rebugger
        # Activate Rebugger's key bindings
        Rebugger.keybindings[:interpret] = "\e[16~"   # add keybinding F5 to switch to interpret mode
        Rebugger.keybindings[:stepin] = "\e[17~"      # Add the keybinding F6 to step into a function.
        Rebugger.keybindings[:stacktrace] = "\e[18~"  # Add the keybinding F7 to capture a stacktrace.
        
    catch
        @warn "Could not load Rebugger."
    end
end

I’m pretty sure “\e[17~” stands for F6, and “\e[18~” stands for F7. So I assume “\e[16~” stands for F5. Is this correct or not? Or did I add the code in a wrong way? Moreover, why use this kind of anti-human string expressions?

EDIT: I think I know the reason why F5 does not work. I need to install Revise.jl

following this link: Configuration · Rebugger.jl
I got roughly and uncomfortably how to get the cryptic string. Yet, I tried it in my workstation computer (relatively powerful compared with a normal computer), and it does not work! Sigh.

These “anti-human” strings are ANSI escape codes, which date back to the 70s. It isn’t really anything about Rebugger — it’s about how your Terminal talks to Julia.

Exactly what escape code gets sent for a key like F7 will depend upon your keyboard, OS, terminal, and its configuration.

5 Likes

@mbauman Thank you for your detailed reply. Could you kindly help me figure out what is the cryptic string representation of f5 key? Somehow it does not work in my computer.

What OS and terminal are you using?

I’m using Linux ubuntu.