wizard bug fixes: screen redraws, spurious errors, frame selection

fixes #668
pull/690/head v1.6.1
romkatv 4 years ago
parent d3e5aebd69
commit 1b6c24e99e

@ -298,14 +298,17 @@ function render_screen_pass() {
done done
} }
function get_columns() { return 'COLUMNS > 88 ? 88 : COLUMNS' }
functions -M get_columns 0 0
function render_screen() { function render_screen() {
{ {
hide_cursor hide_cursor
stty -echo 2>/dev/null stty -echo 2>/dev/null
while true; do while true; do
while true; do while true; do
local -i wizard_columns=$((COLUMNS > 88 ? 88 : COLUMNS)) typeset -gi wizard_columns='get_columns()'
local -i wizard_lines=LINES typeset -gi wizard_lines=LINES
if (( wizard_columns < __p9k_wizard_columns )); then if (( wizard_columns < __p9k_wizard_columns )); then
clear clear
flowing -c %1FNot enough horizontal space.%f flowing -c %1FNot enough horizontal space.%f
@ -362,7 +365,7 @@ function add_prompt_n() {
add_widget 0 "$@" print_prompt add_widget 0 "$@" print_prompt
local var local var
for var; do for var; do
eval "local $var" eval "local ${(q)var}"
done done
if (( num_lines == 2 )); then if (( num_lines == 2 )); then
add_widget $(( 100 - ++prompt_idx )) print -P ' [%3Fnot enough vertical space to display this%f]' add_widget $(( 100 - ++prompt_idx )) print -P ' [%3Fnot enough vertical space to display this%f]'
@ -379,13 +382,13 @@ function add_prompt() {
function ask() { function ask() {
local choices=$1 local choices=$1
local -i lines columns local -i lines columns wizard_lines wizard_columns
add_widget 0 print -P "(q) Quit and do nothing." add_widget 0 print -P "(q) Quit and do nothing."
add_widget 0 print add_widget 0 print
add_widget 0 print -P "%BChoice [${choices}q]: %b" add_widget 0 print -P "%BChoice [${choices}q]: %b"
while true; do while true; do
=true =true
if (( LINES != lines || COLUMNS != columns )); then if (( LINES != lines || get_columns() != columns )); then
render_screen render_screen
lines=wizard_lines lines=wizard_lines
columns=wizard_columns columns=wizard_columns
@ -1364,7 +1367,7 @@ function ask_frame() {
add_prompt left_frame=1 right_frame=1 add_prompt left_frame=1 right_frame=1
add_widget 0 print -P "(r) Restart from the beginning." add_widget 0 print -P "(r) Restart from the beginning."
ask 1234r ask 1234r
case $key in case $choice in
r) return 1;; r) return 1;;
1) left_frame=0; right_frame=0; options+='no frame';; 1) left_frame=0; right_frame=0; options+='no frame';;
2) left_frame=1; right_frame=0; options+='left frame';; 2) left_frame=1; right_frame=0; options+='left frame';;

Loading…
Cancel
Save