tests: updated tests

This commit is contained in:
Jack Wills
2026-01-25 09:33:08 +00:00
parent 4b7bf38a3f
commit 307810391c
24 changed files with 243 additions and 233 deletions
+4 -2
View File
@@ -45,6 +45,9 @@ tracing = "0.1"
tracing-subscriber = "0.3"
uuid = { version = "1.19", features = ["fast-rng", "v4"] }
[dev-dependencies]
insta = "1.42.2"
[profile.release]
lto = true
codegen-units = 1
@@ -52,5 +55,4 @@ panic = 'abort'
strip = true
debug = false
[dev-dependencies]
insta = "1.42.2"
+10 -8
View File
@@ -173,9 +173,10 @@ impl AppData {
pub fn log_search_scroll(&mut self, np: &ScrollDirection) {
if let Some(i) = self.get_mut_selected_container()
&& i.logs.search_scroll(np).is_some() {
self.rerender.update_draw();
}
&& i.logs.search_scroll(np).is_some()
{
self.rerender.update_draw();
}
}
pub fn gen_log_search(&self) -> Option<LogSearch> {
@@ -340,12 +341,13 @@ impl AppData {
pub fn set_sort_by_header(&mut self, selected_header: Header) {
let mut output = Some((selected_header, SortedOrder::Asc));
if let Some((current_header, order)) = self.get_sorted()
&& current_header == selected_header {
match order {
SortedOrder::Desc => output = None,
SortedOrder::Asc => output = Some((selected_header, SortedOrder::Desc)),
}
&& current_header == selected_header
{
match order {
SortedOrder::Desc => output = None,
SortedOrder::Asc => output = Some((selected_header, SortedOrder::Desc)),
}
}
self.set_sorted(output);
}
+17 -15
View File
@@ -159,20 +159,21 @@ impl From<Option<ConfigKeymap>> for Keymap {
keymap_field: &mut (KeyCode, Option<KeyCode>),
keymap_clash: &mut HashSet<KeyCode>| {
if let Some(vec_str) = vec_str
&& let Some(vec_keycode) = Self::try_parse_keycode(&vec_str) {
if let Some(first) = vec_keycode.first() {
keymap_clash.insert(*first);
counter += 1;
keymap_field.0 = *first;
}
if let Some(second) = vec_keycode.get(1) {
keymap_clash.insert(*second);
counter += 1;
keymap_field.1 = Some(*second);
} else {
keymap_field.1 = None;
}
&& let Some(vec_keycode) = Self::try_parse_keycode(&vec_str)
{
if let Some(first) = vec_keycode.first() {
keymap_clash.insert(*first);
counter += 1;
keymap_field.0 = *first;
}
if let Some(second) = vec_keycode.get(1) {
keymap_clash.insert(*second);
counter += 1;
keymap_field.1 = Some(*second);
} else {
keymap_field.1 = None;
}
}
};
if let Some(ck) = value {
@@ -282,9 +283,10 @@ impl Keymap {
Some(first_char)
}
_ => None,
} {
output.push(KeyCode::Char(first_char));
}
{
output.push(KeyCode::Char(first_char));
}
} else {
let keycode = match key.to_lowercase().as_str() {
"f1" => Some(KeyCode::F(1)),
+3 -3
View File
@@ -214,9 +214,9 @@ impl Config {
if let Some(config_file) = &args.config_file
&& let Some(config_file) =
parse_config_file::ConfigFile::try_parse_from_file(config_file)
{
return Self::from(config_file).merge_args(config_from_cli);
}
{
return Self::from(config_file).merge_args(config_from_cli);
}
if let Some(config_file) = parse_config_file::ConfigFile::try_parse(in_container) {
return Self::from(config_file).merge_args(config_from_cli);
+1 -1
View File
@@ -203,7 +203,7 @@ impl DockerData {
if let std::collections::hash_map::Entry::Vacant(spawns) =
self.spawns.lock().entry(spawn_id.clone())
{
// TODO Replace this with toktio tokens
// TODO Replace this with toktio tokens
spawns.insert(tokio::spawn(Self::update_container_stat(
Arc::clone(&self.app_data),
Arc::clone(&self.docker),
+29 -29
View File
@@ -167,37 +167,37 @@ impl ExecMode {
State::Running(RunningState::Unhealthy),
]
.contains(&state)
{
if tty_readable()
&& !use_cli
&& let Ok(exec) = docker
.create_exec(
id.get(),
CreateExecOptions {
attach_stdout: Some(true),
attach_stderr: Some(true),
cmd: Some(vec![command::PWD]),
..Default::default()
},
)
.await
&& let Ok(StartExecResults::Attached { mut output, .. }) =
docker.start_exec(&exec.id, None).await
&& let Some(Ok(msg)) = output.next().await
&& !msg.to_string().starts_with(OCI_ERROR)
{
if tty_readable() && !use_cli
&& let Ok(exec) = docker
.create_exec(
id.get(),
CreateExecOptions {
attach_stdout: Some(true),
attach_stderr: Some(true),
cmd: Some(vec![command::PWD]),
..Default::default()
},
)
.await
&& let Ok(StartExecResults::Attached { mut output, .. }) =
docker.start_exec(&exec.id, None).await
&& let Some(Ok(msg)) = output.next().await
&& !msg.to_string().starts_with(OCI_ERROR) {
return Some(Self::Internal((
Arc::new(id),
Arc::clone(docker),
)));
}
if let Ok(output) = std::process::Command::new(command::DOCKER)
.args([command::EXEC, id.get(), command::PWD])
.output()
&& let Ok(output) = String::from_utf8(output.stdout)
&& !output.starts_with(OCI_ERROR) {
return Some(Self::External(Arc::new(id)));
}
return Some(Self::Internal((Arc::new(id), Arc::clone(docker))));
}
if let Ok(output) = std::process::Command::new(command::DOCKER)
.args([command::EXEC, id.get(), command::PWD])
.output()
&& let Ok(output) = String::from_utf8(output.stdout)
&& !output.starts_with(OCI_ERROR)
{
return Some(Self::External(Arc::new(id)));
}
}
None
}
+45 -44
View File
@@ -179,57 +179,58 @@ impl InputHandler {
let args = self.app_data.lock().config.clone();
let container = self.app_data.lock().get_selected_container_id_state_name();
if let Some((id, _, name)) = container
&& let Some(log_path) = args.save_dir {
let (sx, rx) = tokio::sync::oneshot::channel();
self.docker_tx.send(DockerMessage::Exec(sx)).await?;
&& let Some(log_path) = args.save_dir
{
let (sx, rx) = tokio::sync::oneshot::channel();
self.docker_tx.send(DockerMessage::Exec(sx)).await?;
let now = SystemTime::now()
.duration_since(SystemTime::UNIX_EPOCH)
.map_or(0, |i| i.as_secs());
let now = SystemTime::now()
.duration_since(SystemTime::UNIX_EPOCH)
.map_or(0, |i| i.as_secs());
let path = log_path.join(format!("{name}_{now}.log"));
let path = log_path.join(format!("{name}_{now}.log"));
let options = Some(LogsOptions {
stderr: true,
stdout: true,
timestamps: args.show_timestamp,
since: 0,
..Default::default()
});
let mut logs = rx.await?.logs(id.get(), options);
let mut output = vec![];
let options = Some(LogsOptions {
stderr: true,
stdout: true,
timestamps: args.show_timestamp,
since: 0,
..Default::default()
});
let mut logs = rx.await?.logs(id.get(), options);
let mut output = vec![];
while let Some(Ok(value)) = logs.next().await {
let data = value.to_string();
if !data.trim().is_empty() {
output.push(
categorise_text(&data)
.into_iter()
.map(|i| i.text)
.collect::<String>(),
);
}
}
if !output.is_empty() {
let mut stream = BufWriter::new(
OpenOptions::new()
.read(true)
.write(true)
.create(true)
.truncate(true)
.open(&path)?,
while let Some(Ok(value)) = logs.next().await {
let data = value.to_string();
if !data.trim().is_empty() {
output.push(
categorise_text(&data)
.into_iter()
.map(|i| i.text)
.collect::<String>(),
);
for line in &output {
stream.write_all(line.as_bytes())?;
}
stream.flush()?;
self.gui_state
.lock()
.set_info_box(&format!("saved to {}", path.display()));
}
}
if !output.is_empty() {
let mut stream = BufWriter::new(
OpenOptions::new()
.read(true)
.write(true)
.create(true)
.truncate(true)
.open(&path)?,
);
for line in &output {
stream.write_all(line.as_bytes())?;
}
stream.flush()?;
self.gui_state
.lock()
.set_info_box(&format!("saved to {}", path.display()));
}
}
Ok(())
}
+19 -19
View File
@@ -194,42 +194,41 @@ mod tests {
];
// co-ordinates of the dots from the cpu chart
const CPU_XY: [(usize, usize); 15] = [
(1, 12),
(2, 11),
const CPU_XY: [(usize, usize); 16] = [
(1, 13),
(2, 12),
(3, 10),
(2, 13),
(3, 11),
(3, 12),
(4, 10),
(4, 12),
(5, 9),
(3, 13),
(4, 11),
(4, 13),
(5, 10),
(5, 13),
(5, 14),
(6, 8),
(6, 9),
(6, 13),
(6, 14),
(7, 8),
(7, 9),
(7, 13),
(7, 14),
];
// co-ordinates of the dots from the memory chart
const MEM_XY: [(usize, usize); 16] = [
(1, 54),
const MEM_XY: [(usize, usize); 14] = [
(1, 55),
(2, 54),
(2, 55),
(3, 53),
(3, 54),
(3, 55),
(4, 52),
(4, 53),
(4, 55),
(5, 51),
(5, 52),
(5, 55),
(5, 53),
(5, 56),
(6, 51),
(6, 55),
(6, 52),
(6, 56),
(7, 51),
(7, 55),
(7, 56),
];
#[test]
@@ -336,6 +335,7 @@ mod tests {
.unwrap();
assert_snapshot!(setup.terminal.backend());
//
for (row_index, result_row) in get_result(&setup) {
for (result_cell_index, result_cell) in result_row.iter().enumerate() {
+7 -6
View File
@@ -40,13 +40,14 @@ fn gen_header_block<'a>(colors: AppColors, fd: &FrameData, header: Header) -> (C
let mut color = colors.headers_bar.text;
let mut suffix = "";
if let Some((a, b)) = &fd.sorted_by
&& &header == a {
match b {
SortedOrder::Asc => suffix = "",
SortedOrder::Desc => suffix = " ",
}
color = colors.headers_bar.text_selected;
&& &header == a
{
match b {
SortedOrder::Asc => suffix = " ",
SortedOrder::Desc => suffix = "",
}
color = colors.headers_bar.text_selected;
}
(color, suffix)
}
+6 -5
View File
@@ -104,11 +104,12 @@ fn generate_block<'a>(
.title(ratatui::text::Line::from(title).left_aligned());
if panel == SelectablePanel::Logs
&& let Some(x) = fd.scroll_title.as_ref() {
block = block
.title_bottom(x.to_owned())
.title_alignment(ratatui::layout::Alignment::Right);
}
&& let Some(x) = fd.scroll_title.as_ref()
{
block = block
.title_bottom(x.to_owned())
.title_alignment(ratatui::layout::Alignment::Right);
}
if !fd.status.contains(&Status::Filter) {
if fd.selected_panel == panel {
block = block.border_style(Style::default().fg(colors.borders.selected));
@@ -3,12 +3,12 @@ source: src/ui/draw_blocks/charts.rs
expression: setup.terminal.backend()
---
"╭───────────── cpu 03.00% ─────────────╮╭────────── memory 30.00 kB ───────────╮"
"│10.00%│ • ││100.00 kB│ • │"
"│ │ •• ││ │ •• │"
"│ │ ••• ││ │ • • │"
"│ │ • • ││ │ • • │"
"│ │ • • ││ │•• • │"
"│ │• ││ │• • │"
"│ │• ││ │• • │"
"│10.00%│ • ││100.00 kB│ • │"
"│ │ •• ││ │ •• │"
"│ │ ││ │ •• │"
"│ │ • • ││ │ • • │"
"│ │ • • ││ │ •• • │"
"│ │ •• ││ │ • • │"
"│ │• ││ │• • │"
"│ │ ││ │ │"
"╰──────────────────────────────────────╯╰──────────────────────────────────────╯"
@@ -3,12 +3,12 @@ source: src/ui/draw_blocks/charts.rs
expression: setup.terminal.backend()
---
"╭───────────── cpu 03.00% ─────────────╮╭────────── memory 30.00 kB ───────────╮"
"│10.00%│ • ││100.00 kB│ • │"
"│ │ •• ││ │ •• │"
"│ │ ••• ││ │ • • │"
"│ │ • • ││ │ • • │"
"│ │ • • ││ │•• • │"
"│ │• ││ │• • │"
"│ │• ││ │• • │"
"│10.00%│ • ││100.00 kB│ • │"
"│ │ •• ││ │ •• │"
"│ │ ││ │ •• │"
"│ │ • • ││ │ • • │"
"│ │ • • ││ │ •• • │"
"│ │ •• ││ │ • • │"
"│ │• ││ │• • │"
"│ │ ││ │ │"
"╰──────────────────────────────────────╯╰──────────────────────────────────────╯"
@@ -3,12 +3,12 @@ source: src/ui/draw_blocks/charts.rs
expression: setup.terminal.backend()
---
"╭───────────── cpu 03.00% ─────────────╮╭────────── memory 30.00 kB ───────────╮"
"│10.00%│ • ││100.00 kB│ • │"
"│ │ •• ││ │ •• │"
"│ │ ••• ││ │ • • │"
"│ │ • • ││ │ • • │"
"│ │ • • ││ │•• • │"
"│ │• ││ │• • │"
"│ │• ││ │• • │"
"│10.00%│ • ││100.00 kB│ • │"
"│ │ •• ││ │ •• │"
"│ │ ││ │ •• │"
"│ │ • • ││ │ • • │"
"│ │ • • ││ │ •• • │"
"│ │ •• ││ │ • • │"
"│ │• ││ │• • │"
"│ │ ││ │ │"
"╰──────────────────────────────────────╯╰──────────────────────────────────────╯"
@@ -3,12 +3,12 @@ source: src/ui/draw_blocks/charts.rs
expression: setup.terminal.backend()
---
"╭───────────── cpu 03.00% ─────────────╮╭────────── memory 30.00 kB ───────────╮"
"│10.00%│ • ││100.00 kB│ • │"
"│ │ •• ││ │ •• │"
"│ │ ••• ││ │ • • │"
"│ │ • • ││ │ • • │"
"│ │ • • ││ │•• • │"
"│ │• ││ │• • │"
"│ │• ││ │• • │"
"│10.00%│ • ││100.00 kB│ • │"
"│ │ •• ││ │ •• │"
"│ │ ││ │ •• │"
"│ │ • • ││ │ • • │"
"│ │ • • ││ │ •• • │"
"│ │ •• ││ │ • • │"
"│ │• ││ │• • │"
"│ │ ││ │ │"
"╰──────────────────────────────────────╯╰──────────────────────────────────────╯"
@@ -26,9 +26,9 @@ expression: setup.terminal.backend()
"│ │"
"╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯"
"╭───────────────────────── cpu 03.00% ──────────────────────────╮╭─────────────────────── memory 30.00 kB ───────────────────────╮╭────────── ports ───────────╮"
"│10.00%│ •• ││100.00 kB│ •• ││ ip private public│"
"│ │ • • ││ │ •• • ││ 8001 │"
"│ │ ••• • • ││ │ •• ││127.0.0.1 8003 8003│"
"│ │• •• ││ │• •• ││ │"
"│ │ ││ │ ││ │"
"│10.00%│ •• ││100.00 kB│ •• ││ ip private public│"
"│ │ • • ││ │ •• • ││ 8001 │"
"│ │ ••• ││ │ •• • ││127.0.0.1 8003 8003│"
"│ │• •• ││ │• •• ││ │"
"│ │ ││ │ ││ │"
"╰───────────────────────────────────────────────────────────────╯╰───────────────────────────────────────────────────────────────╯╰────────────────────────────╯"
@@ -33,12 +33,12 @@ expression: setup.terminal.backend()
"│ │"
"╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯"
"╭───────────────────────── cpu 03.00% ──────────────────────────╮╭─────────────────────── memory 30.00 kB ───────────────────────╮╭────────── ports ───────────╮"
"│10.00%│ • ││100.00 kB│ • ││ ip private public│"
"│ │ • • ││ │ •• ││ 8001 │"
"│ │ • • ││ │ •• • ││127.0.0.1 8003 8003│"
"│ │ • ││ │ • • ││ │"
"│ │ •• ││ │ • • ││ │"
"│ │• • ││ │• •• ││ │"
"│ │• ││ │• • ││ │"
"│10.00%│ • ││100.00 kB│ • ││ ip private public│"
"│ │ •• ││ │ •• ││ 8001 │"
"│ │ • • ││ │ • ││127.0.0.1 8003 8003│"
"│ │ • ││ │ • • ││ │"
"│ │ •• • ││ │ • • ││ │"
"│ │ • • ││ │ • •• ││ │"
"│ │• ││ │• ││ │"
"│ │ ││ │ ││ │"
"╰───────────────────────────────────────────────────────────────╯╰───────────────────────────────────────────────────────────────╯╰────────────────────────────╯"
@@ -33,12 +33,12 @@ expression: setup.terminal.backend()
"│ │"
"╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯"
"╭───────────────────────── cpu 03.00% ──────────────────────────╮╭─────────────────────── memory 30.00 kB ───────────────────────╮╭────────── ports ───────────╮"
"│10.00%│ • ││100.00 kB│ • ││ ip private public│"
"│ │ • • ││ │ •• ││ 8001 │"
"│ │ • • ││ │ •• • ││127.0.0.1 8003 8003│"
"│ │ • ││ │ • • ││ │"
"│ │ •• ││ │ • • ││ │"
"│ │• • ││ │• •• ││ │"
"│ │• ││ │• • ││ │"
"│10.00%│ • ││100.00 kB│ • ││ ip private public│"
"│ │ •• ││ │ •• ││ 8001 │"
"│ │ • • ││ │ • ││127.0.0.1 8003 8003│"
"│ │ • ││ │ • • ││ │"
"│ │ •• • ││ │ • • ││ │"
"│ │ • • ││ │ • •• ││ │"
"│ │• ││ │• ││ │"
"│ │ ││ │ ││ │"
"╰───────────────────────────────────────────────────────────────╯╰───────────────────────────────────────────────────────────────╯╰────────────────────────────╯"
@@ -33,12 +33,12 @@ expression: setup.terminal.backend()
"│ │ ( 1 - 9 ) sort by header - or click header │ │"
"╰────────────────────────────────────│ ( - = ) change log section height │────────────────────────────────────╯"
"╭───────────────────────── cpu 03.00%│ ( \ ) toggle log section visibility │──────╮╭────────── ports ───────────╮"
"│10.00%│ • │ ( esc ) close dialog │ ││ ip private public│"
"│ │ • • │ ( q ) quit at any time │ ││ 8001 │"
"│ │ • • │ │ ││127.0.0.1 8003 8003│"
"│ │ • │ currently an early work in progress, all and any input appreciated │ ││ │"
"│ │ •• │ https://github.com/mrjackwills/oxker │ ││ │"
"│ │• • │ │ ││ │"
"│ │• ╰────────────────────────────────────────────────────────────────────────────────────╯ ││ │"
"│10.00%│ • │ ( esc ) close dialog │ ││ ip private public│"
"│ │ •• │ ( q ) quit at any time │ ││ 8001 │"
"│ │ • • │ │ ││127.0.0.1 8003 8003│"
"│ │ • │ currently an early work in progress, all and any input appreciated │ ││ │"
"│ │ •• • │ https://github.com/mrjackwills/oxker │ ││ │"
"│ │ • • │ │ ││ │"
"│ │• ╰────────────────────────────────────────────────────────────────────────────────────╯ ││ │"
"│ │ ││ │ ││ │"
"╰───────────────────────────────────────────────────────────────╯╰───────────────────────────────────────────────────────────────╯╰────────────────────────────╯"
@@ -33,12 +33,12 @@ expression: setup.terminal.backend()
"│ │"
"╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯"
"╭───────────────────────── cpu 03.00% ──────────────────────────╮╭─────────────────────── memory 30.00 kB ───────────────────────╮╭────────── ports ───────────╮"
"│10.00%│ • ││100.00 kB│ • ││ ip private public│"
"│ │ • • ││ │ •• ││ 8001 │"
"│ │ • • ││ │ •• • ││127.0.0.1 8003 8003│"
"│ │ • ││ │ • • ││ │"
"│ │ •• ││ │ • • ││ │"
"│ │• • ││ │• •• ││ "
"│ │• ││ │• • ││ This is a test "
"│10.00%│ • ││100.00 kB│ • ││ ip private public│"
"│ │ •• ││ │ •• ││ 8001 │"
"│ │ • • ││ │ • ││127.0.0.1 8003 8003│"
"│ │ • ││ │ • • ││ │"
"│ │ •• • ││ │ • • ││ │"
"│ │ • • ││ │ • •• ││ "
"│ │• ││ │• ││ This is a test "
"│ │ ││ │ ││ "
"╰───────────────────────────────────────────────────────────────╯╰───────────────────────────────────────────────────────────────╯╰─────── "
@@ -26,9 +26,9 @@ expression: setup.terminal.backend()
"│ │"
"╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯"
"╭───────────────────────────────── cpu 03.00% ─────────────────────────────────╮╭────────────────────────────── memory 30.00 kB ───────────────────────────────╮╭────────── ports ───────────╮"
"│10.00%│ ••• ││100.00 kB│ •••• ││ ip private public│"
"│ │ •• • ││ │ •• • ││ 8001 │"
"│ │ ••• ││ │ ••• • • ││127.0.0.1 8003 8003│"
"│ │•• ••• ││ │•• •• ││ │"
"│ │ ││ │ ││ │"
"│10.00%│ ••• ││100.00 kB│ •• ││ ip private public│"
"│ │ •• • ││ │ •• • ││ 8001 │"
"│ │ ••• • ││ │ ••• ││127.0.0.1 8003 8003│"
"│ │•• ••• ││ │ •• •• ││ │"
"│ │ ││ │ ││ │"
"╰──────────────────────────────────────────────────────────────────────────────╯╰──────────────────────────────────────────────────────────────────────────────╯╰────────────────────────────╯"
@@ -26,9 +26,9 @@ expression: setup.terminal.backend()
"│ ││ │"
"╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯╰──────────────╯"
"╭───────────────────────── cpu 03.00% ──────────────────────────╮╭─────────────────────── memory 30.00 kB ───────────────────────╮╭────────── ports ───────────╮"
"│10.00%│ •• ││100.00 kB│ •• ││ ip private public│"
"│ │ • • ││ │ •• • ││ 8001 │"
"│ │ ••• • • ││ │ •• ││127.0.0.1 8003 8003│"
"│ │• •• ││ │• •• ││ │"
"│ │ ││ │ ││ │"
"│10.00%│ •• ││100.00 kB│ •• ││ ip private public│"
"│ │ • • ││ │ •• • ││ 8001 │"
"│ │ ••• ││ │ •• • ││127.0.0.1 8003 8003│"
"│ │• •• ││ │• •• ││ │"
"│ │ ││ │ ││ │"
"╰───────────────────────────────────────────────────────────────╯╰───────────────────────────────────────────────────────────────╯╰────────────────────────────╯"
@@ -26,9 +26,9 @@ expression: setup.terminal.backend()
"│▶ line 3 │"
"╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯"
"╭───────────────────────── cpu 03.00% ──────────────────────────╮╭─────────────────────── memory 30.00 kB ───────────────────────╮╭────────── ports ───────────╮"
"│10.00%│ •• ││100.00 kB│ •• ││ ip private public│"
"│ │ • • ││ │ •• • ││ 8001 │"
"│ │ ••• • • ││ │ •• ││127.0.0.1 8003 8003│"
"│ │• •• ││ │• •• ││ │"
"│ │ ││ │ ││ │"
"│10.00%│ •• ││100.00 kB│ •• ││ ip private public│"
"│ │ • • ││ │ •• • ││ 8001 │"
"│ │ ••• ││ │ •• • ││127.0.0.1 8003 8003│"
"│ │• •• ││ │• •• ││ │"
"│ │ ││ │ ││ │"
"╰───────────────────────────────────────────────────────────────╯╰───────────────────────────────────────────────────────────────╯╰────────────────────────────╯"
@@ -25,10 +25,10 @@ expression: setup.terminal.backend()
"│ │"
"╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯"
"╭───────────────────────── cpu 03.00% ──────────────────────────╮╭─────────────────────── memory 30.00 kB ───────────────────────╮╭────────── ports ───────────╮"
"│10.00%│ •• ││100.00 kB│ •• ││ ip private public│"
"│ │ • • ││ │ •• • ││ 8001 │"
"│ │ ••• • • ││ │ •• ││ │"
"│ │• •• ││ │• •• ││ │"
"│ │ ││ │ ││ │"
"│10.00%│ •• ││100.00 kB│ •• ││ ip private public│"
"│ │ • • ││ │ •• • ││ 8001 │"
"│ │ ••• ││ │ •• • ││ │"
"│ │• •• ││ │• •• ││ │"
"│ │ ││ │ ││ │"
"╰───────────────────────────────────────────────────────────────╯╰───────────────────────────────────────────────────────────────╯╰────────────────────────────╯"
" Esc clear ← by → Name Image Status All filter term: r_1 "
+21 -20
View File
@@ -238,32 +238,33 @@ impl Ui {
}
if crossterm::event::poll(POLL_RATE).unwrap_or(false)
&& let Ok(event) = event::read() {
if let Event::Key(key) = event {
if key.kind == event::KeyEventKind::Press {
&& let Ok(event) = event::read()
{
if let Event::Key(key) = event {
if key.kind == event::KeyEventKind::Press {
self.input_tx
.send(InputMessages::ButtonPress((key.code, key.modifiers)))
.await
.ok();
}
} else if let Event::Mouse(m) = event {
match m.kind {
event::MouseEventKind::Down(_)
| event::MouseEventKind::ScrollDown
| event::MouseEventKind::ScrollUp => {
self.input_tx
.send(InputMessages::ButtonPress((key.code, key.modifiers)))
.send(InputMessages::MouseEvent((m, m.modifiers)))
.await
.ok();
}
} else if let Event::Mouse(m) = event {
match m.kind {
event::MouseEventKind::Down(_)
| event::MouseEventKind::ScrollDown
| event::MouseEventKind::ScrollUp => {
self.input_tx
.send(InputMessages::MouseEvent((m, m.modifiers)))
.await
.ok();
}
_ => (),
}
} else if let Event::Resize(width, _) = event {
self.gui_state.lock().clear_area_map();
self.terminal.autoresize().ok();
self.gui_state.lock().set_screen_width(width);
_ => (),
}
} else if let Event::Resize(width, _) = event {
self.gui_state.lock().clear_area_map();
self.terminal.autoresize().ok();
self.gui_state.lock().set_screen_width(width);
}
}
self.check_clear();
}
Ok(())