Compare commits

...

6 commits

Author SHA1 Message Date
leo
279b1819a3
feature: show commit gpg sign status (#614)
Some checks are pending
Continuous Integration / Build (push) Waiting to run
Continuous Integration / Prepare version string (push) Waiting to run
Continuous Integration / Package (push) Blocked by required conditions
Localization Check / localization-check (push) Waiting to run
Signed-off-by: leo <longshuang@msn.cn>
2024-10-29 21:03:45 +08:00
leo
5c92fbdb37
fix: MinWidth not work while manually resizing window (#619)
Signed-off-by: leo <longshuang@msn.cn>
2024-10-29 19:59:22 +08:00
leo
ee20eba047
ux: limit the minimal width/height of resizable panels (#619)
Signed-off-by: leo <longshuang@msn.cn>
2024-10-29 16:51:54 +08:00
github-actions[bot]
acd61f49a8 doc: Update translation status and missing keys 2024-10-29 01:59:40 +00:00
leo
1442dcfe00
feature: allow fetch the latest remote changes into local branch which is not current branch (#617)
Signed-off-by: leo <longshuang@msn.cn>
2024-10-29 09:59:13 +08:00
leo
489b57858f
enhance: improve NumericSort.Compare performance
Signed-off-by: leo <longshuang@msn.cn>
2024-10-29 09:36:26 +08:00
23 changed files with 283 additions and 18 deletions

View file

@ -47,7 +47,7 @@
## Translation Status
[![en_US](https://img.shields.io/badge/en__US-100%25-brightgreen)](TRANSLATION.md) [![de__DE](https://img.shields.io/badge/de__DE-98.21%25-yellow)](TRANSLATION.md) [![fr__FR](https://img.shields.io/badge/fr__FR-89.69%25-yellow)](TRANSLATION.md) [![pt__BR](https://img.shields.io/badge/pt__BR-92.83%25-yellow)](TRANSLATION.md) [![ru__RU](https://img.shields.io/badge/ru__RU-99.25%25-yellow)](TRANSLATION.md) [![zh__CN](https://img.shields.io/badge/zh__CN-100.00%25-brightgreen)](TRANSLATION.md) [![zh__TW](https://img.shields.io/badge/zh__TW-100.00%25-brightgreen)](TRANSLATION.md)
[![en_US](https://img.shields.io/badge/en__US-100%25-brightgreen)](TRANSLATION.md) [![de__DE](https://img.shields.io/badge/de__DE-98.06%25-yellow)](TRANSLATION.md) [![fr__FR](https://img.shields.io/badge/fr__FR-89.55%25-yellow)](TRANSLATION.md) [![pt__BR](https://img.shields.io/badge/pt__BR-92.69%25-yellow)](TRANSLATION.md) [![ru__RU](https://img.shields.io/badge/ru__RU-99.10%25-yellow)](TRANSLATION.md) [![zh__CN](https://img.shields.io/badge/zh__CN-100.00%25-brightgreen)](TRANSLATION.md) [![zh__TW](https://img.shields.io/badge/zh__TW-100.00%25-brightgreen)](TRANSLATION.md)
## How to Use

View file

@ -1,9 +1,10 @@
### de_DE.axaml: 98.21%
### de_DE.axaml: 98.06%
<details>
<summary>Missing Keys</summary>
- Text.BranchCM.FetchInto
- Text.ChangeCM.GenerateCommitMessage
- Text.Configure.Git.EnableSignOff
- Text.Configure.IssueTracker.AddSampleGitLabIssue
@ -19,7 +20,7 @@
</details>
### fr_FR.axaml: 89.69%
### fr_FR.axaml: 89.55%
<details>
@ -28,6 +29,7 @@
- Text.About.Chart
- Text.AIAssistant
- Text.AIAssistant.Tip
- Text.BranchCM.FetchInto
- Text.ChangeCM.GenerateCommitMessage
- Text.CherryPick.AppendSourceToMessage
- Text.CherryPick.Mainline
@ -97,7 +99,7 @@
</details>
### pt_BR.axaml: 92.83%
### pt_BR.axaml: 92.69%
<details>
@ -106,6 +108,7 @@
- Text.About.Chart
- Text.AIAssistant
- Text.AIAssistant.Tip
- Text.BranchCM.FetchInto
- Text.ChangeCM.GenerateCommitMessage
- Text.CherryPick.AppendSourceToMessage
- Text.CherryPick.Mainline
@ -154,12 +157,13 @@
</details>
### ru_RU.axaml: 99.25%
### ru_RU.axaml: 99.10%
<details>
<summary>Missing Keys</summary>
- Text.BranchCM.FetchInto
- Text.ChangeCM.GenerateCommitMessage
- Text.Configure.OpenAI
- Text.Configure.OpenAI.Prefered

View file

@ -21,6 +21,16 @@ namespace SourceGit.Commands
Args += remote;
}
public Fetch(string repo, Models.Branch local, Models.Branch remote, Action<string> outputHandler)
{
_outputHandler = outputHandler;
WorkingDirectory = repo;
Context = repo;
TraitErrorAsOutput = true;
SSHKey = new Config(repo).Get($"remote.{remote.Remote}.sshkey");
Args = $"fetch --progress --verbose {remote.Remote} {remote.Name}:{local.Name}";
}
protected override void OnReadline(string line)
{
_outputHandler?.Invoke(line);

View file

@ -0,0 +1,30 @@
namespace SourceGit.Commands
{
public class QueryCommitSignInfo : Command
{
public QueryCommitSignInfo(string repo, string sha)
{
WorkingDirectory = repo;
Context = repo;
var allowedSignersFile = new Config(repo).Get("gpg.ssh.allowedSignersFile");
if (string.IsNullOrEmpty(allowedSignersFile))
Args = $"-c gpg.ssh.allowedSignersFile=/dev/null show --no-show-signature --pretty=format:\"%G? %GK\" -s {sha}";
else
Args = $"show --no-show-signature --pretty=format:\"%G? %GK\" -s {sha}";
}
public Models.CommitSignInfo Result()
{
var rs = ReadToEnd();
if (!rs.IsSuccess)
return null;
var raw = rs.StdOut.Trim();
if (raw.Length > 1)
return new Models.CommitSignInfo() { VerifyResult = raw[0], Key = raw.Substring(2) };
return null;
}
}
}

View file

@ -0,0 +1,58 @@
using Avalonia.Media;
namespace SourceGit.Models
{
public class CommitSignInfo
{
public string Key { get; set; } = string.Empty;
public char VerifyResult { get; set; } = 'N';
public IBrush Brush
{
get
{
switch (VerifyResult)
{
case 'G':
case 'U':
return Brushes.Green;
case 'X':
case 'Y':
case 'R':
return Brushes.DarkOrange;
case 'B':
case 'E':
return Brushes.Red;
default:
return Brushes.Transparent;
}
}
}
public string ToolTip
{
get
{
switch (VerifyResult)
{
case 'G':
return $"Good Signature.\n\nKey: {Key}";
case 'B':
return $"Bad Signature.\n\nKey: {Key}";
case 'U':
return $"Good Signature with unknown validity.\n\nKey: {Key}";
case 'X':
return $"Good Signature but has expired.\n\nKey: {Key}";
case 'Y':
return $"Good Signature made by expired key.\n\nKey: {Key}";
case 'R':
return $"Good signature made by a revoked key.\n\nKey: {Key}";
case 'E':
return $"Signature cannot be checked.\n\nKey: {Key}";
default:
return "No signature.";
}
}
}
}
}

View file

@ -21,6 +21,10 @@
int loc2 = 0;
bool isDigit1 = char.IsDigit(c1);
bool isDigit2 = char.IsDigit(c2);
if (isDigit1 != isDigit2)
return c1.CompareTo(c2);
do
{
tmp1[loc1] = c1;
@ -33,7 +37,6 @@
break;
} while (char.IsDigit(c1) == isDigit1);
bool isDigit2 = char.IsDigit(c2);
do
{
tmp2[loc2] = c2;
@ -49,7 +52,7 @@
string sub1 = new string(tmp1, 0, loc1);
string sub2 = new string(tmp2, 0, loc2);
int result;
if (isDigit1 && isDigit2)
if (isDigit1)
result = loc1 == loc2 ? string.CompareOrdinal(sub1, sub2) : loc1 - loc2;
else
result = string.CompareOrdinal(sub1, sub2);

View file

@ -121,6 +121,7 @@
<StreamGeometry x:Key="Icons.Undo">M762 1024C876 818 895 504 448 514V768L64 384l384-384v248c535-14 595 472 314 776z</StreamGeometry>
<StreamGeometry x:Key="Icons.Unlock">M832 464H332V240c0-31 25-56 56-56h248c31 0 56 25 56 56v68c0 4 4 8 8 8h56c4 0 8-4 8-8v-68c0-71-57-128-128-128H388c-71 0-128 57-128 128v224h-68c-18 0-32 14-32 32v384c0 18 14 32 32 32h640c18 0 32-14 32-32V496c0-18-14-32-32-32zM540 701v53c0 4-4 8-8 8h-40c-4 0-8-4-8-8v-53c-12-9-20-23-20-39 0-27 22-48 48-48s48 22 48 48c0 16-8 30-20 39z</StreamGeometry>
<StreamGeometry x:Key="Icons.Up">M170 831l343-342L855 831l105-105-448-448L64 726 170 831z</StreamGeometry>
<StreamGeometry x:Key="Icons.Verified">M880 128A722 722 0 01555 13a77 77 0 00-85 0 719 719 0 01-325 115c-40 4-71 38-71 80v369c0 246 329 446 439 446 110 0 439-200 439-446V207c0-41-31-76-71-80zM465 692a36 36 0 01-53 0L305 579a42 42 0 010-57 36 36 0 0153 0l80 85L678 353a36 36 0 0153 0 42 42 0 01-0 57L465 692z</StreamGeometry>
<StreamGeometry x:Key="Icons.Waiting">M812 864h-29V654c0-21-11-40-28-52l-133-88 134-89c18-12 28-31 28-52V164h28c18 0 32-14 32-32s-14-32-32-32H212c-18 0-32 14-32 32s14 32 32 32h30v210c0 21 11 40 28 52l133 88-134 89c-18 12-28 31-28 52V864H212c-18 0-32 14-32 32s14 32 32 32h600c18 0 32-14 32-32s-14-32-32-32zM441 566c18-12 28-31 28-52s-11-40-28-52L306 373V164h414v209l-136 90c-18 12-28 31-28 52 0 21 11 40 28 52l135 89V695c-9-7-20-13-32-19-30-15-93-41-176-41-63 0-125 14-175 38-12 6-22 12-31 18v-36l136-90z</StreamGeometry>
<StreamGeometry x:Key="Icons.Whitespace">M0 512M1024 512M512 0M512 1024M762 412v100h-500v-100h-150v200h800v-200h-150z</StreamGeometry>
<StreamGeometry x:Key="Icons.Window.Close">M519 459 222 162a37 37 0 10-52 52l297 297L169 809a37 37 0 1052 52l297-297 297 297a37 37 0 1052-52l-297-297 297-297a37 37 0 10-52-52L519 459z</StreamGeometry>

View file

@ -55,6 +55,7 @@
<x:String x:Key="Text.BranchCM.DeleteMultiBranches" xml:space="preserve">Delete selected {0} branches</x:String>
<x:String x:Key="Text.BranchCM.DiscardAll" xml:space="preserve">Discard all changes</x:String>
<x:String x:Key="Text.BranchCM.FastForward" xml:space="preserve">Fast-Forward to ${0}$</x:String>
<x:String x:Key="Text.BranchCM.FetchInto" xml:space="preserve">Fetch ${0}$ into ${1}$...</x:String>
<x:String x:Key="Text.BranchCM.Finish" xml:space="preserve">Git Flow - Finish ${0}$</x:String>
<x:String x:Key="Text.BranchCM.Merge" xml:space="preserve">Merge ${0}$ into ${1}$...</x:String>
<x:String x:Key="Text.BranchCM.Pull" xml:space="preserve">Pull ${0}$</x:String>

View file

@ -58,6 +58,7 @@
<x:String x:Key="Text.BranchCM.DeleteMultiBranches" xml:space="preserve">删除选中的 {0} 个分支</x:String>
<x:String x:Key="Text.BranchCM.DiscardAll" xml:space="preserve">放弃所有更改</x:String>
<x:String x:Key="Text.BranchCM.FastForward" xml:space="preserve">快进(fast-forward)到 ${0}$</x:String>
<x:String x:Key="Text.BranchCM.FetchInto" xml:space="preserve">拉取(fetch) ${0}$ 至 ${1}$...</x:String>
<x:String x:Key="Text.BranchCM.Finish" xml:space="preserve">GIT工作流 - 完成 ${0}$</x:String>
<x:String x:Key="Text.BranchCM.Merge" xml:space="preserve">合并 ${0}$ 到 ${1}$...</x:String>
<x:String x:Key="Text.BranchCM.Pull" xml:space="preserve">拉回(pull) ${0}$</x:String>

View file

@ -58,6 +58,7 @@
<x:String x:Key="Text.BranchCM.DeleteMultiBranches" xml:space="preserve">刪除所選的 {0} 個分支</x:String>
<x:String x:Key="Text.BranchCM.DiscardAll" xml:space="preserve">捨棄所有變更</x:String>
<x:String x:Key="Text.BranchCM.FastForward" xml:space="preserve">快轉 (fast-forward) 到 ${0}$</x:String>
<x:String x:Key="Text.BranchCM.FetchInto" xml:space="preserve">提取(fetch) ${0}$ 至 ${1}$...</x:String>
<x:String x:Key="Text.BranchCM.Finish" xml:space="preserve">Git 工作流 - 完成 ${0}$</x:String>
<x:String x:Key="Text.BranchCM.Merge" xml:space="preserve">合併 ${0}$ 到 ${1}$...</x:String>
<x:String x:Key="Text.BranchCM.Pull" xml:space="preserve">拉取 (pull) ${0}$</x:String>

View file

@ -45,6 +45,12 @@ namespace SourceGit.ViewModels
private set => SetProperty(ref _fullMessage, value);
}
public Models.CommitSignInfo SignInfo
{
get => _signInfo;
private set => SetProperty(ref _signInfo, value);
}
public List<Models.Change> Changes
{
get => _changes;
@ -131,6 +137,7 @@ namespace SourceGit.ViewModels
_visibleChanges.Clear();
if (_selectedChanges != null)
_selectedChanges.Clear();
_signInfo = null;
_searchChangeFilter = null;
_diffContext = null;
_viewRevisionFileContent = null;
@ -474,6 +481,7 @@ namespace SourceGit.ViewModels
{
_changes = null;
FullMessage = string.Empty;
SignInfo = null;
Changes = [];
VisibleChanges = null;
SelectedChanges = null;
@ -488,6 +496,12 @@ namespace SourceGit.ViewModels
Dispatcher.UIThread.Invoke(() => FullMessage = fullMessage);
});
Task.Run(() =>
{
var signInfo = new Commands.QueryCommitSignInfo(_repo.FullPath, _commit.SHA).Result();
Dispatcher.UIThread.Invoke(() => SignInfo = signInfo);
});
if (_cancelToken != null)
_cancelToken.Requested = true;
@ -637,6 +651,7 @@ namespace SourceGit.ViewModels
private int _activePageIndex = 0;
private Models.Commit _commit = null;
private string _fullMessage = string.Empty;
private Models.CommitSignInfo _signInfo = null;
private List<Models.Change> _changes = null;
private List<Models.Change> _visibleChanges = null;
private List<Models.Change> _selectedChanges = null;

View file

@ -0,0 +1,42 @@
using System.Threading.Tasks;
namespace SourceGit.ViewModels
{
public class FetchInto : Popup
{
public Models.Branch Local
{
get;
private set;
}
public Models.Branch Upstream
{
get;
private set;
}
public FetchInto(Repository repo, Models.Branch local, Models.Branch upstream)
{
_repo = repo;
Local = local;
Upstream = upstream;
View = new Views.FetchInto() { DataContext = this };
}
public override Task<bool> Sure()
{
_repo.SetWatcherEnabled(false);
ProgressDescription = "Fast-Forward ...";
return Task.Run(() =>
{
new Commands.Fetch(_repo.FullPath, Local, Upstream, SetProgressDescription).Exec();
CallUIThread(() => _repo.SetWatcherEnabled(true));
return true;
});
}
private readonly Repository _repo = null;
}
}

View file

@ -1354,6 +1354,7 @@ namespace SourceGit.ViewModels
e.Handled = true;
};
menu.Items.Add(checkout);
menu.Items.Add(new MenuItem() { Header = "-" });
var worktree = _worktrees.Find(x => x.Branch == branch.FullName);
var upstream = _branches.Find(x => x.FullName == branch.Upstream);
@ -1370,11 +1371,22 @@ namespace SourceGit.ViewModels
e.Handled = true;
};
menu.Items.Add(new MenuItem() { Header = "-" });
var fetchInto = new MenuItem();
fetchInto.Header = new Views.NameHighlightedTextBlock("BranchCM.FetchInto", upstream.FriendlyName, branch.Name);
fetchInto.Icon = App.CreateMenuIcon("Icons.Fetch");
fetchInto.IsEnabled = branch.TrackStatus.Ahead.Count == 0;
fetchInto.Click += (_, e) =>
{
if (PopupHost.CanCreatePopup())
PopupHost.ShowAndStartPopup(new FetchInto(this, branch, upstream));
e.Handled = true;
};
menu.Items.Add(fastForward);
menu.Items.Add(new MenuItem() { Header = "-" });
menu.Items.Add(fetchInto);
}
menu.Items.Add(new MenuItem() { Header = "-" });
menu.Items.Add(push);
var merge = new MenuItem();

View file

@ -60,6 +60,22 @@
Margin="12,0,4,0"
VerticalAlignment="Center"/>
<ContentControl Content="{Binding #ThisControl.SignInfo}">
<ContentControl.Styles>
<Style Selector="ToolTip">
<Setter Property="MaxWidth" Value="800"/>
</Style>
</ContentControl.Styles>
<ContentControl.DataTemplates>
<DataTemplate DataType="m:CommitSignInfo">
<Border Width="24" Background="Transparent" ToolTip.Tip="{Binding ToolTip}">
<Path Width="14" Height="14" Data="{StaticResource Icons.Verified}" Fill="{Binding Brush}"/>
</Border>
</DataTemplate>
</ContentControl.DataTemplates>
</ContentControl>
<Button Classes="icon_button" Width="24" Cursor="Hand" Click="OnCopyCommitSHA" ToolTip.Tip="{DynamicResource Text.Copy}">
<Path Width="12" Height="12" Data="{StaticResource Icons.Copy}"/>
</Button>
@ -105,7 +121,7 @@
VerticalAlignment="Center"
UseGraphColor="False"/>
</Border>
<!-- Messages -->
<TextBlock Grid.Row="3" Grid.Column="0" Classes="info_label" Text="{DynamicResource Text.CommitDetail.Info.Message}" VerticalAlignment="Top" Margin="0,4,0,0" />
<v:CommitMessagePresenter Grid.Row="3" Grid.Column="1"

View file

@ -17,6 +17,15 @@ namespace SourceGit.Views
set => SetValue(MessageProperty, value);
}
public static readonly StyledProperty<Models.CommitSignInfo> SignInfoProperty =
AvaloniaProperty.Register<CommitBaseInfo, Models.CommitSignInfo>(nameof(SignInfo));
public Models.CommitSignInfo SignInfo
{
get => GetValue(SignInfoProperty);
set => SetValue(SignInfoProperty, value);
}
public static readonly StyledProperty<bool> SupportsContainsInProperty =
AvaloniaProperty.Register<CommitBaseInfo, bool>(nameof(SupportsContainsIn));

View file

@ -21,6 +21,7 @@
<!-- Base Information -->
<v:CommitBaseInfo Content="{Binding Commit}"
Message="{Binding FullMessage}"
SignInfo="{Binding SignInfo}"
SupportsContainsIn="True"
WebLinks="{Binding WebLinks}"
IssueTrackerRules="{Binding IssueTrackerRules}"/>

21
src/Views/FetchInto.axaml Normal file
View file

@ -0,0 +1,21 @@
<UserControl xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:vm="using:SourceGit.ViewModels"
mc:Ignorable="d" d:DesignWidth="500" d:DesignHeight="450"
x:Class="SourceGit.Views.FetchInto"
x:DataType="vm:FetchInto">
<StackPanel Orientation="Vertical" Margin="8,0">
<TextBlock FontSize="18"
Classes="bold"
Text="{DynamicResource Text.Fetch.Title}"/>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" Margin="0,16,0,0">
<Path Width="14" Height="14" Data="{StaticResource Icons.Branch}"/>
<TextBlock Text="{Binding Upstream.FriendlyName}" Margin="8,0,0,0"/>
<TextBlock Text="→" Margin="8,0"/>
<Path Width="14" Height="14" Data="{StaticResource Icons.Branch}"/>
<TextBlock Text="{Binding Local.Name}" Margin="8,0,0,0"/>
</StackPanel>
</StackPanel>
</UserControl>

View file

@ -0,0 +1,12 @@
using Avalonia.Controls;
namespace SourceGit.Views
{
public partial class FetchInto : UserControl
{
public FetchInto()
{
InitializeComponent();
}
}
}

View file

@ -12,15 +12,15 @@
x:Name="ThisControl">
<v:LayoutableGrid UseHorizontal="{Binding Source={x:Static vm:Preference.Instance}, Path=UseTwoColumnsLayoutInHistories}">
<v:LayoutableGrid.RowDefinitions>
<RowDefinition Height="{Binding TopArea, Mode=TwoWay}"/>
<RowDefinition Height="{Binding TopArea, Mode=TwoWay}" MinHeight="100"/>
<RowDefinition Height="3"/>
<RowDefinition Height="{Binding BottomArea, Mode=TwoWay}"/>
<RowDefinition Height="{Binding BottomArea, Mode=TwoWay}" MinHeight="200"/>
</v:LayoutableGrid.RowDefinitions>
<v:LayoutableGrid.ColumnDefinitions>
<ColumnDefinition Width="{Binding LeftArea, Mode=TwoWay}"/>
<ColumnDefinition Width="{Binding LeftArea, Mode=TwoWay}" MinWidth="100"/>
<ColumnDefinition Width="3"/>
<ColumnDefinition Width="{Binding RightArea, Mode=TwoWay}"/>
<ColumnDefinition Width="{Binding RightArea, Mode=TwoWay}" MinWidth="100"/>
</v:LayoutableGrid.ColumnDefinitions>
<Grid Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="3">

View file

@ -9,11 +9,11 @@
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
x:Class="SourceGit.Views.StashesPage"
x:DataType="vm:StashesPage">
<Grid>
<Grid SizeChanged="OnMainLayoutSizeChanged">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="{Binding Source={x:Static vm:Preference.Instance}, Path=Layout.StashesLeftWidth, Mode=TwoWay}" MinWidth="300"/>
<ColumnDefinition Width="4"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*" MinWidth="300"/>
</Grid.ColumnDefinitions>
<!-- Left -->

View file

@ -9,6 +9,20 @@ namespace SourceGit.Views
InitializeComponent();
}
private void OnMainLayoutSizeChanged(object sender, SizeChangedEventArgs e)
{
var grid = sender as Grid;
if (grid == null)
return;
var layout = ViewModels.Preference.Instance.Layout;
var width = grid.Bounds.Width;
var maxLeft = width - 304;
if (layout.StashesLeftWidth.Value - maxLeft > 1.0)
layout.StashesLeftWidth = new GridLength(maxLeft, GridUnitType.Pixel);
}
private void OnStashContextRequested(object sender, ContextRequestedEventArgs e)
{
if (DataContext is ViewModels.StashesPage vm && sender is Border border)

View file

@ -8,11 +8,11 @@
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="600"
x:Class="SourceGit.Views.WorkingCopy"
x:DataType="vm:WorkingCopy">
<Grid>
<Grid SizeChanged="OnMainLayoutSizeChanged">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="{Binding Source={x:Static vm:Preference.Instance}, Path=Layout.WorkingCopyLeftWidth, Mode=TwoWay}" MinWidth="300"/>
<ColumnDefinition Width="5"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*" MinWidth="300"/>
</Grid.ColumnDefinitions>
<!-- Left -->

View file

@ -11,6 +11,20 @@ namespace SourceGit.Views
InitializeComponent();
}
private void OnMainLayoutSizeChanged(object sender, SizeChangedEventArgs e)
{
var grid = sender as Grid;
if (grid == null)
return;
var layout = ViewModels.Preference.Instance.Layout;
var width = grid.Bounds.Width;
var maxLeft = width - 304;
if (layout.WorkingCopyLeftWidth.Value - maxLeft > 1.0)
layout.WorkingCopyLeftWidth = new GridLength(maxLeft, GridUnitType.Pixel);
}
private void OnOpenCommitMessagePicker(object sender, RoutedEventArgs e)
{
if (sender is Button button && DataContext is ViewModels.WorkingCopy vm)