Skip to content

Commit 814529a

Browse files
committed
feature: add hotkeys to stage/unstage/discard block or selected lines in text diff view (#718)
Signed-off-by: leo <[email protected]>
1 parent 00804e4 commit 814529a

File tree

1 file changed

+23
-3
lines changed

1 file changed

+23
-3
lines changed

src/Views/TextDiffView.axaml

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -97,9 +97,29 @@
9797
</ContentControl>
9898

9999
<StackPanel x:Name="Popup" IsVisible="False" Orientation="Horizontal" VerticalAlignment="Top" HorizontalAlignment="Right" Effect="drop-shadow(0 0 8 #80000000)">
100-
<Button Classes="flat" Content="{DynamicResource Text.Hunk.Stage}" Click="OnStageChunk" IsVisible="{Binding #ThisControl.IsUnstagedChange}"/>
101-
<Button Classes="flat" Content="{DynamicResource Text.Hunk.Unstage}" Click="OnUnstageChunk" IsVisible="{Binding #ThisControl.IsUnstagedChange, Converter={x:Static BoolConverters.Not}}"/>
102-
<Button Classes="flat" Content="{DynamicResource Text.Hunk.Discard}" Margin="8,0,0,0" Click="OnDiscardChunk" IsVisible="{Binding #ThisControl.IsUnstagedChange}"/>
100+
<Button Classes="flat" Click="OnStageChunk" HotKey="{OnPlatform Ctrl+S, macOS=⌘+S}" IsVisible="{Binding #ThisControl.IsUnstagedChange}">
101+
<TextBlock>
102+
<Run Text="{DynamicResource Text.Hunk.Stage}"/>
103+
<Run Text=" "/>
104+
<Run Foreground="{DynamicResource Brush.FG2}" FontWeight="Normal" Text="{OnPlatform Ctrl+S, macOS=⌘+S}"/>
105+
</TextBlock>
106+
</Button>
107+
108+
<Button Classes="flat" Click="OnUnstageChunk" HotKey="{OnPlatform Ctrl+U, macOS=⌘+U}" IsVisible="{Binding #ThisControl.IsUnstagedChange, Converter={x:Static BoolConverters.Not}}">
109+
<TextBlock>
110+
<Run Text="{DynamicResource Text.Hunk.Unstage}"/>
111+
<Run Text=" "/>
112+
<Run Foreground="{DynamicResource Brush.FG2}" FontWeight="Normal" Text="{OnPlatform Ctrl+U, macOS=⌘+U}"/>
113+
</TextBlock>
114+
</Button>
115+
116+
<Button Classes="flat" Margin="8,0,0,0" HotKey="{OnPlatform Ctrl+D, macOS=⌘+D}" Click="OnDiscardChunk" IsVisible="{Binding #ThisControl.IsUnstagedChange}">
117+
<TextBlock>
118+
<Run Text="{DynamicResource Text.Hunk.Discard}"/>
119+
<Run Text=" "/>
120+
<Run Foreground="{DynamicResource Brush.FG2}" FontWeight="Normal" Text="{OnPlatform Ctrl+D, macOS=⌘+D}"/>
121+
</TextBlock>
122+
</Button>
103123
</StackPanel>
104124
</Grid>
105125
</UserControl>

0 commit comments

Comments
 (0)