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

@ -14,15 +14,13 @@ use std::{
use tui_widget_list::{ListBuilder, ListView};
use crate::tui::{
filter::FilterKind,
log_viewer::{InputState, InputTarget, LogViewer},
widgets::{hyperlink::Hyperlink, items::Items, last_error::LastError},
};
use crate::tui::{
filter::{Filter, Matcher},
log_viewer::FieldMatcher,
filter::{Filter, FilterKind, Matcher},
log_viewer::{
LogViewer,
input::{FieldMatcher, InputState, InputTarget},
},
reader::LogfileReader,
widgets::styled::IntoStyled,
widgets::{hyperlink::Hyperlink, items::Items, last_error::LastError, styled::IntoStyled},
};
use ratatui::{
DefaultTerminal, Terminal,
@ -67,7 +65,6 @@ targeting logs:
either a field after `f` or the text of the current log:
p ... with a prefix
r ... matching a regex
/ ... matching a regex
e ... equal to selected
c ... containing
@ -298,6 +295,10 @@ impl App {
KeyCode::Backspace | KeyCode::Left => lv.back(),
KeyCode::Right => lv.enter(),
KeyCode::Enter => lv.enter(),
KeyCode::Char('u') => lv.undo(),
KeyCode::Char('r') => lv.redo(),
KeyCode::Char('f') => {
lv.input_state.target(InputTarget::Fields(None));
lv.footer_list.select(Some(0));
@ -309,7 +310,7 @@ impl App {
KeyCode::Char('t') => {
lv.input_state.target(InputTarget::This);
}
KeyCode::Char('r') | KeyCode::Char('/') => {
KeyCode::Char('/') => {
let v = FieldMatcher::Regex(String::new());
if let InputState::Target(InputTarget::Fields(f @ None)) = &mut lv.input_state {
*f = Some(v);