Compare commits

..

17 commits

Author SHA1 Message Date
Göran W
a80a5f95bd
Merge b0a75932e9 into 6e69c0567a 2024-11-29 20:22:30 +00:00
goran-w
b0a75932e9 Added Preference and ToggleButton for diff navigation style 2024-11-29 21:17:25 +01:00
goran-w
491829968c Added new Icon and String (en-US) for Highlighted Diff Navigation 2024-11-29 21:17:25 +01:00
goran-w
2e815a867c Added indicator of current/total change-blocks in DiffView toolbar 2024-11-29 21:17:25 +01:00
goran-w
d9892d278b Added safeguards for edge cases 2024-11-29 21:17:25 +01:00
goran-w
f7e69d99d6 Implemented change-block navigation
* Modified behavior of the Prev/Next Change buttons in DiffView toolbar.
* Well-defined change-blocks are pre-calculated and can be navigated between.
* Current change-block is highlighted in the Diff panel(s).
* Prev/next at start/end of range (re-)scrolls to first/last change-block
(I.e when unset, or already at first/last change-block, or at the only one.)
* Current change-block is unset in RefreshContent().
2024-11-29 20:59:57 +01:00
goran-w
6026fd8d5c Corrected misspelled local variable nextHigh(t)light 2024-11-29 20:59:57 +01:00
leo
6e69c0567a
refactor: do not use key to start fetch/pull/push/stash directly on macOS (#766)
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-11-29 21:15:12 +08:00
leo
7d857a49f7
ux: add margins for ListItem in InteractiveRebase window (#764)
Signed-off-by: leo <longshuang@msn.cn>
2024-11-29 21:03:11 +08:00
leo
938876e924
fix: wrong column indentation on right side of Interactive Rebase window, for wide commit messages (#764) 2024-11-29 19:12:27 +08:00
leo
e65ac18afc
fix: wrong column indentation on right side of Interactive Rebase window, for wide commit messages (#764) 2024-11-29 19:04:58 +08:00
leo
f028513d49
doc: update tips for manually build 2024-11-29 11:46:27 +08:00
leo
4cb9dbfd14
code_style: remove unused namespace using 2024-11-29 10:35:23 +08:00
leo
4aad6a7f86
fix: System.ArgumentException when hover the commit link multiple times before the first time tooltip shows (#765) 2024-11-29 10:26:36 +08:00
leo
db8ee3410b
refactor: users should change the SystemAccentColor from system-wide settings 2024-11-29 09:59:07 +08:00
leo
dfc03d7a8f
feature: allows to copy branch/tag name from the context menu of selected commit 2024-11-29 09:51:50 +08:00
leo
400aaacf18
fix: wrong column indentation on right side of Interactive Rebase window, for wide commit messages (#764) 2024-11-29 09:21:53 +08:00
17 changed files with 164 additions and 98 deletions

View file

@ -206,6 +206,9 @@ dotnet_diagnostic.CA1854.severity = warning
#CA2211:Non-constant fields should not be visible #CA2211:Non-constant fields should not be visible
dotnet_diagnostic.CA2211.severity = error dotnet_diagnostic.CA2211.severity = error
# IDE0005: remove used namespace using
dotnet_diagnostic.IDE0005.severity = error
# Wrapping preferences # Wrapping preferences
csharp_wrap_before_ternary_opsigns = false csharp_wrap_before_ternary_opsigns = false

View file

@ -5,7 +5,7 @@
## How to build this project manually ## How to build this project manually
1. Make sure [.NET SDK 8](https://dotnet.microsoft.com/en-us/download) is installed on your machine. 1. Make sure [.NET SDK 9](https://dotnet.microsoft.com/en-us/download) is installed on your machine.
2. Clone this project 2. Clone this project
3. Run the follow command under the project root dir 3. Run the follow command under the project root dir
```sh ```sh

View file

@ -164,12 +164,7 @@ namespace SourceGit
var resDic = new ResourceDictionary(); var resDic = new ResourceDictionary();
var overrides = JsonSerializer.Deserialize(File.ReadAllText(themeOverridesFile), JsonCodeGen.Default.ThemeOverrides); var overrides = JsonSerializer.Deserialize(File.ReadAllText(themeOverridesFile), JsonCodeGen.Default.ThemeOverrides);
foreach (var kv in overrides.BasicColors) foreach (var kv in overrides.BasicColors)
{
if (kv.Key.Equals("SystemAccentColor", StringComparison.Ordinal))
resDic["SystemAccentColor"] = kv.Value;
else
resDic[$"Color.{kv.Key}"] = kv.Value; resDic[$"Color.{kv.Key}"] = kv.Value;
}
if (overrides.GraphColors.Count > 0) if (overrides.GraphColors.Count > 0)
Models.CommitGraph.SetPens(overrides.GraphColors, overrides.GraphPenThickness); Models.CommitGraph.SetPens(overrides.GraphColors, overrides.GraphPenThickness);

View file

@ -1,5 +1,4 @@
using System; using System.Collections.Generic;
using System.Collections.Generic;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
namespace SourceGit.Commands namespace SourceGit.Commands

View file

@ -54,6 +54,7 @@
<StreamGeometry x:Key="Icons.Grid">M30 271l241 0 0-241-241 0 0 241zM392 271l241 0 0-241-241 0 0 241zM753 30l0 241 241 0 0-241-241 0zM30 632l241 0 0-241-241 0 0 241zM392 632l241 0 0-241-241 0 0 241zM753 632l241 0 0-241-241 0 0 241zM30 994l241 0 0-241-241 0 0 241zM392 994l241 0 0-241-241 0 0 241zM753 994l241 0 0-241-241 0 0 241z</StreamGeometry> <StreamGeometry x:Key="Icons.Grid">M30 271l241 0 0-241-241 0 0 241zM392 271l241 0 0-241-241 0 0 241zM753 30l0 241 241 0 0-241-241 0zM30 632l241 0 0-241-241 0 0 241zM392 632l241 0 0-241-241 0 0 241zM753 632l241 0 0-241-241 0 0 241zM30 994l241 0 0-241-241 0 0 241zM392 994l241 0 0-241-241 0 0 241zM753 994l241 0 0-241-241 0 0 241z</StreamGeometry>
<StreamGeometry x:Key="Icons.Head">M0 512M1024 512M512 0M512 1024M955 323q0 23-16 39l-414 414-78 78q-16 16-39 16t-39-16l-78-78-207-207q-16-16-16-39t16-39l78-78q16-16 39-16t39 16l168 169 375-375q16-16 39-16t39 16l78 78q16 16 16 39z</StreamGeometry> <StreamGeometry x:Key="Icons.Head">M0 512M1024 512M512 0M512 1024M955 323q0 23-16 39l-414 414-78 78q-16 16-39 16t-39-16l-78-78-207-207q-16-16-16-39t16-39l78-78q16-16 39-16t39 16l168 169 375-375q16-16 39-16t39 16l78 78q16 16 16 39z</StreamGeometry>
<StreamGeometry x:Key="Icons.HiddenSymbol">M416 64H768v64h-64v704h64v64H448v-64h64V512H416a224 224 0 1 1 0-448zM576 832h64V128H576v704zM416 128H512v320H416a160 160 0 0 1 0-320z</StreamGeometry> <StreamGeometry x:Key="Icons.HiddenSymbol">M416 64H768v64h-64v704h64v64H448v-64h64V512H416a224 224 0 1 1 0-448zM576 832h64V128H576v704zM416 128H512v320H416a160 160 0 0 1 0-320z</StreamGeometry>
<StreamGeometry x:Key="Icons.Highlight">M20.2585648,2.00438474 C20.6382605,2.00472706 20.9518016,2.28716326 21.0011348,2.65328337 L21.0078899,2.75506004 L21.0038407,7.25276883 C21.0009137,8.40908568 20.1270954,9.36072944 19.0029371,9.48671858 L19.0024932,11.7464847 C19.0024932,12.9373487 18.0773316,13.9121296 16.906542,13.9912939 L16.7524932,13.9964847 L16.501,13.9963847 L16.5017549,16.7881212 C16.5017549,17.6030744 16.0616895,18.349347 15.3600767,18.7462439 L15.2057929,18.8258433 L8.57108142,21.9321389 C8.10484975,22.1504232 7.57411944,21.8450614 7.50959937,21.3535767 L7.50306874,21.2528982 L7.503,13.9963847 L7.25,13.9964847 C6.05913601,13.9964847 5.08435508,13.0713231 5.00519081,11.9005335 L5,11.7464847 L5.00043957,9.4871861 C3.92882124,9.36893736 3.08392302,8.49812196 3.0058865,7.41488149 L3,7.25086975 L3,2.75438506 C3,2.3401715 3.33578644,2.00438474 3.75,2.00438474 C4.12969577,2.00438474 4.44349096,2.28653894 4.49315338,2.6526145 L4.5,2.75438506 L4.5,7.25086975 C4.5,7.63056552 4.78215388,7.94436071 5.14822944,7.99402313 L5.25,8.00086975 L18.7512697,8.00087075 C19.1315998,8.00025031 19.4461483,7.71759877 19.4967392,7.3518545 L19.5038434,7.25019537 L19.5078902,2.75371008 C19.508263,2.33949668 19.8443515,2.00401258 20.2585648,2.00438474 Z M15.001,13.9963847 L9.003,13.9963847 L9.00306874,20.0736262 L14.5697676,17.4673619 C14.8004131,17.3593763 14.9581692,17.1431606 14.9940044,16.89581 L15.0017549,16.7881212 L15.001,13.9963847 Z M17.502,9.50038474 L6.5,9.50038474 L6.5,11.7464847 C6.5,12.1261805 6.78215388,12.4399757 7.14822944,12.4896381 L7.25,12.4964847 L16.7524932,12.4964847 C17.1321889,12.4964847 17.4459841,12.2143308 17.4956465,11.8482552 L17.5024932,11.7464847 L17.502,9.50038474 Z</StreamGeometry>
<StreamGeometry x:Key="Icons.Histories">M24 512A488 488 0 01512 24A488 488 0 011000 512A488 488 0 01512 1000A488 488 0 0124 512zm447-325v327L243 619l51 111 300-138V187H471z</StreamGeometry> <StreamGeometry x:Key="Icons.Histories">M24 512A488 488 0 01512 24A488 488 0 011000 512A488 488 0 01512 1000A488 488 0 0124 512zm447-325v327L243 619l51 111 300-138V187H471z</StreamGeometry>
<StreamGeometry x:Key="Icons.Home">M832 64h128v278l-128-146V64zm64 448L512 73 128 512H0L448 0h128l448 512h-128zm0 83V1024H640V704c0-35-29-64-64-64h-128a64 64 0 00-64 64v320H128V595l384-424 384 424z</StreamGeometry> <StreamGeometry x:Key="Icons.Home">M832 64h128v278l-128-146V64zm64 448L512 73 128 512H0L448 0h128l448 512h-128zm0 83V1024H640V704c0-35-29-64-64-64h-128a64 64 0 00-64 64v320H128V595l384-424 384 424z</StreamGeometry>
<StreamGeometry x:Key="Icons.Hotkeys">M512 0C229 0 0 229 0 512c0 283 229 512 512 512s512-229 512-512c0-283-229-512-512-512zm0 958C266 958 66 758 66 512S266 66 512 66 958 266 958 512 758 958 512 958zM192 416h96a32 32 0 0032-32v-32a32 32 0 00-32-32H192a32 32 0 00-32 32v32a32 32 0 0032 32zM384 416h96a32 32 0 0032-32v-32a32 32 0 00-32-32h-96a32 32 0 00-32 32v32a32 32 0 0032 32zM576 416h96a32 32 0 0032-32v-32a32 32 0 00-32-32h-96a32 32 0 00-32 32v32a32 32 0 0032 32zM832 320h-64a32 32 0 00-32 32v128h-160a32 32 0 00-32 32v32a32 32 0 0032 32h256a32 32 0 0032-32v-192a32 32 0 00-32-32zM320 544v-32a32 32 0 00-32-32H192a32 32 0 00-32 32v32a32 32 0 0032 32h96a32 32 0 0032-32zM384 576h96a32 32 0 0032-32v-32a32 32 0 00-32-32h-96a32 32 0 00-32 32v32a32 32 0 0032 32zM800 640H256a32 32 0 00-32 32v32a32 32 0 0032 32h544a32 32 0 0032-32v-32a32 32 0 00-32-32z</StreamGeometry> <StreamGeometry x:Key="Icons.Hotkeys">M512 0C229 0 0 229 0 512c0 283 229 512 512 512s512-229 512-512c0-283-229-512-512-512zm0 958C266 958 66 758 66 512S266 66 512 66 958 266 958 512 758 958 512 958zM192 416h96a32 32 0 0032-32v-32a32 32 0 00-32-32H192a32 32 0 00-32 32v32a32 32 0 0032 32zM384 416h96a32 32 0 0032-32v-32a32 32 0 00-32-32h-96a32 32 0 00-32 32v32a32 32 0 0032 32zM576 416h96a32 32 0 0032-32v-32a32 32 0 00-32-32h-96a32 32 0 00-32 32v32a32 32 0 0032 32zM832 320h-64a32 32 0 00-32 32v128h-160a32 32 0 00-32 32v32a32 32 0 0032 32h256a32 32 0 0032-32v-192a32 32 0 00-32-32zM320 544v-32a32 32 0 00-32-32H192a32 32 0 00-32 32v32a32 32 0 0032 32h96a32 32 0 0032-32zM384 576h96a32 32 0 0032-32v-32a32 32 0 00-32-32h-96a32 32 0 00-32 32v32a32 32 0 0032 32zM800 640H256a32 32 0 00-32 32v32a32 32 0 0032 32h544a32 32 0 0032-32v-32a32 32 0 00-32-32z</StreamGeometry>

View file

@ -232,6 +232,7 @@
<x:String x:Key="Text.Diff.Binary.New" xml:space="preserve">NEW</x:String> <x:String x:Key="Text.Diff.Binary.New" xml:space="preserve">NEW</x:String>
<x:String x:Key="Text.Diff.Binary.Old" xml:space="preserve">OLD</x:String> <x:String x:Key="Text.Diff.Binary.Old" xml:space="preserve">OLD</x:String>
<x:String x:Key="Text.Diff.Copy" xml:space="preserve">Copy</x:String> <x:String x:Key="Text.Diff.Copy" xml:space="preserve">Copy</x:String>
<x:String x:Key="Text.Diff.HighlightedDiffNavigation" xml:space="preserve">Highlighted Diff Navigation</x:String>
<x:String x:Key="Text.Diff.FileModeChanged" xml:space="preserve">File Mode Changed</x:String> <x:String x:Key="Text.Diff.FileModeChanged" xml:space="preserve">File Mode Changed</x:String>
<x:String x:Key="Text.Diff.IgnoreWhitespace" xml:space="preserve">Ignore Whitespace Change</x:String> <x:String x:Key="Text.Diff.IgnoreWhitespace" xml:space="preserve">Ignore Whitespace Change</x:String>
<x:String x:Key="Text.Diff.LFS" xml:space="preserve">LFS OBJECT CHANGE</x:String> <x:String x:Key="Text.Diff.LFS" xml:space="preserve">LFS OBJECT CHANGE</x:String>

View file

@ -1,5 +1,4 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
namespace SourceGit.ViewModels namespace SourceGit.ViewModels

View file

@ -133,6 +133,14 @@ namespace SourceGit.ViewModels
LoadDiffContent(); LoadDiffContent();
} }
public void ToggleHighlightedDiffNavigation()
{
Preference.Instance.EnableChangeBlocks = !Preference.Instance.EnableChangeBlocks;
if (_content is Models.TextDiff textDiff)
textDiff.CurrentChangeBlockIdx = -1;
RefreshChangeBlockIndicator();
}
public void IncrUnified() public void IncrUnified()
{ {
UnifiedLines = _unifiedLines + 1; UnifiedLines = _unifiedLines + 1;

View file

@ -813,6 +813,8 @@ namespace SourceGit.ViewModels
submenu.Icon = App.CreateMenuIcon("Icons.Branch"); submenu.Icon = App.CreateMenuIcon("Icons.Branch");
submenu.Header = current.Name; submenu.Header = current.Name;
FillBranchVisibilityMenu(submenu, current);
if (!string.IsNullOrEmpty(current.Upstream)) if (!string.IsNullOrEmpty(current.Upstream))
{ {
var upstream = current.Upstream.Substring(13); var upstream = current.Upstream.Substring(13);
@ -852,6 +854,17 @@ namespace SourceGit.ViewModels
e.Handled = true; e.Handled = true;
}; };
submenu.Items.Add(push); submenu.Items.Add(push);
var rename = new MenuItem();
rename.Header = new Views.NameHighlightedTextBlock("BranchCM.Rename", current.Name);
rename.Icon = App.CreateMenuIcon("Icons.Rename");
rename.Click += (_, e) =>
{
if (PopupHost.CanCreatePopup())
PopupHost.ShowPopup(new RenameBranch(_repo, current));
e.Handled = true;
};
submenu.Items.Add(rename);
submenu.Items.Add(new MenuItem() { Header = "-" }); submenu.Items.Add(new MenuItem() { Header = "-" });
var detect = Commands.GitFlow.DetectType(_repo.FullPath, _repo.Branches, current.Name); var detect = Commands.GitFlow.DetectType(_repo.FullPath, _repo.Branches, current.Name);
@ -870,18 +883,15 @@ namespace SourceGit.ViewModels
submenu.Items.Add(new MenuItem() { Header = "-" }); submenu.Items.Add(new MenuItem() { Header = "-" });
} }
FillBranchVisibilityMenu(submenu, current); var copy = new MenuItem();
copy.Header = App.Text("BranchCM.CopyName");
var rename = new MenuItem(); copy.Icon = App.CreateMenuIcon("Icons.Copy");
rename.Header = new Views.NameHighlightedTextBlock("BranchCM.Rename", current.Name); copy.Click += (_, e) =>
rename.Icon = App.CreateMenuIcon("Icons.Rename");
rename.Click += (_, e) =>
{ {
if (PopupHost.CanCreatePopup()) App.CopyText(current.Name);
PopupHost.ShowPopup(new RenameBranch(_repo, current));
e.Handled = true; e.Handled = true;
}; };
submenu.Items.Add(rename); submenu.Items.Add(copy);
menu.Items.Add(submenu); menu.Items.Add(submenu);
} }
@ -892,6 +902,8 @@ namespace SourceGit.ViewModels
submenu.Icon = App.CreateMenuIcon("Icons.Branch"); submenu.Icon = App.CreateMenuIcon("Icons.Branch");
submenu.Header = branch.Name; submenu.Header = branch.Name;
FillBranchVisibilityMenu(submenu, branch);
var checkout = new MenuItem(); var checkout = new MenuItem();
checkout.Header = new Views.NameHighlightedTextBlock("BranchCM.Checkout", branch.Name); checkout.Header = new Views.NameHighlightedTextBlock("BranchCM.Checkout", branch.Name);
checkout.Icon = App.CreateMenuIcon("Icons.Check"); checkout.Icon = App.CreateMenuIcon("Icons.Check");
@ -913,25 +925,6 @@ namespace SourceGit.ViewModels
e.Handled = true; e.Handled = true;
}; };
submenu.Items.Add(merge); submenu.Items.Add(merge);
submenu.Items.Add(new MenuItem() { Header = "-" });
var detect = Commands.GitFlow.DetectType(_repo.FullPath, _repo.Branches, branch.Name);
if (detect.IsGitFlowBranch)
{
var finish = new MenuItem();
finish.Header = new Views.NameHighlightedTextBlock("BranchCM.Finish", branch.Name);
finish.Icon = App.CreateMenuIcon("Icons.GitFlow");
finish.Click += (_, e) =>
{
if (PopupHost.CanCreatePopup())
PopupHost.ShowPopup(new GitFlowFinish(_repo, branch, detect.Type, detect.Prefix));
e.Handled = true;
};
submenu.Items.Add(finish);
submenu.Items.Add(new MenuItem() { Header = "-" });
}
FillBranchVisibilityMenu(submenu, branch);
var rename = new MenuItem(); var rename = new MenuItem();
rename.Header = new Views.NameHighlightedTextBlock("BranchCM.Rename", branch.Name); rename.Header = new Views.NameHighlightedTextBlock("BranchCM.Rename", branch.Name);
@ -954,6 +947,33 @@ namespace SourceGit.ViewModels
e.Handled = true; e.Handled = true;
}; };
submenu.Items.Add(delete); submenu.Items.Add(delete);
submenu.Items.Add(new MenuItem() { Header = "-" });
var detect = Commands.GitFlow.DetectType(_repo.FullPath, _repo.Branches, branch.Name);
if (detect.IsGitFlowBranch)
{
var finish = new MenuItem();
finish.Header = new Views.NameHighlightedTextBlock("BranchCM.Finish", branch.Name);
finish.Icon = App.CreateMenuIcon("Icons.GitFlow");
finish.Click += (_, e) =>
{
if (PopupHost.CanCreatePopup())
PopupHost.ShowPopup(new GitFlowFinish(_repo, branch, detect.Type, detect.Prefix));
e.Handled = true;
};
submenu.Items.Add(finish);
submenu.Items.Add(new MenuItem() { Header = "-" });
}
var copy = new MenuItem();
copy.Header = App.Text("BranchCM.CopyName");
copy.Icon = App.CreateMenuIcon("Icons.Copy");
copy.Click += (_, e) =>
{
App.CopyText(branch.Name);
e.Handled = true;
};
submenu.Items.Add(copy);
menu.Items.Add(submenu); menu.Items.Add(submenu);
} }
@ -966,6 +986,8 @@ namespace SourceGit.ViewModels
submenu.Icon = App.CreateMenuIcon("Icons.Branch"); submenu.Icon = App.CreateMenuIcon("Icons.Branch");
submenu.Header = name; submenu.Header = name;
FillBranchVisibilityMenu(submenu, branch);
var checkout = new MenuItem(); var checkout = new MenuItem();
checkout.Header = new Views.NameHighlightedTextBlock("BranchCM.Checkout", name); checkout.Header = new Views.NameHighlightedTextBlock("BranchCM.Checkout", name);
checkout.Icon = App.CreateMenuIcon("Icons.Check"); checkout.Icon = App.CreateMenuIcon("Icons.Check");
@ -988,9 +1010,6 @@ namespace SourceGit.ViewModels
}; };
submenu.Items.Add(merge); submenu.Items.Add(merge);
submenu.Items.Add(new MenuItem() { Header = "-" });
FillBranchVisibilityMenu(submenu, branch);
var delete = new MenuItem(); var delete = new MenuItem();
delete.Header = new Views.NameHighlightedTextBlock("BranchCM.Delete", name); delete.Header = new Views.NameHighlightedTextBlock("BranchCM.Delete", name);
@ -1002,6 +1021,17 @@ namespace SourceGit.ViewModels
e.Handled = true; e.Handled = true;
}; };
submenu.Items.Add(delete); submenu.Items.Add(delete);
submenu.Items.Add(new MenuItem() { Header = "-" });
var copy = new MenuItem();
copy.Header = App.Text("BranchCM.CopyName");
copy.Icon = App.CreateMenuIcon("Icons.Copy");
copy.Click += (_, e) =>
{
App.CopyText(name);
e.Handled = true;
};
submenu.Items.Add(copy);
menu.Items.Add(submenu); menu.Items.Add(submenu);
} }
@ -1013,6 +1043,8 @@ namespace SourceGit.ViewModels
submenu.Icon = App.CreateMenuIcon("Icons.Tag"); submenu.Icon = App.CreateMenuIcon("Icons.Tag");
submenu.MinWidth = 200; submenu.MinWidth = 200;
FillTagVisibilityMenu(submenu, tag);
var push = new MenuItem(); var push = new MenuItem();
push.Header = new Views.NameHighlightedTextBlock("TagCM.Push", tag.Name); push.Header = new Views.NameHighlightedTextBlock("TagCM.Push", tag.Name);
push.Icon = App.CreateMenuIcon("Icons.Push"); push.Icon = App.CreateMenuIcon("Icons.Push");
@ -1036,9 +1068,6 @@ namespace SourceGit.ViewModels
e.Handled = true; e.Handled = true;
}; };
submenu.Items.Add(merge); submenu.Items.Add(merge);
submenu.Items.Add(new MenuItem() { Header = "-" });
FillTagVisibilityMenu(submenu, tag);
var delete = new MenuItem(); var delete = new MenuItem();
delete.Header = new Views.NameHighlightedTextBlock("TagCM.Delete", tag.Name); delete.Header = new Views.NameHighlightedTextBlock("TagCM.Delete", tag.Name);
@ -1050,6 +1079,17 @@ namespace SourceGit.ViewModels
e.Handled = true; e.Handled = true;
}; };
submenu.Items.Add(delete); submenu.Items.Add(delete);
submenu.Items.Add(new MenuItem() { Header = "-" });
var copy = new MenuItem();
copy.Header = App.Text("TagCM.Copy");
copy.Icon = App.CreateMenuIcon("Icons.Copy");
copy.Click += (_, e) =>
{
App.CopyText(tag.Name);
e.Handled = true;
};
submenu.Items.Add(copy);
menu.Items.Add(submenu); menu.Items.Add(submenu);
} }

View file

@ -206,6 +206,12 @@ namespace SourceGit.ViewModels
set => SetProperty(ref _useFullTextDiff, value); set => SetProperty(ref _useFullTextDiff, value);
} }
public bool EnableChangeBlocks
{
get => _enableChangeBlocks;
set => SetProperty(ref _enableChangeBlocks, value);
}
public Models.ChangeViewMode UnstagedChangeViewMode public Models.ChangeViewMode UnstagedChangeViewMode
{ {
get => _unstagedChangeViewMode; get => _unstagedChangeViewMode;
@ -614,6 +620,7 @@ namespace SourceGit.ViewModels
private bool _enableDiffViewWordWrap = false; private bool _enableDiffViewWordWrap = false;
private bool _showHiddenSymbolsInDiffView = false; private bool _showHiddenSymbolsInDiffView = false;
private bool _useFullTextDiff = false; private bool _useFullTextDiff = false;
private bool _enableChangeBlocks = false;
private Models.ChangeViewMode _unstagedChangeViewMode = Models.ChangeViewMode.List; private Models.ChangeViewMode _unstagedChangeViewMode = Models.ChangeViewMode.List;
private Models.ChangeViewMode _stagedChangeViewMode = Models.ChangeViewMode.List; private Models.ChangeViewMode _stagedChangeViewMode = Models.ChangeViewMode.List;

View file

@ -1,5 +1,4 @@
using System; using System.Collections.Generic;
using System.Collections.Generic;
using Avalonia.Collections; using Avalonia.Collections;
using CommunityToolkit.Mvvm.ComponentModel; using CommunityToolkit.Mvvm.ComponentModel;

View file

@ -296,6 +296,7 @@ namespace SourceGit.Views
if (currentParent is { DataContext: ViewModels.CommitDetail currentDetail } && if (currentParent is { DataContext: ViewModels.CommitDetail currentDetail } &&
currentDetail.Commit.SHA == lastDetailCommit) currentDetail.Commit.SHA == lastDetailCommit)
{ {
if (!_inlineCommits.ContainsKey(sha))
_inlineCommits.Add(sha, c); _inlineCommits.Add(sha, c);
// Make sure user still hovers the target SHA. // Make sure user still hovers the target SHA.

View file

@ -34,6 +34,15 @@
<!-- Toolbar Buttons --> <!-- Toolbar Buttons -->
<StackPanel Grid.Column="3" Margin="8,0,0,0" Orientation="Horizontal" VerticalAlignment="Center"> <StackPanel Grid.Column="3" Margin="8,0,0,0" Orientation="Horizontal" VerticalAlignment="Center">
<ToggleButton Classes="line_path"
Width="28"
Command="{Binding ToggleHighlightedDiffNavigation}"
IsChecked="{Binding Source={x:Static vm:Preference.Instance}, Path=EnableChangeBlocks, Mode=OneWay}"
IsVisible="{Binding IsTextDiff}"
ToolTip.Tip="{DynamicResource Text.Diff.HighlightedDiffNavigation}">
<Path Width="13" Height="13" Data="{StaticResource Icons.Highlight}" Margin="0,3,0,0"/>
</ToggleButton>
<Button Classes="icon_button" <Button Classes="icon_button"
Width="28" Width="28"
Click="OnGotoPrevChange" Click="OnGotoPrevChange"
@ -45,9 +54,14 @@
<TextBlock Classes="primary" <TextBlock Classes="primary"
Margin="0,0,0,0" Margin="0,0,0,0"
Text="{Binding ChangeBlockIndicator}" Text="{Binding ChangeBlockIndicator}"
FontSize="11" FontSize="11">
TextTrimming="CharacterEllipsis" <TextBlock.IsVisible>
IsVisible="{Binding IsTextDiff}"/> <MultiBinding Converter="{x:Static BoolConverters.And}">
<Binding Path="IsTextDiff"/>
<Binding Source="{x:Static vm:Preference.Instance}" Path="EnableChangeBlocks" Mode="OneWay"/>
</MultiBinding>
</TextBlock.IsVisible>
</TextBlock>
<Button Classes="icon_button" <Button Classes="icon_button"
Width="28" Width="28"

View file

@ -11,11 +11,9 @@ namespace SourceGit.Views
InitializeComponent(); InitializeComponent();
} }
public bool UseChangeBlocks { get; set; } = true;
private void OnGotoPrevChange(object _, RoutedEventArgs e) private void OnGotoPrevChange(object _, RoutedEventArgs e)
{ {
if (UseChangeBlocks) if (ViewModels.Preference.Instance.EnableChangeBlocks)
{ {
if (DataContext is ViewModels.DiffContext diffCtx) if (DataContext is ViewModels.DiffContext diffCtx)
diffCtx.PrevChange(); diffCtx.PrevChange();
@ -36,7 +34,7 @@ namespace SourceGit.Views
private void OnGotoNextChange(object _, RoutedEventArgs e) private void OnGotoNextChange(object _, RoutedEventArgs e)
{ {
if (UseChangeBlocks) if (ViewModels.Preference.Instance.EnableChangeBlocks)
{ {
if (DataContext is ViewModels.DiffContext diffCtx) if (DataContext is ViewModels.DiffContext diffCtx)
diffCtx.NextChange(); diffCtx.NextChange();

View file

@ -65,6 +65,7 @@
<Setter Property="Margin" Value="0"/> <Setter Property="Margin" Value="0"/>
<Setter Property="Padding" Value="0"/> <Setter Property="Padding" Value="0"/>
<Setter Property="Height" Value="28"/> <Setter Property="Height" Value="28"/>
<Setter Property="HorizontalContentAlignment" Value="Stretch"/>
</Style> </Style>
</ListBox.Styles> </ListBox.Styles>
@ -76,13 +77,16 @@
<ListBox.ItemTemplate> <ListBox.ItemTemplate>
<DataTemplate DataType="vm:InteractiveRebaseItem"> <DataTemplate DataType="vm:InteractiveRebaseItem">
<Grid ColumnDefinitions="16,110,*,140,96,156,32,32"> <Grid ColumnDefinitions="16,110,*,456" Margin="8,0" ClipToBounds="True">
<!-- Drag & Drop Anchor --> <!-- Drag & Drop Anchor -->
<Border Grid.Column="0" Background="Transparent" <Border Grid.Column="0" Background="Transparent"
Margin="4,0,0,0"
Loaded="OnSetupRowHeaderDragDrop" Loaded="OnSetupRowHeaderDragDrop"
PointerPressed="OnRowHeaderPointerPressed"> PointerPressed="OnRowHeaderPointerPressed">
<Path Width="14" Height="14" Data="{StaticResource Icons.Move}" Fill="{DynamicResource Brush.FG2}"/> <Path Width="14" Height="14"
Data="{StaticResource Icons.Move}"
Fill="{DynamicResource Brush.FG2}"
HorizontalAlignment="Center"
VerticalAlignment="Center"/>
</Border> </Border>
<!-- Action --> <!-- Action -->
@ -171,7 +175,7 @@
<!-- Subject --> <!-- Subject -->
<Grid Grid.Column="2" ColumnDefinitions="Auto,*" ClipToBounds="True"> <Grid Grid.Column="2" ColumnDefinitions="Auto,*" ClipToBounds="True">
<Button Grid.Column="0" Classes="icon_button" IsVisible="{Binding Action, Converter={x:Static c:InteractiveRebaseActionConverters.CanEditMessage}}"> <Button Grid.Column="0" Classes="icon_button" Margin="0,0,8,0" IsVisible="{Binding Action, Converter={x:Static c:InteractiveRebaseActionConverters.CanEditMessage}}">
<Button.Flyout> <Button.Flyout>
<Flyout Placement="BottomEdgeAlignedLeft"> <Flyout Placement="BottomEdgeAlignedLeft">
<Panel Width="600" Height="120"> <Panel Width="600" Height="120">
@ -181,44 +185,48 @@
</Button.Flyout> </Button.Flyout>
<Path Width="14" Height="14" Margin="0,4,0,0" Data="{StaticResource Icons.Edit}"/> <Path Width="14" Height="14" Margin="0,4,0,0" Data="{StaticResource Icons.Edit}"/>
</Button> </Button>
<TextBlock Grid.Column="1" Classes="primary" Text="{Binding Subject}" Margin="8,0,0,0"/> <TextBlock Grid.Column="1" Classes="primary" Margin="0,0,4,0" Text="{Binding Subject}"/>
</Grid> </Grid>
<!-- Author --> <Grid Grid.Column="3" ColumnDefinitions="32,108,96,156,32,32" IsHitTestVisible="False" ClipToBounds="True">
<Grid Grid.Column="3" ColumnDefinitions="Auto,*" Width="140" ClipToBounds="True"> <!-- Author Avatar -->
<v:Avatar Grid.Column="0" <v:Avatar Grid.Column="0"
Width="16" Height="16" Width="16" Height="16"
Margin="8,0,0,0" Margin="8,0,0,0"
VerticalAlignment="Center" VerticalAlignment="Center"
IsHitTestVisible="False"
User="{Binding Commit.Author}"/> User="{Binding Commit.Author}"/>
<!-- Author Name -->
<TextBlock Grid.Column="1" <TextBlock Grid.Column="1"
Classes="primary" Classes="primary"
MaxWidth="90"
Margin="6,0,12,0" Margin="6,0,12,0"
Text="{Binding Commit.Author.Name}" Text="{Binding Commit.Author.Name}"
HorizontalAlignment="Left"/> HorizontalAlignment="Left"/>
</Grid>
<!-- Commit SHA --> <!-- Commit SHA -->
<Border Grid.Column="4" IsHitTestVisible="False" ClipToBounds="True"> <Border Grid.Column="2" ClipToBounds="True">
<TextBlock Classes="primary" <TextBlock Classes="primary"
Text="{Binding Commit.SHA, Converter={x:Static c:StringConverters.ToShortSHA}}" Text="{Binding Commit.SHA, Converter={x:Static c:StringConverters.ToShortSHA}}"
HorizontalAlignment="Center"/> HorizontalAlignment="Center"/>
</Border> </Border>
<!-- Commit Time --> <!-- Commit Time -->
<TextBlock Grid.Column="5" Classes="primary" Text="{Binding Commit.CommitterTimeStr}" Margin="8,0"/> <Border Grid.Column="3" ClipToBounds="True">
<TextBlock Classes="primary" Text="{Binding Commit.CommitterTimeStr}" Margin="8,0"/>
</Border>
<!-- MoveUp Button --> <!-- MoveUp Button -->
<Button Grid.Column="6" Classes="icon_button" Click="OnMoveItemUp" ToolTip.Tip="Alt+Up"> <Button Grid.Column="4" Classes="icon_button" Click="OnMoveItemUp" ToolTip.Tip="Alt+Up">
<Path Width="14" Height="14" Margin="0,4,0,0" Data="{StaticResource Icons.Up}"/> <Path Width="14" Height="14" Margin="0,4,0,0" Data="{StaticResource Icons.Up}"/>
</Button> </Button>
<!-- MoveDown Button --> <!-- MoveDown Button -->
<Button Grid.Column="7" Classes="icon_button" Click="OnMoveItemDown" ToolTip.Tip="Alt+Down"> <Button Grid.Column="5" Classes="icon_button" Click="OnMoveItemDown" ToolTip.Tip="Alt+Down">
<Path Width="14" Height="14" Margin="0,4,0,0" Data="{StaticResource Icons.Down}"/> <Path Width="14" Height="14" Margin="0,4,0,0" Data="{StaticResource Icons.Down}"/>
</Button> </Button>
</Grid> </Grid>
</Grid>
</DataTemplate> </DataTemplate>
</ListBox.ItemTemplate> </ListBox.ItemTemplate>
</v:InteractiveRebaseListBox> </v:InteractiveRebaseListBox>

View file

@ -50,9 +50,6 @@ namespace SourceGit.Views
if (launcher is not null && DataContext is ViewModels.Repository repo) if (launcher is not null && DataContext is ViewModels.Repository repo)
{ {
var startDirectly = launcher.HasKeyModifier(KeyModifiers.Control); var startDirectly = launcher.HasKeyModifier(KeyModifiers.Control);
if (!startDirectly && OperatingSystem.IsMacOS())
startDirectly = launcher.HasKeyModifier(KeyModifiers.Meta);
launcher.ClearKeyModifier(); launcher.ClearKeyModifier();
repo.Fetch(startDirectly); repo.Fetch(startDirectly);
e.Handled = true; e.Handled = true;
@ -65,9 +62,6 @@ namespace SourceGit.Views
if (launcher is not null && DataContext is ViewModels.Repository repo) if (launcher is not null && DataContext is ViewModels.Repository repo)
{ {
var startDirectly = launcher.HasKeyModifier(KeyModifiers.Control); var startDirectly = launcher.HasKeyModifier(KeyModifiers.Control);
if (!startDirectly && OperatingSystem.IsMacOS())
startDirectly = launcher.HasKeyModifier(KeyModifiers.Meta);
launcher.ClearKeyModifier(); launcher.ClearKeyModifier();
repo.Pull(startDirectly); repo.Pull(startDirectly);
e.Handled = true; e.Handled = true;
@ -80,9 +74,6 @@ namespace SourceGit.Views
if (launcher is not null && DataContext is ViewModels.Repository repo) if (launcher is not null && DataContext is ViewModels.Repository repo)
{ {
var startDirectly = launcher.HasKeyModifier(KeyModifiers.Control); var startDirectly = launcher.HasKeyModifier(KeyModifiers.Control);
if (!startDirectly && OperatingSystem.IsMacOS())
startDirectly = launcher.HasKeyModifier(KeyModifiers.Meta);
launcher.ClearKeyModifier(); launcher.ClearKeyModifier();
repo.Push(startDirectly); repo.Push(startDirectly);
e.Handled = true; e.Handled = true;
@ -95,9 +86,6 @@ namespace SourceGit.Views
if (launcher is not null && DataContext is ViewModels.Repository repo) if (launcher is not null && DataContext is ViewModels.Repository repo)
{ {
var startDirectly = launcher.HasKeyModifier(KeyModifiers.Control); var startDirectly = launcher.HasKeyModifier(KeyModifiers.Control);
if (!startDirectly && OperatingSystem.IsMacOS())
startDirectly = launcher.HasKeyModifier(KeyModifiers.Meta);
launcher.ClearKeyModifier(); launcher.ClearKeyModifier();
repo.StashAll(startDirectly); repo.StashAll(startDirectly);
e.Handled = true; e.Handled = true;

View file

@ -635,6 +635,7 @@ namespace SourceGit.Views
//TextArea.Caret.BringCaretToView(); // NOTE: Brings caret line (barely) into view. //TextArea.Caret.BringCaretToView(); // NOTE: Brings caret line (barely) into view.
ScrollToLine(changeBlock.StartLine); // NOTE: Brings specified line into center of view. ScrollToLine(changeBlock.StartLine); // NOTE: Brings specified line into center of view.
} }
TextArea.TextView.Redraw();
} }
public override void Render(DrawingContext context) public override void Render(DrawingContext context)
@ -712,6 +713,10 @@ namespace SourceGit.Views
{ {
InvalidateVisual(); InvalidateVisual();
} }
else if (change.Property == CurrentChangeBlockIdxProperty)
{
InvalidateVisual();
}
} }
private void OnTextViewContextRequested(object sender, ContextRequestedEventArgs e) private void OnTextViewContextRequested(object sender, ContextRequestedEventArgs e)
@ -1587,7 +1592,7 @@ namespace SourceGit.Views
CurrentChangeBlockIdxProperty.Changed.AddClassHandler<TextDiffView>((v, e) => CurrentChangeBlockIdxProperty.Changed.AddClassHandler<TextDiffView>((v, e) =>
{ {
if ((int)e.NewValue >= 0 && v.Editor.Presenter != null) if (v.Editor.Presenter != null)
{ {
foreach (var p in v.Editor.Presenter.GetVisualDescendants().OfType<ThemedTextDiffPresenter>()) foreach (var p in v.Editor.Presenter.GetVisualDescendants().OfType<ThemedTextDiffPresenter>())
{ {