Compare commits

...

3 commits

Author SHA1 Message Date
46e53ef105
Fix typo 2025-07-04 23:47:08 -07:00
3340114522
Expand LogView key handling 2025-07-04 23:46:53 -07:00
3fafcc4292
Remove debug code 2025-07-04 19:49:04 -07:00
5 changed files with 54 additions and 4 deletions

View file

@ -630,7 +630,6 @@ impl App {
"Program Files", "Program Files",
"Program Files (x86)", "Program Files (x86)",
"ProgramData", "ProgramData",
"Haha.....no",
"Windows\\System32\\config", "Windows\\System32\\config",
] ]
.iter() .iter()

View file

@ -27,7 +27,10 @@ use core::{
config::Config, config::Config,
state::Mode, state::Mode,
}; };
use std::sync::{Arc, Mutex}; use std::{
cmp::min,
sync::{Arc, Mutex},
};
use crate::diags::DiagGroup; use crate::diags::DiagGroup;
@ -75,11 +78,51 @@ impl Component for LogView {
} }
Action::KeyDown => { Action::KeyDown => {
if self.mode == Mode::LogView { if self.mode == Mode::LogView {
self.line_index = self.line_index + 1; let new_index = self.line_index + 1;
if let Some(log_text) = self.list.get_selected() {
let lines: Vec<&str> = log_text.split('\n').collect();
if new_index as usize > lines.len() {
self.line_index = lines.len() as u16;
} else {
self.line_index = new_index;
}
}
} else { } else {
self.list.next(); self.list.next();
} }
} }
Action::KeyPageUp => {
if self.mode == Mode::LogView {
if self.line_index > 10 {
self.line_index -= 10;
} else {
self.line_index = 0;
}
}
}
Action::KeyPageDown => {
if self.mode == Mode::LogView {
let new_index = self.line_index + 10;
if let Some(log_text) = self.list.get_selected() {
let lines: Vec<&str> = log_text.split('\n').collect();
let new_index: u16 = min((lines.len() - 3) as u16, new_index);
self.line_index = new_index;
}
}
}
Action::KeyHome => {
if self.mode == Mode::LogView {
self.line_index = 0;
}
}
Action::KeyEnd => {
if self.mode == Mode::LogView {
if let Some(log_text) = self.list.get_selected() {
let lines: Vec<&str> = log_text.split('\n').collect();
self.line_index = (lines.len() - 3) as u16;
}
}
}
Action::Process => { Action::Process => {
if self.mode == Mode::LogView { if self.mode == Mode::LogView {
if let Some(command_tx) = self.command_tx.clone() { if let Some(command_tx) = self.command_tx.clone() {

View file

@ -356,7 +356,7 @@ pub fn parse_dism(diag_group: &mut DiagGroup, task_result: TaskResult) {
format!("{stdout}\n\n-------\n\n{stderr}") format!("{stdout}\n\n-------\n\n{stderr}")
}; };
if output_text.contains("no component store corruption detected") { if output_text.contains("No component store corruption detected") {
diag_group.passed.push(true); diag_group.passed.push(true);
diag_group.result = String::from("OK"); diag_group.result = String::from("OK");
diag_group.logs.push(Log { diag_group.logs.push(Log {

View file

@ -137,6 +137,10 @@
"<Esc>": "Process", "<Esc>": "Process",
"<Up>": "KeyUp", "<Up>": "KeyUp",
"<Down>": "KeyDown", "<Down>": "KeyDown",
"<PageUp>": "KeyPageUp",
"<PageDown>": "KeyPageDown",
"<Home>": "KeyHome",
"<End>": "KeyEnd",
"<q>": "Quit", "<q>": "Quit",
"<Ctrl-d>": "Quit", "<Ctrl-d>": "Quit",
"<Ctrl-c>": "Quit", "<Ctrl-c>": "Quit",

View file

@ -69,6 +69,10 @@ pub enum Action {
KeyUp, KeyUp,
KeyLeft, KeyLeft,
KeyRight, KeyRight,
KeyPageUp,
KeyPageDown,
KeyHome,
KeyEnd,
Quit, Quit,
Render, Render,
Resize(u16, u16), Resize(u16, u16),