Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/REPLMode/REPLMode.jl
Original file line number Diff line number Diff line change
Expand Up @@ -719,6 +719,7 @@ function try_prompt_pkg_add(pkgs::Vector{Symbol})
editable_envs = filter(v -> v != "@stdlib", LOAD_PATH)
option_list = String[]
keybindings = Char[]
shown_envs = String[]
# We use digits 1-9 as keybindings in the env selection menu
# That's why we can display at most 9 items in the menu
for i in 1:min(length(editable_envs), 9)
Expand All @@ -730,6 +731,7 @@ function try_prompt_pkg_add(pkgs::Vector{Symbol})
n = length(option_list) + 1
push!(option_list, "$(n): $(pathrepr(expanded_env)) ($(env))")
push!(keybindings, only("$n"))
push!(shown_envs, expanded_env)
end
menu = TerminalMenus.RadioMenu(option_list, keybindings=keybindings, pagesize=length(option_list))
print(ctx.io, "\e[1A\e[1G\e[0J") # go up one line, to the start, and clear it
Expand All @@ -744,7 +746,7 @@ function try_prompt_pkg_add(pkgs::Vector{Symbol})
rethrow()
end
choice == -1 && return false
API.activate(envs[choice]) do
API.activate(shown_envs[choice]) do
API.add(string.(available_pkgs))
end
elseif (lower_resp in ["n"])
Expand Down