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(()); return Ok(());
} }
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>()?; cx.editor.last_line_number.get_or_insert_with(|| {
goto_line_without_jumplist(cx.editor, NonZeroUsize::new(line)); let (view, doc) = current!(cx.editor);
let text = doc.text().slice(..);
let line = doc.selection(view.id).primary().cursor_line(text);
line + 1
});
let (view, doc) = current!(cx.editor); let (view, doc) = current!(cx.editor);
let line = args[0].parse::<usize>()?;
view.ensure_cursor_in_view(doc, line); view.ensure_cursor_in_view(doc, line);
goto_line_without_jumplist(cx.editor, NonZeroUsize::new(line));
} }
} }
Ok(()) Ok(())

Loading…
Cancel
Save