Skip to content

Commit 5c454c5

Browse files
authored
Always select first column on F2 (#2817)
1 parent 6bf36d6 commit 5c454c5

File tree

3 files changed

+12
-9
lines changed

3 files changed

+12
-9
lines changed

Files/BaseLayout.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ internal set
9191
if (value != selectedItems)
9292
{
9393
selectedItems = value;
94-
if (selectedItems.Count == 0)
94+
if (selectedItems.Count == 0 || selectedItems[0] == null)
9595
{
9696
IsItemSelected = false;
9797
SelectedItem = null;

Files/Views/LayoutModes/GenericFileBrowser.xaml.cs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -176,8 +176,11 @@ public override void FocusSelectedItems()
176176

177177
public override void StartRenameItem()
178178
{
179-
AllView.CurrentColumn = AllView.Columns[1];
180-
AllView.BeginEdit();
179+
if (AllView.SelectedIndex != -1)
180+
{
181+
AllView.CurrentColumn = AllView.Columns[1];
182+
AllView.BeginEdit();
183+
}
181184
}
182185

183186
private void ViewModel_PropertyChanged(object sender, PropertyChangedEventArgs e)

Files/Views/ModernShellPage.xaml.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1115,17 +1115,17 @@ await FilesystemHelpers.DeleteItemsAsync(
11151115
break;
11161116
};
11171117

1118-
if (CurrentPageType == typeof(GridViewBrowser))
1118+
switch (args.KeyboardAccelerator.Key)
11191119
{
1120-
switch (args.KeyboardAccelerator.Key)
1121-
{
1122-
case VirtualKey.F2: //F2, rename
1120+
case VirtualKey.F2: //F2, rename
1121+
if (CurrentPageType == typeof(GenericFileBrowser) || CurrentPageType == typeof(GridViewBrowser))
1122+
{
11231123
if (ContentPage.IsItemSelected)
11241124
{
11251125
InteractionOperations.RenameItem_Click(null, null);
11261126
}
1127-
break;
1128-
}
1127+
}
1128+
break;
11291129
}
11301130
}
11311131

0 commit comments

Comments
 (0)