This patch does that and adds help text for the new wrap_length and ellipsize_num parameters.
commit ca82ace73f4175d32db5ae03b69d73ea1e643b0eDate: Sat Nov 1 08:40:35 2025 -0500
Update adam1 for more accurate prompt length
Use base_prompt_no_color in base_prompt_etc to get an accurate value for
$prompt_length, analogous to space_left and
base_prompt_expanded_no_color.
Also document the fourth and fifth parameters for wrap_length and
ellipsize_num, respectively.
diff --git a/Functions/Prompts/prompt_adam1_setup b/Functions/Prompts/prompt_adam1_setup
index b88ffc7c1..a7b55b060 100644
--- a/Functions/Prompts/prompt_adam1_setup
+++ b/Functions/Prompts/prompt_adam1_setup
@@ -4,13 +4,22 @@ prompt_adam1_help () {
cat <<'EOF'
This prompt is color-scheme-able. You can invoke it thus:
- prompt adam1 [<color1> [<color2> [<color3>]]]
+ prompt adam1 [<color1> [<color2> [<color3> [<wrap_length> [<ellipsize_num]]]]]
where the colors are for the user@host background, current working
directory, and current working directory if the prompt is split over
two lines respectively. The default colors are blue, cyan and green.
This theme works best with a dark background.
+The wrap length is the maximum length for the base prompt on the left
+(the user@host and current working directory) before the prompt is split
+over two lines. The default wrap length is 40.
+
+Ellipsize_num is the maximum number of directory components shown in a
+single-line prompt. If the current working directory has more than
+ellipsize_num components, only the final ellipsize_num are shown after
+a leading '...'. This defaults to 4.
+
Recommended fonts for this theme: nexus or vga or similar. If you
don't have any of these, then specify the `plain' option to use 7-bit
replacements for the 8-bit characters.
@@ -41,7 +50,7 @@ prompt_adam1_precmd () {
local prompt_length space_left
base_prompt_expanded_no_color=$(print -P "$base_prompt_no_color")
- base_prompt_etc=$(print -P "$base_prompt%($((${prompt_path_ellipsize_num} + 1))~|...|)%${prompt_path_ellipsize_num}~")
+ base_prompt_etc=$(print -P "$base_prompt_no_color%($((${prompt_path_ellipsize_num} + 1))~|...|)%${prompt_path_ellipsize_num}~")
prompt_length=${#base_prompt_etc}
if [[ $prompt_length -lt $prompt_wrap_length ]]; then
path_prompt="%B%F{$prompt_adam1_color2}%($((${prompt_path_ellipsize_num} + 1))~|...|)%${prompt_path_ellipsize_num}~%F{white}"