Compare commits

..

7 commits

Author SHA1 Message Date
leo
1862428a0f
feature: supports Warp terminal on macOS (#829)
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
Signed-off-by: leo <longshuang@msn.cn>
2024-12-20 10:44:06 +08:00
leo
50892f7401
ux: re-order context menu items for selected multiple branches 2024-12-20 10:00:10 +08:00
leo
fec13cdc87
ux: layout of INFORMATION page 2024-12-20 09:56:53 +08:00
leo
ed229166ee
enhance: allow wrap commit refs in INFORMATION page (#807) 2024-12-20 09:51:25 +08:00
leo
6c795e1238
project: upgrade TextMateSharp to 1.0.65 2024-12-19 19:30:17 +08:00
leo
7ee7964799
ux: use trimmed error message 2024-12-19 17:38:53 +08:00
leo
7acd6e42fe
project: upgrade Avalonia to 11.2.3 2024-12-19 17:09:20 +08:00
9 changed files with 72 additions and 34 deletions

View file

@ -120,8 +120,8 @@ namespace SourceGit.Commands
{ {
if (RaiseError) if (RaiseError)
{ {
var errMsg = string.Join("\n", errs); var errMsg = string.Join("\n", errs).Trim();
if (!string.IsNullOrWhiteSpace(errMsg)) if (!string.IsNullOrEmpty(errMsg))
Dispatcher.UIThread.Post(() => App.RaiseException(Context, errMsg)); Dispatcher.UIThread.Post(() => App.RaiseException(Context, errMsg));
} }

View file

@ -41,6 +41,7 @@ namespace SourceGit.Models
{ {
new ShellOrTerminal("mac-terminal", "Terminal", ""), new ShellOrTerminal("mac-terminal", "Terminal", ""),
new ShellOrTerminal("iterm2", "iTerm", ""), new ShellOrTerminal("iterm2", "iTerm", ""),
new ShellOrTerminal("warp", "Warp", ""),
}; };
} }
else else

View file

@ -36,6 +36,8 @@ namespace SourceGit.Native
return "Terminal"; return "Terminal";
case "iterm2": case "iterm2":
return "iTerm"; return "iTerm";
case "warp":
return "Warp";
} }
return string.Empty; return string.Empty;

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

View file

@ -41,17 +41,17 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Avalonia" Version="11.2.2" /> <PackageReference Include="Avalonia" Version="11.2.3" />
<PackageReference Include="Avalonia.Desktop" Version="11.2.2" /> <PackageReference Include="Avalonia.Desktop" Version="11.2.3" />
<PackageReference Include="Avalonia.Fonts.Inter" Version="11.2.2" /> <PackageReference Include="Avalonia.Fonts.Inter" Version="11.2.3" />
<PackageReference Include="Avalonia.Themes.Fluent" Version="11.2.2" /> <PackageReference Include="Avalonia.Themes.Fluent" Version="11.2.3" />
<PackageReference Include="Avalonia.Diagnostics" Version="11.2.2" Condition="'$(Configuration)' == 'Debug'" /> <PackageReference Include="Avalonia.Diagnostics" Version="11.2.3" Condition="'$(Configuration)' == 'Debug'" />
<PackageReference Include="Avalonia.AvaloniaEdit" Version="11.1.0" /> <PackageReference Include="Avalonia.AvaloniaEdit" Version="11.1.0" />
<PackageReference Include="AvaloniaEdit.TextMate" Version="11.1.0" /> <PackageReference Include="AvaloniaEdit.TextMate" Version="11.1.0" />
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.3.2" /> <PackageReference Include="CommunityToolkit.Mvvm" Version="8.3.2" />
<PackageReference Include="LiveChartsCore.SkiaSharpView.Avalonia" Version="2.0.0-rc4.5" /> <PackageReference Include="LiveChartsCore.SkiaSharpView.Avalonia" Version="2.0.0-rc4.5" />
<PackageReference Include="TextMateSharp" Version="1.0.64" /> <PackageReference Include="TextMateSharp" Version="1.0.65" />
<PackageReference Include="TextMateSharp.Grammars" Version="1.0.64" /> <PackageReference Include="TextMateSharp.Grammars" Version="1.0.65" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>

View file

@ -399,15 +399,6 @@ namespace SourceGit.Views
else if (branches.Find(x => x.IsCurrent) == null) else if (branches.Find(x => x.IsCurrent) == null)
{ {
var menu = new ContextMenu(); var menu = new ContextMenu();
var deleteMulti = new MenuItem();
deleteMulti.Header = App.Text("BranchCM.DeleteMultiBranches", branches.Count);
deleteMulti.Icon = App.CreateMenuIcon("Icons.Clear");
deleteMulti.Click += (_, ev) =>
{
repo.DeleteMultipleBranches(branches, branches[0].IsLocal);
ev.Handled = true;
};
menu.Items.Add(deleteMulti);
var mergeMulti = new MenuItem(); var mergeMulti = new MenuItem();
mergeMulti.Header = App.Text("BranchCM.MergeMultiBranches", branches.Count); mergeMulti.Header = App.Text("BranchCM.MergeMultiBranches", branches.Count);
@ -418,6 +409,17 @@ namespace SourceGit.Views
ev.Handled = true; ev.Handled = true;
}; };
menu.Items.Add(mergeMulti); menu.Items.Add(mergeMulti);
menu.Items.Add(new MenuItem() { Header = "-" });
var deleteMulti = new MenuItem();
deleteMulti.Header = App.Text("BranchCM.DeleteMultiBranches", branches.Count);
deleteMulti.Icon = App.CreateMenuIcon("Icons.Clear");
deleteMulti.Click += (_, ev) =>
{
repo.DeleteMultipleBranches(branches, branches[0].IsLocal);
ev.Handled = true;
};
menu.Items.Add(deleteMulti);
menu?.Open(this); menu?.Open(this);
} }

View file

@ -172,19 +172,20 @@
<!-- REFS --> <!-- REFS -->
<TextBlock Grid.Row="3" Grid.Column="0" Classes="info_label" VerticalAlignment="Top" Margin="0,4,0,0" Text="{DynamicResource Text.CommitDetail.Info.Refs}" IsVisible="{Binding HasDecorators}"/> <TextBlock Grid.Row="3" Grid.Column="0" Classes="info_label" VerticalAlignment="Top" Margin="0,4,0,0" Text="{DynamicResource Text.CommitDetail.Info.Refs}" IsVisible="{Binding HasDecorators}"/>
<Border Grid.Row="3" Grid.Column="1" Margin="12,0,0,0" Height="24" IsVisible="{Binding HasDecorators}"> <Border Grid.Row="3" Grid.Column="1" Margin="12,0,0,0" MinHeight="24" IsVisible="{Binding HasDecorators}">
<v:CommitRefsPresenter TagBackground="{DynamicResource Brush.DecoratorTag}" <v:CommitRefsPresenter TagBackground="{DynamicResource Brush.DecoratorTag}"
Foreground="{DynamicResource Brush.FG1}" Foreground="{DynamicResource Brush.FG1}"
FontFamily="{DynamicResource Fonts.Primary}" FontFamily="{DynamicResource Fonts.Primary}"
FontSize="11" FontSize="11"
VerticalAlignment="Center" AllowWrap="True"
Margin="0,4,0,0"
UseGraphColor="False"/> UseGraphColor="False"/>
</Border> </Border>
<!-- Messages --> <!-- Messages -->
<TextBlock Grid.Row="4" Grid.Column="0" Classes="info_label" VerticalAlignment="Top" Margin="0,4,0,0" Text="{DynamicResource Text.CommitDetail.Info.Message}" /> <TextBlock Grid.Row="4" Grid.Column="0" Classes="info_label" VerticalAlignment="Top" Margin="0,4,0,0" Text="{DynamicResource Text.CommitDetail.Info.Message}" />
<v:CommitMessagePresenter Grid.Row="4" Grid.Column="1" <v:CommitMessagePresenter Grid.Row="4" Grid.Column="1"
Margin="12,5,8,0" Margin="12,4,8,0"
Classes="primary" Classes="primary"
Message="{Binding #ThisControl.Message}" Message="{Binding #ThisControl.Message}"
IssueTrackerRules="{Binding #ThisControl.IssueTrackerRules}" IssueTrackerRules="{Binding #ThisControl.IssueTrackerRules}"

View file

@ -73,6 +73,15 @@ namespace SourceGit.Views
set => SetValue(TagBackgroundProperty, value); set => SetValue(TagBackgroundProperty, value);
} }
public static readonly StyledProperty<bool> AllowWrapProperty =
AvaloniaProperty.Register<CommitRefsPresenter, bool>(nameof(AllowWrap));
public bool AllowWrap
{
get => GetValue(AllowWrapProperty);
set => SetValue(AllowWrapProperty, value);
}
static CommitRefsPresenter() static CommitRefsPresenter()
{ {
AffectsMeasure<CommitRefsPresenter>( AffectsMeasure<CommitRefsPresenter>(
@ -93,10 +102,19 @@ namespace SourceGit.Views
var useGraphColor = UseGraphColor; var useGraphColor = UseGraphColor;
var fg = Foreground; var fg = Foreground;
var bg = Background; var bg = Background;
var allowWrap = AllowWrap;
var x = 1.0; var x = 1.0;
var y = 0.0;
foreach (var item in _items) foreach (var item in _items)
{ {
var entireRect = new RoundedRect(new Rect(x, 0, item.Width, 16), new CornerRadius(2)); if (allowWrap && x > 1.0 && x + item.Width > Bounds.Width)
{
x = 1.0;
y += 20.0;
}
var entireRect = new RoundedRect(new Rect(x, y, item.Width, 16), new CornerRadius(2));
if (item.IsHead) if (item.IsHead)
{ {
@ -109,24 +127,24 @@ namespace SourceGit.Views
context.DrawRectangle(item.Brush, null, entireRect); context.DrawRectangle(item.Brush, null, entireRect);
} }
context.DrawText(item.Label, new Point(x + 16, 8.0 - item.Label.Height * 0.5)); context.DrawText(item.Label, new Point(x + 16, y + 8.0 - item.Label.Height * 0.5));
} }
else else
{ {
if (bg != null) if (bg != null)
context.DrawRectangle(bg, null, entireRect); context.DrawRectangle(bg, null, entireRect);
var labelRect = new RoundedRect(new Rect(x + 16, 0, item.Label.Width + 8, 16), new CornerRadius(0, 2, 2, 0)); var labelRect = new RoundedRect(new Rect(x + 16, y, item.Label.Width + 8, 16), new CornerRadius(0, 2, 2, 0));
using (context.PushOpacity(.2)) using (context.PushOpacity(.2))
context.DrawRectangle(item.Brush, null, labelRect); context.DrawRectangle(item.Brush, null, labelRect);
context.DrawLine(new Pen(item.Brush), new Point(x + 16, 0), new Point(x + 16, 16)); context.DrawLine(new Pen(item.Brush), new Point(x + 16, y), new Point(x + 16, y + 16));
context.DrawText(item.Label, new Point(x + 20, 8.0 - item.Label.Height * 0.5)); context.DrawText(item.Label, new Point(x + 20, y + 8.0 - item.Label.Height * 0.5));
} }
context.DrawRectangle(null, new Pen(item.Brush), entireRect); context.DrawRectangle(null, new Pen(item.Brush), entireRect);
using (context.PushTransform(Matrix.CreateTranslation(x + 3, 3))) using (context.PushTransform(Matrix.CreateTranslation(x + 3, y + 3)))
context.DrawGeometry(fg, null, item.Icon); context.DrawGeometry(fg, null, item.Icon);
x += item.Width + 4; x += item.Width + 4;
@ -157,6 +175,9 @@ namespace SourceGit.Views
var tagBG = TagBackground; var tagBG = TagBackground;
var labelSize = FontSize; var labelSize = FontSize;
var requiredWidth = 0.0; var requiredWidth = 0.0;
var requiredHeight = 16.0;
var x = 0.0;
var allowWrap = AllowWrap;
foreach (var decorator in refs) foreach (var decorator in refs)
{ {
@ -211,11 +232,24 @@ namespace SourceGit.Views
item.Width = 16 + (isHead ? 0 : 4) + label.Width + 4; item.Width = 16 + (isHead ? 0 : 4) + label.Width + 4;
_items.Add(item); _items.Add(item);
requiredWidth += item.Width + 4; x += item.Width + 4;
if (allowWrap)
{
if (x > availableSize.Width)
{
requiredHeight += 20.0;
x = item.Width;
}
}
} }
if (allowWrap && requiredHeight > 16.0)
requiredWidth = availableSize.Width;
else
requiredWidth = x + 2;
InvalidateVisual(); InvalidateVisual();
return new Size(requiredWidth + 2, 16); return new Size(requiredWidth, requiredHeight);
} }
InvalidateVisual(); InvalidateVisual();

View file

@ -125,11 +125,9 @@
</Button> </Button>
</Grid> </Grid>
<Border Grid.Row="1" Margin="8" Background="Transparent"> <ScrollViewer Grid.Row="1" Margin="8" MaxHeight="200" HorizontalScrollBarVisibility="Disabled" VerticalScrollBarVisibility="Auto">
<ScrollViewer MaxHeight="200" HorizontalScrollBarVisibility="Disabled" VerticalScrollBarVisibility="Auto"> <TextBlock Margin="4,2" TextWrapping="Wrap" Text="{Binding Message}"/>
<TextBlock Margin="4,2" TextWrapping="Wrap" Text="{Binding Message}"/> </ScrollViewer>
</ScrollViewer>
</Border>
</Grid> </Grid>
</Border> </Border>
</Border> </Border>