pub struct Editor {
pub theme: Theme,
/* private fields */
}Fields§
§theme: ThemeImplementations§
Source§impl Editor
impl Editor
Sourcepub fn render(&mut self, buffer: &mut RenderBuffer) -> Result<()>
pub fn render(&mut self, buffer: &mut RenderBuffer) -> Result<()>
Sourcepub fn draw_status_line(&mut self, buffer: &mut RenderBuffer)
pub fn draw_status_line(&mut self, buffer: &mut RenderBuffer)
Draws the status line at the bottom of the editor view
§Arguments
buffer: The buffer containing the status line
§Panics
This function may panic if the lengths of the mode and position strings exceed u16::MAX,
which is currently impossible for the mode string but is not necessarily impossible for the
position string
Sourcepub fn draw_cursor(&mut self) -> Result<()>
pub fn draw_cursor(&mut self) -> Result<()>
Source§impl Editor
impl Editor
Sourcepub fn with_size(
width: usize,
height: usize,
config: Config,
theme: Theme,
buffers: Vec<Buffer>,
) -> Result<Self>
pub fn with_size( width: usize, height: usize, config: Config, theme: Theme, buffers: Vec<Buffer>, ) -> Result<Self>
Creates a new editor with a given size
§Arguments
width: The desired width of the editor viewportheight: The desired height of the editor viewportconfig: A configuration constructed from a parsed config filetheme: A theme for coloring, styling, and decorating the editorbuffers: A buffer which will contain the contents of the file being edited
§Errors
Can return errors if width and height are larger than u16::MAX or if creating a new
Highlighter with the provided theme fails
§Panics
This function may panic if width and height are larger than u16::MAX
Sourcepub fn new(config: Config, theme: Theme, buffers: Vec<Buffer>) -> Result<Self>
pub fn new(config: Config, theme: Theme, buffers: Vec<Buffer>) -> Result<Self>
Creates a new editor with a configuration, theme, and buffer
§Arguments
config: A configuration constructed from a parsed config filetheme: A theme for coloring, styling, and decorating the editorbuffers: A buffer which will contain the contents of the file being edited
§Errors
Can return an IoError if the call to query the terminal’s size fails
pub fn vwidth(&self) -> usize
pub fn vheight(&self) -> usize
pub fn window_to_terminal_x(&self, window: &Window, x: usize) -> usize
pub fn window_to_terminal_y(&self, window: &Window, y: usize) -> usize
pub fn buffer_to_window_coords( &self, window: &Window, buf_x: usize, buf_y: usize, ) -> Option<(usize, usize)>
pub fn window_vwidth(&self, window: &Window) -> usize
pub fn window_vheight(&self, window: &Window) -> usize
pub fn cursor_position(&self) -> (usize, usize)
Auto Trait Implementations§
impl Freeze for Editor
impl RefUnwindSafe for Editor
impl Send for Editor
impl Sync for Editor
impl Unpin for Editor
impl UnsafeUnpin for Editor
impl UnwindSafe for Editor
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more