diff options
author | Jiayi Zhao <jeff.no.zhao@gmail.com> | 2019-03-30 15:11:08 -0400 |
---|---|---|
committer | Jiayi Zhao <jeff.no.zhao@gmail.com> | 2019-03-30 15:11:08 -0400 |
commit | 554f06d72aeb639548314336b2318e14f8ffcc7e (patch) | |
tree | 4f3346fdd7b9302ccaa82089cd7eceff4d8b28de /src/tab.rs | |
parent | f56511becd2be285ff2ce74269113384856aaa95 (diff) |
move view struct out of Context and pass in as a separate argument
- rename static variables to all caps
- change index to be Option<usize> rather than i32 where -1 means
the directory is empty
Diffstat (limited to 'src/tab.rs')
-rw-r--r-- | src/tab.rs | 16 |
1 files changed, 9 insertions, 7 deletions
@@ -7,7 +7,7 @@ use crate::structs::JoshutoDirList; use crate::ui; use crate::window::{JoshutoPanel, JoshutoView}; -use crate::theme_t; +use crate::THEME_T; pub struct JoshutoTab { pub history: history::DirHistory, @@ -110,10 +110,12 @@ impl JoshutoTab { if let Some(entry) = dirlist.get_curr_ref() { ui::wprint_file_mode(win.win, entry); ncurses::waddstr(win.win, " "); - ncurses::waddstr( - win.win, - format!("{}/{} ", dirlist.index + 1, dirlist.contents.len()).as_str(), - ); + if let Some(index) = dirlist.index { + ncurses::waddstr( + win.win, + format!("{}/{} ", index + 1, dirlist.contents.len()).as_str(), + ); + } ncurses::waddstr(win.win, " "); ui::wprint_file_info(win.win, entry); } @@ -138,7 +140,7 @@ impl JoshutoTab { ncurses::waddstr(win.win, " "); - ncurses::wattron(win.win, ncurses::COLOR_PAIR(theme_t.directory.colorpair)); + ncurses::wattron(win.win, ncurses::COLOR_PAIR(THEME_T.directory.colorpair)); if tilde_in_titlebar { let path_str = &path_str.replace(&format!("/home/{}", username), "~"); ncurses::waddstr(win.win, path_str); @@ -146,7 +148,7 @@ impl JoshutoTab { ncurses::waddstr(win.win, path_str); } ncurses::waddstr(win.win, "/"); - ncurses::wattroff(win.win, ncurses::COLOR_PAIR(theme_t.directory.colorpair)); + ncurses::wattroff(win.win, ncurses::COLOR_PAIR(THEME_T.directory.colorpair)); if let Some(ref dirlist) = self.curr_list { if let Some(entry) = dirlist.get_curr_ref() { ncurses::waddstr(win.win, &entry.file_name_as_string); |