Skip to content

Commit

Permalink
cursor position
Browse files Browse the repository at this point in the history
Kacperacy committed Mar 5, 2024
1 parent 4a0a099 commit 19210fc
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/editor.rs
Original file line number Diff line number Diff line change
@@ -26,7 +26,10 @@ impl Editor {

pub fn draw_rows(&self) {
for _ in 0..self.screen_rows {
println!("~\r");
print!("~");
if self.screen_rows > 1 {
print!("\r\n");
}
}
}

@@ -55,4 +58,8 @@ impl Editor {
eprintln!("{}: {}", message.into(), std::io::Error::last_os_error());
std::process::exit(1);
}

pub fn get_cursor_position(&self) -> Result<(u16, u16), ()> {
crossterm::cursor::position().map_err(|_| ())
}
}

0 comments on commit 19210fc

Please sign in to comment.