From e8730ca5fd72e3bb275b4d825de40475eabea174 Mon Sep 17 00:00:00 2001 From: aaron404 Date: Thu, 1 Sep 2022 22:39:38 -0400 Subject: initial implementation of bufferline (#2759) * initial implementation of bufferline * fixed lint * changed to 'bufferline', added enum for config modes, some cleanup * fixed lint * added file modification indicator * removed redundant code, added proper themeing with fallback, changed 'file modified' indicator * remove commented code * Update helix-term/src/ui/editor.rs simplify text and offset computation Co-authored-by: Gokul Soumya * add ui.bufferline.background key for themes Co-authored-by: lazytanuki <43273245+lazytanuki@users.noreply.github.com> * address PR comments * Update helix-term/src/ui/editor.rs * simplify computation of editor area: * change to set_stringn to avoid overflow * Update configuration.md Updates documentation to reflect decision re: defaulting to never showing bufferline. * addressed pr comments * fix build error * address pr comments * revert accidental change Co-authored-by: Gokul Soumya Co-authored-by: lazytanuki <43273245+lazytanuki@users.noreply.github.com> Co-authored-by: Seth Bromberger --- helix-view/src/editor.rs | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'helix-view/src') diff --git a/helix-view/src/editor.rs b/helix-view/src/editor.rs index ed1813b3..65e64b16 100644 --- a/helix-view/src/editor.rs +++ b/helix-view/src/editor.rs @@ -162,6 +162,8 @@ pub struct Config { pub rulers: Vec, #[serde(default)] pub whitespace: WhitespaceConfig, + /// Persistently display open buffers along the top + pub bufferline: BufferLine, /// Vertical indent width guides. pub indent_guides: IndentGuidesConfig, /// Whether to color modes with different colors. Defaults to `false`. @@ -367,6 +369,24 @@ impl Default for CursorShapeConfig { } } +/// bufferline render modes +#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] +#[serde(rename_all = "kebab-case")] +pub enum BufferLine { + /// Don't render bufferline + Never, + /// Always render + Always, + /// Only if multiple buffers are open + Multiple, +} + +impl Default for BufferLine { + fn default() -> Self { + BufferLine::Never + } +} + #[derive(Debug, Copy, Clone, PartialEq, Eq, Serialize, Deserialize)] #[serde(rename_all = "kebab-case")] pub enum LineNumber { @@ -554,6 +574,7 @@ impl Default for Config { terminal: get_terminal_provider(), rulers: Vec::new(), whitespace: WhitespaceConfig::default(), + bufferline: BufferLine::default(), indent_guides: IndentGuidesConfig::default(), color_modes: false, } -- cgit v1.2.3-70-g09d2