1#[derive(Clone, Copy, PartialEq, Debug)]
2pub struct EditableConfig {
3 pub(crate) indentation: u8,
4 pub(crate) allow_tabs: bool,
5 pub(crate) allow_changes: bool,
6 pub(crate) allow_read_clipboard: bool,
7 pub(crate) allow_write_clipboard: bool,
8 pub(crate) select_all_on_double_click: bool,
9}
10
11impl Default for EditableConfig {
12 fn default() -> Self {
13 Self::new()
14 }
15}
16
17impl EditableConfig {
18 pub fn new() -> Self {
20 Self {
21 indentation: 4,
22 allow_tabs: false,
23 allow_changes: true,
24 allow_read_clipboard: true,
25 allow_write_clipboard: true,
26 select_all_on_double_click: false,
27 }
28 }
29
30 pub fn with_indentation(mut self, indentation: u8) -> Self {
32 self.indentation = indentation;
33 self
34 }
35
36 pub fn with_allow_tabs(mut self, allow_tabs: bool) -> Self {
38 self.allow_tabs = allow_tabs;
39 self
40 }
41
42 pub fn with_allow_changes(mut self, allow_changes: bool) -> Self {
44 self.allow_changes = allow_changes;
45 self
46 }
47
48 pub fn with_allow_read_clipboard(mut self, allow_read_clipboard: bool) -> Self {
50 self.allow_read_clipboard = allow_read_clipboard;
51 self
52 }
53
54 pub fn with_allow_write_clipboard(mut self, allow_write_clipboard: bool) -> Self {
56 self.allow_write_clipboard = allow_write_clipboard;
57 self
58 }
59
60 pub fn with_select_all_on_double_click(mut self, select_all_on_double_click: bool) -> Self {
63 self.select_all_on_double_click = select_all_on_double_click;
64 self
65 }
66}