aboutsummaryrefslogtreecommitdiff
path: root/helix-term/src/ui/mod.rs
diff options
context:
space:
mode:
authorNathan Vegdahl2021-07-02 02:37:28 +0000
committerNathan Vegdahl2021-07-02 02:37:28 +0000
commit2224a1527ec9592f16131b0aa3923fc3d37592e7 (patch)
tree2a08b053cb32cef9dc1db5895778d419ebaebb5b /helix-term/src/ui/mod.rs
parente725957704274b1ec814a34ddf6f75faf35358e7 (diff)
parent9f62ad0715240156b512dfc7c584d2d0df05a664 (diff)
Merge branch 'master' into great_line_ending_and_cursor_range_cleanup
Diffstat (limited to 'helix-term/src/ui/mod.rs')
-rw-r--r--helix-term/src/ui/mod.rs25
1 files changed, 11 insertions, 14 deletions
diff --git a/helix-term/src/ui/mod.rs b/helix-term/src/ui/mod.rs
index 2d4cf9cf..7111c968 100644
--- a/helix-term/src/ui/mod.rs
+++ b/helix-term/src/ui/mod.rs
@@ -20,12 +20,9 @@ pub use text::Text;
use helix_core::regex::Regex;
use helix_core::register::Registers;
-use helix_view::{
- graphics::{Color, Modifier, Rect, Style},
- Document, Editor, View,
-};
+use helix_view::{Document, Editor, View};
-use std::path::{Path, PathBuf};
+use std::path::PathBuf;
pub fn regex_prompt(
cx: &mut crate::commands::Context,
@@ -38,7 +35,7 @@ pub fn regex_prompt(
Prompt::new(
prompt,
- |input: &str| Vec::new(), // this is fine because Vec::new() doesn't allocate
+ |_input: &str| Vec::new(), // this is fine because Vec::new() doesn't allocate
move |cx: &mut crate::compositor::Context, input: &str, event: PromptEvent| {
match event {
PromptEvent::Abort => {
@@ -121,7 +118,7 @@ pub fn file_picker(root: PathBuf) -> Picker<PathBuf> {
.into()
},
move |editor: &mut Editor, path: &PathBuf, action| {
- let document_id = editor
+ editor
.open(path.into(), action)
.expect("editor.open failed");
},
@@ -133,8 +130,8 @@ pub mod completers {
use fuzzy_matcher::skim::SkimMatcherV2 as Matcher;
use fuzzy_matcher::FuzzyMatcher;
use helix_view::theme;
+ use std::borrow::Cow;
use std::cmp::Reverse;
- use std::{borrow::Cow, sync::Arc};
pub type Completer = fn(&str) -> Vec<Completion>;
@@ -154,7 +151,7 @@ pub mod completers {
let mut matches: Vec<_> = names
.into_iter()
- .filter_map(|(range, name)| {
+ .filter_map(|(_range, name)| {
matcher.fuzzy_match(&name, input).map(|score| (name, score))
})
.collect();
@@ -208,7 +205,7 @@ pub mod completers {
// Rust's filename handling is really annoying.
use ignore::WalkBuilder;
- use std::path::{Path, PathBuf};
+ use std::path::Path;
let is_tilde = input.starts_with('~') && input.len() == 1;
let path = helix_view::document::expand_tilde(Path::new(input));
@@ -229,7 +226,7 @@ pub mod completers {
(path, file_name)
};
- let end = (input.len()..);
+ let end = input.len()..;
let mut files: Vec<_> = WalkBuilder::new(dir.clone())
.max_depth(Some(1))
@@ -242,7 +239,7 @@ pub mod completers {
return None;
}
- let is_dir = entry.file_type().map_or(false, |entry| entry.is_dir());
+ //let is_dir = entry.file_type().map_or(false, |entry| entry.is_dir());
let path = entry.path();
let mut path = if is_tilde {
@@ -274,14 +271,14 @@ pub mod completers {
// inefficient, but we need to calculate the scores, filter out None, then sort.
let mut matches: Vec<_> = files
.into_iter()
- .filter_map(|(range, file)| {
+ .filter_map(|(_range, file)| {
matcher
.fuzzy_match(&file, &file_name)
.map(|score| (file, score))
})
.collect();
- let range = ((input.len().saturating_sub(file_name.len()))..);
+ let range = (input.len().saturating_sub(file_name.len()))..;
matches.sort_unstable_by_key(|(_file, score)| Reverse(*score));
files = matches