@@ -25,47 +25,48 @@ pub struct AppSub {
2525 pub ( crate ) input_mode : InputMode ,
2626 // History of recorded subs
2727 // subs's names
28- pub subs : Vec < String > ,
29- pub state : ListState ,
28+ pub subs : Vec < Vec < String > > ,
29+ pub subsindex : usize ,
30+ pub state : Vec < ListState > ,
3031 pub index_subscription : ListState ,
3132 pub index_settings : usize ,
3233 pub stateoflist : bool ,
3334 pub show_popup : bool ,
3435 // subscribes's information
35- pub informations : Vec < spider:: Information > ,
36+ pub informations : Vec < Vec < spider:: Information > > ,
3637 pub subscription : Vec < String > ,
3738}
3839impl AppSub {
3940 pub fn next ( & mut self ) {
40- let i = match self . state . selected ( ) {
41+ let i = match self . state [ self . subsindex ] . selected ( ) {
4142 Some ( i) => {
42- if i >= self . subs . len ( ) - 1 {
43+ if i >= self . subs [ self . subsindex ] . len ( ) - 1 {
4344 0
4445 } else {
4546 i + 1
4647 }
4748 }
4849 None => 0 ,
4950 } ;
50- self . state . select ( Some ( i) ) ;
51+ self . state [ self . subsindex ] . select ( Some ( i) ) ;
5152 }
5253
5354 pub fn previous ( & mut self ) {
54- let i = match self . state . selected ( ) {
55+ let i = match self . state [ self . subsindex ] . selected ( ) {
5556 Some ( i) => {
5657 if i == 0 {
57- self . subs . len ( ) - 1
58+ self . subs [ self . subsindex ] . len ( ) - 1
5859 } else {
5960 i - 1
6061 }
6162 }
6263 None => 0 ,
6364 } ;
64- self . state . select ( Some ( i) ) ;
65+ self . state [ self . subsindex ] . select ( Some ( i) ) ;
6566 }
6667
6768 pub fn unselect ( & mut self ) {
68- self . state . select ( None ) ;
69+ self . state [ self . subsindex ] . select ( None ) ;
6970 }
7071 pub fn next_sub ( & mut self ) {
7172 let i = match self . index_subscription . selected ( ) {
@@ -113,13 +114,14 @@ impl Default for AppSub {
113114 input : String :: new ( ) ,
114115 settings_input : vec ! [ String :: new( ) , String :: new( ) ] ,
115116 input_mode : InputMode :: Normal ,
116- subs : Vec :: new ( ) ,
117- state : ListState :: default ( ) ,
117+ subs : vec ! [ vec![ ] ] ,
118+ subsindex : 0 ,
119+ state : vec ! [ ListState :: default ( ) ] ,
118120 index_subscription : ListState :: default ( ) ,
119121 index_settings : 0 ,
120122 stateoflist : false ,
121123 show_popup : false ,
122- informations : Vec :: new ( ) ,
124+ informations : vec ! [ vec! [ ] ] ,
123125 subscription : Vec :: new ( ) ,
124126 }
125127 }
0 commit comments