The current newline segment does 2 things, it adds a newline but it also adds the $/# 'prompt character'; which renders it useless for use at the start or in the middle of a prompt. To work around those issue I had to create 2 custom segments of my own, one for just a newline and one for just the prompt character. However those rely on un-documented private implementation details of trueline and I would prefer if they were included upstream. I think replacing the current newline segment by those 2 new segments would give more flexibility for all users.
_trueline_my_newline_segment() {
local fg_color="$1"
local bg_color="$2"
local font_style="$3"
local segment="$(_trueline_separator default_bg)"
segment+="\n"
PS1+="$segment"
unset _last_color
}
_trueline_prompt_char_segment() {
local fg_color="$1"
local bg_color="$2"
local font_style="$3"
local is_root="$(_trueline_is_root)"
local newline_symbol="${TRUELINE_SYMBOLS[newline]}"
if [[ -n "$is_root" ]]; then
local newline_symbol="${TRUELINE_SYMBOLS[newline_root]}"
fi
local segment="$(_trueline_separator)"
segment+="$(_trueline_content "$fg_color" "$bg_color" "$font_style" " $newline_symbol ")"
PS1+="$segment"
_trueline_record_colors "$fg_color" "$bg_color" "$font_style" true
}
The current newline segment does 2 things, it adds a newline but it also adds the $/# 'prompt character'; which renders it useless for use at the start or in the middle of a prompt. To work around those issue I had to create 2 custom segments of my own, one for just a newline and one for just the prompt character. However those rely on un-documented private implementation details of trueline and I would prefer if they were included upstream. I think replacing the current newline segment by those 2 new segments would give more flexibility for all users.