feat(gui): add 'Show sent data' toggle in send panel

Add checkbox to control whether sent text/hex appears in the
console/hex view. Default enabled (current behavior). Log-to-file
is unaffected.
This commit is contained in:
2026-06-22 15:42:05 +08:00
parent 5923ad0143
commit 37f7713938
3 changed files with 10 additions and 2 deletions

View File

@@ -280,6 +280,7 @@ impl XserialApp {
search: SearchState::default(),
log_enabled: false,
log_path: String::new(),
show_sent: true,
log_writer: None,
});
}

View File

@@ -129,5 +129,6 @@ pub struct SessionTab {
pub search: SearchState,
pub log_enabled: bool,
pub log_path: String,
pub show_sent: bool,
pub log_writer: Option<LogWriter>,
}

View File

@@ -66,6 +66,8 @@ pub fn render_send_panel(ui: &mut egui::Ui, manager: &SessionManager, tab: &mut
});
}
ui.add_space(3.0);
ui.checkbox(&mut tab.show_sent, "Show sent data");
ui.add_space(3.0);
let hint = match tab.send_mode {
SendMode::Text => "Enter to send, Ctrl+Enter for newline",
@@ -116,7 +118,9 @@ pub fn render_send_panel(ui: &mut egui::Ui, manager: &SessionManager, tab: &mut
LineEnding::CR => text.push('\r'),
LineEnding::CRLF => text.push_str("\r\n"),
}
if tab.show_sent {
tab.console.push_outbound(text.clone());
}
if let Some(ref writer) = tab.log_writer {
writer.write_line(&logging::format_sent_log(&text));
}
@@ -129,7 +133,9 @@ pub fn render_send_panel(ui: &mut egui::Ui, manager: &SessionManager, tab: &mut
.collect::<Vec<_>>()
.join(" ");
if !hex.is_empty() {
if tab.show_sent {
tab.hex.push_outbound(hex.clone());
}
if let Some(ref writer) = tab.log_writer {
writer.write_line(&logging::format_sent_log(&hex));
}