ass_editor/core/history/config.rs
1//! Configuration for undo-stack capacity and memory behavior.
2//!
3//! [`UndoStackConfig`] controls how many entries the undo stack retains, its
4//! memory budget, compression, and arena-reset cadence.
5
6/// Configuration for undo stack behavior
7#[derive(Debug, Clone)]
8pub struct UndoStackConfig {
9 /// Maximum number of undo entries to keep
10 pub max_entries: usize,
11
12 /// Maximum memory usage in bytes (0 = unlimited)
13 pub max_memory: usize,
14
15 /// Whether to enable compression of old entries
16 pub enable_compression: bool,
17
18 /// Interval for arena resets (0 = never reset)
19 pub arena_reset_interval: usize,
20}
21
22impl Default for UndoStackConfig {
23 fn default() -> Self {
24 Self {
25 max_entries: 50, // Set a sensible default, can be overridden programmatically
26 max_memory: 10 * 1024 * 1024, // 10MB default
27 enable_compression: true,
28 arena_reset_interval: 100, // Reset arena every 100 operations
29 }
30 }
31}