Skip to content

Split Panes inherit tab color and title of active pane #18981

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Techypanda
Copy link

Summary of the Pull Request

Previously to this PR if you split a pane as suggested in #18930, the split pane will lose its custom title and will not have its custom color, with this PR it will keep as indicated.

References and Relevant Issues

Detailed Description of the Pull Request / Additional comments

This PR makes it so that when you perform a split on a pane, it will copy the title and color of the source tab to make it stay.

Validation Steps Performed

  1. .\WindowsTerminal.exe -p "Windows PowerShell" --tabColor "#FF0000" --title "Hello World"
  2. Split pane
  3. Kept name and color
  4. Added new tab
  5. Added new tab
  6. Renamed third tab
  7. Changed color of third tab
  8. Split second tab (remains as normal (PowerShell title)
  9. Split third tab (Kept custom name and custom title)
  10. First tab still kept original name title, second is isolated to itself and third has its custom color and title.

PR Checklist

@Techypanda Techypanda force-pushed the split-panes-inherit-tab-color-and-title branch from bf4dde3 to c5bc0ea Compare May 29, 2025 04:00
Copy link
Member

@carlos-zamora carlos-zamora left a comment

Choose a reason for hiding this comment

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

Ok, I did some digging and played around with the branch. It looks like this change made it so that duplicatePane copies over the tab title and tab color. That's good, but we still need to copy those over for splitPane.

This also doesn't fix the issue described in #18930, which is basically that if you run this:

wt new-tab -p "Windows PowerShell" --tabColor "#FF0000" --title "Hello World" ; split-pane -p "Windows PowerShell"

Both panes are expected to have the tab color and title set.

Implementation-wise, it looks like _MakeTerminalPane(newTerminalArgs, sourceTab, existingConnection)'s sourceTab is only set if we're duplicating a pane (passed in by _MakePane(contentArgs, sourceTab, existingConnection)'s sourceTab. Maybe that context always has to be passed along, and we'll need a separate parameter to track if we're duplicating a pane?

@microsoft-github-policy-service microsoft-github-policy-service bot added the Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something label Jun 3, 2025
@Techypanda
Copy link
Author

Techypanda commented Jun 4, 2025

I thought split pane on the UI and split pane via CLI would use the exact same path but the fact that when i run the command you suggested (also in original issue) it doesnt retain title tells me this is not the case...

I will see how to fix this thanks

@microsoft-github-policy-service microsoft-github-policy-service bot added Needs-Attention The core contributors need to come back around and look at this ASAP. and removed Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something labels Jun 4, 2025
Previously to this PR if you split a pane as suggested in microsoft#18930, the split pane will lose its custom title and
will not have its custom color, with this PR it will keep as indicated
@Techypanda Techypanda force-pushed the split-panes-inherit-tab-color-and-title branch from c5bc0ea to 558a396 Compare June 4, 2025 06:28
Comment on lines +285 to +292
if (!duplicateFromTab && terminalTab.get())
{
_SplitPane(terminalTab,
realArgs.SplitDirection(),
// This is safe, we're already filtering so the value is (0, 1)
realArgs.SplitSize(),
_MakePane(realArgs.ContentArgs(), *terminalTab.get()));
}
Copy link
Author

Choose a reason for hiding this comment

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

So i came up with a way that works (fallback to terminalTab which is the 'sender/focused tab' as getFocused will always be null for the case described above;

@carlos-zamora i've done a bit of testing but do you think i might be missing a edge case where this would cause a bug?

@Techypanda Techypanda marked this pull request as draft June 4, 2025 06:30
Copy link

github-actions bot commented Jun 4, 2025

@check-spelling-bot Report

🔴 Please review

See the 📂 files view, the 📜action log, or 📝 job summary for details.

Unrecognized words (1)

ebefore

These words are not needed and should be removed abcd ABCDEFGHIJ abcdefghijk ABCDEFGHIJKLMNOPQRS ABCDEFGHIJKLMNOPQRST ABCDEFGHIJKLMNOPQRSTUVWXY allocs appium Argb asan autocrlf backported bytebuffer cac CLE codenav codepath commandline COMMITID componentization constness dealloc deserializers DISPATCHNOTIFY DTest entrypoints EVENTID FINDUP foob fuzzer fuzzyfinder hlocal hstring IInput Interner keyscan lstrcmpi Munged numlock offboarded oob pids positionals Productize pseudoterminal remoting renamer roadmap ruleset SELECTALL somefile Stringable tearoff TODOs touchpad TREX Unregistering USERDATA vectorize viewports wsl

To accept these unrecognized words as correct and remove the previously acknowledged and now absent words, you could run the following commands

... in a clone of the git@github.com:Techypanda/terminal.git repository
on the split-panes-inherit-tab-color-and-title branch (ℹ️ how do I use this?):

curl -s -S -L 'https://raw.githubusercontent.com/check-spelling/check-spelling/v0.0.24/apply.pl' |
perl - 'https://github.com/microsoft/terminal/actions/runs/15435220146/attempts/1'
Errors (1)

See the 📂 files view, the 📜action log, or 📝 job summary for details.

❌ Errors Count
❌ ignored-expect-variant 3

See ❌ Event descriptions for more information.

✏️ Contributor please read this

By default the command suggestion will generate a file named based on your commit. That's generally ok as long as you add the file to your commit. Someone can reorganize it later.

If the listed items are:

  • ... misspelled, then please correct them instead of using the command.
  • ... names, please add them to .github/actions/spelling/allow/names.txt.
  • ... APIs, you can add them to a file in .github/actions/spelling/allow/.
  • ... just things you're using, please add them to an appropriate file in .github/actions/spelling/expect/.
  • ... tokens you only need in one place and shouldn't generally be used, you can add an item in an appropriate file in .github/actions/spelling/patterns/.

See the README.md in each directory for more information.

🔬 You can test your commits without appending to a PR by creating a new branch with that extra change and pushing it to your fork. The check-spelling action will run in response to your push -- it doesn't require an open pull request. By using such a branch, you can limit the number of typos your peers see you make. 😉

If the flagged items are 🤯 false positives

If items relate to a ...

  • binary file (or some other file you wouldn't want to check at all).

    Please add a file path to the excludes.txt file matching the containing file.

    File paths are Perl 5 Regular Expressions - you can test yours before committing to verify it will match your files.

    ^ refers to the file's path from the root of the repository, so ^README\.md$ would exclude README.md (on whichever branch you're using).

  • well-formed pattern.

    If you can write a pattern that would match it,
    try adding it to the patterns.txt file.

    Patterns are Perl 5 Regular Expressions - you can test yours before committing to verify it will match your lines.

    Note that patterns can't match multiline strings.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs-Attention The core contributors need to come back around and look at this ASAP.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

New panes should inherit the tab color of the active pane when they're split
2 participants