From d4c17b633c09ab2a0ba8794a6650dcfb67f50ea9 Mon Sep 17 00:00:00 2001 From: Blaž Hrastnik Date: Fri, 20 Aug 2021 13:42:47 +0900 Subject: minor: Extract doc.text().slice(..) into a var --- helix-term/src/commands.rs | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'helix-term') diff --git a/helix-term/src/commands.rs b/helix-term/src/commands.rs index 9ec2c336..d7d50109 100644 --- a/helix-term/src/commands.rs +++ b/helix-term/src/commands.rs @@ -4113,11 +4113,9 @@ fn align_view_bottom(cx: &mut Context) { fn align_view_middle(cx: &mut Context) { let (view, doc) = current!(cx.editor); - let pos = doc - .selection(view.id) - .primary() - .cursor(doc.text().slice(..)); - let pos = coords_at_pos(doc.text().slice(..), pos); + let text = doc.text().slice(..); + let pos = doc.selection(view.id).primary().cursor(text); + let pos = coords_at_pos(text, pos); view.offset.col = pos .col -- cgit v1.2.3-70-g09d2