pub struct Buffer { /* private fields */ }
Expand description
Internal state for a text buffer backed by a file on disk
Implementations§
Source§impl Buffer
impl Buffer
Sourcepub fn new_from_canonical_file_path(id: usize, path: PathBuf) -> Result<Self>
pub fn new_from_canonical_file_path(id: usize, path: PathBuf) -> Result<Self>
As the name implies, this method MUST be called with the full cannonical file path
Sourcepub fn new_unnamed(id: usize, content: impl Into<String>) -> Self
pub fn new_unnamed(id: usize, content: impl Into<String>) -> Self
Create a new unnamed buffer with the given content
Sourcepub fn new_virtual(
id: usize,
name: impl Into<String>,
content: impl Into<String>,
) -> Self
pub fn new_virtual( id: usize, name: impl Into<String>, content: impl Into<String>, ) -> Self
Create a new virtual buffer with the given name and content.
The buffer will not be included in the virtual filesystem and it will be removed when it loses focus.
Sourcepub fn display_name(&self) -> String
pub fn display_name(&self) -> String
Short name for displaying in the status line
Sourcepub fn dir(&self) -> Option<&Path>
pub fn dir(&self) -> Option<&Path>
The directory containing the file backing this buffer (if any).
Sourcepub fn output_file_key(&self, cwd: &Path) -> String
pub fn output_file_key(&self, cwd: &Path) -> String
The key for the +output buffer that output from command run from this buffer should be redirected to
Sourcepub fn is_unnamed(&self) -> bool
pub fn is_unnamed(&self) -> bool
Check whether or not this is an unnamed buffer
Sourcepub fn str_contents(&self) -> String
pub fn str_contents(&self) -> String
The utf-8 string contents of this buffer
pub fn update_ts_state(&mut self, from: usize, n_rows: usize)
pub fn iter_tokenized_lines_from( &self, line: usize, load_exec_range: Option<(bool, Range)>, ) -> LineIter<'_> ⓘ
Sourcepub fn dot_contents(&self) -> String
pub fn dot_contents(&self) -> String
The contents of the current Dot.
Sourcepub fn xdot_contents(&self) -> String
pub fn xdot_contents(&self) -> String
The contents of the current xdot.
This is a virtual dot that is only made use of through the filesystem interface.
Sourcepub fn xaddr(&self) -> String
pub fn xaddr(&self) -> String
The address of the current xdot.
This is a virtual dot that is only made use of through the filesystem interface.