diff --git a/codex-rs/file-search/src/lib.rs b/codex-rs/file-search/src/lib.rs index 7a338792d0..9fd4db12ce 100644 --- a/codex-rs/file-search/src/lib.rs +++ b/codex-rs/file-search/src/lib.rs @@ -199,6 +199,14 @@ pub async fn run( }) } +/// Sort matches in-place by descending score, then ascending path. +fn sort_matches(matches: &mut [(u32, String)]) { + matches.sort_by(|a, b| match b.0.cmp(&a.0) { + std::cmp::Ordering::Equal => a.1.cmp(&b.1), + other => other, + }); +} + /// Maintains the `max_count` best matches for a given pattern. struct BestMatchesList { max_count: usize,