only switch when target is not-empty (#105)

This commit is contained in:
Stephan Dilly 2020-06-02 14:31:54 +02:00
parent 2032182cf9
commit ce45c886c1

View file

@ -366,12 +366,16 @@ impl Component for Status {
})
}
keys::MOVE_DOWN
if self.focus == Focus::WorkDir =>
if self.focus == Focus::WorkDir
&& !self.index.is_empty() =>
{
self.switch_focus(Focus::Stage)
}
keys::MOVE_UP if self.focus == Focus::Stage => {
keys::MOVE_UP
if self.focus == Focus::Stage
&& !self.index_wd.is_empty() =>
{
self.switch_focus(Focus::WorkDir)
}
_ => Ok(false),