From 4919dd79dfd848eb6d9929768666977f374c7f10 Mon Sep 17 00:00:00 2001 From: Ian Butterworth Date: Thu, 25 Jan 2024 14:50:47 -0500 Subject: [PATCH] Profile: use full terminal cols to show function name (#53055) --- stdlib/Profile/src/Profile.jl | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/stdlib/Profile/src/Profile.jl b/stdlib/Profile/src/Profile.jl index aad97be683309..e01f5ae7d2d6b 100644 --- a/stdlib/Profile/src/Profile.jl +++ b/stdlib/Profile/src/Profile.jl @@ -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 @@ -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 @@ -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