feat: reorder focus list
1 file changed, +18 -0
+18-0src/views/browser.rs
| @@ -174,6 +174,24 @@ impl BrowserView { | ||
| 174 | 174 | // Build entries for current + parent level |
| 175 | 175 | let in_focus_root = self.focus_mode && self.path.is_empty() && !self.focused.is_empty(); |
| 176 | 176 | |
| 177 | + // Handle focus reorder BEFORE building entries so they're in sync | |
| 178 | + if in_focus_root { | |
| 179 | + let move_up = ui.input_mut(|i| i.consume_key(egui::Modifiers::CTRL, egui::Key::K)) | |
| 180 | + || ui.input_mut(|i| i.consume_key(egui::Modifiers::CTRL, egui::Key::ArrowUp)); | |
| 181 | + let move_down = ui.input_mut(|i| i.consume_key(egui::Modifiers::CTRL, egui::Key::J)) | |
| 182 | + || ui.input_mut(|i| i.consume_key(egui::Modifiers::CTRL, egui::Key::ArrowDown)); | |
| 183 | + if move_up && self.selection > 0 { | |
| 184 | + self.focused.swap(self.selection, self.selection - 1); | |
| 185 | + self.selection -= 1; | |
| 186 | + self.focus_dirty = true; | |
| 187 | + } | |
| 188 | + if move_down && self.selection + 1 < self.focused.len() { | |
| 189 | + self.focused.swap(self.selection, self.selection + 1); | |
| 190 | + self.selection += 1; | |
| 191 | + self.focus_dirty = true; | |
| 192 | + } | |
| 193 | + } | |
| 194 | + | |
| 177 | 195 | let (current_entries, parent_entries) = if in_focus_root { |
| 178 | 196 | // Focus mode root: show pinned items as the root list |
| 179 | 197 | let entries: Vec<Entry> = self.focused.iter().map(|fp| { |