Fix demo rotation and move demo to top

This commit is contained in:
2026-01-24 18:27:03 +00:00
parent 761a1ae38a
commit 8c68ce28f7
3 changed files with 61 additions and 62 deletions

View File

@@ -228,14 +228,13 @@ _ps1_demo_next() {
"" "" "" "" "" "" ""
)
local count=${#styles[@]}
if [[ -z "${__PS1_DEMO_INDEX+x}" ]]; then
__PS1_DEMO_INDEX=0
else
__PS1_DEMO_INDEX=$(( (__PS1_DEMO_INDEX + 1) % count ))
fi
__PS1_DEMO_STYLE="${styles[$__PS1_DEMO_INDEX]}"
__PS1_DEMO_PACK="${packs[$__PS1_DEMO_INDEX]}"
__PS1_DEMO_HOLIDAY="${holidays[$__PS1_DEMO_INDEX]}"
local idx="${PS1_DEMO_INDEX:--1}"
idx=$(( (idx + 1) % count ))
PS1_DEMO_INDEX="$idx"
export PS1_DEMO_INDEX
__PS1_DEMO_STYLE="${styles[$idx]}"
__PS1_DEMO_PACK="${packs[$idx]}"
__PS1_DEMO_HOLIDAY="${holidays[$idx]}"
}
# ---- Load Git prompt helper (best effort) ----