fix: focus list previews
1 file changed, +13 -3
+13-3src/views/browser.rs
| @@ -238,9 +238,19 @@ impl BrowserView { | ||
| 238 | 238 | } |
| 239 | 239 | |
| 240 | 240 | 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 | + }) | |
| 244 | 254 | } else if let Some(cv) = current_value { |
| 245 | 255 | // Inside a file — look up child by key/index |
| 246 | 256 | current_entries.get(self.selection) |