Correctly handle clicking cancel on go to dialog

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

No files matched your search

+5 -1
View File
@@ -1381,7 +1381,11 @@ class InputWaiter {
*/ */
async goToTab() { async goToTab() {
const inputNums = await this.getInputNums(); 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); this.changeTab(tabNum, this.app.options.syncTabs);
} }
+6 -2
View File
@@ -797,8 +797,12 @@ class OutputWaiter {
*/ */
goToTab() { goToTab() {
const min = this.getSmallestInputNum(), const min = this.getSmallestInputNum(),
max = this.getLargestInputNum(), max = this.getLargestInputNum();
tabNum = parseInt(window.prompt(`Enter tab number (${min} - ${max}):`, this.getActiveTab().toString()), 10);
let tabNum = window.prompt(`Enter tab number (${min} - ${max}):`, this.getActiveTab().toString());
if (tabNum === null) return;
tabNum = parseInt(tabNum, 10);
if (this.outputExists(tabNum)) { if (this.outputExists(tabNum)) {
this.changeTab(tabNum, this.app.options.syncTabs); this.changeTab(tabNum, this.app.options.syncTabs);
} }