[PR #10651] [MERGED] Clamp the focusTab action to the number of available tabs #28166

Open
opened 2026-01-31 09:26:44 +00:00 by claunia · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/microsoft/terminal/pull/10651
Author: @zadjii-msft
Created: 7/13/2021
Status: ✅ Merged
Merged: 7/22/2021
Merged by: @undefined

Base: main ← Head: dev/migrie/b/6776-focus-tab-clamping


📝 Commits (7)

  • f1d98fb Add a test for this case
  • adca70d I think this fixes #6776, but some tests are broken. They may have always been.
  • 4dfa80e Gosh, clamping is hard
  • 503b952 @dhowett wants it to go to the last tab? It'll go to the last tab
  • 25ed724 Merge remote-tracking branch 'origin/main' into dev/migrie/b/6776-focus-tab-clamping
  • 647577b fine. make 'switch to last' a special case on UINT32_MAX
  • 131cef5 Update src/cascadia/LocalTests_TerminalApp/TabTests.cpp

📊 Changes

6 files changed (+80 additions, -18 deletions)

View changed files

📝 src/cascadia/LocalTests_TerminalApp/TabTests.cpp (+53 -0)
📝 src/cascadia/TerminalApp/TabManagement.cpp (+16 -15)
📝 src/cascadia/TerminalApp/TerminalPage.h (+1 -1)
📝 src/cascadia/TerminalSettingsModel/ActionArgs.cpp (+5 -0)
📝 src/cascadia/TerminalSettingsModel/Resources/en-US/Resources.resw (+4 -1)
📝 src/cascadia/TerminalSettingsModel/defaults.json (+1 -1)

📄 Description

Summary of the Pull Request

When we perform a focusTab action, we currently do nothing if the parameter was greater than the number of tabs. This PR changes that behavior. Now, focus-tab -t 999999 will always focus the last tab, instead of silently doing nothing.

PR Checklist

Validation Steps Performed

  • ran tests
  • validated commandline manually

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/microsoft/terminal/pull/10651 **Author:** [@zadjii-msft](https://github.com/zadjii-msft) **Created:** 7/13/2021 **Status:** ✅ Merged **Merged:** 7/22/2021 **Merged by:** [@undefined](undefined) **Base:** `main` ← **Head:** `dev/migrie/b/6776-focus-tab-clamping` --- ### 📝 Commits (7) - [`f1d98fb`](https://github.com/microsoft/terminal/commit/f1d98fb9663bb3747ff6153801a197ce073efab8) Add a test for this case - [`adca70d`](https://github.com/microsoft/terminal/commit/adca70db7b641f8e8068828cda116d096f884176) I think this fixes #6776, but some tests are broken. They may have always been. - [`4dfa80e`](https://github.com/microsoft/terminal/commit/4dfa80e28d46161a02b8fbab2ea16741f6f2df93) Gosh, clamping is hard - [`503b952`](https://github.com/microsoft/terminal/commit/503b95200d0a574e0e16f8278c2bfa3983f2d380) @dhowett wants it to go to the last tab? It'll go to the last tab - [`25ed724`](https://github.com/microsoft/terminal/commit/25ed7244b0042b828577e25827c45362f3a81f61) Merge remote-tracking branch 'origin/main' into dev/migrie/b/6776-focus-tab-clamping - [`647577b`](https://github.com/microsoft/terminal/commit/647577b9465a0357b97b56991a152965cdf0b2d8) fine. make 'switch to last' a special case on UINT32_MAX - [`131cef5`](https://github.com/microsoft/terminal/commit/131cef51536649a19f48f7854cebeedc4a52a991) Update src/cascadia/LocalTests_TerminalApp/TabTests.cpp ### 📊 Changes **6 files changed** (+80 additions, -18 deletions) <details> <summary>View changed files</summary> 📝 `src/cascadia/LocalTests_TerminalApp/TabTests.cpp` (+53 -0) 📝 `src/cascadia/TerminalApp/TabManagement.cpp` (+16 -15) 📝 `src/cascadia/TerminalApp/TerminalPage.h` (+1 -1) 📝 `src/cascadia/TerminalSettingsModel/ActionArgs.cpp` (+5 -0) 📝 `src/cascadia/TerminalSettingsModel/Resources/en-US/Resources.resw` (+4 -1) 📝 `src/cascadia/TerminalSettingsModel/defaults.json` (+1 -1) </details> ### 📄 Description ## Summary of the Pull Request When we perform a `focusTab` action, we currently do nothing if the parameter was greater than the number of tabs. This PR changes that behavior. Now, `focus-tab -t 999999` will always focus the last tab, instead of silently doing nothing. ## PR Checklist * [x] Closes #9369 * [x] I work here * [x] Tests added/passed * [n/a] Requires documentation to be updated ## Validation Steps Performed * [x] ran tests * [x] validated commandline manually --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
claunia added the pull-request label 2026-01-31 09:26:44 +00:00
Sign in to join this conversation.
No Label pull-request
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#28166