From 62a2ba02df8e238c1fe60899c0df025360cb198a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ian=20Guimar=C3=A3es?= Date: Sun, 19 Nov 2023 11:53:42 -0300 Subject: [PATCH] feat(snapshot): sort selectors ascending (#184) --- core/src/snapshot/util/table.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/core/src/snapshot/util/table.rs b/core/src/snapshot/util/table.rs index 9594735f..d5acb8a7 100644 --- a/core/src/snapshot/util/table.rs +++ b/core/src/snapshot/util/table.rs @@ -22,8 +22,11 @@ pub fn build_rows(state: &mut State, max_row_height: usize) -> Vec> false => snapshots.len() - num_items..snapshots.len(), }; + let mut sorted_snapshots = snapshots[indices].to_vec(); + sorted_snapshots.sort_by(|a, b| a.selector.cmp(&b.selector)); + // slice storage_iter - for (i, snapshot) in snapshots[indices].iter().enumerate() { + for (i, snapshot) in sorted_snapshots.iter().enumerate() { rows.push( Row::new(vec![Cell::from(format!(" 0x{} ", snapshot.selector))]) .style(if snapshots.len() - state.function_index < num_items {