Compare commits

..

No commits in common. "19e930ef40bdeee38f60b9343c305360e8da9312" and "bb907deddb4b9bce9bceddbc340efb59145429a5" have entirely different histories.

7 changed files with 31 additions and 59 deletions

View file

@ -623,7 +623,8 @@
<x:String x:Key="Text.WorkingCopy.CommitAndPush" xml:space="preserve">COMMIT &amp; PUSH</x:String>
<x:String x:Key="Text.WorkingCopy.CommitMessageHelper" xml:space="preserve">Template/Histories</x:String>
<x:String x:Key="Text.WorkingCopy.CommitTip" xml:space="preserve">CTRL + Enter</x:String>
<x:String x:Key="Text.WorkingCopy.CommitWithAutoStage" xml:space="preserve">Use 'Ctrl(⌘)+Shift+Enter' to stage all changes and commit</x:String>
<x:String x:Key="Text.WorkingCopy.CommitWithAutoStage" xml:space="preserve">Use 'Alt+Enter' to stage all changes and commit</x:String>
<x:String x:Key="Text.WorkingCopy.CommitWithAutoStage.MacOS" xml:space="preserve">Use '⌥+Enter' to stage all changes and commit</x:String>
<x:String x:Key="Text.WorkingCopy.Conflicts" xml:space="preserve">CONFLICTS DETECTED</x:String>
<x:String x:Key="Text.WorkingCopy.Conflicts.Resolved" xml:space="preserve">FILE CONFLICTS ARE RESOLVED</x:String>
<x:String x:Key="Text.WorkingCopy.IncludeUntracked" xml:space="preserve">INCLUDE UNTRACKED FILES</x:String>

View file

@ -621,7 +621,8 @@
<x:String x:Key="Text.WorkingCopy.CommitAndPush" xml:space="preserve">提交并推送</x:String>
<x:String x:Key="Text.WorkingCopy.CommitMessageHelper" xml:space="preserve">历史输入/模板</x:String>
<x:String x:Key="Text.WorkingCopy.CommitTip" xml:space="preserve">CTRL + Enter</x:String>
<x:String x:Key="Text.WorkingCopy.CommitWithAutoStage" xml:space="preserve">使用 Ctrl(⌘)+Shift+Enter 自动暂存所有变更并提交</x:String>
<x:String x:Key="Text.WorkingCopy.CommitWithAutoStage" xml:space="preserve">使用 Alt+Enter 自动暂存所有变更并提交</x:String>
<x:String x:Key="Text.WorkingCopy.CommitWithAutoStage.MacOS" xml:space="preserve">使用 ⌥+Enter 自动暂存所有变更并提交</x:String>
<x:String x:Key="Text.WorkingCopy.Conflicts" xml:space="preserve">检测到冲突</x:String>
<x:String x:Key="Text.WorkingCopy.Conflicts.Resolved" xml:space="preserve">文件冲突已解决</x:String>
<x:String x:Key="Text.WorkingCopy.IncludeUntracked" xml:space="preserve">显示未跟踪文件</x:String>

View file

@ -626,7 +626,8 @@
<x:String x:Key="Text.WorkingCopy.CommitAndPush" xml:space="preserve">提交並推送</x:String>
<x:String x:Key="Text.WorkingCopy.CommitMessageHelper" xml:space="preserve">歷史輸入/範本</x:String>
<x:String x:Key="Text.WorkingCopy.CommitTip" xml:space="preserve">CTRL + Enter</x:String>
<x:String x:Key="Text.WorkingCopy.CommitWithAutoStage" xml:space="preserve">使用 Ctrl(⌘)+Shift+Enter 自動暫存全部變更並提交</x:String>
<x:String x:Key="Text.WorkingCopy.CommitWithAutoStage" xml:space="preserve">使用 Alt+Enter 自動暫存全部變更並提交</x:String>
<x:String x:Key="Text.WorkingCopy.CommitWithAutoStage.MacOS" xml:space="preserve">使用 ⌥+Enter 自動暫存全部變更並提交</x:String>
<x:String x:Key="Text.WorkingCopy.Conflicts" xml:space="preserve">檢測到衝突</x:String>
<x:String x:Key="Text.WorkingCopy.Conflicts.Resolved" xml:space="preserve">檔案衝突已解決</x:String>
<x:String x:Key="Text.WorkingCopy.IncludeUntracked" xml:space="preserve">顯示未追蹤檔案</x:String>

View file

@ -33,7 +33,7 @@ namespace SourceGit.Views
return;
var view = TextView;
if (view is { VisualLinesValid: true })
if (view != null && view.VisualLinesValid)
{
var typeface = view.CreateTypeface();
var underlinePen = new Pen(Brushes.DarkOrange);
@ -142,53 +142,12 @@ namespace SourceGit.Views
return new Size(maxWidth, 0);
}
protected override void OnPointerMoved(PointerEventArgs e)
{
base.OnPointerMoved(e);
var view = TextView;
if (!e.Handled && view is { VisualLinesValid: true })
{
var pos = e.GetPosition(this);
var typeface = view.CreateTypeface();
foreach (var line in view.VisualLines)
{
if (line.IsDisposed || line.FirstDocumentLine == null || line.FirstDocumentLine.IsDeleted)
continue;
var lineNumber = line.FirstDocumentLine.LineNumber;
if (lineNumber >= _editor.BlameData.LineInfos.Count)
break;
var info = _editor.BlameData.LineInfos[lineNumber - 1];
var y = line.GetTextLineVisualYPosition(line.TextLines[0], VisualYPosition.TextTop) - view.VerticalOffset;
var shaLink = new FormattedText(
info.CommitSHA,
CultureInfo.CurrentCulture,
FlowDirection.LeftToRight,
typeface,
_editor.FontSize,
Brushes.DarkOrange);
var rect = new Rect(0, y, shaLink.Width, shaLink.Height);
if (rect.Contains(pos))
{
Cursor = Cursor.Parse("Hand");
return;
}
}
}
Cursor = Cursor.Default;
}
protected override void OnPointerPressed(PointerPressedEventArgs e)
{
base.OnPointerPressed(e);
var view = TextView;
if (!e.Handled && e.GetCurrentPoint(this).Properties.IsLeftButtonPressed && view is { VisualLinesValid: true })
if (!e.Handled && e.GetCurrentPoint(this).Properties.IsLeftButtonPressed && view != null && view.VisualLinesValid)
{
var pos = e.GetPosition(this);
var typeface = view.CreateTypeface();

View file

@ -87,7 +87,6 @@
<TextBlock Grid.Column="2"
Classes="primary"
Text="{Binding SHA, Converter={x:Static c:StringConverters.ToShortSHA}}"
Cursor="Hand"
Background="Transparent"
Foreground="DarkOrange"
TextDecorations="Underline"

View file

@ -103,10 +103,10 @@
<TextBlock Grid.Row="7" Grid.Column="0" Classes="primary bold" Text="{OnPlatform Ctrl+Enter, macOS=⌘+Enter}"/>
<TextBlock Grid.Row="7" Grid.Column="1" Margin="16,0,0,0" Text="{DynamicResource Text.Hotkeys.Repo.Commit}" />
<TextBlock Grid.Row="8" Grid.Column="0" Classes="primary bold" Text="{OnPlatform Ctrl+Shift+Enter, macOS=⌘+⇧+Enter}"/>
<TextBlock Grid.Row="8" Grid.Column="0" Classes="primary bold" Text="{OnPlatform Alt+Enter, macOS=⌥+Enter}"/>
<TextBlock Grid.Row="8" Grid.Column="1" Margin="16,0,0,0" Text="{DynamicResource Text.Hotkeys.Repo.CommitWithAutoStage}" />
<TextBlock Grid.Row="9" Grid.Column="0" Classes="primary bold" Text="{OnPlatform Alt+Enter, macOS=⌥+Enter}"/>
<TextBlock Grid.Row="9" Grid.Column="0" Classes="primary bold" Text="{OnPlatform Ctrl+Shift+Enter, macOS=⌘+⇧+Enter}"/>
<TextBlock Grid.Row="9" Grid.Column="1" Margin="16,0,0,0" Text="{DynamicResource Text.Hotkeys.Repo.CommitAndPush}" />
<TextBlock Grid.Row="10" Grid.Column="0" Classes="primary bold" Text="F5"/>

View file

@ -226,21 +226,32 @@
ToolTip.Placement="Top"
ToolTip.VerticalOffset="0">
<ToolTip.Tip>
<TextBlock TextWrapping="Wrap" TextAlignment="Left">
<Run Text="{OnPlatform Ctrl+Enter, macOS=⌘+Enter}"/>
<Run Foreground="{DynamicResource Brush.FG2}"
FontSize="12"
Text="{DynamicResource Text.WorkingCopy.CommitWithAutoStage}"/>
</TextBlock>
<StackPanel Orientation="Vertical">
<TextBlock Text="{OnPlatform Ctrl+Enter, macOS=⌘+Enter}"/>
<TextBlock Classes="small italic"
Margin="0,4,0,0"
Foreground="{DynamicResource Brush.FG2}">
<TextBlock.Text>
<OnPlatform>
<On Options="Windows, Linux">
<DynamicResource ResourceKey="Text.WorkingCopy.CommitWithAutoStage"/>
</On>
<On Options="macOS">
<DynamicResource ResourceKey="Text.WorkingCopy.CommitWithAutoStage.MacOS"/>
</On>
</OnPlatform>
</TextBlock.Text>
</TextBlock>
</StackPanel>
</ToolTip.Tip>
</Button>
<!-- Invisible button just to add another hotkey `Ctrl+Shift+Enter` to commit with auto-stage -->
<!-- Invisible button just to add another hotkey `Alt+Enter/⌥+Enter` to commit with auto-stage -->
<Button Grid.Column="7"
Width="0" Height="0"
Background="Transparent"
Command="{Binding CommitWithAutoStage}"
HotKey="{OnPlatform Ctrl+Shift+Enter, macOS=⌘+Shift+Enter}"/>
HotKey="Alt+Enter"/>
<Button Grid.Column="8"
Classes="flat"
@ -249,8 +260,8 @@
Margin="8,0,0,0"
Padding="8,0"
Command="{Binding CommitWithPush}"
HotKey="Alt+Enter"
ToolTip.Tip="{OnPlatform Alt+Enter, macOS=⌥+Enter}"
HotKey="{OnPlatform Ctrl+Shift+Enter, macOS=⌘+Shift+Enter}"
ToolTip.Tip="{OnPlatform Ctrl+Shift+Enter, macOS=⌘+Shift+Enter}"
ToolTip.Placement="Top"
ToolTip.VerticalOffset="0"
IsVisible="{Binding IsCommitWithPushVisible}"/>