pub struct File { /* private fields */ }Expand description
The widget that is used to print and edit files.
Implementations§
source§impl File
impl File
pub fn search(&self) -> Searcher<'_>
pub fn search_at(&self, point: Point) -> Searcher<'_>
pub fn rev_search(&self) -> RevSearcher<'_>
pub fn rev_search_at(&self, point: Point) -> RevSearcher<'_>
sourcepub fn path(&self) -> String
pub fn path(&self) -> String
The full path of the file.
If there is no set path, returns "*scratch file*#{id}".
sourcepub fn path_set(&self) -> Option<String>
pub fn path_set(&self) -> Option<String>
The full path of the file.
Returns None if the path has not been set yet.
sourcepub fn name(&self) -> String
pub fn name(&self) -> String
The file’s name.
If there is no set path, returns "*scratch file #{id}*".
sourcepub fn name_set(&self) -> Option<String>
pub fn name_set(&self) -> Option<String>
The file’s name.
Returns None if the path has not been set yet.
sourcepub fn printed_lines(&self) -> &[(usize, bool)]
pub fn printed_lines(&self) -> &[(usize, bool)]
Returns the currently printed set of lines.
These are returned as a usize, showing the index of the line
in the file, and a bool, which is true when the line is
wrapped.
source§impl File
impl File
§History related functions.
These functions allow for the modification of the File’s
Text by navigating through a History’s changes.
For now, this is a linear history (i.e. modification removes all
future changes), but the plan is to change it to a tree at some
point.
sourcepub fn add_moment(&mut self)
pub fn add_moment(&mut self)
Begins a new moment in history.
A new moment makes it so that “undoing” or “redoing” will undo or redo all the changes in the moment. The previous moment can be undone, undoing multiple changes at once.
sourcepub fn redo(&mut self, area: &impl Area, cursors: &mut Cursors)
pub fn redo(&mut self, area: &impl Area, cursors: &mut Cursors)
Redoes the next moment, if there is one.