In Differential, make the "Open in Editor" keystroke work with no selection, or a change or inline selected

Summary:
Ref T13515. Currently, "Open in Editor" only works with a file-level selection.

  - If we have a change-level or inline-level selection, open the parent changeset.
  - If we have no selection, but the banner is showing something, open the fine shown in the banner.

Test Plan: With files, inlines, changes, and no selection, pressed "\". Saw files pop open in my external editor.

Maniphest Tasks: T13515

Differential Revision: https://secure.phabricator.com/D21148
This commit is contained in:
epriestley
2020-04-19 07:18:24 -07:00
parent f02024615a
commit 537ff68edd
2 changed files with 26 additions and 21 deletions

View File

@@ -462,23 +462,28 @@ JX.install('DiffChangesetList', {
var pht = this.getTranslations();
var cursor = this._cursorItem;
var changeset;
if (cursor) {
if (cursor.type == 'file') {
var changeset = cursor.changeset;
var editor_uri = changeset.getEditorURI();
if (editor_uri === null) {
this._warnUser(pht('No external editor is configured.'));
return;
}
JX.$U(editor_uri).go();
return;
}
changeset = cursor.changeset;
}
this._warnUser(pht('You must select a file to edit.'));
if (!changeset) {
changeset = this._getVisibleChangeset();
}
if (!changeset) {
this._warnUser(pht('You must select a file to edit.'));
return;
}
var editor_uri = changeset.getEditorURI();
if (editor_uri === null) {
this._warnUser(pht('No external editor is configured.'));
return;
}
JX.$U(editor_uri).go();
},
_onkeycollapse: function() {