1use gpui::App;
2use settings::Settings;
3use util::MergeFrom;
4
5/// Settings for configuring REPL display and behavior.
6#[derive(Clone, Debug)]
7pub struct ReplSettings {
8 /// Maximum number of lines to keep in REPL's scrollback buffer.
9 /// Clamped with [4, 256] range.
10 ///
11 /// Default: 32
12 pub max_lines: usize,
13 /// Maximum number of columns to keep in REPL's scrollback buffer.
14 /// Clamped with [20, 512] range.
15 ///
16 /// Default: 128
17 pub max_columns: usize,
18}
19
20impl Settings for ReplSettings {
21 fn from_defaults(content: &settings::SettingsContent, _cx: &mut App) -> Self {
22 let repl = content.repl.as_ref().unwrap();
23
24 Self {
25 max_lines: repl.max_lines.unwrap(),
26 max_columns: repl.max_columns.unwrap(),
27 }
28 }
29
30 fn refine(&mut self, content: &settings::SettingsContent, _cx: &mut App) {
31 let Some(repl) = content.repl.as_ref() else {
32 return;
33 };
34
35 self.max_columns.merge_from(&repl.max_columns);
36 self.max_lines.merge_from(&repl.max_lines);
37 }
38}