This commit is contained in:
andromeda
2026-04-15 12:01:53 +02:00
parent a6afe8626b
commit 2dbe2c7811

View File

@@ -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) {