diff --git a/src/main.rs b/src/main.rs index 0e50df8..a718a90 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,6 +1,6 @@ use anki_bridge::{AnkiClient, AnkiRequestable, prelude::*}; use crossterm::{ - cursor::*, + cursor, event::{self, Event, KeyCode}, execute, style::*, @@ -48,6 +48,8 @@ fn init(anki: &AnkiClient) { } fn prompt(anki: &AnkiClient) { + // needs to be done twice to account for lag on the other end + anki.request(GuiCurrentCardRequest {}).unwrap(); let card = anki.request(GuiCurrentCardRequest {}).unwrap(); clear_screen(); display_html(&card.question); @@ -83,7 +85,12 @@ fn prompt(anki: &AnkiClient) { } fn clear_screen() { - execute!(stdout(), Clear(ClearType::All), MoveTo(0, 0)); + execute!( + stdout(), + Clear(ClearType::All), + cursor::MoveTo(0, 0), + cursor::Hide + ); } fn display_prompt_text(text: &str) {