From 73d6f348615e34770df431298febc002ef21dae9 Mon Sep 17 00:00:00 2001 From: etienne-k <2804556+etienne-k@users.noreply.github.com> Date: Sun, 8 May 2022 15:31:53 +0200 Subject: [PATCH] refactor(statusline): split the statusline implementation into different functions --- helix-term/src/ui/statusline.rs | 250 +++++++++++++++++++++++++------- 1 file changed, 197 insertions(+), 53 deletions(-) diff --git a/helix-term/src/ui/statusline.rs b/helix-term/src/ui/statusline.rs index a123cb1fd..2735b51ec 100644 --- a/helix-term/src/ui/statusline.rs +++ b/helix-term/src/ui/statusline.rs @@ -1,13 +1,28 @@ -use helix_core::{coords_at_pos, encoding}; +use helix_core::{ + coords_at_pos, + encoding::{self, Encoding}, + Position, +}; use helix_view::{ document::{Mode, SCRATCH_BUFFER_NAME}, graphics::Rect, - Document, Editor, View, + theme::Style, + Document, Editor, Theme, View, }; use crate::ui::ProgressSpinners; use tui::buffer::Buffer as Surface; +use tui::text::{Span, Spans}; + +struct StatusLineElement { + /// The element + pub text: String, + + /// The style to be used to render the element (this style will be merged with the base style). + /// If not set, a default base style will be used. + pub style: Option