Skip to content

Commit

Permalink
picker(jumplist): show newest options on top instead of bottom
Browse files Browse the repository at this point in the history
  • Loading branch information
woojiq committed Apr 1, 2024
1 parent ef13bf5 commit a4b5b4c
Showing 1 changed file with 21 additions and 21 deletions.
42 changes: 21 additions & 21 deletions helix-term/src/commands.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2974,27 +2974,27 @@ fn jumplist_picker(cx: &mut Context) {
}
};

let picker = Picker::new(
cx.editor
.tree
.views()
.flat_map(|(view, _)| {
view.jumps
.iter()
.map(|(doc_id, selection)| new_meta(view, *doc_id, selection.clone()))
})
.collect(),
(),
|cx, meta, action| {
cx.editor.switch(meta.id, action);
let config = cx.editor.config();
let (view, doc) = (view_mut!(cx.editor), doc_mut!(cx.editor, &meta.id));
doc.set_selection(view.id, meta.selection.clone());
if action.align_view(view, doc.id()) {
view.ensure_cursor_in_view_center(doc, config.scrolloff);
}
},
)
let mut options: Vec<JumpMeta> = cx
.editor
.tree
.views()
.flat_map(|(view, _)| {
view.jumps
.iter()
.map(|(doc_id, selection)| new_meta(view, *doc_id, selection.clone()))
})
.collect();
options.reverse();

let picker = Picker::new(options, (), |cx, meta, action| {
cx.editor.switch(meta.id, action);
let config = cx.editor.config();
let (view, doc) = (view_mut!(cx.editor), doc_mut!(cx.editor, &meta.id));
doc.set_selection(view.id, meta.selection.clone());
if action.align_view(view, doc.id()) {
view.ensure_cursor_in_view_center(doc, config.scrolloff);
}
})
.with_preview(|editor, meta| {
let doc = &editor.documents.get(&meta.id)?;
let line = meta.selection.primary().cursor_line(doc.text().slice(..));
Expand Down

0 comments on commit a4b5b4c

Please sign in to comment.