From 8e5c9052134dc67379c6231caef9062e10708422 Mon Sep 17 00:00:00 2001 From: Alexandre Bury Date: Fri, 18 Dec 2020 15:54:49 -0800 Subject: [PATCH] Add Effect::Blink --- cursive-core/src/theme/effect.rs | 2 ++ cursive/src/backends/blt.rs | 2 ++ cursive/src/backends/crossterm.rs | 2 ++ cursive/src/backends/curses/n.rs | 2 ++ cursive/src/backends/curses/pan.rs | 2 ++ cursive/src/backends/termion.rs | 2 ++ 6 files changed, 12 insertions(+) diff --git a/cursive-core/src/theme/effect.rs b/cursive-core/src/theme/effect.rs index e95ecfb..3f294ca 100644 --- a/cursive-core/src/theme/effect.rs +++ b/cursive-core/src/theme/effect.rs @@ -16,4 +16,6 @@ pub enum Effect { Strikethrough, /// Prints foreground with underline Underline, + /// Foreground text blinks (background color is static). + Blink, } diff --git a/cursive/src/backends/blt.rs b/cursive/src/backends/blt.rs index 9312800..ba29757 100644 --- a/cursive/src/backends/blt.rs +++ b/cursive/src/backends/blt.rs @@ -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 => { diff --git a/cursive/src/backends/crossterm.rs b/cursive/src/backends/crossterm.rs index 2951dca..7777dc8 100644 --- a/cursive/src/backends/crossterm.rs +++ b/cursive/src/backends/crossterm.rs @@ -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) diff --git a/cursive/src/backends/curses/n.rs b/cursive/src/backends/curses/n.rs index f5ac27a..559db2a 100644 --- a/cursive/src/backends/curses/n.rs +++ b/cursive/src/backends/curses/n.rs @@ -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(), diff --git a/cursive/src/backends/curses/pan.rs b/cursive/src/backends/curses/pan.rs index c78b372..3e693fd 100644 --- a/cursive/src/backends/curses/pan.rs +++ b/cursive/src/backends/curses/pan.rs @@ -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, diff --git a/cursive/src/backends/termion.rs b/cursive/src/backends/termion.rs index 21b4a54..b86220f 100644 --- a/cursive/src/backends/termion.rs +++ b/cursive/src/backends/termion.rs @@ -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),