summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Cargo.lock2
-rw-r--r--Cargo.toml2
-rw-r--r--README.md10
-rw-r--r--src/file_browser.rs20
-rw-r--r--src/files.rs7
-rw-r--r--src/fscache.rs11
-rw-r--r--src/listview.rs6
-rw-r--r--src/term.rs2
8 files changed, 41 insertions, 19 deletions
diff --git a/Cargo.lock b/Cargo.lock
index 5220100..cd54f59 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -239,7 +239,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "hunter"
-version = "1.0.4"
+version = "1.0.7"
dependencies = [
"alphanumeric-sort 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)",
"chrono 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
diff --git a/Cargo.toml b/Cargo.toml
index 39190ae..2f2396b 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "hunter"
-version = "1.0.5"
+version = "1.0.7"
authors = ["rabite"]
edition = "2018"
description = "Fast, lag-free terminal file browser"
diff --git a/README.md b/README.md
index 54b4712..eaf71d7 100644
--- a/README.md
+++ b/README.md
@@ -29,6 +29,14 @@ A big thanks to ranger and its developers. Without its inspiration this wouldn't
* slide up animation for previews for a smoother experience (configurable)
* fffast
+## Known to work on:
+
+* GNU/Linux
+* macOS
+* Windows (WSL)
+
+If it works on a system not mentioned here, please open an issue. Also feel free to open an issue if it doesn't work on your system, if it's reasonably Unix-like.
+
## PREREQUISITES:
* gcc
@@ -75,7 +83,7 @@ This will link the the binary to your local bin file. You can call hunter from a
hunter uses [ranger's rifle](https://github.com/ranger/ranger/blob/master/ranger/ext/rifle.py) to open files if rifle is in your $PATH. If it can't find rifle it uses xdg-open. It also uses ranger's scope.sh to generate previews for non-text files. A slightly modified version is included in the "extra" directory. Put it in your $PATH somewhere if you want previews for non-text files.
## Configuration
-hunter reads $XDG_CONFIG_HOME/hunter/config at startup. There are two options, which can be set. The configuration file is read asynchronously, so if it's not read by the time hunter starts drawing you will see its default configuration until the config file is read. Options can be set like this (default config):
+hunter reads $XDG_CONFIG_HOME/hunter/config at startup. On macOS it reads $HOME/Library/Preferences/hunter/config, according to Apple guidelines, although this might change. There are two options, which can be set. The configuration file is read asynchronously, so if it's not read by the time hunter starts drawing you will see its default configuration until the config file is read. Options can be set like this (default config):
```
animation=on
diff --git a/src/file_browser.rs b/src/file_browser.rs
index c916789..b0fe845 100644
--- a/src/file_browser.rs
+++ b/src/file_browser.rs
@@ -226,7 +226,6 @@ impl Tabbable for TabView<FileBrowser> {
impl FileBrowser {
pub fn new(core: &WidgetCore, cache: Option<FsCache>) -> HResult<FileBrowser> {
- let startup = cache.is_none();
let fs_cache = cache.unwrap_or_else(|| FsCache::new(core.get_sender()));
let cwd = std::env::current_dir().unwrap();
@@ -261,23 +260,20 @@ impl FileBrowser {
let main_dir = File::new(&name,
main_path.clone(),
None);
- let files = cache.get_files_sync(&main_dir)?;
+ let mut files = cache.get_files_sync(&main_dir)?;
let selection = cache.get_selection(&main_dir).ok();
+
+ files.meta_all();
+ files.meta_all();
+
let mut list = ListView::new(&core_m.clone(),
files);
if let Some(file) = selection {
list.select_file(&file);
}
- list.content.meta_all();
- list.content.dirty_meta.set_dirty();
list.refresh().log();
- if startup {
- list.animate_slide_up(None).log();
- }
-
- list.content.meta_all();
Ok(list)
}));
@@ -304,10 +300,6 @@ impl FileBrowser {
list.refresh().log();
- if startup {
- list.animate_slide_up(None).log();
- }
-
Ok(list)
}));
let left_widget = FileBrowserWidgets::FileList(left_widget);
@@ -408,7 +400,7 @@ impl FileBrowser {
.args(file.path.file_name())
.status();
- self.core.screen.reset_screen();
+ self.core.screen.reset_screen().log();
self.clear().log();
self.core.screen.cursor_hide().log();
diff --git a/src/files.rs b/src/files.rs
index 14c718f..38108e6 100644
--- a/src/files.rs
+++ b/src/files.rs
@@ -342,7 +342,12 @@ impl Files {
}
pub fn toggle_hidden(&mut self) {
- self.show_hidden = !self.show_hidden
+ self.show_hidden = !self.show_hidden;
+ self.set_dirty();
+
+ if self.show_hidden == true {
+ self.remove_placeholder();
+ }
}
pub fn replace_file(&mut self,
diff --git a/src/fscache.rs b/src/fscache.rs
index e5b1340..1c5ab17 100644
--- a/src/fscache.rs
+++ b/src/fscache.rs
@@ -130,6 +130,7 @@ impl FsCache {
let files = self.get_files(&dir, Stale::new())?.1;
let mut files = files.wait()?;
FsCache::apply_settingss(&self, &mut files).ok();
+ let files = FsCache::ensure_not_empty(files)?;
Ok(files)
}
@@ -230,6 +231,7 @@ impl FsCache {
}
files.sort();
+ let files = FsCache::ensure_not_empty(files)?;
Ok(files)
}));
@@ -265,6 +267,15 @@ impl FsCache {
Ok(())
}
+ pub fn ensure_not_empty(mut files: Files) -> HResult<Files> {
+ if files.len() == 0 {
+ let path = &files.directory.path;
+ let placeholder = File::new_placeholder(&path)?;
+ files.files.push(placeholder);
+ }
+ Ok(files)
+ }
+
fn extract_tab_settings(files: &Files, selection: Option<File>) -> TabSettings {
TabSettings {
diff --git a/src/listview.rs b/src/listview.rs
index b2225e0..f584597 100644
--- a/src/listview.rs
+++ b/src/listview.rs
@@ -35,6 +35,12 @@ impl Listable for ListView<Files> {
}
fn on_refresh(&mut self) -> HResult<()> {
+ if self.content.len() == 0 {
+ let path = &self.content.directory.path;
+ let placeholder = File::new_placeholder(&path)?;
+ self.content.files.push(placeholder);
+ }
+
let sender = self.core.get_sender();
let visible_files = self.core.coordinates.size_u().1 + self.offset + 1;
diff --git a/src/term.rs b/src/term.rs
index 4d9d228..272e9dd 100644
--- a/src/term.rs
+++ b/src/term.rs
@@ -40,7 +40,7 @@ impl Screen {
self.screen.lock().map(|mut screen| std::mem::drop(screen.take())).ok();
// Terminal stays fucked without this. Why?
- Ok(std::process::Command::new("reset").arg("-I").spawn()).log();
+ //Ok(std::process::Command::new("reset").arg("-I").spawn()).log();
}
pub fn reset_screen(&mut self) -> HResult<()> {