Skip to content

Commit

Permalink
DevTools: revert to last committed live expression on escape
Browse files Browse the repository at this point in the history
Bug: none
Change-Id: I6e206b63e45e8b6e4510125195aa1169223d5d1e
Reviewed-on: https://chromium-review.googlesource.com/1220550
Reviewed-by: Joel Einbinder <einbinder@chromium.org>
Commit-Queue: Erik Luo <luoe@chromium.org>
Cr-Commit-Position: refs/heads/master@{#592664}
  • Loading branch information
psybuzz authored and Commit Bot committed Sep 20, 2018
1 parent a9f9627 commit 1939073
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,12 @@ Console.ConsolePin = class extends Common.Object {
this._editor.widget().element.tabIndex = -1;
this._editor.setText(expression);
this._editor.widget().element.addEventListener('keydown', event => {
if (event.key === 'Tab' && !this._editor.text())
if (event.key === 'Tab' && !this._editor.text()) {
event.consume();
return;
}
if (event.keyCode === UI.KeyboardShortcut.Keys.Esc.code)
this._editor.setText(this._committedExpression);
}, true);
this._editor.widget().element.addEventListener('focusout', event => {
const text = this._editor.text();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -163,8 +163,11 @@ Console.ConsoleView = class extends UI.VBox {
this._pinPane.element.classList.add('console-view-pinpane');
this._pinPane.show(this._contentsElement);
this._pinPane.element.addEventListener('keydown', event => {
if (event.key === 'Enter' && event.ctrlKey)
if ((event.key === 'Enter' && UI.KeyboardShortcut.eventHasCtrlOrMeta(/** @type {!KeyboardEvent} */ (event))) ||
event.keyCode === UI.KeyboardShortcut.Keys.Esc.code) {
this._prompt.focus();
event.consume();
}
});
}

Expand Down

0 comments on commit 1939073

Please sign in to comment.