diff options
author | Jiayi Zhao <jeff.no.zhao@gmail.com> | 2019-05-25 16:59:39 -0400 |
---|---|---|
committer | Jiayi Zhao <jeff.no.zhao@gmail.com> | 2019-05-25 16:59:39 -0400 |
commit | 27d3b33f44b68582d500f787e8f2fe5b68a4867d (patch) | |
tree | d4feb379ef551009c57c8bf011478e5bd679c6d7 /src/preview.rs | |
parent | 62a3f87502373c25d0cfd9ce35b966b4f199673e (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.rs | 62 |
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); + } + }, + } + } + */ } } |