Skip to main content

render_line_with_cursor

Function render_line_with_cursor 

Source
pub fn render_line_with_cursor(
    line: &str,
    cursor_col: usize,
    width: u16,
    edit_style: &Style,
    cursor_style: &Style,
) -> String
Expand description

Render a single line of text with a full-block cursor at cursor_col.

The grapheme at the visual column cursor_col is replaced by EDIT_CURSOR. If cursor_col is at or past the end of the line, the cursor is appended. The result is padded to width and styled: text with edit_style, cursor with cursor_style.