From 461cd2056336c26138c96a4f0769f08d527be039 Mon Sep 17 00:00:00 2001 From: Jason Rodney Hansen Date: Sat, 4 Dec 2021 11:38:08 -0700 Subject: Small change --- helix-term/src/commands.rs | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) (limited to 'helix-term') diff --git a/helix-term/src/commands.rs b/helix-term/src/commands.rs index 013a4280..3d583ba8 100644 --- a/helix-term/src/commands.rs +++ b/helix-term/src/commands.rs @@ -5800,28 +5800,26 @@ fn decrement(cx: &mut Context) { fn increment_impl(cx: &mut Context, amount: i64) { let (view, doc) = current!(cx.editor); let selection = doc.selection(view.id); - let text = doc.text(); + let text = doc.text().slice(..); - let changes = selection + let changes: Vec<_> = selection .ranges() .iter() .filter_map(|range| { - let incrementor: Box = if let Some(incrementor) = - DateTimeIncrementor::from_range(text.slice(..), *range) - { - Box::new(incrementor) - } else if let Some(incrementor) = NumberIncrementor::from_range(text.slice(..), *range) - { - Box::new(incrementor) - } else { - return None; - }; + let incrementor: Box = + if let Some(incrementor) = DateTimeIncrementor::from_range(text, *range) { + Box::new(incrementor) + } else if let Some(incrementor) = NumberIncrementor::from_range(text, *range) { + Box::new(incrementor) + } else { + return None; + }; let (range, new_text) = incrementor.increment(amount); Some((range.from(), range.to(), Some(new_text))) }) - .collect::>(); + .collect(); // Overlapping changes in a transaction will panic, so we need to find and remove them. // For example, if there are cursors on each of the year, month, and day of `2021-11-29`, -- cgit v1.2.3-70-g09d2