Skip to content

Commit

Permalink
Add a pile of 'experimental' settings to the profile SUI (#16809)
Browse files Browse the repository at this point in the history
As noted in #3337, we never actually added this menu to the settings. 

Since we're planning on taking this out of "experimental" in 1.21, we
should have a visible setting for it too.
  • Loading branch information
zadjii-msft authored Mar 21, 2024
1 parent 0a83946 commit b9a0cae
Show file tree
Hide file tree
Showing 6 changed files with 100 additions and 1 deletion.
1 change: 0 additions & 1 deletion src/cascadia/TerminalControl/TermControl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,6 @@ namespace winrt::Microsoft::Terminal::Control::implementation
// (The window has a min. size that ensures that there's always a scrollbar thumb.)
if (drawableRange < 0)
{
assert(false);
return;
}

Expand Down
12 changes: 12 additions & 0 deletions src/cascadia/TerminalSettingsEditor/ProfileViewModel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,18 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
{
return Feature_VtPassthroughMode::IsEnabled() && Feature_VtPassthroughModeSettingInUI::IsEnabled();
}
bool ProfileViewModel::ShowMarksAvailable() const noexcept
{
return Feature_ScrollbarMarks::IsEnabled();
}
bool ProfileViewModel::AutoMarkPromptsAvailable() const noexcept
{
return Feature_ScrollbarMarks::IsEnabled();
}
bool ProfileViewModel::RepositionCursorWithMouseAvailable() const noexcept
{
return Feature_ScrollbarMarks::IsEnabled();
}

bool ProfileViewModel::UseParentProcessDirectory()
{
Expand Down
8 changes: 8 additions & 0 deletions src/cascadia/TerminalSettingsEditor/ProfileViewModel.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,11 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
bool ShowUnfocusedAppearance();
void CreateUnfocusedAppearance();
void DeleteUnfocusedAppearance();

bool VtPassthroughAvailable() const noexcept;
bool ShowMarksAvailable() const noexcept;
bool AutoMarkPromptsAvailable() const noexcept;
bool RepositionCursorWithMouseAvailable() const noexcept;

til::typed_event<Editor::ProfileViewModel, Editor::DeleteProfileEventArgs> DeleteProfileRequested;

Expand Down Expand Up @@ -115,6 +119,10 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
OBSERVABLE_PROJECTED_SETTING(_profile, Elevate);
OBSERVABLE_PROJECTED_SETTING(_profile, VtPassthrough);
OBSERVABLE_PROJECTED_SETTING(_profile, ReloadEnvironmentVariables);
OBSERVABLE_PROJECTED_SETTING(_profile, RightClickContextMenu);
OBSERVABLE_PROJECTED_SETTING(_profile, ShowMarks);
OBSERVABLE_PROJECTED_SETTING(_profile, AutoMarkPrompts);
OBSERVABLE_PROJECTED_SETTING(_profile, RepositionCursorWithMouse);

WINRT_PROPERTY(bool, IsBaseLayer, false);
WINRT_PROPERTY(bool, FocusDeleteButton, false);
Expand Down
8 changes: 8 additions & 0 deletions src/cascadia/TerminalSettingsEditor/ProfileViewModel.idl
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,11 @@ namespace Microsoft.Terminal.Settings.Editor
Boolean EditableUnfocusedAppearance { get; };
Boolean ShowUnfocusedAppearance { get; };
AppearanceViewModel UnfocusedAppearance { get; };

Boolean VtPassthroughAvailable { get; };
Boolean ShowMarksAvailable { get; };
Boolean AutoMarkPromptsAvailable { get; };
Boolean RepositionCursorWithMouseAvailable { get; };

String EvaluatedIcon { get; };

Expand Down Expand Up @@ -109,5 +113,9 @@ namespace Microsoft.Terminal.Settings.Editor
OBSERVABLE_PROJECTED_PROFILE_SETTING(Boolean, Elevate);
OBSERVABLE_PROJECTED_PROFILE_SETTING(Boolean, VtPassthrough);
OBSERVABLE_PROJECTED_PROFILE_SETTING(Boolean, ReloadEnvironmentVariables);
OBSERVABLE_PROJECTED_PROFILE_SETTING(Boolean, RightClickContextMenu);
OBSERVABLE_PROJECTED_PROFILE_SETTING(Boolean, ShowMarks);
OBSERVABLE_PROJECTED_PROFILE_SETTING(Boolean, AutoMarkPrompts);
OBSERVABLE_PROJECTED_PROFILE_SETTING(Boolean, RepositionCursorWithMouse);
}
}
40 changes: 40 additions & 0 deletions src/cascadia/TerminalSettingsEditor/Profiles_Advanced.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,35 @@
Style="{StaticResource ToggleSwitchInExpanderStyle}" />
</local:SettingContainer>

<!-- RightClickContextMenu -->
<local:SettingContainer x:Uid="Profile_RightClickContextMenu"
ClearSettingValue="{x:Bind Profile.ClearRightClickContextMenu}"
HasSettingValue="{x:Bind Profile.HasRightClickContextMenu, Mode=OneWay}"
SettingOverrideSource="{x:Bind Profile.RightClickContextMenuOverrideSource, Mode=OneWay}">
<ToggleSwitch IsOn="{x:Bind Profile.RightClickContextMenu, Mode=TwoWay}"
Style="{StaticResource ToggleSwitchInExpanderStyle}" />
</local:SettingContainer>

<!-- ShowMarks -->
<local:SettingContainer x:Uid="Profile_ShowMarks"
ClearSettingValue="{x:Bind Profile.ClearShowMarks}"
HasSettingValue="{x:Bind Profile.HasShowMarks, Mode=OneWay}"
SettingOverrideSource="{x:Bind Profile.ShowMarksOverrideSource, Mode=OneWay}"
Visibility="{x:Bind Profile.ShowMarksAvailable}">
<ToggleSwitch IsOn="{x:Bind Profile.ShowMarks, Mode=TwoWay}"
Style="{StaticResource ToggleSwitchInExpanderStyle}" />
</local:SettingContainer>

<!-- AutoMarkPrompts -->
<local:SettingContainer x:Uid="Profile_AutoMarkPrompts"
ClearSettingValue="{x:Bind Profile.ClearAutoMarkPrompts}"
HasSettingValue="{x:Bind Profile.HasAutoMarkPrompts, Mode=OneWay}"
SettingOverrideSource="{x:Bind Profile.AutoMarkPromptsOverrideSource, Mode=OneWay}"
Visibility="{x:Bind Profile.AutoMarkPromptsAvailable}">
<ToggleSwitch IsOn="{x:Bind Profile.AutoMarkPrompts, Mode=TwoWay}"
Style="{StaticResource ToggleSwitchInExpanderStyle}" />
</local:SettingContainer>

<!-- ReloadEnvVars -->
<local:SettingContainer x:Uid="Profile_ReloadEnvVars"
ClearSettingValue="{x:Bind Profile.ClearReloadEnvironmentVariables}"
Expand All @@ -135,6 +164,17 @@
<ToggleSwitch IsOn="{x:Bind Profile.ReloadEnvironmentVariables, Mode=TwoWay}"
Style="{StaticResource ToggleSwitchInExpanderStyle}" />
</local:SettingContainer>

<!-- RepositionCursorWithMouse -->
<local:SettingContainer x:Uid="Profile_RepositionCursorWithMouse"
ClearSettingValue="{x:Bind Profile.ClearRepositionCursorWithMouse}"
HasSettingValue="{x:Bind Profile.HasRepositionCursorWithMouse, Mode=OneWay}"
SettingOverrideSource="{x:Bind Profile.RepositionCursorWithMouseOverrideSource, Mode=OneWay}"
Visibility="{x:Bind Profile.RepositionCursorWithMouseAvailable}">
<ToggleSwitch IsOn="{x:Bind Profile.RepositionCursorWithMouse, Mode=TwoWay}"
Style="{StaticResource ToggleSwitchInExpanderStyle}" />
</local:SettingContainer>

</StackPanel>
</Grid>
</Page>
32 changes: 32 additions & 0 deletions src/cascadia/TerminalSettingsEditor/Resources/en-US/Resources.resw
Original file line number Diff line number Diff line change
Expand Up @@ -1218,6 +1218,38 @@
<value>Enable experimental virtual terminal passthrough</value>
<comment>An option to enable experimental virtual terminal passthrough connectivity option with the underlying ConPTY</comment>
</data>
<data name="Profile_RightClickContextMenu.Header" xml:space="preserve">
<value>Display a menu on right-click</value>
<comment>This controls how a right-click behaves in the terminal</comment>
</data>
<data name="Profile_RightClickContextMenu.HelpText" xml:space="preserve">
<value>When enabled, the Terminal will display a menu on right-click. When disabled, right-clicking will copy the selected text (or paste if there's no selection).</value>
<comment>A description for what the "Display a menu on right-click" setting does. Presented near "Profile_RightClickContextMenu".</comment>
</data>
<data name="Profile_ShowMarks.Header" xml:space="preserve">
<value>Display marks on the scrollbar</value>
<comment>"Marks" are small visual indicators that can help the user identify the position of useful info in the scrollbar</comment>
</data>
<data name="Profile_ShowMarks.HelpText" xml:space="preserve">
<value>When enabled, the Terminal will display marks in the scrollbar when searching for text, or when shell integration is enabled.</value>
<comment>A description for what the "Display marks on the scrollbar" setting does. Presented near "Profile_ShowMarks".</comment>
</data>
<data name="Profile_AutoMarkPrompts.Header" xml:space="preserve">
<value>Automatically mark prompts on pressing Enter</value>
<comment>"Enter" is the enter/return key on the keyboard. This will add a mark indicating the position of a shell prompt when the user presses enter.</comment>
</data>
<data name="Profile_AutoMarkPrompts.HelpText" xml:space="preserve">
<value>When enabled, the Terminal automatically add a mark indicating the position of the end of the command when you press enter.</value>
<comment>A description for what the "Automatically mark prompts on pressing Enter" setting does. Presented near "Profile_AutoMarkPrompts".</comment>
</data>
<data name="Profile_RepositionCursorWithMouse.Header" xml:space="preserve">
<value>Experimental: Reposition the cursor with mouse clicks</value>
<comment>This allows the user to move the text cursor just by clicking with the mouse.</comment>
</data>
<data name="Profile_RepositionCursorWithMouse.HelpText" xml:space="preserve">
<value>When enabled, clicking inside the prompt will move the cursor to that position. This requires shell integration to be enabled in your shell to work as expected.</value>
<comment>A description for what the "Reload environment variables" setting does. Presented near "Profile_RepositionCursorWithMouse".</comment>
</data>
<data name="Profile_BellStyleAudible.Content" xml:space="preserve">
<value>Audible</value>
<comment>An option to choose from for the "bell style" setting. When selected, an audible cue is used to notify the user.</comment>
Expand Down

0 comments on commit b9a0cae

Please sign in to comment.