pub struct BufferOpts {Show 17 fields
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 space_char_trailing: Option<char>,
pub new_line_char: char,
pub new_line_on_empty: Option<char>,
pub new_line_trailing: Option<char>,
}Expand description
The default suite of options available to Buffers
Unlike most other widget options, these ones are dynamic, that is,
if they are changed while duat is still open, the Buffer will be
updated accordingly.
§Note
While these options are defined as a core part of the Buffer,
they are not implemented natively. The implementation is done in
the duat-base crate, which means you may replace the
implementation with your own version if that suits you.
Fields§
§highlight_current_line: bool§wrap_lines: boolEnables wrapping of lines
The default is true
wrap_on_word: boolWrap on word boundaries, rather than on any character
The default is false.
wrapping_cap: Option<u32>Where to start wrapping
The default is None
If this value is None and opts.wrap_lines == true, then
wrapping will take place at the right edge of the screen.
Otherwise, if it is Some({cap}), then wrapping will take
place {cap} cells from the left edge. This value may or may
not be greater than the width of the area. If it is greater
than it, then wrapping will take place slightly outside the
screen as a concequence.
indent_wraps: boolWhether to indent wrapped lines or not
The default is true.
This turns this:
This is a very long line of text, so long that it
wraps aroundInto this:
This is a very long line of text, so long that it
wraps aroundtabstop: u8How much space a tab should occupy
The default is 4
This also affect other things, like if your tabs are converted into spaces, this will also set how many spaces should be added.
scrolloff: ScrollOffHow much space to keep between the cursor and edges
The default is ScrollOff { x: 3, y: 3 }
force_scrolloff: boolWhether to limit scrolloff at the end of lines
The default is false
This makes it so, as you reach the end of a long line of text,
the cursor line will continue scrolling to the left,
maintaining the scrolloff.x’s gap.
extra_word_chars: &'static [char]Extra characters to be considered part of a word
The default is &[].
Normally, word characters include all of those in the \w
character set, which most importantly includes [0-9A-Za-z_].
You can use this setting to add more characters to that list,
usually something like -, $ or @, which are useful to
consider as word characters in some circumstances.
indent_str: Option<&'static str>Indent string
The default is Some("│").
The indent lines will be printed with the replace.indent
Form.
A string to replace the indentation at the start of the line.
This string will repeat on every opts.tabstop initial spaces
or on every \t character, replacing that many characters of
the tab stop with those of the string.
For example, if tabstop == 2 && indent_str == Some("│ "),
this:
int (int var1, int var2) {
if (var1 > 2)
return 42;
else
if (var1 <= 50)
return 20;
else
return 10;
}Would be displayed like this:
int (int var1, int var2) {
│ if (var1 > 2)
│ │ return 42;
│ else
│ │ if (var1 <= 50)
│ │ │ return 20;
│ │ else
│ │ │ return 10;
}That is, it will take tabstop characters and print them.
Where the tabstop == 4, it would use all 4 characters.
indent_str_on_empty: boolWether to copy the indentation string of opts.indent_str on
empty lines.
The default is true
If this is set to true, this str will be printed with the
replace.indent.empty form.
This will always copy whichever line has the smallest ammount of indentation.
indent_tab_str: Option<&'static str>An indent string, just like opts.indent_str, but only for
\ts
The default is None
This is useful for languages like python, where the mixup of tabs and spaces on indentation can cause problems.
If it is Some, the str will be shown with the
replace.indent.tab form. If this is None, then
opts.indent_str will be used instead.
space_char: Option<char>A character to be printed in place of the space
The default is None
The char will be printed with the replace.space Form.
This character will replace only the space characters that are not part of the indentation.
space_char_trailing: Option<char>A character to be printed on trailing whitespace
The default is None
This character will be printed with the
replace.space.trailing Form
If it is None, it will be the same as opts.space_char.
new_line_char: charWhich char should be printed in new lines
The default is ' ' (space character)
This character will be printed with the replace.new_line
Form.
new_line_on_empty: Option<char>A character to be printed on the new line on empty strings
The default is None
This character will be printed with the
replace.new_line.empty Form.
If it is None, it will be the same as opts.new_line_char.
new_line_trailing: Option<char>A character to be printed on trailing new lines
The default is None
This character will be printed with the
replace.new_line.trailing Form.
Implementations§
Source§impl BufferOpts
impl BufferOpts
Sourcepub fn to_print_opts(&self) -> PrintOpts
pub fn to_print_opts(&self) -> PrintOpts
Gets PrintOpts from this BufferOpts
Trait Implementations§
Source§impl Clone for BufferOpts
impl Clone for BufferOpts
Source§fn clone(&self) -> BufferOpts
fn clone(&self) -> BufferOpts
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more