Skip to content

Commit

Permalink
Profile: use full terminal cols to show function name (JuliaLang#53055)
Browse files Browse the repository at this point in the history
  • Loading branch information
IanButterworth authored Jan 25, 2024
1 parent 55c13d2 commit 4919dd7
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions stdlib/Profile/src/Profile.jl
Original file line number Diff line number Diff line change
Expand Up @@ -891,7 +891,6 @@ function tree_format(frames::Vector{<:StackFrameTree}, level::Int, cols::Int, ma
ndigline = ndigits(maximum(frame.frame.line for frame in frames)) + 6
ntext = max(30, cols - ndigoverhead - nindent - ndigcounts - ndigline - 6)
widthfile = 2*ntext÷5 # min 12
widthfunc = 3*ntext÷5 # min 18
strs = Vector{String}(undef, length(frames))
showextra = false
if level > nindent
Expand Down Expand Up @@ -933,11 +932,12 @@ function tree_format(frames::Vector{<:StackFrameTree}, level::Int, cols::Int, ma
":",
li.line == -1 ? "?" : string(li.line),
"; ",
ltruncto(fname, widthfunc))
fname)
end
else
strs[i] = string(stroverhead, "", base, strcount, " [unknown stackframe]")
end
strs[i] = ltruncto(strs[i], cols)
end
return strs
end
Expand Down Expand Up @@ -1193,17 +1193,17 @@ end

# Utilities
function rtruncto(str::String, w::Int)
if length(str) <= w
if textwidth(str) <= w
return str
else
return string("...", str[prevind(str, end, w-4):end])
return string("", str[prevind(str, end, w-2):end])
end
end
function ltruncto(str::String, w::Int)
if length(str) <= w
if textwidth(str) <= w
return str
else
return string(str[1:nextind(str, 1, w-4)], "...")
return string(str[1:nextind(str, 1, w-2)], "")
end
end

Expand Down

0 comments on commit 4919dd7

Please sign in to comment.