-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathzui-demo-list-boxes
40 lines (28 loc) · 1.38 KB
/
zui-demo-list-boxes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# Started from Zle or from command line
-zui_std_cleanup deserialize:"zui-demo-list-boxes"
-zui_std_init app:"zui-demo-list-boxes" app_name:"ZUI List-Boxes"
emulate -LR zsh -o extendedglob -o typesetsilent -o warncreateglobal
-zui_std_init2 # after emulate -LR
-zui_std_store_default_app_config b:border 1
-zui_std_store_default_app_config s:status_size 3
-zui_std_store_default_app_config b:status_border 1
local xtra # extra line of text, loaded from list box
# Generator for module 1
demo_generator_A() {
local mod="$1" ice="$2"
# Variables of the list box
(( ${+ZUI[my_lbox1_width]} == 0 )) && ZUI[my_lbox1_width]=8
(( ${+ZUI[my_lbox1_idx]} == 0 )) && ZUI[my_lbox1_idx]=2
(( ${+ZUI[my_lbox1_opts]} == 0 )) && ZUI[my_lbox1_opts]="Option 1;Option 2;Option 3"
reply=()
noglob -zui_std_list_box "lbox1_$mod" ZUI[my_lbox1_width] ZUI[my_lbox1_idx] ZUI[my_lbox1_opts] "" "" "" 'xtra="Received: ${ZUI[CYAN]}${${(s:;:)ZUI[my_lbox1_opts]}[${ZUI[my_lbox1_idx]}]}${ZUI[FMT_END]}"; -zui_std_fly_mod_regen "'"$mod"'" "'"$ice"'"'
# Content
reply=( "${ZUI[YELLOW]}ZUI${ZUI[FMT_END]} list-box example: <${reply[1]}>" $xtra )
# Non-selectable lines Hops to jump with [ and ] Local anchors
reply2=( ${xtra:+2} ) reply3=( 1 ) reply4=( )
}
## Start application ##
zui-event-loop 1:demo_generator_A
-zui_std_cleanup serialize
return 0
# vim:ft=zsh