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
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])
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This won't work right with composites, will it? But of course that's an existing issue with the code; and one might argue that usually it won't matter in this context. Unless someone heavily uses accents in function names perhaps?

I.e., compare this:

julia> s = "áb"  # input via ""a\acute<TAB>b""
"áb"

julia> collect(s)
3-element Vector{Char}:
 'a': ASCII/Unicode U+0061 (category Ll: Letter, lowercase)
 '́': Unicode U+0301 (category Mn: Mark, nonspacing)
 'b': ASCII/Unicode U+0062 (category Ll: Letter, lowercase)

julia> using Unicode

julia> collect(Unicode.graphemes(s))
2-element Vector{SubString{String}}:
 "á"
 "b"

Anyway, don't take this as an objection to this PR from me -- this issue will never affect me, I only ever use ASCII function names, so I don't mind either way ;-)

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