Settings / Startup / Launch Parameters / Launch Position doesn't allow Negative values #20371

Closed
opened 2026-01-31 07:11:42 +00:00 by claunia · 6 comments
Owner

Originally created by @internayt on GitHub (Aug 14, 2023).

Description of the new feature/enhancement

Currently, the Launch Position doesn't allow negative values.
I have a 3 monitor setup with the middle monitor as monitor 1.
I have "cmd" setup with defaults to set Left (X) as -1924, which works great as the window comes up on my left monitor all they way to the edge.

Please allow negative values for X in Launch Position.

Originally created by @internayt on GitHub (Aug 14, 2023). # Description of the new feature/enhancement Currently, the Launch Position doesn't allow negative values. I have a 3 monitor setup with the middle monitor as monitor 1. I have "cmd" setup with defaults to set Left (X) as -1924, which works great as the window comes up on my left monitor all they way to the edge. Please allow negative values for X in Launch Position.
Author
Owner

@zadjii-msft commented on GitHub (Aug 14, 2023):

Methinks this is #15656:

I don't think this needs to be a feature request - this is probably just a bug report 😜 --pos with a negative number absolutely should work! Our psychic debugging guess is that the arg parser we're using is treating --pos -100,-200 as a different option entirely, rather than a value for the --pos arg.

@zadjii-msft commented on GitHub (Aug 14, 2023): Methinks this is #15656: > I don't think this needs to be a feature request - this is probably just a bug report 😜 `--pos` with a negative number absolutely _should_ work! Our psychic debugging guess is that the arg parser we're using is treating `--pos -100,-200` as a different option entirely, rather than a value for the `--pos` arg.
Author
Owner

@lhecker commented on GitHub (Aug 15, 2023):

@zadjii-msft But, as far as I understand it, this issue is about the settings UI not supporting negative numbers. There, it doesn't work either (= separate issue).

@lhecker commented on GitHub (Aug 15, 2023): @zadjii-msft But, as far as I understand it, this issue is about the settings UI not supporting negative numbers. There, it doesn't work either (= separate issue).
Author
Owner

@zadjii-msft commented on GitHub (Aug 15, 2023):

Ho boy it doesn't work in the SUI either? Jeez 🤦

Note

Walkthrough

Yep, these guys:
b556594793/src/cascadia/TerminalSettingsEditor/Launch.xaml (L239-L254)

use this style

b556594793/src/cascadia/TerminalSettingsEditor/Launch.xaml (L26-L32)

and that's got a minimum of 1.

Should be easy enough to make a duplicate of that style, but for LaunchPositionNumberBoxStyle, and with a different minimum.

@zadjii-msft commented on GitHub (Aug 15, 2023): Ho boy it doesn't work in the SUI either? Jeez 🤦 > **Note** > ## Walkthrough Yep, these guys: https://github.com/microsoft/terminal/blob/b556594793006ba49934d9e5291cbf235e18b4b3/src/cascadia/TerminalSettingsEditor/Launch.xaml#L239-L254 use this style https://github.com/microsoft/terminal/blob/b556594793006ba49934d9e5291cbf235e18b4b3/src/cascadia/TerminalSettingsEditor/Launch.xaml#L26-L32 and that's got a minimum of 1. Should be easy enough to make a duplicate of that style, but for `LaunchPositionNumberBoxStyle`, and with a different minimum.
Author
Owner

@codecruisedor commented on GitHub (Sep 6, 2023):

Hello @zadjii-msft , @lhecker , I would like to work on this.

A few questions:

  1. We have to implement two things, One is a new style LaunchPositionNumberBoxStyle in the settings UI. Another is allowing negative x and y in the argument parser so that it allows negative numbers in the --pos argument. Is my understanding correct?
  2. What should be the minimum value in the new LaunchPositionNumberBoxStyle..?

Thank you.

@codecruisedor commented on GitHub (Sep 6, 2023): Hello @zadjii-msft , @lhecker , I would like to work on this. A few questions: 1) We have to implement two things, One is a new style `LaunchPositionNumberBoxStyle` in the settings UI. Another is allowing negative x and y in the argument parser so that it allows negative numbers in the `--pos` argument. **Is my understanding correct?** 2) What should be the minimum value in the new `LaunchPositionNumberBoxStyle`..? Thank you.
Author
Owner

@lhecker commented on GitHub (Sep 6, 2023):

  1. We have to implement two things, One is a new style LaunchPositionNumberBoxStyle in the settings UI. Another is allowing negative x and y in the argument parser so that it allows negative numbers in the --pos argument. Is my understanding correct?

Yes, but --pos already allows negative coordinates as far as I know. It doesn't need to be fixed. 🙂

  1. What should be the minimum value in the new LaunchPositionNumberBoxStyle..?

I doesn't necessarily need a minimum value, because the min. is just as large as the max. value. Technically speaking, window coordinates are limited to INT32_MIN and INT32_MAX, so you can use this if you'd like:

     <Setter Property="Minimum" Value="-2147483648" /> 
     <Setter Property="Maximum" Value="2147483647" /> 

@zadjii-msft BTW I noticed that InitialPosition struct uses IReference<Int32>. I think we should progressively replace all those integer coordinates with floats in DIPs in the coming ~year to make our lives with HiDPI a bit better. We can use NAN to indicate a field not being set.

@lhecker commented on GitHub (Sep 6, 2023): > 1. We have to implement two things, One is a new style LaunchPositionNumberBoxStyle in the settings UI. Another is allowing negative x and y in the argument parser so that it allows negative numbers in the --pos argument. Is my understanding correct? Yes, but `--pos` already allows negative coordinates as far as I know. It doesn't need to be fixed. 🙂 > 2. What should be the minimum value in the new `LaunchPositionNumberBoxStyle`..? I doesn't necessarily need a minimum value, because the min. is just as large as the max. value. Technically speaking, window coordinates are limited to INT32_MIN and INT32_MAX, so you can use this if you'd like: ``` <Setter Property="Minimum" Value="-2147483648" /> <Setter Property="Maximum" Value="2147483647" /> ``` --- @zadjii-msft BTW I noticed that `InitialPosition` struct uses `IReference<Int32>`. I think we should progressively replace all those integer coordinates with `float`s in DIPs in the coming ~year to make our lives with HiDPI a bit better. We can use NAN to indicate a field not being set.
Author
Owner

@zadjii-msft commented on GitHub (Sep 6, 2023):

@codecruisedor

  1. Yea, there's two parts, but for the sake of this thread, I'd just focus on the Settings UI bit. #15656 is tracking the commandline parsing one, and that seems... well quite a bit weirder.
  2. I agree with lhecker. INT_MAX for all I know. I'm sure there's technically a smarter value out there to use for "the largest/smallest possible window coordinate", but I'm not sure we need to be that precise.
@zadjii-msft commented on GitHub (Sep 6, 2023): @codecruisedor 1. Yea, there's two parts, but for the sake of _this_ thread, I'd just focus on the Settings UI bit. #15656 is tracking the commandline parsing one, and that seems... well quite a bit weirder. 2. I agree with lhecker. INT_MAX for all I know. I'm sure there's _technically_ a smarter value out there to use for "the largest/smallest possible window coordinate", but I'm not sure we _need_ to be that precise.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#20371