Commit 176df21c authored by E5ten's avatar E5ten
Browse files

Add underline and strikethrough support.

parent 18a50799
...@@ -12,7 +12,9 @@ pub enum Event<'a> { ...@@ -12,7 +12,9 @@ pub enum Event<'a> {
y: usize, y: usize,
c: char, c: char,
bold: bool, bold: bool,
italic: bool,
underlined: bool, underlined: bool,
strikethrough: bool,
color: Color color: Color
}, },
Input { Input {
...@@ -63,7 +65,9 @@ pub struct State { ...@@ -63,7 +65,9 @@ pub struct State {
pub background_default: Color, pub background_default: Color,
pub bold: bool, pub bold: bool,
pub inverted: bool, pub inverted: bool,
pub italic: bool,
pub underlined: bool, pub underlined: bool,
pub strikethrough: bool,
pub cursor: bool, pub cursor: bool,
pub redraw: bool, pub redraw: bool,
pub origin: bool, pub origin: bool,
...@@ -93,7 +97,9 @@ impl State { ...@@ -93,7 +97,9 @@ impl State {
background_default: Color::Ansi(0), background_default: Color::Ansi(0),
bold: false, bold: false,
inverted: false, inverted: false,
italic: false,
underlined: false, underlined: false,
strikethrough: false,
cursor: true, cursor: true,
redraw: true, redraw: true,
origin: false, origin: false,
...@@ -118,7 +124,9 @@ impl State { ...@@ -118,7 +124,9 @@ impl State {
y: self.y, y: self.y,
c: c, c: c,
bold: self.bold, bold: self.bold,
italic: self.italic,
underlined: self.underlined, underlined: self.underlined,
strikethrough: self.strikethrough,
color: if self.inverted { self.background } else { self.foreground } color: if self.inverted { self.background } else { self.foreground }
}); });
} }
...@@ -559,21 +567,36 @@ impl State { ...@@ -559,21 +567,36 @@ impl State {
1 => { 1 => {
self.bold = true; self.bold = true;
}, },
3 => {
self.italic = true;
},
4 => { 4 => {
self.underlined = true; self.underlined = true;
}, },
7 => { 7 => {
self.inverted = true; self.inverted = true;
}, },
9 => {
self.strikethrough = true;
},
}
21 => { 21 => {
self.bold = false; self.bold = false;
}, },
23 => {
self.italic = false;
},
}
24 => { 24 => {
self.underlined = false; self.underlined = false;
}, },
27 => { 27 => {
self.inverted = false; self.inverted = false;
}, },
29 => {
self.strikethrough = false;
},
}
30 ... 37 => self.foreground = Color::Ansi(*value as u8 - 30), 30 ... 37 => self.foreground = Color::Ansi(*value as u8 - 30),
38 => match value_iter.next().map(|v| *v).unwrap_or(0) { 38 => match value_iter.next().map(|v| *v).unwrap_or(0) {
2 => { 2 => {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment