Skip to content

Commit

Permalink
avoid dead code warnings for Windows; improve verbose output
Browse files Browse the repository at this point in the history
  • Loading branch information
apparebit committed Dec 23, 2024
1 parent 2bfeffa commit 6bf0f11
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 12 deletions.
3 changes: 3 additions & 0 deletions crates/prettytty/src/conn.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@ impl Connection {
println!("terminal::reconfig {:?}", &reconfig);
}
reconfig.write(connection.output())?;
if verbose {
println!("terminal::reconfigured")
}
Ok(Some(config))
},
)?;
Expand Down
8 changes: 4 additions & 4 deletions crates/prettytty/src/sys/unix.rs
Original file line number Diff line number Diff line change
Expand Up @@ -132,10 +132,10 @@ impl ModeGroup {
use self::ModeGroup::*;

match self {
Input => "input",
Output => "output",
Control => "control",
Local => "local"
Input => "input_modes",
Output => "output_modes",
Control => "control_modes",
Local => "local_modes"
}
}
}
Expand Down
20 changes: 12 additions & 8 deletions crates/prettytty/src/sys/windows.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,8 @@ impl ModeGroup {

pub fn name(&self) -> &'static str {
match self {
Self::Input => "input",
Self::Output => "output",
Self::Input => "input_modes",
Self::Output => "output_modes",
}
}
}
Expand Down Expand Up @@ -216,12 +216,16 @@ impl Config {

impl std::fmt::Debug for Config {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
f.debug_struct("Config")
.field("input_modes", &IdentList::new(self.labels(ModeGroup::Input)))
.field("input_encoding", &self.input_encoding)
.field("output_modes", &IdentList::new(self.labels(ModeGroup::Output)))
.field("output_encoding", &self.output_encoding)
.finish()
let mut debugger = f.debug_struct("Config");
for group in ModeGroup::all() {
debugger.field(group.name(), &IdentList::new(self.labels(group)));
if group == ModeGroup::Input {
debugger.field("input_encoding", &self.input_encoding)
} else {
debugger.field("output_encoding", &self.output_encoding)
}
}
debugger.finish()
}
}

Expand Down

0 comments on commit 6bf0f11

Please sign in to comment.