summaryrefslogtreecommitdiffstats
path: root/src/main.rs
blob: 7de9a46fcf6a4de22130bb5885fd25e4d7bbc3f9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#![feature(vec_remove_item)]
#![feature(trivial_bounds)]

extern crate termion;
extern crate unicode_width;
#[macro_use]
extern crate lazy_static;
#[macro_use]
extern crate failure;
#[macro_use]
extern crate failure_derive;
extern crate alphanumeric_sort;
extern crate dirs_2;
extern crate lscolors;
extern crate users;
extern crate chrono;
extern crate mime_detective;
extern crate rayon;
extern crate libc;

use termion::input::MouseTerminal;
use termion::raw::IntoRawMode;
use termion::screen::AlternateScreen;

use std::io::{stdout, Write};
use std::marker::Send;

mod coordinates;
mod file_browser;
mod files;
mod listview;
mod miller_columns;
mod preview;
mod term;
mod textview;
mod widget;
mod win_main;
mod window;
mod hbox;
mod tabview;
mod async_widget;
mod fail;

use window::Window;
///use async_widget::AsyncPlug;
use widget::Widget;

fn main() {
    let mut bufout = std::io::BufWriter::new(std::io::stdout());
    // Need to do this here to actually turn terminal into raw mode...
    let mut _screen = AlternateScreen::from(Box::new(bufout));
    let mut _stdout = MouseTerminal::from(stdout().into_raw_mode().unwrap());

    

    let filebrowser = crate::file_browser::FileBrowser::new().unwrap();
    let mut tabview = crate::tabview::TabView::new();
    tabview.push_widget(filebrowser);

    let mut win = Window::new(tabview);
    win.draw();
    win.handle_input();

    write!(_stdout, "{}", termion::cursor::Show).unwrap();
}