aboutsummaryrefslogtreecommitdiff
path: root/helix-view/src/editor.rs
diff options
context:
space:
mode:
authoraaron4042022-09-02 02:39:38 +0000
committerGitHub2022-09-02 02:39:38 +0000
commite8730ca5fd72e3bb275b4d825de40475eabea174 (patch)
tree5dc9a9bf1505b1e4e6ae45905f01a1925b43269a /helix-view/src/editor.rs
parent04a4033b6c46e072eebb8b8bf1ec1745022d482d (diff)
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 <gokulps15@gmail.com> * 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 <gokulps15@gmail.com> Co-authored-by: lazytanuki <43273245+lazytanuki@users.noreply.github.com> Co-authored-by: Seth Bromberger <sbromberger@users.noreply.github.com>
Diffstat (limited to 'helix-view/src/editor.rs')
-rw-r--r--helix-view/src/editor.rs21
1 files changed, 21 insertions, 0 deletions
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<u16>,
#[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,
}