use crate::opts::{PrintOpts, ScrollOff};
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub struct BufferOpts {
pub highlight_current_line: bool,
pub wrap_lines: bool,
pub wrap_on_word: bool,
pub wrapping_cap: Option<u32>,
pub indent_wraps: bool,
pub tabstop: u8,
pub scrolloff: ScrollOff,
pub force_scrolloff: bool,
pub extra_word_chars: &'static [char],
pub indent_str: Option<&'static str>,
pub indent_str_on_empty: bool,
pub indent_tab_str: Option<&'static str>,
pub space_char: Option<char>,
pub newline: char,
pub newline_on_empty: Option<char>,
pub newline_trailing: Option<char>,
}
impl BufferOpts {
pub fn to_print_opts(&self) -> PrintOpts {
PrintOpts {
wrap_lines: self.wrap_lines,
wrap_on_word: self.wrap_on_word,
wrapping_cap: self.wrapping_cap,
indent_wraps: self.indent_wraps,
tabstop: self.tabstop,
print_new_line: true,
scrolloff: self.scrolloff,
force_scrolloff: self.force_scrolloff,
extra_word_chars: self.extra_word_chars,
show_ghosts: true,
allow_overscroll: true,
}
}
}
impl Default for BufferOpts {
fn default() -> Self {
Self {
highlight_current_line: false,
wrap_lines: true,
wrap_on_word: false,
wrapping_cap: None,
indent_wraps: true,
tabstop: 4,
scrolloff: ScrollOff { x: 3, y: 3 },
force_scrolloff: false,
extra_word_chars: &[],
indent_str: Some("▎"),
indent_str_on_empty: true,
indent_tab_str: None,
space_char: None,
newline: ' ',
newline_on_empty: None,
newline_trailing: Some('↵'),
}
}
}