aboutsummaryrefslogtreecommitdiff
path: root/src/config.rs
diff options
context:
space:
mode:
authorOgulcan Celik <ogulcancelik@gmail.com>2026-04-07 00:04:32 +0300
committerOgulcan Celik <ogulcancelik@gmail.com>2026-04-07 00:04:32 +0300
commita51902ede97afd84b469f838f25ab79287bd375d (patch)
tree986cf68f33370450eae9152ac3c2015aeebe5882 /src/config.rs
parent6ccf156a3dd23f419c03892ddc1136e72957f66a (diff)
fix: use byte-based pane scrollback limit
Diffstat (limited to 'src/config.rs')
-rw-r--r--src/config.rs38
1 files changed, 36 insertions, 2 deletions
diff --git a/src/config.rs b/src/config.rs
index 8733d5cc..bd6b93b9 100644
--- a/src/config.rs
+++ b/src/config.rs
@@ -4,6 +4,7 @@ use crossterm::event::{KeyCode, KeyModifiers};
use serde::Deserialize;
pub const CONFIG_PATH_ENV_VAR: &str = "HERDR_CONFIG_PATH";
+pub const DEFAULT_SCROLLBACK_LIMIT_BYTES: usize = 10_000_000;
use tracing::warn;
pub fn app_dir_name() -> &'static str {
@@ -151,11 +152,14 @@ pub struct UiConfig {
pub sound: SoundConfig,
}
-#[derive(Debug, Default, Deserialize)]
+#[derive(Debug, Deserialize)]
#[serde(default)]
pub struct AdvancedConfig {
/// Allow launching herdr inside an existing herdr pane. Default: false.
pub allow_nested: bool,
+ /// Maximum scrollback buffer size in bytes retained per pane terminal. Default: 10000000.
+ #[serde(alias = "scrollback_lines")]
+ pub scrollback_limit_bytes: usize,
}
#[derive(Debug, Clone, Deserialize)]
@@ -337,6 +341,15 @@ impl Default for SoundConfig {
}
}
+impl Default for AdvancedConfig {
+ fn default() -> Self {
+ Self {
+ allow_nested: false,
+ scrollback_limit_bytes: DEFAULT_SCROLLBACK_LIMIT_BYTES,
+ }
+ }
+}
+
impl Default for AgentSoundOverrides {
fn default() -> Self {
Self {
@@ -1356,13 +1369,34 @@ path = "sounds/notification.wav"
}
#[test]
- fn advanced_allow_nested_parses() {
+ fn advanced_defaults_include_scrollback_limit_bytes() {
+ let config = Config::default();
+ assert_eq!(
+ config.advanced.scrollback_limit_bytes,
+ DEFAULT_SCROLLBACK_LIMIT_BYTES
+ );
+ }
+
+ #[test]
+ fn advanced_config_parses() {
let toml = r#"
[advanced]
allow_nested = true
+scrollback_limit_bytes = 12345
"#;
let config: Config = toml::from_str(toml).unwrap();
assert!(config.advanced.allow_nested);
+ assert_eq!(config.advanced.scrollback_limit_bytes, 12345);
+ }
+
+ #[test]
+ fn advanced_legacy_scrollback_lines_alias_parses() {
+ let toml = r#"
+[advanced]
+scrollback_lines = 12345
+"#;
+ let config: Config = toml::from_str(toml).unwrap();
+ assert_eq!(config.advanced.scrollback_limit_bytes, 12345);
}
#[test]