Skip to content

Commit a4dd7fa

Browse files
IanButterworthDrvi
authored andcommitted
Profile: use full terminal cols to show function name (JuliaLang#53055)
(cherry picked from commit 4919dd7)
1 parent df05523 commit a4dd7fa

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

stdlib/Profile/src/Profile.jl

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -859,7 +859,6 @@ function tree_format(frames::Vector{<:StackFrameTree}, level::Int, cols::Int, ma
859859
ndigline = ndigits(maximum(frame.frame.line for frame in frames)) + 6
860860
ntext = max(30, cols - ndigoverhead - nindent - ndigcounts - ndigline - 6)
861861
widthfile = 2*ntext÷5 # min 12
862-
widthfunc = 3*ntext÷5 # min 18
863862
strs = Vector{String}(undef, length(frames))
864863
showextra = false
865864
if level > nindent
@@ -901,11 +900,12 @@ function tree_format(frames::Vector{<:StackFrameTree}, level::Int, cols::Int, ma
901900
":",
902901
li.line == -1 ? "?" : string(li.line),
903902
"; ",
904-
ltruncto(fname, widthfunc))
903+
fname)
905904
end
906905
else
907906
strs[i] = string(stroverhead, "", base, strcount, " [unknown stackframe]")
908907
end
908+
strs[i] = ltruncto(strs[i], cols)
909909
end
910910
return strs
911911
end
@@ -1161,17 +1161,17 @@ end
11611161

11621162
# Utilities
11631163
function rtruncto(str::String, w::Int)
1164-
if length(str) <= w
1164+
if textwidth(str) <= w
11651165
return str
11661166
else
1167-
return string("...", str[prevind(str, end, w-4):end])
1167+
return string("", str[prevind(str, end, w-2):end])
11681168
end
11691169
end
11701170
function ltruncto(str::String, w::Int)
1171-
if length(str) <= w
1171+
if textwidth(str) <= w
11721172
return str
11731173
else
1174-
return string(str[1:nextind(str, 1, w-4)], "...")
1174+
return string(str[1:nextind(str, 1, w-2)], "")
11751175
end
11761176
end
11771177

0 commit comments

Comments
 (0)