From 478144ee4f7a0da53d0059cc1168c0f19c7d0aeb Mon Sep 17 00:00:00 2001 From: TEC Date: Sun, 22 Oct 2023 16:56:01 +0800 Subject: [PATCH] Use StyledStrings Faces for stacktrace printing This allows for the faces used (e.g. the file path) to be user-customised, which provides an escape from themes that make bright black invisible. --- base/errorshow.jl | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/base/errorshow.jl b/base/errorshow.jl index 8c3aa03b1e0953..0f148e2c10566b 100644 --- a/base/errorshow.jl +++ b/base/errorshow.jl @@ -100,9 +100,9 @@ function showerror(io::IO, ex, bt; backtrace=true) end end -function stacktrace_path(file::Union{Nothing, String}, line::Union{Nothing, Int64}) +function stacktrace_path(file::Union{Nothing, String}, line::Union{Nothing, Int}) realfile = if !isnothing(file) && file != "" && !startswith(String(file), "REPL") - fixup_stdlib_path(String(file)) + String(file) |> fixup_stdlib_path |> find_source_file end pathstr = file if !isnothing(pathstr) @@ -802,7 +802,8 @@ function print_stackframe(io, i, frame::StackFrame, n::Int, ndigits_max, modulec print(io, if inlined AnnotatedString("[inlined]", [(1:9, :face => :julia_stacktrace_inlined)]) else "" end) end -function print_module_path_file(io, modul, file, line; modulecolor = :bright_black, digit_align_width = 0) +function print_module_path_file(io::IO, modul::Module, file::Union{Nothing, String}, line::Union{Nothing, Int}; + modulecolor = :bright_black, digit_align_width = 0) print(io, ' ' ^ digit_align_width, AnnotatedString("@", [(1:1, :face => :julia_stacktrace_location)])) if modul !== nothing && modulecolor !== nothing mstr = string(modul)