Reimplement disassembly styling
This commit is contained in:
parent
85a706e0fb
commit
942b494b7f
@ -40,9 +40,7 @@
|
|||||||
//! ```
|
//! ```
|
||||||
use std::{
|
use std::{
|
||||||
env::current_exe,
|
env::current_exe,
|
||||||
io::{self, ErrorKind, Write},
|
io::{self, Write},
|
||||||
iter::empty,
|
|
||||||
str::Chars,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
use colored::{ColoredString, Colorize};
|
use colored::{ColoredString, Colorize};
|
||||||
@ -147,6 +145,10 @@ impl<'a, W: Write> Disassembler<'a, W> {
|
|||||||
write!(&mut self.writer, "{}", text)
|
write!(&mut self.writer, "{}", text)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn write_colored(&mut self, text: &ColoredString) -> Result<(), io::Error> {
|
||||||
|
write!(&mut self.writer, "{}", text)
|
||||||
|
}
|
||||||
|
|
||||||
fn write_content(
|
fn write_content(
|
||||||
&mut self,
|
&mut self,
|
||||||
text: &str,
|
text: &str,
|
||||||
@ -196,7 +198,13 @@ impl<'a, W: Write> Disassembler<'a, W> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if style_bold {
|
||||||
|
self.write_colored(&line_content.bold())?;
|
||||||
|
} else if style_dim {
|
||||||
|
self.write_colored(&line_content.dimmed())?;
|
||||||
|
} else {
|
||||||
self.write_str(line_content)?;
|
self.write_str(line_content)?;
|
||||||
|
}
|
||||||
|
|
||||||
if center {
|
if center {
|
||||||
for _ in 0..right_pad_length {
|
for _ in 0..right_pad_length {
|
||||||
|
Loading…
Reference in New Issue
Block a user