KristofferC / OhMyREPL.jl

Syntax highlighting and other enhancements for the Julia REPL
https://kristofferc.github.io/OhMyREPL.jl/latest/
Other
746 stars 57 forks source link

Fix moving up and down in REPL #350

Closed huangyxi closed 4 days ago

huangyxi commented 5 days ago

Fix #349 corresponding to https://github.com/JuliaLang/julia/pull/54674

https://github.com/JuliaLang/julia/pull/54674/files#diff-730f90e0bf9ca018477a1d4a52e0d7398af2bb8cf9e401568fd86690eec81bb7L1453-R1488

daviehh commented 4 days ago

Thanks for the quick fix! If you do not wish to hard code by assuming main mode is first entry, one can replace the main_mode = interface_modes[1] line w/ something like

get_prompt_str = m -> LineEdit.prompt_string(isdefined(m, :prompt) ? m.prompt : "")
mm_idx_ = findfirst(m -> get_prompt_str(m) == REPL.JULIA_PROMPT, interface_modes) # main mode index
mm_idx = isnothing(mm_idx_) ? 1 : mm_idx_
main_mode = interface_modes[mm_idx]