aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoriximeow <me@iximeow.net>2019-04-17 18:17:27 -0700
committeriximeow <me@iximeow.net>2020-01-12 16:26:39 -0800
commit9e2e1a1bc0f0a03e03a6e370ce91536bc2443774 (patch)
tree03f2faf07f4887ea151ea5b49758c0716e7b2640
parent05d511ff490fa4b4783e54a9f4f32418a29af2d1 (diff)
add color for program counter register (default to the same as ret and friends)
-rw-r--r--src/lib.rs12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/lib.rs b/src/lib.rs
index 86c8a2d..b62d52f 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -167,6 +167,7 @@ pub struct ColorSettings {
misc: color::Fg<&'static color::Color>,
register: color::Fg<&'static color::Color>,
+ program_counter: color::Fg<&'static color::Color>,
number: color::Fg<&'static color::Color>,
zero: color::Fg<&'static color::Color>,
@@ -205,6 +206,7 @@ impl Default for ColorSettings {
misc: color::Fg(&color::LightCyan),
register: color::Fg(&color::Cyan),
+ program_counter: color::Fg(&color::Red),
number: color::Fg(&color::White),
zero: color::Fg(&color::White),
@@ -230,6 +232,7 @@ pub trait YaxColors {
fn platform_op<T: Display>(&self, t: T) -> Colored<T>;
fn register<T: Display>(&self, t: T) -> Colored<T>;
+ fn program_counter<T: Display>(&self, t: T) -> Colored<T>;
fn number<T: Display>(&self, t: T) -> Colored<T>;
fn zero<T: Display>(&self, t: T) -> Colored<T>;
fn one<T: Display>(&self, t: T) -> Colored<T>;
@@ -271,6 +274,9 @@ impl YaxColors for ColorSettings {
fn register<T: Display>(&self, t: T) -> Colored<T> {
Colored::Color(t, self.register)
}
+ fn program_counter<T: Display>(&self, t: T) -> Colored<T> {
+ Colored::Color(t, self.program_counter)
+ }
fn number<T: Display>(&self, t: T) -> Colored<T> {
Colored::Color(t, self.number)
}
@@ -356,6 +362,12 @@ impl <'a> YaxColors for Option<&'a ColorSettings> {
None => { Colored::Just(t) }
}
}
+ fn program_counter<T: Display>(&self, t: T) -> Colored<T> {
+ match self {
+ Some(colors) => { colors.program_counter(t) }
+ None => { Colored::Just(t) }
+ }
+ }
fn number<T: Display>(&self, t: T) -> Colored<T> {
match self {
Some(colors) => { colors.number(t) }