summaryrefslogtreecommitdiffstats
path: root/src/main.rs
blob: 4ec540067dfc8f20d2a59e8a646160a221b3b43f (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
extern crate termion;
extern crate unicode_width;
#[macro_use]
extern crate lazy_static;
extern crate alphanumeric_sort;

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


use termion::screen::AlternateScreen;

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

mod term;
mod window;
mod listview;
mod files;
mod win_main;
mod widget;
mod hbox;

use listview::ListView;
use window::Window;
use hbox::HBox;


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

    let files = files::get_files("/home/project/code").unwrap();
    let listview = ListView::new(files, (50,50), (10,10));

    let files = files::get_files("/home/project/code").unwrap();
    let listview2 = ListView::new(files, (50,50), (80,10));

    let boxed = vec![listview.to_trait(), listview2.to_trait()];

    let hbox = HBox::new(boxed);

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

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