summaryrefslogtreecommitdiff
path: root/helix-term
diff options
context:
space:
mode:
authorBlaž Hrastnik2021-08-20 04:42:47 +0000
committerBlaž Hrastnik2021-08-20 04:42:47 +0000
commitd4c17b633c09ab2a0ba8794a6650dcfb67f50ea9 (patch)
treeda184ae6a7445f76a7938c6a195b79e373a6ab72 /helix-term
parent38e932bd4c8b5ba105f7bd6c0c933c681b4df68a (diff)
minor: Extract doc.text().slice(..) into a var
Diffstat (limited to 'helix-term')
-rw-r--r--helix-term/src/commands.rs8
1 files changed, 3 insertions, 5 deletions
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