summaryrefslogtreecommitdiff
path: root/internal/wizard.zsh
diff options
context:
space:
mode:
authorromkatv <roman.perepelitsa@gmail.com>2019-09-03 11:18:19 +0300
committerromkatv <roman.perepelitsa@gmail.com>2019-09-03 11:18:19 +0300
commitd6041f53aa17402298fd05ac4309dafb34dd75e7 (patch)
treefda7b61fdbfdb8ba486c9b4abcbec5c18d7bb731 /internal/wizard.zsh
parent8797ecd8e468ff8b250042dab432199438616c4d (diff)
wizard: make it look better on narrow screens
Diffstat (limited to 'internal/wizard.zsh')
-rwxr-xr-xinternal/wizard.zsh33
1 files changed, 27 insertions, 6 deletions
diff --git a/internal/wizard.zsh b/internal/wizard.zsh
index c9dc9e89..87d20823 100755
--- a/internal/wizard.zsh
+++ b/internal/wizard.zsh
@@ -129,9 +129,22 @@ function href() {
}
function centered() {
- local n=$(prompt_length ${(g::)1})
- (( n < wizard_columns )) && print -n -- ${(pl:$(((wizard_columns - n) / 2)):: :)}
- print -P -- $1
+ local line word lines=()
+ for word in "$@"; do
+ local n=$(prompt_length ${(g::):-"$line $word"})
+ if (( n > wizard_columns )); then
+ [[ -z $line ]] || lines+=$line
+ line=
+ fi
+ [[ -z $line ]] || line+=' '
+ line+=$word
+ done
+ [[ -z $line ]] || lines+=$line
+ for line in $lines; do
+ local n=$(prompt_length ${(g::)line})
+ (( n < wizard_columns )) && print -n -- ${(pl:$(((wizard_columns - n) / 2)):: :)}
+ print -P -- $line
+ done
}
function clear() {
@@ -170,9 +183,17 @@ function quit() {
function ask_diamond() {
while true; do
clear
- centered "%4FPowerlevel10k configuration wizard%f."
+ if (( force )); then
+ centered This is %4FPowerlevel10k configuration wizard%f. \
+ It will ask you a few questions and configure your prompt.
+ else
+ centered This is %4FPowerlevel10k configuration wizard%f. \
+ You are seeing it because you haven\'t defined any \
+ Powerlevel10k configuration options. It will ask \
+ you a few questions and configure your prompt.
+ fi
print -P ""
- centered "%BDoes this look like a %b%2Fdiamond%f%B (square rotated 45 degrees)?%b"
+ centered "%BDoes this look like a %b%2Fdiamond%f%B (rotated square)?%b"
centered "reference: $(href https://graphemica.com/%E2%97%86)"
print -P ""
centered "---> \uE0B2\uE0B0 <---"
@@ -253,7 +274,7 @@ function ask_debian() {
while true; do
clear
centered "%BDoes this look like a %b%2FDebian logo%f%B (swirl/spiral)?%b"
- centered "reference: $(href https://www.debian.org/logos/openlogo-nd-100.jpg)"
+ centered "reference: $(href https://debian.org/logos/openlogo-nd.svg)"
print -P ""
centered "---> \uF306 <---"
print -P ""