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(),
|
search: SearchState::default(),
|
||||||
log_enabled: false,
|
log_enabled: false,
|
||||||
log_path: String::new(),
|
log_path: String::new(),
|
||||||
|
show_sent: true,
|
||||||
log_writer: None,
|
log_writer: None,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -129,5 +129,6 @@ pub struct SessionTab {
|
|||||||
pub search: SearchState,
|
pub search: SearchState,
|
||||||
pub log_enabled: bool,
|
pub log_enabled: bool,
|
||||||
pub log_path: String,
|
pub log_path: String,
|
||||||
|
pub show_sent: bool,
|
||||||
pub log_writer: Option<LogWriter>,
|
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.add_space(3.0);
|
||||||
|
ui.checkbox(&mut tab.show_sent, "Show sent data");
|
||||||
|
ui.add_space(3.0);
|
||||||
|
|
||||||
let hint = match tab.send_mode {
|
let hint = match tab.send_mode {
|
||||||
SendMode::Text => "Enter to send, Ctrl+Enter for newline",
|
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::CR => text.push('\r'),
|
||||||
LineEnding::CRLF => text.push_str("\r\n"),
|
LineEnding::CRLF => text.push_str("\r\n"),
|
||||||
}
|
}
|
||||||
|
if tab.show_sent {
|
||||||
tab.console.push_outbound(text.clone());
|
tab.console.push_outbound(text.clone());
|
||||||
|
}
|
||||||
if let Some(ref writer) = tab.log_writer {
|
if let Some(ref writer) = tab.log_writer {
|
||||||
writer.write_line(&logging::format_sent_log(&text));
|
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<_>>()
|
.collect::<Vec<_>>()
|
||||||
.join(" ");
|
.join(" ");
|
||||||
if !hex.is_empty() {
|
if !hex.is_empty() {
|
||||||
|
if tab.show_sent {
|
||||||
tab.hex.push_outbound(hex.clone());
|
tab.hex.push_outbound(hex.clone());
|
||||||
|
}
|
||||||
if let Some(ref writer) = tab.log_writer {
|
if let Some(ref writer) = tab.log_writer {
|
||||||
writer.write_line(&logging::format_sent_log(&hex));
|
writer.write_line(&logging::format_sent_log(&hex));
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user