@@ -965,19 +965,18 @@ fn goto_file_start(cx: &mut Context) {
965965 if cx.count.is_some() {
966966 goto_line(cx);
967967 } else {
968− push_jump(cx.editor);
969968 let (view, doc) = current!(cx.editor);
970969 let text = doc.text().slice(..);
971970 let selection = doc
972971 .selection(view.id)
973972 .clone()
974973 .transform(|range| range.put_cursor(text, 0, doc.mode == Mode::Select));
974+ push_jump(view, doc);
975975 doc.set_selection(view.id, selection);
976976 }
977977}
978978
979979fn goto_file_end(cx: &mut Context) {
980− push_jump(cx.editor);
981980 let (view, doc) = current!(cx.editor);
982981 let text = doc.text().slice(..);
983982 let pos = doc.text().len_chars();
@@ -985,6 +984,7 @@ fn goto_file_end(cx: &mut Context) {
985984 .selection(view.id)
986985 .clone()
987986 .transform(|range| range.put_cursor(text, pos, doc.mode == Mode::Select));
987+ push_jump(view, doc);
988988 doc.set_selection(view.id, selection);
989989}
990990
@@ -2485,8 +2485,7 @@ fn try_restore_indent(doc: &mut Document, view_id: ViewId) {
24852485}
24862486
24872487// Store a jump on the jumplist.
2488−fn push_jump(editor: &mut Editor) {
2489− let (view, doc) = current!(editor);
2488+fn push_jump(view: &mut View, doc: &Document) {
24902489 let jump = (doc.id(), doc.selection(view.id).clone());
24912490 view.jumps.push(jump);
24922491}
@@ -2497,8 +2496,6 @@ fn goto_line(cx: &mut Context) {
24972496
24982497fn goto_line_impl(editor: &mut Editor, count: Option<NonZeroUsize>) {
24992498 if let Some(count) = count {
2500− push_jump(editor);
2501−
25022499 let (view, doc) = current!(editor);
25032500 let max_line = if doc.text().line(doc.text().len_lines() - 1).len_chars() == 0 {
25042501 // If the last line is blank, don't jump to it.
@@ -2513,13 +2510,13 @@ fn goto_line_impl(editor: &mut Editor, count: Option<NonZeroUsize>) {
25132510 .selection(view.id)
25142511 .clone()
25152512 .transform(|range| range.put_cursor(text, pos, doc.mode == Mode::Select));
2513+
2514+ push_jump(view, doc);
25162515 doc.set_selection(view.id, selection);
25172516 }
25182517}
25192518
25202519fn goto_last_line(cx: &mut Context) {
2521− push_jump(cx.editor);
2522−
25232520 let (view, doc) = current!(cx.editor);
25242521 let line_idx = if doc.text().line(doc.text().len_lines() - 1).len_chars() == 0 {
25252522 // If the last line is blank, don't jump to it.
@@ -2533,6 +2530,8 @@ fn goto_last_line(cx: &mut Context) {
25332530 .selection(view.id)
25342531 .clone()
25352532 .transform(|range| range.put_cursor(text, pos, doc.mode == Mode::Select));
2533+
2534+ push_jump(view, doc);
25362535 doc.set_selection(view.id, selection);
25372536}
25382537
@@ -2601,10 +2600,9 @@ fn exit_select_mode(cx: &mut Context) {
26012600}
26022601
26032602fn goto_pos(editor: &mut Editor, pos: usize) {
2604− push_jump(editor);
2605−
26062603 let (view, doc) = current!(editor);
26072604
2605+ push_jump(view, doc);
26082606 doc.set_selection(view.id, Selection::point(pos));
26092607 align_view(doc, view, Align::Center);
26102608}
@@ -3886,7 +3884,8 @@ fn jump_backward(cx: &mut Context) {
38863884}
38873885
38883886fn save_selection(cx: &mut Context) {
3889− push_jump(cx.editor);
3887+ let (view, doc) = current!(cx.editor);
3888+ push_jump(view, doc);
38903889 cx.editor.set_status("Selection saved to jumplist");
38913890}
38923891