pub struct Cursor {
pub offset_from_end: usize,
pub underlying_char: u8,
/* private fields */
}
Expand description
The cursor structure used in the terminal.
A cursor is a special symbol shown in the text box of a terminal. It indicates the position of character where the next input would be put or the delete operation works on.
Terminal invokes its display
method in a loop to let a cursor blink.
Fields§
§offset_from_end: usize
The position of the cursor relative to the end of terminal text in number of characters.
underlying_char: u8
The underlying character at the position of the cursor. It is shown when the cursor is unseen.
Implementations§
source§impl Cursor
impl Cursor
sourcepub fn display<P: Pixel>(
&mut self,
coordinate: Coord,
column: usize,
line: usize,
framebuffer: &mut Framebuffer<P>
) -> Result<Rectangle, &'static str>where
Color: Into<P>,
pub fn display<P: Pixel>( &mut self, coordinate: Coord, column: usize, line: usize, framebuffer: &mut Framebuffer<P> ) -> Result<Rectangle, &'static str>where Color: Into<P>,
Display a cursor in a framebuffer
Arguments
coordinate
: the start point of a textarea in the framebuffer.column
: the column of the cursor in the textarea.line
: the line of the cursor in the textarea.framebuffer
: the framebuffer to display the cursor in.
Returns a bounding box which wraps the cursor.
sourcepub fn set_offset_from_end(&mut self, offset: usize)
pub fn set_offset_from_end(&mut self, offset: usize)
Sets the position of the cursor relative to the end of the command
sourcepub fn offset_from_end(&self) -> usize
pub fn offset_from_end(&self) -> usize
Gets the position of the cursor relative to the end of the command
sourcepub fn set_underlying_char(&mut self, c: u8)
pub fn set_underlying_char(&mut self, c: u8)
Sets the character at the position of the cursor
sourcepub fn underlying_char(&self) -> u8
pub fn underlying_char(&self) -> u8
Gets the character at the position of the cursor