From dd1b767b8a3491c0b0b70520aced4791cb75ec11 Mon Sep 17 00:00:00 2001 From: Ylin Date: Tue, 3 Dec 2024 12:00:15 +0800 Subject: [PATCH] table: Make set_selected_row, set_selected_col public (#455) Co-authored-by: Jason Lee --- crates/ui/src/table.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/crates/ui/src/table.rs b/crates/ui/src/table.rs index 6848e42b..72baa533 100644 --- a/crates/ui/src/table.rs +++ b/crates/ui/src/table.rs @@ -361,7 +361,8 @@ where cx.notify(); } - fn set_selected_row(&mut self, row_ix: usize, cx: &mut ViewContext) { + /// Sets the selected row to the given index. + pub fn set_selected_row(&mut self, row_ix: usize, cx: &mut ViewContext) { self.selection_state = SelectionState::Row; self.right_clicked_row = None; self.selected_row = Some(row_ix); @@ -373,7 +374,8 @@ where cx.notify(); } - fn set_selected_col(&mut self, col_ix: usize, cx: &mut ViewContext) { + /// Sets the selected col to the given index. + pub fn set_selected_col(&mut self, col_ix: usize, cx: &mut ViewContext) { self.selection_state = SelectionState::Column; self.selected_col = Some(col_ix); if let Some(_col_ix) = self.selected_col {