separate terminal from ui

This commit is contained in:
Maddie 2022-11-11 11:57:40 +00:00
parent 25b0da3962
commit 6f792ff546
8 changed files with 9 additions and 8 deletions

View File

@ -1,8 +1,9 @@
mod core; mod core;
mod terminal; mod terminal;
mod tui;
fn main() { fn main() {
let lambda = core::editor::Editor::new(); let lambda = core::editor::Editor::new();
let mut screen = terminal::screen::Screen::new().unwrap(); let mut screen = terminal::screen::Screen::new().unwrap();
terminal::tui::start(&mut screen, lambda); tui::ui::start(&mut screen, lambda);
} }

View File

@ -1,4 +1 @@
pub mod screen; pub mod screen;
pub mod tui;
pub mod utils;
mod components;

View File

@ -1,7 +1,7 @@
use crossterm::style::Stylize; use crossterm::style::Stylize;
use crate::core::editor::Editor; use crate::core::editor::Editor;
use crate::terminal::screen::{Coords, Screen}; use crate::terminal::screen::{Coords, Screen};
use crate::terminal::utils; use crate::tui::utils;
pub fn draw(screen: &mut Screen, editor: &Editor) -> Result<(), ()> { pub fn draw(screen: &mut Screen, editor: &Editor) -> Result<(), ()> {
// Calculate where to draw the status bar // Calculate where to draw the status bar

View File

@ -1,7 +1,7 @@
use crossterm::style::Stylize; use crossterm::style::Stylize;
use crate::core::editor::Editor; use crate::core::editor::Editor;
use crate::terminal::screen::{Coords, Screen}; use crate::terminal::screen::{Coords, Screen};
use crate::terminal::utils; use crate::tui::utils;
pub fn draw(screen: &mut Screen, editor: &Editor) { pub fn draw(screen: &mut Screen, editor: &Editor) {
// The welcome message // The welcome message

3
src/tui/mod.rs Normal file
View File

@ -0,0 +1,3 @@
pub mod ui;
pub mod utils;
mod components;

View File

@ -1,6 +1,6 @@
use crate::core::editor::Editor; use crate::core::editor::Editor;
use crate::terminal::screen::Screen; use crate::terminal::screen::Screen;
use crate::terminal::components; use crate::tui::components;
use crossterm::event::{read, Event, KeyCode, KeyEvent, KeyModifiers}; use crossterm::event::{read, Event, KeyCode, KeyEvent, KeyModifiers};
pub fn start(screen: &mut Screen, editor: Editor) { pub fn start(screen: &mut Screen, editor: Editor) {