mirror of
https://github.com/gitui-org/gitui.git
synced 2026-10-12 02:14:16 +00:00
move focus after last file staged
This commit is contained in:
@@ -562,6 +562,9 @@ impl App {
|
||||
self.push_tags_popup.push_tags()?;
|
||||
flags.insert(NeedsUpdate::ALL)
|
||||
}
|
||||
InternalEvent::StatusLastFileMoved => {
|
||||
self.status_tab.last_file_moved()?;
|
||||
}
|
||||
};
|
||||
|
||||
Ok(flags)
|
||||
|
||||
@@ -87,6 +87,12 @@ impl ChangesComponent {
|
||||
_ => sync::stage_add_file(CWD, path)?,
|
||||
};
|
||||
|
||||
if self.is_empty() {
|
||||
self.queue.borrow_mut().push_back(
|
||||
InternalEvent::StatusLastFileMoved,
|
||||
);
|
||||
}
|
||||
|
||||
return Ok(true);
|
||||
}
|
||||
|
||||
@@ -274,6 +280,9 @@ impl Component for ChangesComponent {
|
||||
} else {
|
||||
self.stage_remove_all()?;
|
||||
}
|
||||
self.queue.borrow_mut().push_back(
|
||||
InternalEvent::StatusLastFileMoved,
|
||||
);
|
||||
Ok(EventState::Consumed)
|
||||
} else if e == self.key_config.status_reset_item
|
||||
&& self.is_working_dir
|
||||
|
||||
@@ -48,6 +48,8 @@ pub enum InternalEvent {
|
||||
ShowErrorMsg(String),
|
||||
///
|
||||
Update(NeedsUpdate),
|
||||
///
|
||||
StatusLastFileMoved,
|
||||
/// open commit msg input
|
||||
OpenCommit,
|
||||
///
|
||||
|
||||
@@ -437,6 +437,13 @@ impl Status {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn last_file_moved(&mut self) -> Result<()> {
|
||||
if !self.is_focus_on_diff() && self.is_visible() {
|
||||
self.switch_focus(self.focus.toggled_focus())?;
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn push(&self, force: bool) {
|
||||
if self.can_push() {
|
||||
if let Some(branch) = self.git_branch_name.last() {
|
||||
|
||||
Reference in New Issue
Block a user