some more testing

This commit is contained in:
Maddie H 2022-11-04 07:19:20 +00:00
parent 62e9bd45e5
commit 9a9c14bc0f
No known key found for this signature in database
GPG Key ID: 64FAA9959751687D
2 changed files with 13 additions and 5 deletions

View File

@ -5,11 +5,14 @@ mod editor;
fn main() { fn main() {
let lambda = editor::Editor::new(); let lambda = editor::Editor::new();
println!("{}", lambda.buffer.data[0]); let _term = terminal::Terminal::new();
let term = terminal::Terminal::new(); loop {
for _ in [0..1000000000] { print!("{esc}[2J{esc}[1;1H", esc = 27 as char);
println!("{:?}", term); for line in lambda.buffer.data {
std::thread::sleep(Duration::from_millis(2000)); terminal::Terminal::write(format!("{line}"));
};
std::thread::sleep(Duration::from_millis(3000));
break;
}; };
terminal::Terminal::exit() terminal::Terminal::exit()
} }

View File

@ -1,5 +1,6 @@
use crossterm::terminal; use crossterm::terminal;
use crossterm::{execute, ErrorKind}; use crossterm::{execute, ErrorKind};
use crossterm::style::Print;
use std::io::{stdout, Write}; use std::io::{stdout, Write};
#[derive(Debug)] #[derive(Debug)]
@ -36,4 +37,8 @@ impl Terminal {
execute!(stdout(), terminal::LeaveAlternateScreen).unwrap(); execute!(stdout(), terminal::LeaveAlternateScreen).unwrap();
terminal::disable_raw_mode().unwrap(); terminal::disable_raw_mode().unwrap();
} }
pub fn write(text: String) {
execute!(stdout(), Print(text)).unwrap();
}
} }