diff options
author | Kunal Mohan <44079328+kunalmohan@users.noreply.github.com> | 2022-01-04 23:24:05 +0530 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-01-04 23:24:05 +0530 |
commit | e23d06b70d827bd2a4d1c674019a0321a9f67e2d (patch) | |
tree | 8418bcab3467e44797ff94dd912df8e4c2fa3f03 /zellij-utils/src | |
parent | 3e0ac752ccbca5d5121b85bb0a1c8a2459c01c73 (diff) |
Feature: Configurable scroll buffer (#936)
* Configurable scroll buffer
* Fix unit test failures
* Add scroll_buffer_size description in the default config file
* Fix config file
Diffstat (limited to 'zellij-utils/src')
-rw-r--r-- | zellij-utils/src/consts.rs | 3 | ||||
-rw-r--r-- | zellij-utils/src/input/options.rs | 7 |
2 files changed, 10 insertions, 0 deletions
diff --git a/zellij-utils/src/consts.rs b/zellij-utils/src/consts.rs index 416153f20..494d12a20 100644 --- a/zellij-utils/src/consts.rs +++ b/zellij-utils/src/consts.rs @@ -5,6 +5,7 @@ use crate::shared::set_permissions; use directories_next::ProjectDirs; use lazy_static::lazy_static; use nix::unistd::Uid; +use once_cell::sync::OnceCell; use std::path::PathBuf; use std::{env, fs}; @@ -12,6 +13,8 @@ pub const ZELLIJ_CONFIG_FILE_ENV: &str = "ZELLIJ_CONFIG_FILE"; pub const ZELLIJ_CONFIG_DIR_ENV: &str = "ZELLIJ_CONFIG_DIR"; pub const ZELLIJ_LAYOUT_DIR_ENV: &str = "ZELLIJ_LAYOUT_DIR"; pub const VERSION: &str = env!("CARGO_PKG_VERSION"); +pub const DEFAULT_SCROLL_BUFFER_SIZE: usize = 10_000; +pub static SCROLL_BUFFER_SIZE: OnceCell<usize> = OnceCell::new(); pub const SYSTEM_DEFAULT_CONFIG_DIR: &str = "/etc/zellij"; pub const SYSTEM_DEFAULT_DATA_DIR_PREFIX: &str = system_default_data_dir(); diff --git a/zellij-utils/src/input/options.rs b/zellij-utils/src/input/options.rs index e0a38946b..dcaad306a 100644 --- a/zellij-utils/src/input/options.rs +++ b/zellij-utils/src/input/options.rs @@ -72,6 +72,8 @@ pub struct Options { /// Set behaviour on force close (quit or detach) #[structopt(long)] pub on_force_close: Option<OnForceClose>, + #[structopt(long)] + pub scroll_buffer_size: Option<usize>, } impl Options { @@ -96,6 +98,7 @@ impl Options { let layout_dir = other.layout_dir.or_else(|| self.layout_dir.clone()); let theme = other.theme.or_else(|| self.theme.clone()); let on_force_close = other.on_force_close.or(self.on_force_close); + let scroll_buffer_size = other.scroll_buffer_size.or(self.scroll_buffer_size); Options { simplified_ui, @@ -107,6 +110,7 @@ impl Options { pane_frames, mirror_session, on_force_close, + scroll_buffer_size, } } @@ -135,6 +139,7 @@ impl Options { let layout_dir = other.layout_dir.or_else(|| self.layout_dir.clone()); let theme = other.theme.or_else(|| self.theme.clone()); let on_force_close = other.on_force_close.or(self.on_force_close); + let scroll_buffer_size = other.scroll_buffer_size.or(self.scroll_buffer_size); Options { simplified_ui, @@ -146,6 +151,7 @@ impl Options { pane_frames, mirror_session, on_force_close, + scroll_buffer_size, } } @@ -193,6 +199,7 @@ impl From<CliOptions> for Options { pane_frames: opts.pane_frames, mirror_session: opts.mirror_session, on_force_close: opts.on_force_close, + scroll_buffer_size: opts.scroll_buffer_size, } } } |