Skip to content

Commit 423da7f

Browse files
committed
merge feature/sprint-3-1-file-browser into feature/sprint-3-1-wave3
2 parents 5478077 + e5a161c commit 423da7f

2 files changed

Lines changed: 13 additions & 19 deletions

File tree

.github/workflows/ci.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ jobs:
6363
run: |
6464
sudo apt-get update
6565
sudo apt-get install -y \
66+
libx11-dev \
6667
libxcb1-dev \
6768
libxcb-render0-dev \
6869
libxcb-shape0-dev \
@@ -138,6 +139,7 @@ jobs:
138139
run: |
139140
sudo apt-get update
140141
sudo apt-get install -y \
142+
libx11-dev \
141143
libxcb1-dev \
142144
libxcb-render0-dev \
143145
libxcb-shape0-dev \

src/file_browser/pane.rs

Lines changed: 11 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -629,7 +629,7 @@ mod tests {
629629
];
630630

631631
let state = FileBrowserRuntimeState {
632-
all_entries: all_entries.clone(),
632+
all_entries,
633633
visible_entries: Vec::new(),
634634
expanded_dir_ids: vec![1], // "src" is expanded
635635
..Default::default()
@@ -644,7 +644,7 @@ mod tests {
644644
fn initial_selection_down_selects_first() {
645645
// When no selection exists, down arrow should select index 0
646646
// This verifies the fix for the off-by-one bug
647-
let entries = vec![
647+
let entries = [
648648
Entry {
649649
id: 1,
650650
path: PathBuf::from("first"),
@@ -661,24 +661,16 @@ mod tests {
661661

662662
// With no current selection, down should pick index 0
663663
let current_index: Option<usize> = None;
664-
let new_index = match current_index {
665-
Some(idx) => {
666-
if idx >= entries.len() - 1 {
667-
0
668-
} else {
669-
idx + 1
670-
}
671-
}
672-
None => 0, // This is the bug fix
673-
};
664+
let new_index =
665+
current_index.map_or(0, |idx| if idx >= entries.len() - 1 { 0 } else { idx + 1 });
674666
assert_eq!(new_index, 0);
675667
assert_eq!(entries[new_index].id, 1);
676668
}
677669

678670
#[test]
679671
fn initial_selection_up_selects_last() {
680672
// When no selection exists, up arrow should select last entry
681-
let entries = vec![
673+
let entries = [
682674
Entry {
683675
id: 1,
684676
path: PathBuf::from("first"),
@@ -695,16 +687,16 @@ mod tests {
695687

696688
// With no current selection, up should pick last entry
697689
let current_index: Option<usize> = None;
698-
let new_index = match current_index {
699-
Some(idx) => {
690+
let new_index = current_index.map_or_else(
691+
|| entries.len() - 1,
692+
|idx| {
700693
if idx == 0 {
701694
entries.len() - 1
702695
} else {
703696
idx - 1
704697
}
705-
}
706-
None => entries.len() - 1, // This is the bug fix
707-
};
698+
},
699+
);
708700
assert_eq!(new_index, 1);
709701
assert_eq!(entries[new_index].id, 2);
710702
}
@@ -713,7 +705,7 @@ mod tests {
713705
fn collapse_finds_correct_parent_not_later_sibling() {
714706
// Test that collapse finds parent by scanning backwards from current position,
715707
// not from end of list (which would find wrong parent)
716-
let entries = vec![
708+
let entries = [
717709
Entry {
718710
id: 1,
719711
path: PathBuf::from("src"),

0 commit comments

Comments
 (0)