feature: supports to use Ctrl+D/⌘+D to open in external diff/merge tool (#1312)

This commit is contained in:
leo 2025-05-14 16:01:47 +08:00
parent d3363429df
commit bc5c4670de
No known key found for this signature in database
5 changed files with 18 additions and 2 deletions

View file

@ -406,6 +406,7 @@
<x:String x:Key="Text.Hotkeys.TextEditor.CloseSearch" xml:space="preserve">Close search panel</x:String>
<x:String x:Key="Text.Hotkeys.TextEditor.GotoNextMatch" xml:space="preserve">Find next match</x:String>
<x:String x:Key="Text.Hotkeys.TextEditor.GotoPrevMatch" xml:space="preserve">Find previous match</x:String>
<x:String x:Key="Text.Hotkeys.TextEditor.OpenExternalMergeTool" xml:space="preserve">Open with external diff/merge tool</x:String>
<x:String x:Key="Text.Hotkeys.TextEditor.Search" xml:space="preserve">Open search panel</x:String>
<x:String x:Key="Text.Hunk.Discard" xml:space="preserve">Discard</x:String>
<x:String x:Key="Text.Hunk.Stage" xml:space="preserve">Stage</x:String>

View file

@ -410,6 +410,7 @@
<x:String x:Key="Text.Hotkeys.TextEditor.CloseSearch" xml:space="preserve">关闭搜索</x:String>
<x:String x:Key="Text.Hotkeys.TextEditor.GotoNextMatch" xml:space="preserve">定位到下一个匹配搜索的位置</x:String>
<x:String x:Key="Text.Hotkeys.TextEditor.GotoPrevMatch" xml:space="preserve">定位到上一个匹配搜索的位置</x:String>
<x:String x:Key="Text.Hotkeys.TextEditor.OpenExternalMergeTool" xml:space="preserve">使用外部比对工具查看</x:String>
<x:String x:Key="Text.Hotkeys.TextEditor.Search" xml:space="preserve">打开搜索</x:String>
<x:String x:Key="Text.Hunk.Discard" xml:space="preserve">丢弃</x:String>
<x:String x:Key="Text.Hunk.Stage" xml:space="preserve">暂存</x:String>

View file

@ -410,6 +410,7 @@
<x:String x:Key="Text.Hotkeys.TextEditor.CloseSearch" xml:space="preserve">關閉搜尋面板</x:String>
<x:String x:Key="Text.Hotkeys.TextEditor.GotoNextMatch" xml:space="preserve">前往下一個搜尋相符的位置</x:String>
<x:String x:Key="Text.Hotkeys.TextEditor.GotoPrevMatch" xml:space="preserve">前往上一個搜尋相符的位置</x:String>
<x:String x:Key="Text.Hotkeys.TextEditor.OpenExternalMergeTool" xml:space="preserve">使用外部比對工具檢視</x:String>
<x:String x:Key="Text.Hotkeys.TextEditor.Search" xml:space="preserve">開啟搜尋面板</x:String>
<x:String x:Key="Text.Hunk.Discard" xml:space="preserve">捨棄</x:String>
<x:String x:Key="Text.Hunk.Stage" xml:space="preserve">暫存</x:String>

View file

@ -175,7 +175,17 @@
<Path Width="12" Height="12" Data="{StaticResource Icons.Layout}" Margin="0,2,0,0"/>
</ToggleButton>
<Button Classes="icon_button" Width="28" Command="{Binding OpenExternalMergeTool}" ToolTip.Tip="{DynamicResource Text.Diff.UseMerger}">
<Button Classes="icon_button"
Width="28"
Command="{Binding OpenExternalMergeTool}"
HotKey="{OnPlatform Ctrl+D, macOS=⌘+D}">
<ToolTip.Tip>
<TextBlock>
<Run Text="{DynamicResource Text.Diff.UseMerger}"/>
<Run Text=" "/>
<Run Text="{OnPlatform Ctrl+D, macOS=⌘+D}" Foreground="{DynamicResource Brush.FG2}"/>
</TextBlock>
</ToolTip.Tip>
<Path Width="12" Height="12" Stretch="Uniform" Data="{StaticResource Icons.OpenWith}"/>
</Button>
</StackPanel>

View file

@ -130,7 +130,7 @@
FontSize="{Binding Source={x:Static vm:Preferences.Instance}, Path=DefaultFontSize, Converter={x:Static c:DoubleConverters.Increase}}"
Margin="0,8"/>
<Grid RowDefinitions="20,20,20,20" ColumnDefinitions="150,*">
<Grid RowDefinitions="20,20,20,20,20" ColumnDefinitions="150,*">
<TextBlock Grid.Row="0" Grid.Column="0" Classes="primary bold" Text="{OnPlatform Ctrl+F, macOS=⌘+F}"/>
<TextBlock Grid.Row="0" Grid.Column="1" Margin="16,0,0,0" Text="{DynamicResource Text.Hotkeys.TextEditor.Search}" />
@ -142,6 +142,9 @@
<TextBlock Grid.Row="3" Grid.Column="0" Classes="primary bold" Text="ESC"/>
<TextBlock Grid.Row="3" Grid.Column="1" Margin="16,0,0,0" Text="{DynamicResource Text.Hotkeys.TextEditor.CloseSearch}" />
<TextBlock Grid.Row="4" Grid.Column="0" Classes="primary bold" Text="{OnPlatform Ctrl+D, macOS=⌘+D}"/>
<TextBlock Grid.Row="4" Grid.Column="1" Margin="16,0,0,0" Text="{DynamicResource Text.Hotkeys.TextEditor.OpenExternalMergeTool}" />
</Grid>
</StackPanel>
</Border>