diff --git a/helix-term/src/ui/statusline.rs b/helix-term/src/ui/statusline.rs index 4e845b23984b..05f23a2b52a5 100644 --- a/helix-term/src/ui/statusline.rs +++ b/helix-term/src/ui/statusline.rs @@ -9,7 +9,6 @@ use helix_view::{ use crate::ui::ProgressSpinners; -use helix_view::editor::ModeSeparator; use helix_view::editor::StatusLineElement as StatusLineElementID; use tui::buffer::Buffer as Surface; use tui::text::{Span, Spans}; @@ -192,27 +191,29 @@ where mode_style, ); - match config.statusline.mode_separator { - ModeSeparator::Flat => {} - _ => { - // use mode style as mode separator style except set - // background to statusline background - let mode_separator_style = mode_style.map(|s| Style { - fg: s.bg, - bg: context.editor.theme.get("ui.statusline").bg, - ..Default::default() - }); - - let mode_separator = match config.statusline.mode_separator { - ModeSeparator::Angled => "", - ModeSeparator::Slanted => "", - ModeSeparator::Round => "", - ModeSeparator::Flat => unreachable!(), - }; - - write(context, mode_separator.to_string(), mode_separator_style); - } - }; + if visible { + match config.statusline.mode_separator.as_str() { + "" => {} + _ => { + // use mode style as mode separator style except set + // background to statusline background + let mode_separator_style = mode_style.map(|s| Style { + fg: s.bg, + bg: context.editor.theme.get("ui.statusline").bg, + ..Default::default() + }); + + let mode_separator = match config.statusline.mode_separator.as_str() { + "angled" => "", + "slanted" => "", + "round" => "", + s => s, + }; + + write(context, mode_separator.to_string(), mode_separator_style); + } + }; + } } fn render_lsp_spinner(context: &mut RenderContext, write: F) diff --git a/helix-view/src/editor.rs b/helix-view/src/editor.rs index 82c92eb0c87b..3a91daef113c 100644 --- a/helix-view/src/editor.rs +++ b/helix-view/src/editor.rs @@ -271,16 +271,7 @@ pub struct StatusLineConfig { pub right: Vec, pub separator: String, pub mode: ModeConfig, - pub mode_separator: ModeSeparator, -} - -#[derive(Debug, Copy, Clone, PartialEq, Eq, Serialize, Deserialize)] -#[serde(rename_all = "kebab-case")] -pub enum ModeSeparator { - Flat, - Angled, - Round, - Slanted, + pub mode_separator: String, } impl Default for StatusLineConfig { @@ -293,7 +284,7 @@ impl Default for StatusLineConfig { right: vec![E::Diagnostics, E::Selections, E::Position, E::FileEncoding], separator: String::from("│"), mode: ModeConfig::default(), - mode_separator: ModeSeparator::Flat, + mode_separator: String::from(""), } } }