@@ -7,7 +7,7 @@ use crate::{
7
7
InspectCommitComponent , MsgComponent , ResetComponent ,
8
8
StashMsgComponent ,
9
9
} ,
10
- input:: { InputEvent , InputState } ,
10
+ input:: { Input , InputEvent , InputState } ,
11
11
keys,
12
12
queue:: { Action , InternalEvent , NeedsUpdate , Queue } ,
13
13
strings:: { self , commands, order} ,
@@ -45,21 +45,25 @@ pub struct App {
45
45
stashlist_tab : StashList ,
46
46
queue : Queue ,
47
47
theme : SharedTheme ,
48
+ input : Input ,
48
49
49
50
// "Flags"
50
51
requires_redraw : Cell < bool > ,
51
- set_polling : bool ,
52
52
}
53
53
54
54
// public interface
55
55
impl App {
56
56
///
57
- pub fn new ( sender : & Sender < AsyncNotification > ) -> Self {
57
+ pub fn new (
58
+ sender : & Sender < AsyncNotification > ,
59
+ input : Input ,
60
+ ) -> Self {
58
61
let queue = Queue :: default ( ) ;
59
62
60
63
let theme = Rc :: new ( Theme :: init ( ) ) ;
61
64
62
65
Self {
66
+ input,
63
67
reset : ResetComponent :: new ( queue. clone ( ) , theme. clone ( ) ) ,
64
68
commit : CommitComponent :: new (
65
69
queue. clone ( ) ,
@@ -90,7 +94,6 @@ impl App {
90
94
queue,
91
95
theme,
92
96
requires_redraw : Cell :: new ( false ) ,
93
- set_polling : true ,
94
97
}
95
98
}
96
99
@@ -197,7 +200,7 @@ impl App {
197
200
self . msg . show_msg ( msg. as_str ( ) ) ?;
198
201
}
199
202
self . requires_redraw . set ( true ) ;
200
- self . set_polling = true ;
203
+ self . input . set_polling ( true ) ;
201
204
}
202
205
}
203
206
@@ -249,6 +252,7 @@ impl App {
249
252
|| self . revlog . any_work_pending ( )
250
253
|| self . stashing_tab . anything_pending ( )
251
254
|| self . inspect_commit_popup . any_work_pending ( )
255
+ || self . input . is_state_changing ( )
252
256
}
253
257
254
258
///
@@ -260,12 +264,6 @@ impl App {
260
264
false
261
265
}
262
266
}
263
-
264
- ///
265
- //TODO: rename
266
- pub const fn set_polling ( & self ) -> bool {
267
- self . set_polling
268
- }
269
267
}
270
268
271
269
// private impls
@@ -407,7 +405,7 @@ impl App {
407
405
flags. insert ( NeedsUpdate :: ALL | NeedsUpdate :: COMMANDS )
408
406
}
409
407
InternalEvent :: SuspendPolling => {
410
- self . set_polling = false ;
408
+ self . input . set_polling ( false ) ;
411
409
}
412
410
} ;
413
411
0 commit comments