minor: Extract doc.text().slice(..) into a var

This commit is contained in:
Blaž Hrastnik 2021-08-20 13:42:47 +09:00
parent 38e932bd4c
commit d4c17b633c

View File

@ -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