Correctly handle clicking cancel on go to dialog

This commit is contained in:
j433866 2019-06-04 09:41:47 +01:00
parent f55102716e
commit 15b5cf7c20
2 changed files with 11 additions and 3 deletions

View File

@ -1381,7 +1381,11 @@ class InputWaiter {
*/
async goToTab() {
const inputNums = await this.getInputNums();
const tabNum = parseInt(window.prompt(`Enter tab number (${inputNums.min} - ${inputNums.max}):`, this.getActiveTab().toString()), 10);
let tabNum = window.prompt(`Enter tab number (${inputNums.min} - ${inputNums.max}):`, this.getActiveTab().toString());
if (tabNum === null) return;
tabNum = parseInt(tabNum, 10);
this.changeTab(tabNum, this.app.options.syncTabs);
}

View File

@ -797,8 +797,12 @@ class OutputWaiter {
*/
goToTab() {
const min = this.getSmallestInputNum(),
max = this.getLargestInputNum(),
tabNum = parseInt(window.prompt(`Enter tab number (${min} - ${max}):`, this.getActiveTab().toString()), 10);
max = this.getLargestInputNum();
let tabNum = window.prompt(`Enter tab number (${min} - ${max}):`, this.getActiveTab().toString());
if (tabNum === null) return;
tabNum = parseInt(tabNum, 10);
if (this.outputExists(tabNum)) {
this.changeTab(tabNum, this.app.options.syncTabs);
}