diff options
| author | krolxon <krolyxon@tutanota.com> | 2024-04-23 16:10:03 +0530 |
|---|---|---|
| committer | krolxon <krolyxon@tutanota.com> | 2024-04-23 16:10:03 +0530 |
| commit | a0582ead78fda02e4137a82e100963e88362f252 (patch) | |
| tree | 557c85daaa8b015b177de952af9cd1d786d52fa1 /src/list.rs | |
| parent | a0a313996428b598e83016c97adeacd08ad42628 (diff) | |
get basic tui working with Ratatui
Diffstat (limited to 'src/list.rs')
| -rwxr-xr-x | src/list.rs | 24 |
1 files changed, 24 insertions, 0 deletions
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; + } + } +} |
