@@ -254,6 +254,33 @@ public void OpenChangeInMergeTool(Models.Change c)
254
254
new Commands . DiffTool ( _repo . FullPath , toolType , toolPath , opt ) . Open ( ) ;
255
255
}
256
256
257
+ public async Task SaveRevisionFile ( Models . Object file )
258
+ {
259
+ var storageProvider = App . GetStorageProvider ( ) ;
260
+ if ( storageProvider == null )
261
+ return ;
262
+
263
+ var options = new FolderPickerOpenOptions ( ) { AllowMultiple = false } ;
264
+ try
265
+ {
266
+ var selected = await storageProvider . OpenFolderPickerAsync ( options ) ;
267
+ if ( selected . Count == 1 )
268
+ {
269
+ var folder = selected [ 0 ] ;
270
+ var folderPath = folder is { Path : { IsAbsoluteUri : true } path } ? path . LocalPath : folder . Path . ToString ( ) ;
271
+ var saveTo = Path . Combine ( folderPath , Path . GetFileName ( file . Path ) ! ) ;
272
+
273
+ await Commands . SaveRevisionFile
274
+ . RunAsync ( _repo . FullPath , _commit . SHA , file . Path , saveTo )
275
+ . ConfigureAwait ( false ) ;
276
+ }
277
+ }
278
+ catch ( Exception e )
279
+ {
280
+ App . RaiseException ( _repo . FullPath , $ "Failed to save file: { e . Message } ") ;
281
+ }
282
+ }
283
+
257
284
public ContextMenu CreateChangeContextMenuByFolder ( ChangeTreeNode node , List < Models . Change > changes )
258
285
{
259
286
var fullPath = Native . OS . GetAbsPath ( _repo . FullPath , node . FullPath ) ;
@@ -540,32 +567,10 @@ public ContextMenu CreateRevisionFileContextMenu(Models.Object file)
540
567
saveAs . Header = App . Text ( "SaveAs" ) ;
541
568
saveAs . Icon = App . CreateMenuIcon ( "Icons.Save" ) ;
542
569
saveAs . IsEnabled = file . Type == Models . ObjectType . Blob ;
570
+ saveAs . Tag = OperatingSystem . IsMacOS ( ) ? "⌘+S" : "Ctrl+S" ;
543
571
saveAs . Click += async ( _ , ev ) =>
544
572
{
545
- var storageProvider = App . GetStorageProvider ( ) ;
546
- if ( storageProvider == null )
547
- return ;
548
-
549
- var options = new FolderPickerOpenOptions ( ) { AllowMultiple = false } ;
550
- try
551
- {
552
- var selected = await storageProvider . OpenFolderPickerAsync ( options ) ;
553
- if ( selected . Count == 1 )
554
- {
555
- var folder = selected [ 0 ] ;
556
- var folderPath = folder is { Path : { IsAbsoluteUri : true } path } ? path . LocalPath : folder . Path . ToString ( ) ;
557
- var saveTo = Path . Combine ( folderPath , Path . GetFileName ( file . Path ) ! ) ;
558
-
559
- await Commands . SaveRevisionFile
560
- . RunAsync ( _repo . FullPath , _commit . SHA , file . Path , saveTo )
561
- . ConfigureAwait ( false ) ;
562
- }
563
- }
564
- catch ( Exception e )
565
- {
566
- App . RaiseException ( _repo . FullPath , $ "Failed to save file: { e . Message } ") ;
567
- }
568
-
573
+ await SaveRevisionFile ( file ) ;
569
574
ev . Handled = true ;
570
575
} ;
571
576
0 commit comments