irongit

fix: focus list navigation back up the path

huncholanehuncholaneauthored
parent 17552cbcommit fe34cf39bb690617a9c21fd0b97ba98d17b700d7Browse files

1 file changed, +10 -3

+10-3src/views/browser.rs
@@ -355,9 +355,16 @@ impl BrowserView {
355355 } else if !self.path.is_empty() {
356356 self.filter.query.clear();
357357 if self.focus_mode {
358- // In focus mode, H goes back to focus root
359- self.path.clear();
360- self.selection = 0;
358+ // Check if current path IS a focused item (one more pop = focus root)
359+ let focused_idx = self.focused.iter().position(|fp| *fp == self.path);
360+ if let Some(idx) = focused_idx {
361+ // Back from a focused item → return to focus root, select that item
362+ self.path.clear();
363+ self.selection = idx;
364+ } else {
365+ // Deeper than a focused item → normal go_up
366+ self.go_up();
367+ }
361368 } else {
362369 self.go_up();
363370 }