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:
@@ -280,6 +280,7 @@ impl XserialApp {
|
||||
search: SearchState::default(),
|
||||
log_enabled: false,
|
||||
log_path: String::new(),
|
||||
show_sent: true,
|
||||
log_writer: None,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -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>,
|
||||
}
|
||||
|
||||
@@ -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"),
|
||||
}
|
||||
tab.console.push_outbound(text.clone());
|
||||
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() {
|
||||
tab.hex.push_outbound(hex.clone());
|
||||
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));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user