diff --git a/src/widgets/list.rs b/src/widgets/list.rs index d785d54..96cc86c 100644 --- a/src/widgets/list.rs +++ b/src/widgets/list.rs @@ -14,6 +14,16 @@ pub struct ListState { } impl ListState { + /// Returns the offset. + pub fn offset(&self) -> usize { + self.offset + } + + /// Mutably returns the offset. + pub fn offset_mut(&mut self) -> &mut usize { + &mut self.offset + } + pub fn selected(&self) -> Option { self.selected } diff --git a/src/widgets/table.rs b/src/widgets/table.rs index e1b1bf6..4e54b41 100644 --- a/src/widgets/table.rs +++ b/src/widgets/table.rs @@ -342,6 +342,16 @@ pub struct TableState { } impl TableState { + /// Returns the offset. + pub fn offset(&self) -> usize { + self.offset + } + + /// Mutably returns the offset. + pub fn offset_mut(&mut self) -> &mut usize { + &mut self.offset + } + pub fn selected(&self) -> Option { self.selected }