irongit

fix: focus list previews

huncholanehuncholaneauthored
parent 0ead49bcommit ec592bda808a17f3bbe2c955eccaefa1c302e087Browse files

1 file changed, +13 -3

+13-3src/views/browser.rs
@@ -238,9 +238,19 @@ impl BrowserView {
238238 }
239239
240240 let selected_child = if in_focus_root {
241- // Focus root — resolve via the focused entry's full path
242- self.focused.get(self.selection)
243- .and_then(|fp| resolve_from_files(files, fp))
241+ // Focus root — find the focused path matching the selected entry's label
242+ current_entries.get(self.selection)
243+ .and_then(|entry| {
244+ self.focused.iter()
245+ .find(|fp| {
246+ let label = fp.iter().map(|seg| match seg {
247+ PathSegment::Key(k) => k.clone(),
248+ PathSegment::Index(i) => format!("[{}]", i),
249+ }).collect::<Vec<_>>().join(".");
250+ label == entry.label
251+ })
252+ .and_then(|fp| resolve_from_files(files, fp))
253+ })
244254 } else if let Some(cv) = current_value {
245255 // Inside a file — look up child by key/index
246256 current_entries.get(self.selection)