Skip to content

Commit 538451f

Browse files
committed
Correction of expander logic
-If the search is expanded, expand the snippets panel because of the filtering view
1 parent 9004139 commit 538451f

File tree

2 files changed

+16
-5
lines changed

2 files changed

+16
-5
lines changed

src/CodeSnip/MainViewModel.cs

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,10 @@ public partial class MainViewModel : ObservableObject
8181
private bool _isSearchExpanded = false;
8282

8383
[ObservableProperty]
84-
private bool _isSnippetMetadataExpanded = true;
84+
private bool _isSnippetsExpanded = true;
85+
86+
[ObservableProperty]
87+
private bool _isSnippetMetadataExpanded = false;
8588

8689
[ObservableProperty]
8790
private string _filterText = string.Empty;
@@ -199,6 +202,15 @@ public void InitializeEditor(TextEditor textEditor)
199202
_searchReplacePanel = SearchReplacePanel.Install(textEditor);
200203
}
201204

205+
partial void OnIsSearchExpandedChanged(bool value)
206+
{
207+
// If expanding the search panel, also ensure snippets panel is expanded
208+
if (value)
209+
{
210+
IsSnippetsExpanded = true;
211+
}
212+
}
213+
202214
partial void OnFilterTextChanged(string? oldValue, string newValue)
203215
{
204216
if (!IsFilteringEnabled) return;

src/CodeSnip/MainWindow.xaml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -110,9 +110,8 @@
110110
<RowDefinition Height="*"/>
111111
<!-- Snippets expander -->
112112
</Grid.RowDefinitions>
113-
<Expander Header="Search" Grid.Row="0" Margin="0,0,2,3"
114-
IsExpanded="{Binding IsSearchExpanded, Mode=TwoWay}">
115-
<Grid Margin="0,10,0,0" VerticalAlignment="Center">
113+
<Expander Header="Search" Grid.Row="0" Margin="0,0,2,3" IsExpanded="{Binding IsSearchExpanded, Mode=TwoWay}">
114+
<Grid Margin="0,5,0,5" VerticalAlignment="Center">
116115
<Grid.ColumnDefinitions>
117116
<ColumnDefinition Width="Auto" />
118117
<!-- RadioButton "by Name" -->
@@ -135,7 +134,7 @@
135134
Text="{Binding FilterText, UpdateSourceTrigger=PropertyChanged}" />
136135
</Grid>
137136
</Expander>
138-
<Expander Header="Snippets" Grid.Row="1" Margin="0,0,2,0" IsExpanded="True">
137+
<Expander Header="Snippets" Grid.Row="1" Margin="0,0,2,0" IsExpanded="{Binding IsSnippetsExpanded, Mode=TwoWay}">
139138
<Grid>
140139
<Grid.RowDefinitions>
141140
<RowDefinition Height="*"/>

0 commit comments

Comments
 (0)