File tree Expand file tree Collapse file tree 5 files changed +27
-31
lines changed Expand file tree Collapse file tree 5 files changed +27
-31
lines changed Original file line number Diff line number Diff line change @@ -108,14 +108,6 @@ impl App {
108
108
flags. insert ( NeedsUpdate :: COMMANDS ) ;
109
109
} else if let Event :: Key ( k) = ev {
110
110
let new_flags = match k {
111
- //TODO: move into status tab
112
- keys:: OPEN_COMMIT
113
- if self . status_tab . offer_open_commit_cmd ( ) =>
114
- {
115
- self . commit . show ( ) ;
116
- NeedsUpdate :: COMMANDS
117
- }
118
-
119
111
keys:: TAB_TOGGLE => {
120
112
self . toggle_tabs ( ) ;
121
113
NeedsUpdate :: COMMANDS
@@ -265,6 +257,7 @@ impl App {
265
257
flags. insert ( NeedsUpdate :: ALL ) ;
266
258
}
267
259
InternalEvent :: Update ( u) => flags. insert ( u) ,
260
+ InternalEvent :: OpenCommit => self . commit . show ( ) ,
268
261
} ;
269
262
270
263
flags
Original file line number Diff line number Diff line change @@ -302,7 +302,7 @@ impl Component for ChangesComponent {
302
302
fn commands (
303
303
& self ,
304
304
out : & mut Vec < CommandInfo > ,
305
- _force_all : bool ,
305
+ force_all : bool ,
306
306
) -> CommandBlocking {
307
307
let some_selection = self . selection ( ) . is_some ( ) ;
308
308
@@ -323,6 +323,14 @@ impl Component for ChangesComponent {
323
323
some_selection,
324
324
self . focused ,
325
325
) ) ;
326
+ out. push (
327
+ CommandInfo :: new (
328
+ commands:: COMMIT_OPEN ,
329
+ !self . is_empty ( ) ,
330
+ self . focused || force_all,
331
+ )
332
+ . order ( -1 ) ,
333
+ ) ;
326
334
}
327
335
328
336
out. push ( CommandInfo :: new (
@@ -338,6 +346,15 @@ impl Component for ChangesComponent {
338
346
if self . focused {
339
347
if let Event :: Key ( e) = ev {
340
348
return match e {
349
+ keys:: OPEN_COMMIT
350
+ if !self . is_working_dir
351
+ && !self . is_empty ( ) =>
352
+ {
353
+ self . queue
354
+ . borrow_mut ( )
355
+ . push_back ( InternalEvent :: OpenCommit ) ;
356
+ true
357
+ }
341
358
keys:: STATUS_STAGE_FILE => {
342
359
if self . index_add_remove ( ) {
343
360
self . queue . borrow_mut ( ) . push_back (
@@ -348,9 +365,10 @@ impl Component for ChangesComponent {
348
365
}
349
366
true
350
367
}
351
- keys:: STATUS_RESET_FILE => {
352
- self . is_working_dir
353
- && self . dispatch_reset_workdir ( )
368
+ keys:: STATUS_RESET_FILE
369
+ if self . is_working_dir =>
370
+ {
371
+ self . dispatch_reset_workdir ( )
354
372
}
355
373
keys:: MOVE_DOWN => {
356
374
self . move_selection ( MoveSelection :: Down )
Original file line number Diff line number Diff line change @@ -33,6 +33,8 @@ pub enum InternalEvent {
33
33
ShowMsg ( String ) ,
34
34
///
35
35
Update ( NeedsUpdate ) ,
36
+ ///
37
+ OpenCommit ,
36
38
}
37
39
38
40
///
Original file line number Diff line number Diff line change @@ -14,7 +14,7 @@ pub static COMMIT_MSG: &str = "type commit message..";
14
14
pub static RESET_TITLE : & str = "Reset" ;
15
15
pub static RESET_MSG : & str = "confirm file reset?" ;
16
16
17
- pub static HELP_TITLE : & str = "Help" ;
17
+ pub static HELP_TITLE : & str = "Help: all commands " ;
18
18
19
19
pub mod commands {
20
20
use crate :: components:: CommandText ;
@@ -100,7 +100,7 @@ pub mod commands {
100
100
///
101
101
pub static COMMIT_OPEN : CommandText = CommandText :: new (
102
102
"Commit [c]" ,
103
- "open commit view (available in non-empty stage)" ,
103
+ "open commit popup (available in non-empty stage)" ,
104
104
CMD_GROUP_COMMIT ,
105
105
) ;
106
106
///
Original file line number Diff line number Diff line change @@ -130,13 +130,6 @@ impl Status {
130
130
}
131
131
}
132
132
133
- //TODO: unpub
134
- pub fn offer_open_commit_cmd ( & self ) -> bool {
135
- self . visible
136
- && self . diff_target == DiffTarget :: Stage
137
- && !self . index . is_empty ( )
138
- }
139
-
140
133
fn switch_focus ( & mut self , f : Focus ) -> bool {
141
134
if self . focus != f {
142
135
self . focus = f;
@@ -273,16 +266,6 @@ impl Component for Status {
273
266
) ) ;
274
267
}
275
268
276
- out. push (
277
- CommandInfo :: new (
278
- commands:: COMMIT_OPEN ,
279
- !self . index . is_empty ( ) ,
280
- ( self . visible && self . offer_open_commit_cmd ( ) )
281
- || force_all,
282
- )
283
- . order ( -1 ) ,
284
- ) ;
285
-
286
269
out. push (
287
270
CommandInfo :: new (
288
271
commands:: SELECT_STATUS ,
You can’t perform that action at this time.
0 commit comments