From 5f8c9beb393b8c906ebe95d98135a6ec7418e052 Mon Sep 17 00:00:00 2001 From: Ian Guimaraes Date: Sun, 19 Nov 2023 01:06:05 -0300 Subject: [PATCH 1/2] feat: sorts function selectors on snapshot tui --- core/src/snapshot/util/table.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/core/src/snapshot/util/table.rs b/core/src/snapshot/util/table.rs index 9594735f..aa388d4a 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 { @@ -63,3 +66,4 @@ pub fn build_rows(state: &mut State, max_row_height: usize) -> Vec> rows } + From cf4d6047e8359c7fba362554d6c4284f7e4d1351 Mon Sep 17 00:00:00 2001 From: Ian Guimaraes Date: Sun, 19 Nov 2023 01:08:31 -0300 Subject: [PATCH 2/2] style: remove trailing blank line --- core/src/snapshot/util/table.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/core/src/snapshot/util/table.rs b/core/src/snapshot/util/table.rs index aa388d4a..d5acb8a7 100644 --- a/core/src/snapshot/util/table.rs +++ b/core/src/snapshot/util/table.rs @@ -66,4 +66,3 @@ pub fn build_rows(state: &mut State, max_row_height: usize) -> Vec> rows } -