summaryrefslogtreecommitdiff
path: root/internal/wizard.zsh
diff options
context:
space:
mode:
authorRoman Perepelitsa <roman.perepelitsa@gmail.com>2023-05-04 12:50:14 +0300
committerRoman Perepelitsa <roman.perepelitsa@gmail.com>2023-05-04 12:50:14 +0300
commit0af598cbed78660066f8a8f4465844501ba5695b (patch)
treef8a21a28d5966bab007d6cd754eb2abd74cbbcbf /internal/wizard.zsh
parentce0bee979bec1b63d2d2005d96253bbe87fe2a72 (diff)
wizard: add a screen for detecting faulty terminals that render glyphs such as U+F0001 as wide (e.g., Windows Terminal)v1.18.0
Diffstat (limited to 'internal/wizard.zsh')
-rw-r--r--internal/wizard.zsh36
1 files changed, 36 insertions, 0 deletions
diff --git a/internal/wizard.zsh b/internal/wizard.zsh
index c77f8151..2265b07c 100644
--- a/internal/wizard.zsh
+++ b/internal/wizard.zsh
@@ -795,6 +795,39 @@ function ask_arrow() {
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() {
if [[ $POWERLEVEL9K_MODE == (powerline|compatible|ascii) ]]; then
POWERLEVEL9K_ICON_PADDING=none
@@ -2106,6 +2139,9 @@ while true; do
else
ask_arrow '\UF0737' "Let's try another one." || continue
if (( cap_arrow )); then
+ ask_width || continue
+ fi
+ if (( cap_arrow )); then
POWERLEVEL9K_MODE=nerdfont-v3
else
POWERLEVEL9K_MODE=awesome-fontconfig