pub trait BufferExt: Debug {
// Required methods
fn get_line(&self, idx: usize) -> Result<String>;
fn get_lines(
&self,
line_range: RangeInclusive<usize>,
strict_indexing: bool,
) -> Result<Box<dyn SuperIterator<String>>, Error>;
fn get_buf_type(&self) -> Option<String>;
fn get_channel(&self) -> Option<u32>;
fn set_text_at_cursor_pos(&mut self, text: &str);
fn get_pid(&self) -> Result<String>;
// Provided methods
fn get_text_between(
&self,
start: (usize, usize),
end: (usize, usize),
boundary: TextBoundary,
) -> Result<String> { ... }
fn is_terminal(&self) -> bool { ... }
fn send_command(&self, cmd: &str) -> Option<()> { ... }
}Expand description
Extension trait for Buffer.
Required Methods§
Sourcefn get_lines(
&self,
line_range: RangeInclusive<usize>,
strict_indexing: bool,
) -> Result<Box<dyn SuperIterator<String>>, Error>
fn get_lines( &self, line_range: RangeInclusive<usize>, strict_indexing: bool, ) -> Result<Box<dyn SuperIterator<String>>, Error>
Retrieves a range of lines from the buffer.
§Errors
- If
strict_indexingis true and the range is out of bounds. - If the Nvim API call to fetch lines fails.
Sourcefn get_buf_type(&self) -> Option<String>
fn get_buf_type(&self) -> Option<String>
Retrieves the buffer type via the buftype option.
fn get_channel(&self) -> Option<u32>
Sourcefn set_text_at_cursor_pos(&mut self, text: &str)
fn set_text_at_cursor_pos(&mut self, text: &str)
Inserts text at the current cursor position.
Provided Methods§
Sourcefn get_text_between(
&self,
start: (usize, usize),
end: (usize, usize),
boundary: TextBoundary,
) -> Result<String>
fn get_text_between( &self, start: (usize, usize), end: (usize, usize), boundary: TextBoundary, ) -> Result<String>
Get text between start and end positions.
§Errors
- Substring extraction fails due to invalid indices.