Reduce calculations during update cycle.

pull/5751/head
Kyle Smith 2 years ago
parent af7cdefc2b
commit 78cac8f934

@ -1445,15 +1445,20 @@ pub(super) fn goto_line_number(
}
return Ok(());
}
cx.editor.last_line_number.get_or_insert_with(|| {
let (view, doc) = current!(cx.editor);
let text = doc.text().slice(..);
let line = doc.selection(view.id).primary().cursor_line(text);
cx.editor.last_line_number.get_or_insert(line + 1);
let line = args[0].parse::<usize>()?;
goto_line_without_jumplist(cx.editor, NonZeroUsize::new(line));
line + 1
});
let (view, doc) = current!(cx.editor);
let line = args[0].parse::<usize>()?;
view.ensure_cursor_in_view(doc, line);
goto_line_without_jumplist(cx.editor, NonZeroUsize::new(line));
}
}
Ok(())

Loading…
Cancel
Save