Skip to content

Conversation

KavishaHaswani
Copy link

Summary of the Pull Request

Fixes #4247. Improves consistency in -pos tag parsing by supporting single-value input for both axes.

References and Relevant Issues

#4247

Detailed Description of the Pull Request / Additional comments

The change aligns -pos behavior with padding-style logic. Existing comma-separated behavior remains unchanged.

  • A single value like "number" now sets both x and y positions to that value — similar to how padding behaves.
  • A value like "number," (with a trailing comma) continues to set only x, leaving y unchanged.

Validation Steps Performed

  • Ran all unit and integration tests
  • Added unit test to verify single-value and comma-separated inputs

PR Checklist

This update modifies how the -pos tag is parsed when setting the initial window position.

Specifically:
- A single value like "number" now sets both x and y positions to that value — similar to how padding behaves.
- A value like "number," (with a trailing comma) continues to set only x, leaving y unchanged.

Changes:
- Updated parsing logic for -pos tag
- Added unit test to verify single-value behavior
- Confirmed all existing tests pass
@microsoft-github-policy-service microsoft-github-policy-service bot added Issue-Task It's a feature request, but it doesn't really need a major design. Area-Settings Issues related to settings and customizability, for console or terminal Product-Terminal The new Windows Terminal. labels Oct 4, 2025
@KavishaHaswani
Copy link
Author

@microsoft-github-policy-service agree

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.

Thanks!

@carlos-zamora
Copy link
Member

/azp run

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@KavishaHaswani
Copy link
Author

Thank you so much @carlos-zamora ! This was my first PR ever and I am beyond thrilled to have it approved. This really made my day. Looking forward to contributing and learning more.

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.

👍

@carlos-zamora
Copy link
Member

/azp run

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@KavishaHaswani
Copy link
Author

Is there any documentation on how to run the full CI test suite locally before pushing? I ran the tests as instructed in the project README, which passed on my system, but the tests here failed.

@carlos-zamora
Copy link
Member

Yeah! So the problem here is that you're working with an IReference<> but you're calling has_value() on it, which doesn't exist. So you're going to have to use the right API there. Honestly, just treating it as a boolean directly like you did in src/cascadia/TerminalSettingsModel/ModelSerializationHelpers.h should be fine.

Is there any documentation on how to run the full CI test suite locally before pushing? I ran the tests as instructed in the project README, which passed on my system, but the tests here failed.

Yeah! So, the easiest way to run the tests is to do this in PowerShell:

# in project root directory
Import-Module .\tools\OpenConsole.psm1

# Use "-Test" to choose a specific DLL to load tests
# (Optional) Add something like "-TaefArgs /name:*settings*" to run all tests with "settings" in the name (you still need -Test to pick the right dll though)
# Alternatively, just use "-AllTests" to run all of the tests, though this takes much longer
Invoke-OpenConsoleTests -Test localTerminalApp -TaefArgs /name:*settings*

That said, the local tests don't actually run in CI due to a limitation with TAEF. We're supposed to run them on our own, but admittedly, we haven't done a very good job of that and some of the tests are failing 😅.

Instead, I suggest adding tests to something in src\cascadia\UnitTests_SettingsModel\ since those do run in CI.

Comment on lines +70 to +73
if (initialPosition.X && !initialPosition.Y && string.find(',') == std::string::npos)
{
initialPosition.Y = initialPosition.X;
}
Copy link
Member

Choose a reason for hiding this comment

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

Why don't we modify ParseCommaSeparatedPair to do this for us?

Copy link
Author

Choose a reason for hiding this comment

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

I felt that function was more general purpose and could be reused elsewhere whereas the LaunchPositionFromString function is specifically for the initialPosition argument. Shall I modify ParseCommaSeparatedPair instead?

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

Labels

Area-Settings Issues related to settings and customizability, for console or terminal Issue-Task It's a feature request, but it doesn't really need a major design. Product-Terminal The new Windows Terminal.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

initialPosition should set both coordinates when one number exists

3 participants