File tree Expand file tree Collapse file tree 2 files changed +10
-3
lines changed Expand file tree Collapse file tree 2 files changed +10
-3
lines changed Original file line number Diff line number Diff line change 1+ 2025-10-27 Bart Schaefer <
[email protected] >
2+
3+ * Dan Drake: 53803: Functions/Prompts/prompt_adam1_setup: make
4+ adam1 prompt wrap len, ellipsized path elements configurable
5+
162025-10-26 Bart Schaefer <
[email protected] >
27
38 * Philippe: 53732: Src/loop.c, Test/A01grammar.ztst: avoid tail-call
Original file line number Diff line number Diff line change @@ -22,6 +22,8 @@ prompt_adam1_setup () {
2222 prompt_adam1_color1=${1:-'blue'}
2323 prompt_adam1_color2=${2:-'cyan'}
2424 prompt_adam1_color3=${3:-'green'}
25+ prompt_wrap_length=${4:-40}
26+ prompt_path_ellipsize_num=${5:-4}
2527
2628 base_prompt="%K{$prompt_adam1_color1}%n@%m%k "
2729 post_prompt="%b%f%k"
@@ -39,10 +41,10 @@ prompt_adam1_precmd () {
3941 local prompt_length space_left
4042
4143 base_prompt_expanded_no_color=$(print -P "$base_prompt_no_color")
42- base_prompt_etc=$(print -P "$base_prompt%(4 ~|...|)%3 ~")
44+ base_prompt_etc=$(print -P "$base_prompt%($((${prompt_path_ellipsize_num} + 1)) ~|...|)%${prompt_path_ellipsize_num} ~")
4345 prompt_length=${#base_prompt_etc}
44- if [[ $prompt_length -lt 40 ]]; then
45- path_prompt="%B%F{$prompt_adam1_color2}%(4 ~|...|)%3 ~%F{white}"
46+ if [[ $prompt_length -lt $prompt_wrap_length ]]; then
47+ path_prompt="%B%F{$prompt_adam1_color2}%($((${prompt_path_ellipsize_num} + 1)) ~|...|)%${prompt_path_ellipsize_num} ~%F{white}"
4648 else
4749 space_left=$(( $COLUMNS - $#base_prompt_expanded_no_color - 2 ))
4850 path_prompt="%B%F{$prompt_adam1_color3}%${space_left}<...<%~$prompt_newline%F{white}"
You can’t perform that action at this time.
0 commit comments