newTab with out-of-range profile index uses the default profile #15056

Closed
opened 2026-01-31 04:27:08 +00:00 by claunia · 6 comments
Owner

Originally created by @KalleOlaviNiemitalo on GitHub (Sep 1, 2021).

Windows Terminal version (or Windows build number)

1.9.1942.0

Other Software

No response

Steps to reproduce

  1. Uninstall and reinstall Windows Terminal, to delete any custom settings.
  2. Start Windows Terminal. It opens a tab with the PowerShell profile.
  3. Open the new-tab dropdown list and note it lists five profiles
    Windows PowerShell Ctrl+Shift+1
    Command Prompt Ctrl+Shift+2
    PowerShell Ctrl+Shift+3
    Debian Ctrl+Shift+4
    Azure Cloud Shell Ctrl+Shift+5
  4. Close the new-tab dropdown list.
  5. Press Ctrl+Shift+9.

Expected Behavior

No tab opens, because there are fewer than nine active profiles. Perhaps it beeps instead.

Actual Behavior

A new tab opens with the PowerShell profile.

Originally created by @KalleOlaviNiemitalo on GitHub (Sep 1, 2021). ### Windows Terminal version (or Windows build number) 1.9.1942.0 ### Other Software _No response_ ### Steps to reproduce 1. Uninstall and reinstall Windows Terminal, to delete any custom settings. 2. Start Windows Terminal. It opens a tab with the PowerShell profile. 3. Open the new-tab dropdown list and note it lists five profiles | | | |---|---| |Windows PowerShell|Ctrl+Shift+1| |Command Prompt|Ctrl+Shift+2| |**PowerShell**|Ctrl+Shift+3| |Debian|Ctrl+Shift+4| |Azure Cloud Shell|Ctrl+Shift+5| 4. Close the new-tab dropdown list. 5. Press Ctrl+Shift+9. ### Expected Behavior No tab opens, because there are fewer than nine active profiles. Perhaps it beeps instead. ### Actual Behavior A new tab opens with the PowerShell profile.
Author
Owner

@DHowett commented on GitHub (Sep 1, 2021):

Hmm. I likely regressed this in the change to profile resolution...

@DHowett commented on GitHub (Sep 1, 2021): Hmm. I likely regressed this in the change to profile resolution...
Author
Owner

@zadjii-msft commented on GitHub (Sep 29, 2021):

Oh wait, this isn't a regression. Even in #10982 this worked this way. OP is reporting this in 1.9, and the profile resolution changes only started in v1.11.2421.0.

I'm un-blocking this one, and tossing into 2.0, discussion.

  • How breaking do we think it is if
    { "command": { "action": "newTab", "index": 999 } },
    
    does nothing instead?
  • Is there someone out there relying on ctrl+shift+9 to launch their default profile (despite only having two profiles)
  • This is kinda like "pass through move-focus keys when there aren't any panes"

It's easy enough to change this, but we'll need to think for a second about this.

pushed proposal in https://github.com/microsoft/terminal/pull/new/dev/migrie/b/11114-proposal

@zadjii-msft commented on GitHub (Sep 29, 2021): Oh wait, this isn't a regression. Even in #10982 this worked this way. OP is reporting this in 1.9, and the profile resolution changes only started in v1.11.2421.0. I'm un-blocking this one, and tossing into 2.0, discussion. * How breaking do we think it is if ```json { "command": { "action": "newTab", "index": 999 } }, ``` does nothing instead? * Is there someone out there relying on <kbd>ctrl+shift+9</kbd> to launch their default profile (despite only having two profiles) * This is kinda like "pass through move-focus keys when there aren't any panes" It's easy enough to change this, but we'll need to think for a second about this. pushed proposal in https://github.com/microsoft/terminal/pull/new/dev/migrie/b/11114-proposal
Author
Owner

@KalleOlaviNiemitalo commented on GitHub (Sep 29, 2021):

I'd prefer discarding the keyboard event rather than passing it through to the conpty.

@KalleOlaviNiemitalo commented on GitHub (Sep 29, 2021): I'd prefer discarding the keyboard event rather than passing it through to the conpty.
Author
Owner

@zadjii-msft commented on GitHub (Oct 26, 2021):

Theoretically, the best thing to do here is warn the user "hey bud you had an action for 'profile 900' but you have like 5, that doesn't make sense". Unfortunately, we ship with the profiles 1-9 actions by default. So we can't warn for those easily - we'd need to conditionally warn depending on where the action camefrom and that's ridiculous.

We also concur that this is different than switchToTab(999). For this one, we can determine at parse time that doesn't make sense. switchToTab is different, because we won't know at parse time if the value is bigger than the number of tabs.

We also agree that it is okay that these two act differently. It makes more sense for newTab(999) to not open something, and switchToTab(999) to switch to the last tab, rather than them both doing the "same thing".

@zadjii-msft commented on GitHub (Oct 26, 2021): Theoretically, the best thing to do here is warn the user "_hey bud you had an action for 'profile 900' but you have like 5, that doesn't make sense_". Unfortunately, we ship with the profiles 1-9 actions by default. So we can't warn for those easily - we'd need to conditionally warn depending on where the action camefrom and that's ridiculous. We also concur that this is _different_ than `switchToTab(999)`. For this one, we can determine at parse time that doesn't make sense. `switchToTab` is different, because we won't know at parse time if the value is bigger than the number of tabs. We also agree that **it is okay** that these two act differently. It makes more sense for `newTab(999)` to not open something, and `switchToTab(999)` to switch to the last tab, rather than them both doing the "same thing".
Author
Owner

@ghost commented on GitHub (May 24, 2022):

:tada:This issue was addressed in #11621, which has now been successfully released as Windows Terminal v1.13.1143.🎉

Handy links:

@ghost commented on GitHub (May 24, 2022): :tada:This issue was addressed in #11621, which has now been successfully released as `Windows Terminal v1.13.1143`.:tada: Handy links: * [Release Notes](https://github.com/microsoft/terminal/releases/tag/v1.13.1143) * [Store Download](https://www.microsoft.com/store/apps/9n8g5rfz9xk3?cid=storebadge&ocid=badge)
Author
Owner

@ghost commented on GitHub (May 24, 2022):

:tada:This issue was addressed in #11621, which has now been successfully released as Windows Terminal Preview v1.14.143.🎉

Handy links:

@ghost commented on GitHub (May 24, 2022): :tada:This issue was addressed in #11621, which has now been successfully released as `Windows Terminal Preview v1.14.143`.:tada: Handy links: * [Release Notes](https://github.com/microsoft/terminal/releases/tag/v1.14.143) * [Store Download](https://www.microsoft.com/store/apps/9n8g5rfz9xk3?cid=storebadge&ocid=badge)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#15056