Skip to content

Commit 0af598c

Browse files
committed
wizard: add a screen for detecting faulty terminals that render glyphs such as U+F0001 as wide (e.g., Windows Terminal)
1 parent ce0bee9 commit 0af598c

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

internal/wizard.zsh

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -795,6 +795,39 @@ function ask_arrow() {
795795
return 0
796796
}
797797

798+
function print_indented() {
799+
local -i max_width=$1
800+
local text=$2
801+
local -i indent='(wizard_columns - max_width) / 2'
802+
print -P "${(l:$indent:: :)}$text"
803+
}
804+
805+
function ask_width() {
806+
add_widget 0 flowing -c %BWhat digit is the%b "%2Fdownwards arrow%f" %Bpointing "at?%b"
807+
add_widget 0 print -P ""
808+
add_widget 0 print_indented 11 '%3F\UF0734%f %3F\UF0734%f %3F\UF0734%f %2F\UF072E%f'
809+
add_widget 0 print_indented 11 ' 111222'
810+
add_widget 0 print -P ""
811+
add_widget 3
812+
add_widget 0 print -P "%B(1) It is pointing at '1'.%b"
813+
add_widget 0 print -P ""
814+
add_widget 1
815+
add_widget 0 print -P "%B(2) It is pointing at '2'.%b"
816+
add_widget 0 print -P ""
817+
add_widget 1
818+
add_widget 0 print -P "%B(3) Something else.%b"
819+
add_widget 0 print -P ""
820+
add_widget 2
821+
add_widget 0 print -P "(r) Restart from the beginning."
822+
ask 123r
823+
case $choice in
824+
r) return 1;;
825+
1) cap_arrow=1;;
826+
2|3) cap_arrow=0;;
827+
esac
828+
return 0
829+
}
830+
798831
function ask_icon_padding() {
799832
if [[ $POWERLEVEL9K_MODE == (powerline|compatible|ascii) ]]; then
800833
POWERLEVEL9K_ICON_PADDING=none
@@ -2105,6 +2138,9 @@ while true; do
21052138
POWERLEVEL9K_MODE=nerdfont-complete
21062139
else
21072140
ask_arrow '\UF0737' "Let's try another one." || continue
2141+
if (( cap_arrow )); then
2142+
ask_width || continue
2143+
fi
21082144
if (( cap_arrow )); then
21092145
POWERLEVEL9K_MODE=nerdfont-v3
21102146
else

0 commit comments

Comments
 (0)