2017-06-20 13:57:32 +08:00
|
|
|
# Define the default debugging prompt command.
|
|
|
|
function fish_breakpoint_prompt --description "A right prompt to be used when `breakpoint` is executed"
|
|
|
|
set -l saved_status $status
|
2017-06-24 13:14:21 +08:00
|
|
|
set -l function (status -L0 function)
|
|
|
|
set -l line (status -L0 line-number)
|
2017-06-20 13:57:32 +08:00
|
|
|
# At the moment we don't include the filename because, even if we truncate it, it makes the
|
|
|
|
# prompt too long.
|
2017-06-24 13:14:21 +08:00
|
|
|
#set -l filename (status filename)
|
2017-06-20 13:57:32 +08:00
|
|
|
#set -l prompt "$filename:$function:$line >"
|
|
|
|
set -l prompt "$function:$line"
|
|
|
|
if test $saved_status -ne 0
|
|
|
|
set prompt "$prompt [!$saved_status]"
|
|
|
|
end
|
|
|
|
set prompt "$prompt > "
|
|
|
|
|
|
|
|
# Make sure the prompt doesn't consume more than half the terminal width.
|
2017-09-10 14:35:47 +08:00
|
|
|
set -l max_len (math "$COLUMNS / 2")
|
2017-06-20 13:57:32 +08:00
|
|
|
if test (string length -- $prompt) -gt $max_len
|
2017-09-10 14:35:47 +08:00
|
|
|
set prompt ...(string sub -s -(math $max_len - 3) -- $prompt)
|
2017-06-20 13:57:32 +08:00
|
|
|
end
|
|
|
|
|
|
|
|
echo -ns (set_color $fish_color_status) "BP $prompt" (set_color normal) ' '
|
|
|
|
end
|