Repository: microsoft/terminal (language: cpp)

Issue:
[SUI] A long commandline causes the 'Browse' button to get cut off if the window is too narrow
### Windows Terminal version

current main

### Windows build number

_No response_

### Other Software

_No response_

### Steps to reproduce

1. Open up the SUI, go to a profile page
2. Make the terminal window very narrow
3. Open up the commandline expander and make the commandline very long

### Expected Behavior

The browse button should not get cut off

### Actual Behavior

The browse button gets cut off


Discussion / hints:

Fix patch:
diff --git a/src/cascadia/TerminalSettingsEditor/Appearances.xaml b/src/cascadia/TerminalSettingsEditor/Appearances.xaml
index 8f9d92b913b..74e39b87359 100644
--- a/src/cascadia/TerminalSettingsEditor/Appearances.xaml
+++ b/src/cascadia/TerminalSettingsEditor/Appearances.xaml
@@ -221,20 +221,22 @@
                                     SettingOverrideSource="{x:Bind Appearance.BackgroundImagePathOverrideSource, Mode=OneWay}"
                                     Style="{StaticResource ExpanderSettingContainerStyle}">
                 <StackPanel Orientation="Vertical">
+                    <TextBox x:Uid="Profile_BackgroundImageBox"
+                             IsEnabled="{x:Bind local:Converters.StringsAreNotEqual('desktopWallpaper', Appearance.BackgroundImagePath), Mode=OneWay}"
+                             IsSpellCheckEnabled="False"
+                             Style="{StaticResource TextBoxSettingStyle}"
+                             Text="{x:Bind local:Converters.StringOrEmptyIfPlaceholder('desktopWallpaper', Appearance.BackgroundImagePath), Mode=TwoWay, BindBack=Appearance.SetBackgroundImagePath}" />
                     <StackPanel Orientation="Horizontal">
-                        <TextBox x:Uid="Profile_BackgroundImageBox"
-                                 IsEnabled="{x:Bind local:Converters.StringsAreNotEqual('desktopWallpaper', Appearance.BackgroundImagePath), Mode=OneWay}"
-                                 IsSpellCheckEnabled="False"
-                                 Style="{StaticResource TextBoxSettingStyle}"
-                                 Text="{x:Bind local:Converters.StringOrEmptyIfPlaceholder('desktopWallpaper', Appearance.BackgroundImagePath), Mode=TwoWay, BindBack=Appearance.SetBackgroundImagePath}" />
                         <Button x:Uid="Profile_BackgroundImageBrowse"
+                                Margin="0,10,10,0"
                                 Click="BackgroundImage_Click"
                                 IsEnabled="{x:Bind local:Converters.StringsAreNotEqual('desktopWallpaper', Appearance.BackgroundImagePath), Mode=OneWay}"
                                 Style="{StaticResource BrowseButtonStyle}" />
+                        <CheckBox x:Name="UseDesktopImageCheckBox"
+                                  x:Uid="Profile_UseDesktopImage"
+                                  Margin="0,5,0,0"
+                                  IsChecked="{x:Bind Appearance.UseDesktopBGImage, Mode=TwoWay}" />
                     </StackPanel>
-                    <CheckBox x:Name="UseDesktopImageCheckBox"
-                              x:Uid="Profile_UseDesktopImage"
-                              IsChecked="{x:Bind Appearance.UseDesktopBGImage, Mode=TwoWay}" />
                 </StackPanel>
             </local:SettingContainer>
 
diff --git a/src/cascadia/TerminalSettingsEditor/CommonResources.xaml b/src/cascadia/TerminalSettingsEditor/CommonResources.xaml
index 5707b1dc1ac..5f98f4effc6 100644
--- a/src/cascadia/TerminalSettingsEditor/CommonResources.xaml
+++ b/src/cascadia/TerminalSettingsEditor/CommonResources.xaml
@@ -50,7 +50,7 @@
            BasedOn="{StaticResource DefaultTextBoxStyle}"
            TargetType="TextBox">
         <Setter Property="MinWidth" Value="{StaticResource StandardBoxMinWidth}" />
-        <Setter Property="MaxWidth" Value="500" />
+        <Setter Property="MaxWidth" Value="400" />
         <Setter Property="HorizontalAlignment" Value="Left" />
         <Setter Property="TextWrapping" Value="Wrap" />
     </Style>
diff --git a/src/cascadia/TerminalSettingsEditor/Profiles_Base.xaml b/src/cascadia/TerminalSettingsEditor/Profiles_Base.xaml
index 08d7b3a4be5..22472d4aa0e 100644
--- a/src/cascadia/TerminalSettingsEditor/Profiles_Base.xaml
+++ b/src/cascadia/TerminalSettingsEditor/Profiles_Base.xaml
@@ -58,12 +58,13 @@
                                         SettingOverrideSource="{x:Bind Profile.CommandlineOverrideSource, Mode=OneWay}"
                                         Style="{StaticResource ExpanderSettingContainerStyle}"
                                         Visibility="{x:Bind local:Converters.InvertedBooleanToVisibility(Profile.IsBaseLayer), Mode=OneWay}">
-                    <StackPanel Orientation="Horizontal">
+                    <StackPanel>
                         <TextBox x:Uid="Profile_CommandlineBox"
                                  IsSpellCheckEnabled="False"
                                  Style="{StaticResource TextBoxSettingStyle}"
                                  Text="{x:Bind Profile.Commandline, Mode=TwoWay}" />
                         <Button x:Uid="Profile_CommandlineBrowse"
+                                Margin="0,10,0,0"
                                 Click="Commandline_Click"
                                 Style="{StaticResource BrowseButtonStyle}" />
                     </StackPanel>
@@ -78,21 +79,23 @@
                                         SettingOverrideSource="{x:Bind Profile.StartingDirectoryOverrideSource, Mode=OneWay}"
                                         Style="{StaticResource ExpanderSettingContainerStyle}">
                     <StackPanel Orientation="Vertical">
+                        <TextBox x:Uid="Profile_StartingDirectoryBox"
+                                 IsEnabled="{x:Bind Profile.UseCustomStartingDirectory, Mode=OneWay}"
+                                 IsSpellCheckEnabled="False"
+                                 Style="{StaticResource TextBoxSettingStyle}"
+                                 Text="{x:Bind Profile.StartingDirectory, Mode=TwoWay}" />
                         <StackPanel Orientation="Horizontal">
-                            <TextBox x:Uid="Profile_StartingDirectoryBox"
-                                     IsEnabled="{x:Bind Profile.UseCustomStartingDirectory, Mode=OneWay}"
-                                     IsSpellCheckEnabled="False"
-                                     Style="{StaticResource TextBoxSettingStyle}"
-                                     Text="{x:Bind Profile.StartingDirectory, Mode=TwoWay}" />
                             <Button x:Name="StartingDirectoryBrowse"
                                     x:Uid="Profile_StartingDirectoryBrowse"
+                                    Margin="0,10,10,0"
                                     Click="StartingDirectory_Click"
                                     IsEnabled="{x:Bind Profile.UseCustomStartingDirectory, Mode=OneWay}"
                                     Style="{StaticResource BrowseButtonStyle}" />
+                            <CheckBox x:Name="StartingDirectoryUseParentCheckbox"
+                                      x:Uid="Profile_StartingDirectoryUseParentCheckbox"
+                                      Margin="0,5,0,0"
+                                      IsChecked="{x:Bind Profile.UseParentProcessDirectory, Mode=TwoWay}" />
                         </StackPanel>
-                        <CheckBox x:Name="StartingDirectoryUseParentCheckbox"
-                                  x:Uid="Profile_StartingDirectoryUseParentCheckbox"
-                                  IsChecked="{x:Bind Profile.UseParentProcessDirectory, Mode=TwoWay}" />
                     </StackPanel>
                 </local:SettingContainer>
 
@@ -103,13 +106,14 @@
                                         HasSettingValue="{x:Bind Profile.HasIcon, Mode=OneWay}"
                                         SettingOverrideSource="{x:Bind Profile.IconOverrideSource, Mode=OneWay}"
                                         Style="{StaticResource ExpanderSettingContainerStyle}">
-                    <StackPanel Orientation="Horizontal">
+                    <StackPanel>
                         <TextBox x:Uid="Profile_IconBox"
                                  FontFamily="Segoe UI, Segoe MDL2 Assets"
                                  IsSpellCheckEnabled="False"
                                  Style="{StaticResource TextBoxSettingStyle}"
                                  Text="{x:Bind Profile.Icon, Mode=TwoWay}" />
                         <Button x:Uid="Profile_IconBrowse"
+                                Margin="0,10,0,0"
                                 Click="Icon_Click"
                                 Style="{StaticResource BrowseButtonStyle}" />
                     </StackPanel>


Test patch: