Commit 3c071011 authored by Thomas Randolph's avatar Thomas Randolph

Add keyboard shortcuts for commit navigation

parent ee921003
...@@ -224,6 +224,7 @@ export default { ...@@ -224,6 +224,7 @@ export default {
methods: { methods: {
...mapActions(['startTaskList']), ...mapActions(['startTaskList']),
...mapActions('diffs', [ ...mapActions('diffs', [
'moveToNeighboringCommit',
'setBaseConfig', 'setBaseConfig',
'fetchDiffFiles', 'fetchDiffFiles',
'fetchDiffFilesMeta', 'fetchDiffFilesMeta',
...@@ -344,9 +345,16 @@ export default { ...@@ -344,9 +345,16 @@ export default {
break; break;
} }
}); });
if (this.commit) {
Mousetrap.bind('c', () => this.moveToNeighboringCommit({ direction: 'next' }));
Mousetrap.bind('x', () => this.moveToNeighboringCommit({ direction: 'previous' }));
}
}, },
removeEventListeners() { removeEventListeners() {
Mousetrap.unbind(['[', 'k', ']', 'j']); Mousetrap.unbind(['[', 'k', ']', 'j']);
Mousetrap.unbind('c');
Mousetrap.unbind('x');
}, },
jumpToFile(step) { jumpToFile(step) {
const targetIndex = this.currentDiffIndex + step; const targetIndex = this.currentDiffIndex + step;
......
...@@ -313,6 +313,18 @@ ...@@ -313,6 +313,18 @@
%td.shortcut %td.shortcut
%kbd p %kbd p
%td= _('Previous unresolved discussion') %td= _('Previous unresolved discussion')
%tbody
%tr
%th
%th= _('Merge Request Commits')
%tr
%td.shortcut
%kbd c
%td= _('Next commit')
%tr
%td.shortcut
%kbd x
%td= _('Previous commit')
%tbody %tbody
%tr %tr
%th %th
......
...@@ -13028,6 +13028,9 @@ msgstr "" ...@@ -13028,6 +13028,9 @@ msgstr ""
msgid "Merge Request Approvals" msgid "Merge Request Approvals"
msgstr "" msgstr ""
msgid "Merge Request Commits"
msgstr ""
msgid "Merge Requests" msgid "Merge Requests"
msgstr "" msgstr ""
...@@ -13886,6 +13889,9 @@ msgstr "" ...@@ -13886,6 +13889,9 @@ msgstr ""
msgid "Next" msgid "Next"
msgstr "" msgstr ""
msgid "Next commit"
msgstr ""
msgid "Next file in diff" msgid "Next file in diff"
msgstr "" msgstr ""
...@@ -15592,6 +15598,9 @@ msgstr "" ...@@ -15592,6 +15598,9 @@ msgstr ""
msgid "Previous Artifacts" msgid "Previous Artifacts"
msgstr "" msgstr ""
msgid "Previous commit"
msgstr ""
msgid "Previous file in diff" msgid "Previous file in diff"
msgstr "" msgstr ""
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment