1
0
Fork 0
mirror of https://github.com/romkatv/powerlevel10k.git synced 2024-11-22 04:10:07 +00:00

wizard: add a screen for detecting faulty terminals that render glyphs such as U+F0001 as wide (e.g., Windows Terminal)

This commit is contained in:
Roman Perepelitsa 2023-05-04 11:50:14 +02:00
parent ce0bee979b
commit 0af598cbed

View file

@ -795,6 +795,39 @@ function ask_arrow() {
return 0 return 0
} }
function print_indented() {
local -i max_width=$1
local text=$2
local -i indent='(wizard_columns - max_width) / 2'
print -P "${(l:$indent:: :)}$text"
}
function ask_width() {
add_widget 0 flowing -c %BWhat digit is the%b "%2Fdownwards arrow%f" %Bpointing "at?%b"
add_widget 0 print -P ""
add_widget 0 print_indented 11 '%3F\UF0734%f %3F\UF0734%f %3F\UF0734%f %2F\UF072E%f'
add_widget 0 print_indented 11 ' 111222'
add_widget 0 print -P ""
add_widget 3
add_widget 0 print -P "%B(1) It is pointing at '1'.%b"
add_widget 0 print -P ""
add_widget 1
add_widget 0 print -P "%B(2) It is pointing at '2'.%b"
add_widget 0 print -P ""
add_widget 1
add_widget 0 print -P "%B(3) Something else.%b"
add_widget 0 print -P ""
add_widget 2
add_widget 0 print -P "(r) Restart from the beginning."
ask 123r
case $choice in
r) return 1;;
1) cap_arrow=1;;
2|3) cap_arrow=0;;
esac
return 0
}
function ask_icon_padding() { function ask_icon_padding() {
if [[ $POWERLEVEL9K_MODE == (powerline|compatible|ascii) ]]; then if [[ $POWERLEVEL9K_MODE == (powerline|compatible|ascii) ]]; then
POWERLEVEL9K_ICON_PADDING=none POWERLEVEL9K_ICON_PADDING=none
@ -2105,6 +2138,9 @@ while true; do
POWERLEVEL9K_MODE=nerdfont-complete POWERLEVEL9K_MODE=nerdfont-complete
else else
ask_arrow '\UF0737' "Let's try another one." || continue ask_arrow '\UF0737' "Let's try another one." || continue
if (( cap_arrow )); then
ask_width || continue
fi
if (( cap_arrow )); then if (( cap_arrow )); then
POWERLEVEL9K_MODE=nerdfont-v3 POWERLEVEL9K_MODE=nerdfont-v3
else else