Skip to content

Commit

Permalink
fix REPL prompt on 1.10
Browse files Browse the repository at this point in the history
  • Loading branch information
KristofferC committed Jun 22, 2024
1 parent 202151d commit ffb88e8
Showing 1 changed file with 4 additions and 19 deletions.
23 changes: 4 additions & 19 deletions stdlib/REPL/src/Pkg_beforeload.jl
Original file line number Diff line number Diff line change
Expand Up @@ -53,15 +53,6 @@ function find_project_file(env::Union{Nothing,String}=nothing)
return safe_realpath(project_file)
end

function find_root_base_project(start_project::String)
project_file = start_project
while true
base_project_file = Base.base_project(project_file)
base_project_file === nothing && return project_file
project_file = base_project_file
end
end

function relative_project_path(project_file::String, path::String)
# compute path relative the project
# realpath needed to expand symlinks before taking the relative path
Expand Down Expand Up @@ -107,17 +98,11 @@ function Pkg_promptf()
else
project_name = projname(project_file)
if project_name !== nothing
root = find_root_base_project(project_file)
rootname = projname(root)
if root !== project_file
path_prefix = "/" * dirname(relative_project_path(root, project_file))
else
path_prefix = ""
end
if textwidth(rootname) > 30
rootname = first(rootname, 27) * "..."
pname = projname(project_file)
if textwidth(pname) > 30
pname = first(pname, 27) * "..."
end
prefix = "($(rootname)$(path_prefix)) "
prefix = "($(pname)) "
prev_prefix = prefix
prev_project_timestamp = mtime(project_file)
prev_project_file = project_file
Expand Down

0 comments on commit ffb88e8

Please sign in to comment.