mirror of https://github.com/bobwen-dev/hunter
fix warnings
This commit is contained in:
parent
c6b98a7726
commit
a5400b1e6c
|
@ -5,7 +5,6 @@ use std::collections::HashMap;
|
|||
use crate::fail::{HResult, HError, ErrorLog};
|
||||
use crate::widget::{Widget, WidgetCore};
|
||||
use crate::coordinates::Coordinates;
|
||||
use crate::files::{Files, File};
|
||||
use crate::term;
|
||||
|
||||
#[derive(PartialEq, Eq, Clone, Debug)]
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
use failure;
|
||||
use failure::Fail;
|
||||
use failure::Backtrace;
|
||||
//use failure::Backtrace;
|
||||
|
||||
use termion::event::Key;
|
||||
|
||||
|
@ -279,7 +279,7 @@ impl<T> From<std::sync::PoisonError<T>> for HError {
|
|||
}
|
||||
|
||||
impl<T> From<std::sync::TryLockError<T>> for HError {
|
||||
fn from(error: std::sync::TryLockError<T>) -> Self {
|
||||
fn from(_error: std::sync::TryLockError<T>) -> Self {
|
||||
// dbg!(&error);
|
||||
let err = HError::TryLockError;
|
||||
put_log(&err).ok();
|
||||
|
@ -288,7 +288,7 @@ impl<T> From<std::sync::TryLockError<T>> for HError {
|
|||
}
|
||||
|
||||
impl From<std::option::NoneError> for HError {
|
||||
fn from(error: std::option::NoneError) -> Self {
|
||||
fn from(_error: std::option::NoneError) -> Self {
|
||||
//dbg!(&error);
|
||||
let err = HError::NoneError;
|
||||
//put_log(&err).ok();
|
||||
|
|
|
@ -196,7 +196,8 @@ impl Tabbable for TabView<FileBrowser> {
|
|||
|
||||
fn on_config_loaded(&mut self) -> HResult<()> {
|
||||
// hack: wait a bit for widget readyness...
|
||||
std::thread::sleep_ms(100);
|
||||
let duration = std::time::Duration::from_millis(100);
|
||||
std::thread::sleep(duration);
|
||||
|
||||
let show_hidden = self.config().show_hidden();
|
||||
for tab in self.widgets.iter_mut() {
|
||||
|
@ -534,7 +535,7 @@ impl FileBrowser {
|
|||
}
|
||||
}
|
||||
|
||||
self.columns.resize_children();
|
||||
self.columns.resize_children().log();
|
||||
self.refresh()
|
||||
}
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@ use chrono::{DateTime, Local};
|
|||
use crate::term;
|
||||
use crate::widget::Widget;
|
||||
use crate::listview::{ListView, Listable};
|
||||
use crate::fail::{HResult, HError, ErrorLog};
|
||||
use crate::fail::{HResult, HError};
|
||||
use crate::dirty::Dirtyable;
|
||||
|
||||
pub type LogView = ListView<Vec<LogEntry>>;
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
#![feature(trivial_bounds)]
|
||||
#![feature(try_trait)]
|
||||
#![feature(fnbox)]
|
||||
#![allow(dead_code)]
|
||||
|
||||
extern crate termion;
|
||||
extern crate unicode_width;
|
||||
|
@ -25,11 +26,7 @@ extern crate systemstat;
|
|||
|
||||
use failure::Fail;
|
||||
|
||||
use termion::input::MouseTerminal;
|
||||
use termion::raw::IntoRawMode;
|
||||
use termion::screen::AlternateScreen;
|
||||
|
||||
use std::io::{stdout, Write};
|
||||
use std::io::Write;
|
||||
|
||||
mod coordinates;
|
||||
mod file_browser;
|
||||
|
@ -63,7 +60,6 @@ use term::ScreenExt;
|
|||
use fail::{HResult, HError};
|
||||
use file_browser::FileBrowser;
|
||||
use tabview::TabView;
|
||||
use preview::Async;
|
||||
|
||||
|
||||
fn main() -> HResult<()> {
|
||||
|
|
|
@ -505,7 +505,7 @@ impl Previewer {
|
|||
let selected_file = cache.get_selection(&files.directory);
|
||||
let mut filelist = ListView::new(&core, files);
|
||||
|
||||
selected_file.map(|file| filelist.select_file(&file));
|
||||
selected_file.map(|file| filelist.select_file(&file)).log();
|
||||
|
||||
Ok(PreviewWidget::FileList(filelist))
|
||||
}));
|
||||
|
|
|
@ -4,7 +4,7 @@ use std::process::Child;
|
|||
use std::os::unix::process::{CommandExt, ExitStatusExt};
|
||||
use std::io::{BufRead, BufReader};
|
||||
use std::ffi::OsString;
|
||||
use std::os::unix::ffi::{OsStringExt, OsStrExt};
|
||||
use std::os::unix::ffi::OsStringExt;
|
||||
|
||||
use termion::event::Key;
|
||||
use unicode_width::UnicodeWidthStr;
|
||||
|
@ -403,7 +403,7 @@ impl ProcView {
|
|||
pub fn remove_proc(&mut self) -> HResult<()> {
|
||||
if self.get_listview_mut().content.len() == 0 { return Ok(()) }
|
||||
self.get_listview_mut().remove_proc()?;
|
||||
self.get_textview().clear();
|
||||
self.get_textview().clear().log();
|
||||
self.get_textview().widget_mut()?.set_text("")
|
||||
}
|
||||
|
||||
|
@ -414,14 +414,14 @@ impl ProcView {
|
|||
let output = self.get_listview_mut().selected_proc()?.output.lock()?.clone();
|
||||
|
||||
let animator = self.animator.clone();
|
||||
animator.set_fresh();
|
||||
animator.set_fresh().log();
|
||||
|
||||
self.get_textview().change_to(Box::new(move |_, core| {
|
||||
let mut textview = TextView::new_blank(&core);
|
||||
textview.set_text(&output).log();
|
||||
textview.animate_slide_up(Some(animator));
|
||||
textview.animate_slide_up(Some(animator)).log();
|
||||
Ok(textview)
|
||||
}));
|
||||
})).log();
|
||||
|
||||
self.viewing = Some(self.get_listview_mut().get_selection());
|
||||
Ok(())
|
||||
|
@ -550,8 +550,8 @@ impl Widget for ProcView {
|
|||
fn on_key(&mut self, key: Key) -> HResult<()> {
|
||||
match key {
|
||||
Key::Char('w') => {
|
||||
self.animator.set_stale();
|
||||
self.clear();
|
||||
self.animator.set_stale().log();
|
||||
self.clear().log();
|
||||
return Err(HError::PopupFinnished) }
|
||||
Key::Char('d') => { self.remove_proc()? }
|
||||
Key::Char('k') => { self.get_listview_mut().kill_proc()? }
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
use termion::event::Key;
|
||||
|
||||
use crate::widget::{Widget, WidgetCore, Events};
|
||||
use crate::widget::{Widget, WidgetCore};
|
||||
use crate::fail::{HResult, ErrorLog};
|
||||
use crate::coordinates::Coordinates;
|
||||
|
||||
|
|
10
src/term.rs
10
src/term.rs
|
@ -8,7 +8,7 @@ use termion::raw::{IntoRawMode, RawTerminal};
|
|||
|
||||
use parse_ansi::parse_bytes;
|
||||
|
||||
use crate::fail::HResult;
|
||||
use crate::fail::{HResult, ErrorLog};
|
||||
|
||||
pub type TermMode = AlternateScreen<MouseTerminal<RawTerminal<BufWriter<Stdout>>>>;
|
||||
|
||||
|
@ -22,7 +22,7 @@ pub struct Screen {
|
|||
impl Screen {
|
||||
pub fn new() -> HResult<Screen> {
|
||||
let screen = BufWriter::new(std::io::stdout()).into_raw_mode()?;
|
||||
let mut screen = MouseTerminal::from(screen);
|
||||
let screen = MouseTerminal::from(screen);
|
||||
let mut screen = AlternateScreen::from(screen);
|
||||
let terminal = std::env::var("TERM").unwrap_or("xterm".into());
|
||||
|
||||
|
@ -35,12 +35,12 @@ impl Screen {
|
|||
}
|
||||
|
||||
pub fn drop_screen(&mut self) {
|
||||
self.cursor_show();
|
||||
self.to_main_screen();
|
||||
self.cursor_show().log();
|
||||
self.to_main_screen().log();
|
||||
self.screen = Arc::new(Mutex::new(None));
|
||||
|
||||
// Terminal stays fucked without this. Why?
|
||||
std::process::Command::new("reset").arg("-I").spawn();
|
||||
Ok(std::process::Command::new("reset").arg("-I").spawn()).log();
|
||||
}
|
||||
|
||||
pub fn reset_screen(&mut self) -> HResult<()> {
|
||||
|
|
|
@ -134,9 +134,9 @@ impl Widget for TextView {
|
|||
Ok(&mut self.core)
|
||||
}
|
||||
fn refresh(&mut self) -> HResult<()> {
|
||||
let (xsize, ysize) = self.get_coordinates()?.size().size();
|
||||
let (xpos, ypos) = self.get_coordinates()?.position().position();
|
||||
let len = self.lines.len();
|
||||
// let (xsize, ysize) = self.get_coordinates()?.size().size();
|
||||
// let (xpos, ypos) = self.get_coordinates()?.position().position();
|
||||
// let len = self.lines.len();
|
||||
|
||||
if self.follow {
|
||||
self.scroll_bottom();
|
||||
|
|
Loading…
Reference in New Issue