summaryrefslogtreecommitdiffstats
path: root/src/preview.rs
diff options
context:
space:
mode:
authorJiayi Zhao <jeff.no.zhao@gmail.com>2019-05-25 16:59:39 -0400
committerJiayi Zhao <jeff.no.zhao@gmail.com>2019-05-25 16:59:39 -0400
commit27d3b33f44b68582d500f787e8f2fe5b68a4867d (patch)
treed4feb379ef551009c57c8bf011478e5bd679c6d7 /src/preview.rs
parent62a3f87502373c25d0cfd9ce35b966b4f199673e (diff)
tab autocomplete supports partial inputs
- rather than replacing the entire input stream with the autocomplete candidate, it only replaces from the last whitespace; rustyline's default behaviour
Diffstat (limited to 'src/preview.rs')
-rw-r--r--src/preview.rs62
1 files changed, 30 insertions, 32 deletions
diff --git a/src/preview.rs b/src/preview.rs
index 3aaf9ce..44bcd41 100644
--- a/src/preview.rs
+++ b/src/preview.rs
@@ -61,39 +61,37 @@ fn preview_file(entry: &JoshutoDirEntry, win: &JoshutoPanel) {
match path.extension() {
Some(file_ext) => match PREVIEW_T.extension.get(file_ext.to_str().unwrap()) {
Some(s) => preview_with(path, win, &s),
- None => {}
- /*
- None => if let Some(mimetype) = tree_magic::from_filepath(&path) {
- match PREVIEW_T.mimetype.get(mimetype.as_str()) {
- Some(s) => preview_with(path, win, &s),
- None => if let Some(ind) = mimetype.find('/') {
- let supertype = &mimetype[..ind];
- if supertype == "text" {
- preview_text(path, win);
- } else if let Some(s) = PREVIEW_T.mimetype.get(supertype) {
- preview_with(path, win, &s);
- }
- },
- }
- }
- */
+ None => {} /*
+ None => if let Some(mimetype) = tree_magic::from_filepath(&path) {
+ match PREVIEW_T.mimetype.get(mimetype.as_str()) {
+ Some(s) => preview_with(path, win, &s),
+ None => if let Some(ind) = mimetype.find('/') {
+ let supertype = &mimetype[..ind];
+ if supertype == "text" {
+ preview_text(path, win);
+ } else if let Some(s) = PREVIEW_T.mimetype.get(supertype) {
+ preview_with(path, win, &s);
+ }
+ },
+ }
+ }
+ */
},
- None => {}
- /*
- if let Some(mimetype) = tree_magic::from_filepath(&path) {
- match PREVIEW_T.mimetype.get(mimetype.as_str()) {
- Some(s) => preview_with(path, win, &s),
- None => if let Some(ind) = mimetype.find('/') {
- let supertype = &mimetype[..ind];
- if supertype == "text" {
- preview_text(path, win);
- } else if let Some(s) = PREVIEW_T.mimetype.get(supertype) {
- preview_with(path, win, &s);
- }
- },
- }
- }
- */
+ None => {} /*
+ if let Some(mimetype) = tree_magic::from_filepath(&path) {
+ match PREVIEW_T.mimetype.get(mimetype.as_str()) {
+ Some(s) => preview_with(path, win, &s),
+ None => if let Some(ind) = mimetype.find('/') {
+ let supertype = &mimetype[..ind];
+ if supertype == "text" {
+ preview_text(path, win);
+ } else if let Some(s) = PREVIEW_T.mimetype.get(supertype) {
+ preview_with(path, win, &s);
+ }
+ },
+ }
+ }
+ */
}
}