diff --git a/cursive-syntect/Cargo.toml b/cursive-syntect/Cargo.toml index 94aba36a..d93a9fec 100644 --- a/cursive-syntect/Cargo.toml +++ b/cursive-syntect/Cargo.toml @@ -14,7 +14,7 @@ include = ["src/lib.rs", "LICENSE", "README.md"] # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -cursive_core = { path = "../cursive-core", version= "0.3.5"} +cursive_core = { path = "../cursive-core", version= "0.4.0"} unicode-width = "0.1.9" [dependencies.syntect] diff --git a/cursive-syntect/src/lib.rs b/cursive-syntect/src/lib.rs index 2545df27..ac73c24a 100644 --- a/cursive-syntect/src/lib.rs +++ b/cursive-syntect/src/lib.rs @@ -6,25 +6,25 @@ //! [`syntect`]: https://docs.rs/syntect #![deny(missing_docs)] -use cursive_core::theme; +use cursive_core::style; use cursive_core::utils::markup::{StyledIndexedSpan, StyledString}; use cursive_core::utils::span::IndexedCow; use unicode_width::UnicodeWidthStr; /// Translate a syntect font style into a set of cursive effects. -pub fn translate_effects(font_style: syntect::highlighting::FontStyle) -> theme::Effects { - let mut effects = theme::Effects::empty(); +pub fn translate_effects(font_style: syntect::highlighting::FontStyle) -> style::Effects { + let mut effects = style::Effects::empty(); for &(style, effect) in &[ - (syntect::highlighting::FontStyle::BOLD, theme::Effect::Bold), + (syntect::highlighting::FontStyle::BOLD, style::Effect::Bold), ( syntect::highlighting::FontStyle::UNDERLINE, - theme::Effect::Underline, + style::Effect::Underline, ), ( syntect::highlighting::FontStyle::ITALIC, - theme::Effect::Italic, + style::Effect::Italic, ), ] { if font_style.contains(style) { @@ -36,16 +36,16 @@ pub fn translate_effects(font_style: syntect::highlighting::FontStyle) -> theme: } /// Translate a syntect color into a cursive color. -pub fn translate_color(color: syntect::highlighting::Color) -> theme::Color { - theme::Color::Rgb(color.r, color.g, color.b) +pub fn translate_color(color: syntect::highlighting::Color) -> style::Color { + style::Color::Rgb(color.r, color.g, color.b) } /// Translate a syntect style into a cursive style. -pub fn translate_style(style: syntect::highlighting::Style) -> theme::Style { +pub fn translate_style(style: syntect::highlighting::Style) -> style::Style { let front = translate_color(style.foreground); let back = translate_color(style.background); - theme::Style { + style::Style { color: (front, back).into(), effects: translate_effects(style.font_style), }