Add Effect::Blink

This commit is contained in:
Alexandre Bury 2020-12-18 15:54:49 -08:00
parent d464dc8ce0
commit 8e5c905213
6 changed files with 12 additions and 0 deletions

View File

@ -16,4 +16,6 @@ pub enum Effect {
Strikethrough,
/// Prints foreground with underline
Underline,
/// Foreground text blinks (background color is static).
Blink,
}

View File

@ -268,6 +268,7 @@ impl backend::Backend for Backend {
| Effect::Italic
| Effect::Underline
| Effect::Strikethrough
| Effect::Blink
| Effect::Simple => {}
// TODO: how to do this correctly?`
// BLT itself doesn't do this kind of thing,
@ -286,6 +287,7 @@ impl backend::Backend for Backend {
| Effect::Italic
| Effect::Underline
| Effect::Strikethrough
| Effect::Blink
| Effect::Simple => {}
// The process of reversing is the same as unreversing
Effect::Reverse => {

View File

@ -363,6 +363,7 @@ impl backend::Backend for Backend {
theme::Effect::Simple => (),
theme::Effect::Reverse => self.set_attr(Attribute::Reverse),
theme::Effect::Bold => self.set_attr(Attribute::Bold),
theme::Effect::Blink => self.set_attr(Attribute::SlowBlink),
theme::Effect::Italic => self.set_attr(Attribute::Italic),
theme::Effect::Strikethrough => {
self.set_attr(Attribute::CrossedOut)
@ -376,6 +377,7 @@ impl backend::Backend for Backend {
theme::Effect::Simple => (),
theme::Effect::Reverse => self.set_attr(Attribute::NoReverse),
theme::Effect::Bold => self.set_attr(Attribute::NormalIntensity),
theme::Effect::Blink => self.set_attr(Attribute::NoBlink),
theme::Effect::Italic => self.set_attr(Attribute::NoItalic),
theme::Effect::Strikethrough => {
self.set_attr(Attribute::NotCrossedOut)

View File

@ -364,6 +364,7 @@ impl backend::Backend for Backend {
Effect::Reverse => ncurses::A_REVERSE(),
Effect::Simple => ncurses::A_NORMAL(),
Effect::Bold => ncurses::A_BOLD(),
Effect::Blink => ncurses::A_BLINK(),
Effect::Italic => ncurses::A_ITALIC(),
Effect::Strikethrough => ncurses::A_NORMAL(),
Effect::Underline => ncurses::A_UNDERLINE(),
@ -376,6 +377,7 @@ impl backend::Backend for Backend {
Effect::Reverse => ncurses::A_REVERSE(),
Effect::Simple => ncurses::A_NORMAL(),
Effect::Bold => ncurses::A_BOLD(),
Effect::Blink => ncurses::A_BLINK(),
Effect::Italic => ncurses::A_ITALIC(),
Effect::Strikethrough => ncurses::A_NORMAL(),
Effect::Underline => ncurses::A_UNDERLINE(),

View File

@ -396,6 +396,7 @@ impl backend::Backend for Backend {
Effect::Simple => pancurses::Attribute::Normal,
Effect::Reverse => pancurses::Attribute::Reverse,
Effect::Bold => pancurses::Attribute::Bold,
Effect::Blink => pancurses::Attribute::Blink,
Effect::Italic => pancurses::Attribute::Italic,
Effect::Strikethrough => pancurses::Attribute::Strikeout,
Effect::Underline => pancurses::Attribute::Underline,
@ -408,6 +409,7 @@ impl backend::Backend for Backend {
Effect::Simple => pancurses::Attribute::Normal,
Effect::Reverse => pancurses::Attribute::Reverse,
Effect::Bold => pancurses::Attribute::Bold,
Effect::Blink => pancurses::Attribute::Blink,
Effect::Italic => pancurses::Attribute::Italic,
Effect::Strikethrough => pancurses::Attribute::Strikeout,
Effect::Underline => pancurses::Attribute::Underline,

View File

@ -245,6 +245,7 @@ impl backend::Backend for Backend {
theme::Effect::Simple => (),
theme::Effect::Reverse => self.write(tstyle::Invert),
theme::Effect::Bold => self.write(tstyle::Bold),
theme::Effect::Blink => self.write(tstyle::Blink),
theme::Effect::Italic => self.write(tstyle::Italic),
theme::Effect::Strikethrough => self.write(tstyle::CrossedOut),
theme::Effect::Underline => self.write(tstyle::Underline),
@ -256,6 +257,7 @@ impl backend::Backend for Backend {
theme::Effect::Simple => (),
theme::Effect::Reverse => self.write(tstyle::NoInvert),
theme::Effect::Bold => self.write(tstyle::NoFaint),
theme::Effect::Blink => self.write(tstyle::NoBlink),
theme::Effect::Italic => self.write(tstyle::NoItalic),
theme::Effect::Strikethrough => self.write(tstyle::NoCrossedOut),
theme::Effect::Underline => self.write(tstyle::NoUnderline),