MasonProtter / ReplMaker.jl

Simple API for building repl modes in Julia
Other
134 stars 14 forks source link

ReplMaker and OhMyREPL conflict #18

Closed tuckertwo closed 3 years ago

tuckertwo commented 3 years ago

Problem

OhMyREPL is a package that enhances the base Julia REPL, in part by making various keys do useful things, like making { insert a closing curly bracket (and making it such that when one presses } while in front of to the } character, it moves over the latter and inserts nothing). To do so, it rebinds various keys, many of which are used (by other packages) to enter REPLs (for example, } is used by Reduce.jl). If ReplMaker detects that a key is in use by another package, it spits out a warning and does nothing else, causing the former keybind to break.

Examples

Note: a Unicode combining underscore (U+0332, ̲) follows the current cursor position in these examples.

Errant behavior

julia> using OhMyREPL, ReplMaker
[ Info: Precompiling OhMyREPL [5fb14364-9ced-5910-84b2-373655c76a03]
[ Info: Precompiling ReplMaker [b873ce64-0db9-51f5-a568-4457d8e49576]

julia>  ̲

Press {:

julia> { ̲}

Press }:

julia> {} ̲

Throw another keybind in:

julia> initrepl(identity, start_key='}')
┌ Warning: REPL key '}' overwritten.
└ @ ReplMaker ~/.julia/packages/ReplMaker/SZ5Aa/src/ReplMaker.jl:96
REPL mode mylang initialized. Press } to enter and backspace to exit.
"Prompt(\"myrepl> \",...)"

(The REPL mode works)

Mess with braces again Press {:

julia> { ̲}

Press }:

julia> {} ̲}

Expected behavior

julia> using OhMyREPL, ReplMaker
[ Info: Precompiling OhMyREPL [5fb14364-9ced-5910-84b2-373655c76a03]
[ Info: Precompiling ReplMaker [b873ce64-0db9-51f5-a568-4457d8e49576]

julia> initrepl(identity, start_key='}')
┌ Warning: REPL key '}' overwritten.
└ @ ReplMaker ~/.julia/packages/ReplMaker/SZ5Aa/src/ReplMaker.jl:96
REPL mode mylang initialized. Press } to enter and backspace to exit.
"Prompt(\"myrepl> \",...)"

julia> 

Mess with braces again Press {:

julia> { ̲}

Press }:

julia> {} ̲

(The REPL mode still works, but the keybind is triggered)

tuckertwo commented 3 years ago

Fixed by #19