1use settings::{RegisterSetting, Settings};
2
3/// Settings for configuring REPL display and behavior.
4#[derive(Clone, Debug, RegisterSetting)]
5pub struct ReplSettings {
6 /// Maximum number of lines to keep in REPL's scrollback buffer.
7 /// Clamped with [4, 256] range.
8 ///
9 /// Default: 32
10 pub max_lines: usize,
11 /// Maximum number of columns to keep in REPL's scrollback buffer.
12 /// Clamped with [20, 512] range.
13 ///
14 /// Default: 128
15 pub max_columns: usize,
16 /// Whether to show small single-line outputs inline instead of in a block.
17 ///
18 /// Default: true
19 pub inline_output: bool,
20 /// Maximum number of characters for an output to be shown inline.
21 /// Only applies when `inline_output` is true.
22 ///
23 /// Default: 50
24 pub inline_output_max_length: usize,
25}
26
27impl Settings for ReplSettings {
28 fn from_settings(content: &settings::SettingsContent) -> Self {
29 let repl = content.repl.as_ref().unwrap();
30
31 Self {
32 max_lines: repl.max_lines.unwrap(),
33 max_columns: repl.max_columns.unwrap(),
34 inline_output: repl.inline_output.unwrap_or(true),
35 inline_output_max_length: repl.inline_output_max_length.unwrap_or(50),
36 }
37 }
38}