From fea49c478e986da8b2769c59fb77e8388b3edbe1 Mon Sep 17 00:00:00 2001 From: woojiq <122799969+woojiq@users.noreply.github.com> Date: Tue, 2 Apr 2024 17:39:44 +0300 Subject: [PATCH] show newest options in jumplist picker first, fix docs (#10095) * docs: mention `g` changed file picker * picker(jumplist): show jumps in order from latest to oldest --- book/src/keymap.md | 3 ++- helix-term/src/commands.rs | 1 + helix-view/src/view.rs | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/book/src/keymap.md b/book/src/keymap.md index 3a5ccca533114..73f7a8532a963 100644 --- a/book/src/keymap.md +++ b/book/src/keymap.md @@ -280,7 +280,8 @@ This layer is a kludge of mappings, mostly pickers. | `F` | Open file picker at current working directory | `file_picker_in_current_directory` | | `b` | Open buffer picker | `buffer_picker` | | `j` | Open jumplist picker | `jumplist_picker` | -| `g` | Debug (experimental) | N/A | +| `g` | Open changed file picker | `changed_file_picker` | +| `G` | Debug (experimental) | N/A | | `k` | Show documentation for item under cursor in a [popup](#popup) (**LSP**) | `hover` | | `s` | Open document symbol picker (**LSP**) | `symbol_picker` | | `S` | Open workspace symbol picker (**LSP**) | `workspace_symbol_picker` | diff --git a/helix-term/src/commands.rs b/helix-term/src/commands.rs index 260eb01085ad9..6862f98280a90 100644 --- a/helix-term/src/commands.rs +++ b/helix-term/src/commands.rs @@ -2958,6 +2958,7 @@ fn jumplist_picker(cx: &mut Context) { .flat_map(|(view, _)| { view.jumps .iter() + .rev() .map(|(doc_id, selection)| new_meta(view, *doc_id, selection.clone())) }) .collect(), diff --git a/helix-view/src/view.rs b/helix-view/src/view.rs index b5dc0615a5afd..5b283b98f98d4 100644 --- a/helix-view/src/view.rs +++ b/helix-view/src/view.rs @@ -79,7 +79,7 @@ impl JumpList { self.jumps.retain(|(other_id, _)| other_id != doc_id); } - pub fn iter(&self) -> impl Iterator { + pub fn iter(&self) -> impl DoubleEndedIterator { self.jumps.iter() }