From 8289bd1cb0cf34d26a9f452850081799311e3f45 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bla=C5=BE=20Hrastnik?= Date: Thu, 25 Feb 2021 16:52:32 +0900 Subject: [PATCH] minor, fix clippy lint --- helix-syntax/build.rs | 2 +- helix-term/src/commands.rs | 5 +---- helix-view/src/editor.rs | 2 ++ 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/helix-syntax/build.rs b/helix-syntax/build.rs index 89641225c..b915ebf10 100644 --- a/helix-syntax/build.rs +++ b/helix-syntax/build.rs @@ -133,7 +133,7 @@ fn main() { tx.send(1).unwrap(); }); } - assert_eq!(rx.iter().take(n_jobs).fold(0, |a, b| a + b), n_jobs); + assert_eq!(rx.iter().take(n_jobs).sum::(), n_jobs); build_dir("tree-sitter-typescript/tsx", "tsx"); build_dir("tree-sitter-typescript/typescript", "typescript"); diff --git a/helix-term/src/commands.rs b/helix-term/src/commands.rs index 7d7ad0c9c..6b1109ba4 100644 --- a/helix-term/src/commands.rs +++ b/helix-term/src/commands.rs @@ -470,8 +470,6 @@ pub fn flip_selections(cx: &mut Context) { fn enter_insert_mode(doc: &mut Document) { doc.mode = Mode::Insert; - - // TODO: store selection for undo } // inserts at the start of each selection @@ -493,10 +491,9 @@ pub fn append_mode(cx: &mut Context) { let text = doc.text().slice(..); let selection = doc.selection().transform(|range| { - // TODO: to() + next char Range::new( range.from(), - graphemes::next_grapheme_boundary(text, range.to()), + graphemes::next_grapheme_boundary(text, range.to()), // to() + next char ) }); doc.set_selection(selection); diff --git a/helix-view/src/editor.rs b/helix-view/src/editor.rs index 1c737b3e5..c5597a342 100644 --- a/helix-view/src/editor.rs +++ b/helix-view/src/editor.rs @@ -33,6 +33,8 @@ impl Editor { } pub fn open(&mut self, path: PathBuf, executor: &smol::Executor) -> Result<(), Error> { + // TODO: try to find an open view/buffer first + let mut doc = Document::load(path, self.theme.scopes())?; // try to find a language server based on the language name