Skip to content

Always open duplicated tabs next to source tab - #20565

Open
OmarMashal (OmarMashal0) wants to merge 2 commits into
microsoft:mainfrom
OmarMashal0:fix-duplicate-tab-position
Open

Always open duplicated tabs next to source tab#20565
OmarMashal (OmarMashal0) wants to merge 2 commits into
microsoft:mainfrom
OmarMashal0:fix-duplicate-tab-position

Conversation

@OmarMashal0

Copy link
Copy Markdown

Summary

Fixes duplicate tab placement so duplicated tabs always open immediately after the source tab, regardless of the configured newTabPosition.

Previously, when newTabPosition was set to AfterLastTab, duplicated tabs were inserted at the end of the tab list. This change keeps normal new-tab behavior unchanged while making duplicate-tab placement consistently use the source tab's position.

Fixes #20355

Validation

  • TabTests::TryDuplicateBadTab
  • TabTests::NextMRUTab
  • TabTests::TestClampSwitchToTab
  • TabTests::DuplicateTabAlwaysOpensAfterCurrent
  • Manual UI verification with newTabPosition set to AfterLastTab

Screenshots

Before

Duplicating tab2 placed the duplicated tab at the end of the tab list.

before

After

Duplicating tab2 now places the duplicated tab immediately after the source tab.

after

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
There may be pipelines that require an authorized user to comment /azp run to run.

@OmarMashal0

Copy link
Copy Markdown
Author

@microsoft-github-policy-service agree

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change removes user choice, but it gives me what I wanted, so I take it :)

Comment thread src/cascadia/TerminalApp/TabManagement.cpp
// In the future, it may be preferable to just duplicate the
// current control's live settings (which will include changes
// made through VT).
uint32_t insertPosition = _tabs.Size();

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At least this change gets rid of this initialize-then-modify antipattern.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Duplicate tab should create a new tab next to the original

2 participants