undo/redo

This commit is contained in:
Jana Dönszelmann 2026-02-25 14:29:28 +01:00
parent 8a4df3307d
commit 8cfe1a0b65
No known key found for this signature in database
8 changed files with 247 additions and 154 deletions

View file

@ -0,0 +1,28 @@
use std::rc::Rc;
use crate::tui::{model::LogEntry, processing::LogStream};
pub struct LogView {
pub iter: Box<dyn LogStream>,
pub selection_offset: usize,
}
impl LogView {
pub fn selected(&self) -> Option<(Rc<LogEntry>, usize)> {
let mut temp_iter = self.iter.clone();
for _ in 0..self.selection_offset {
let _ = temp_iter.next()?;
}
temp_iter.next()
}
}
impl Clone for LogView {
fn clone(&self) -> Self {
Self {
iter: self.iter.clone(),
selection_offset: self.selection_offset.clone(),
}
}
}