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 {
108108 flags. insert ( NeedsUpdate :: COMMANDS ) ;
109109 } else if let Event :: Key ( k) = ev {
110110 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-
119111 keys:: TAB_TOGGLE => {
120112 self . toggle_tabs ( ) ;
121113 NeedsUpdate :: COMMANDS
@@ -265,6 +257,7 @@ impl App {
265257 flags. insert ( NeedsUpdate :: ALL ) ;
266258 }
267259 InternalEvent :: Update ( u) => flags. insert ( u) ,
260+ InternalEvent :: OpenCommit => self . commit . show ( ) ,
268261 } ;
269262
270263 flags
Original file line number Diff line number Diff line change @@ -302,7 +302,7 @@ impl Component for ChangesComponent {
302302 fn commands (
303303 & self ,
304304 out : & mut Vec < CommandInfo > ,
305- _force_all : bool ,
305+ force_all : bool ,
306306 ) -> CommandBlocking {
307307 let some_selection = self . selection ( ) . is_some ( ) ;
308308
@@ -323,6 +323,14 @@ impl Component for ChangesComponent {
323323 some_selection,
324324 self . focused ,
325325 ) ) ;
326+ out. push (
327+ CommandInfo :: new (
328+ commands:: COMMIT_OPEN ,
329+ !self . is_empty ( ) ,
330+ self . focused || force_all,
331+ )
332+ . order ( -1 ) ,
333+ ) ;
326334 }
327335
328336 out. push ( CommandInfo :: new (
@@ -338,6 +346,15 @@ impl Component for ChangesComponent {
338346 if self . focused {
339347 if let Event :: Key ( e) = ev {
340348 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+ }
341358 keys:: STATUS_STAGE_FILE => {
342359 if self . index_add_remove ( ) {
343360 self . queue . borrow_mut ( ) . push_back (
@@ -348,9 +365,10 @@ impl Component for ChangesComponent {
348365 }
349366 true
350367 }
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 ( )
354372 }
355373 keys:: MOVE_DOWN => {
356374 self . move_selection ( MoveSelection :: Down )
Original file line number Diff line number Diff line change @@ -33,6 +33,8 @@ pub enum InternalEvent {
3333 ShowMsg ( String ) ,
3434 ///
3535 Update ( NeedsUpdate ) ,
36+ ///
37+ OpenCommit ,
3638}
3739
3840///
Original file line number Diff line number Diff line change @@ -14,7 +14,7 @@ pub static COMMIT_MSG: &str = "type commit message..";
1414pub static RESET_TITLE : & str = "Reset" ;
1515pub static RESET_MSG : & str = "confirm file reset?" ;
1616
17- pub static HELP_TITLE : & str = "Help" ;
17+ pub static HELP_TITLE : & str = "Help: all commands " ;
1818
1919pub mod commands {
2020 use crate :: components:: CommandText ;
@@ -100,7 +100,7 @@ pub mod commands {
100100 ///
101101 pub static COMMIT_OPEN : CommandText = CommandText :: new (
102102 "Commit [c]" ,
103- "open commit view (available in non-empty stage)" ,
103+ "open commit popup (available in non-empty stage)" ,
104104 CMD_GROUP_COMMIT ,
105105 ) ;
106106 ///
Original file line number Diff line number Diff line change @@ -130,13 +130,6 @@ impl Status {
130130 }
131131 }
132132
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-
140133 fn switch_focus ( & mut self , f : Focus ) -> bool {
141134 if self . focus != f {
142135 self . focus = f;
@@ -273,16 +266,6 @@ impl Component for Status {
273266 ) ) ;
274267 }
275268
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-
286269 out. push (
287270 CommandInfo :: new (
288271 commands:: SELECT_STATUS ,
You can’t perform that action at this time.
0 commit comments