Lines
100 %
Functions
50 %
Branches
//! The read-only category CSV pane.
use crate::event::Intent;
use tvui::RowWindow;
use crate::scroll;
#[derive(Debug)]
pub struct Csv {
pub text: String,
pub lines: Vec<String>,
pub scroll: RowWindow,
/// File name offered by the save prompt.
pub file_name: String,
}
impl Csv {
#[must_use]
pub fn new(file_name: String, text: String) -> Self {
let lines = text.lines().map(str::to_string).collect();
Self {
text,
lines,
scroll: RowWindow::default(),
file_name,
pub fn scroll_by(&self, intent: Intent) {
let _ = scroll::apply(&self.scroll, intent);