diff --git a/CHANGELOG.md b/CHANGELOG.md index acfb318..5857a57 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p - Adds a new section for associated pull requests (when connected to GitHub) and auto-linked issues to the _Details_ hover - Adds the ability to filter comparisons to show only either the left-side or right-side file differences - Adds the _Open Folder History_ command to root folders — closes [#1505](https://github.com/eamodio/vscode-gitlens/issues/1505) +- Adds alternate `j`/`k` and `shift+j`/`shift+k` keyboard shortcuts to the Interactive Rebase Editor — closes [#1538](https://github.com/eamodio/vscode-gitlens/issues/1538) - Adds the ability to show contributor statistics, files changed as well as lines added and deleted (can take a while to compute depending on the repository) — closes [#1489](https://github.com/eamodio/vscode-gitlens/issues/1489) - Adds a _Show Statistics_ / _Hide Statistics_ toggle to the `...` menu of the _Contributors_ view - Adds a `gitlens.views.contributors.showStatistics` setting to specify whether to show contributor statistics in the _Contributors_ view diff --git a/src/webviews/apps/rebase/rebase.ts b/src/webviews/apps/rebase/rebase.ts index 0a8c34d..22158b4 100644 --- a/src/webviews/apps/rebase/rebase.ts +++ b/src/webviews/apps/rebase/rebase.ts @@ -174,6 +174,34 @@ class RebaseEditor extends App { document.querySelectorAll(`li[data-ref="${ref}"]`)[0]?.focus(); } } + } else if (e.key === 'j' || e.key === 'k') { + if (!e.metaKey && !e.ctrlKey && !e.shiftKey && !e.altKey) { + if (me.state == null) return; + + let ref = (this as HTMLLIElement).dataset.ref; + if (ref == null) return; + + e.preventDefault(); + + let index = me.getEntryIndex(ref) + (e.key === 'k' ? 1 : -1); + if (index < 0) { + index = me.state.entries.length - 1; + } else if (index === me.state.entries.length) { + index = 0; + } + + ref = me.state.entries[index].ref; + document.querySelectorAll(`li[data-ref="${ref}"]`)[0]?.focus(); + } + } else if (e.key === 'J' || e.key === 'K') { + if (!e.metaKey && !e.ctrlKey && !e.altKey && e.shiftKey) { + const ref = (this as HTMLLIElement).dataset.ref; + if (ref) { + e.stopPropagation(); + + me.moveEntry(ref, e.key === 'K' ? 1 : -1, true); + } + } } else if (!e.metaKey && !e.altKey && !e.ctrlKey) { const action = rebaseActionsMap.get(e.key); if (action !== undefined) {