From a0582ead78fda02e4137a82e100963e88362f252 Mon Sep 17 00:00:00 2001 From: krolxon Date: Tue, 23 Apr 2024 16:10:03 +0530 Subject: get basic tui working with Ratatui --- src/list.rs | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100755 src/list.rs (limited to 'src/list.rs') diff --git a/src/list.rs b/src/list.rs new file mode 100755 index 0000000..669d1af --- /dev/null +++ b/src/list.rs @@ -0,0 +1,24 @@ +#[derive(Debug)] +pub struct ContentList { + pub index: usize +} + +impl ContentList { + pub fn new() -> Self { + ContentList { + index: 0 + } + } + + // Go to next item in list + pub fn next(&mut self) { + self.index += 1; + } + + /// Go to previous item in list + pub fn prev(&mut self) { + if self.index != 0 { + self.index -= 1; + } + } +} -- cgit v1.2.3