mirror of
https://github.com/sourcegit-scm/sourcegit
synced 2025-05-22 12:45:00 +00:00
refactor: commit message
- move issue tracker and commit hash links parsing to view models - parsing links async - make sure matched hash is a valid commit oid - disable `CHILDREN` row in submodule info panel Signed-off-by: leo <longshuang@msn.cn>
This commit is contained in:
parent
5301a368e0
commit
b75676a7f8
17 changed files with 191 additions and 186 deletions
17
src/Commands/IsCommitSHA.cs
Normal file
17
src/Commands/IsCommitSHA.cs
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
namespace SourceGit.Commands
|
||||||
|
{
|
||||||
|
public class IsCommitSHA : Command
|
||||||
|
{
|
||||||
|
public IsCommitSHA(string repo, string hash)
|
||||||
|
{
|
||||||
|
WorkingDirectory = repo;
|
||||||
|
Args = $"cat-file -t {hash}";
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool Result()
|
||||||
|
{
|
||||||
|
var rs = ReadToEnd();
|
||||||
|
return rs.IsSuccess && rs.StdOut.Trim().Equals("commit");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -3,18 +3,18 @@ using System.Collections.Generic;
|
||||||
|
|
||||||
namespace SourceGit.Commands
|
namespace SourceGit.Commands
|
||||||
{
|
{
|
||||||
public class QueryCommitsWithFullMessage : Command
|
public class QueryCommitsForInteractiveRebase : Command
|
||||||
{
|
{
|
||||||
public QueryCommitsWithFullMessage(string repo, string args)
|
public QueryCommitsForInteractiveRebase(string repo, string on)
|
||||||
{
|
{
|
||||||
_boundary = $"----- BOUNDARY OF COMMIT {Guid.NewGuid()} -----";
|
_boundary = $"----- BOUNDARY OF COMMIT {Guid.NewGuid()} -----";
|
||||||
|
|
||||||
WorkingDirectory = repo;
|
WorkingDirectory = repo;
|
||||||
Context = repo;
|
Context = repo;
|
||||||
Args = $"log --date-order --no-show-signature --decorate=full --pretty=format:\"%H%n%P%n%D%n%aN±%aE%n%at%n%cN±%cE%n%ct%n%B%n{_boundary}\" {args}";
|
Args = $"log --date-order --no-show-signature --decorate=full --pretty=format:\"%H%n%P%n%D%n%aN±%aE%n%at%n%cN±%cE%n%ct%n%B%n{_boundary}\" {on}..HEAD";
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<Models.CommitWithMessage> Result()
|
public List<Models.InteractiveCommit> Result()
|
||||||
{
|
{
|
||||||
var rs = ReadToEnd();
|
var rs = ReadToEnd();
|
||||||
if (!rs.IsSuccess)
|
if (!rs.IsSuccess)
|
||||||
|
@ -29,7 +29,7 @@ namespace SourceGit.Commands
|
||||||
switch (nextPartIdx)
|
switch (nextPartIdx)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
_current = new Models.CommitWithMessage();
|
_current = new Models.InteractiveCommit();
|
||||||
_current.Commit.SHA = line;
|
_current.Commit.SHA = line;
|
||||||
_commits.Add(_current);
|
_commits.Add(_current);
|
||||||
break;
|
break;
|
||||||
|
@ -52,7 +52,7 @@ namespace SourceGit.Commands
|
||||||
_current.Commit.CommitterTime = ulong.Parse(line);
|
_current.Commit.CommitterTime = ulong.Parse(line);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
var boundary = rs.StdOut.IndexOf(_boundary, end + 1);
|
var boundary = rs.StdOut.IndexOf(_boundary, end + 1, StringComparison.Ordinal);
|
||||||
if (boundary > end)
|
if (boundary > end)
|
||||||
{
|
{
|
||||||
_current.Message = rs.StdOut.Substring(start, boundary - start - 1);
|
_current.Message = rs.StdOut.Substring(start, boundary - start - 1);
|
||||||
|
@ -88,8 +88,8 @@ namespace SourceGit.Commands
|
||||||
_current.Commit.Parents.AddRange(data.Split(separator: ' ', options: StringSplitOptions.RemoveEmptyEntries));
|
_current.Commit.Parents.AddRange(data.Split(separator: ' ', options: StringSplitOptions.RemoveEmptyEntries));
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<Models.CommitWithMessage> _commits = new List<Models.CommitWithMessage>();
|
private List<Models.InteractiveCommit> _commits = [];
|
||||||
private Models.CommitWithMessage _current = null;
|
private Models.InteractiveCommit _current = null;
|
||||||
private string _boundary = "";
|
private string _boundary = "";
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -112,9 +112,9 @@ namespace SourceGit.Models
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class CommitWithMessage
|
public class CommitFullMessage
|
||||||
{
|
{
|
||||||
public Commit Commit { get; set; } = new Commit();
|
public string Message { get; set; } = string.Empty;
|
||||||
public string Message { get; set; } = "";
|
public List<Hyperlink> Links { get; set; } = [];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,6 +12,12 @@ namespace SourceGit.Models
|
||||||
Drop,
|
Drop,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class InteractiveCommit
|
||||||
|
{
|
||||||
|
public Commit Commit { get; set; } = new Commit();
|
||||||
|
public string Message { get; set; } = string.Empty;
|
||||||
|
}
|
||||||
|
|
||||||
public class InteractiveRebaseJob
|
public class InteractiveRebaseJob
|
||||||
{
|
{
|
||||||
public string SHA { get; set; } = string.Empty;
|
public string SHA { get; set; } = string.Empty;
|
||||||
|
|
|
@ -29,6 +29,6 @@ namespace SourceGit.Models
|
||||||
public class RevisionSubmodule
|
public class RevisionSubmodule
|
||||||
{
|
{
|
||||||
public Commit Commit { get; set; } = null;
|
public Commit Commit { get; set; } = null;
|
||||||
public string FullMessage { get; set; } = string.Empty;
|
public CommitFullMessage FullMessage { get; set; } = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,6 @@ using System.IO;
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
using Avalonia.Collections;
|
|
||||||
using Avalonia.Controls;
|
using Avalonia.Controls;
|
||||||
using Avalonia.Media.Imaging;
|
using Avalonia.Media.Imaging;
|
||||||
using Avalonia.Platform.Storage;
|
using Avalonia.Platform.Storage;
|
||||||
|
@ -46,7 +45,7 @@ namespace SourceGit.ViewModels
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public string FullMessage
|
public Models.CommitFullMessage FullMessage
|
||||||
{
|
{
|
||||||
get => _fullMessage;
|
get => _fullMessage;
|
||||||
private set => SetProperty(ref _fullMessage, value);
|
private set => SetProperty(ref _fullMessage, value);
|
||||||
|
@ -85,11 +84,11 @@ namespace SourceGit.ViewModels
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public AvaloniaList<string> Children
|
public List<string> Children
|
||||||
{
|
{
|
||||||
get;
|
get => _children;
|
||||||
private set;
|
private set => SetProperty(ref _children, value);
|
||||||
} = [];
|
}
|
||||||
|
|
||||||
public string SearchChangeFilter
|
public string SearchChangeFilter
|
||||||
{
|
{
|
||||||
|
@ -109,17 +108,12 @@ namespace SourceGit.ViewModels
|
||||||
set => SetProperty(ref _viewRevisionFileContent, value);
|
set => SetProperty(ref _viewRevisionFileContent, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
public AvaloniaList<Models.CommitLink> WebLinks
|
public List<Models.CommitLink> WebLinks
|
||||||
{
|
{
|
||||||
get;
|
get;
|
||||||
private set;
|
private set;
|
||||||
} = [];
|
} = [];
|
||||||
|
|
||||||
public AvaloniaList<Models.IssueTrackerRule> IssueTrackerRules
|
|
||||||
{
|
|
||||||
get => _repo.Settings?.IssueTrackerRules;
|
|
||||||
}
|
|
||||||
|
|
||||||
public string RevisionFileSearchFilter
|
public string RevisionFileSearchFilter
|
||||||
{
|
{
|
||||||
get => _revisionFileSearchFilter;
|
get => _revisionFileSearchFilter;
|
||||||
|
@ -127,25 +121,23 @@ namespace SourceGit.ViewModels
|
||||||
{
|
{
|
||||||
if (SetProperty(ref _revisionFileSearchFilter, value))
|
if (SetProperty(ref _revisionFileSearchFilter, value))
|
||||||
{
|
{
|
||||||
RevisionFileSearchSuggestion.Clear();
|
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(value))
|
if (!string.IsNullOrEmpty(value))
|
||||||
{
|
{
|
||||||
if (_revisionFiles.Count == 0)
|
if (_revisionFiles == null)
|
||||||
{
|
{
|
||||||
var sha = Commit.SHA;
|
var sha = Commit.SHA;
|
||||||
|
|
||||||
Task.Run(() =>
|
Task.Run(() =>
|
||||||
{
|
{
|
||||||
var files = new Commands.QueryRevisionFileNames(_repo.FullPath, sha).Result();
|
var files = new Commands.QueryRevisionFileNames(_repo.FullPath, sha).Result();
|
||||||
|
var filesList = new List<string>();
|
||||||
|
filesList.AddRange(files);
|
||||||
|
|
||||||
Dispatcher.UIThread.Invoke(() =>
|
Dispatcher.UIThread.Invoke(() =>
|
||||||
{
|
{
|
||||||
if (sha == Commit.SHA)
|
if (sha == Commit.SHA)
|
||||||
{
|
{
|
||||||
_revisionFiles.Clear();
|
_revisionFiles = filesList;
|
||||||
_revisionFiles.AddRange(files);
|
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(_revisionFileSearchFilter))
|
if (!string.IsNullOrEmpty(_revisionFileSearchFilter))
|
||||||
UpdateRevisionFileSearchSuggestion();
|
UpdateRevisionFileSearchSuggestion();
|
||||||
}
|
}
|
||||||
|
@ -159,23 +151,17 @@ namespace SourceGit.ViewModels
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
IsRevisionFileSearchSuggestionOpen = false;
|
RevisionFileSearchSuggestion = null;
|
||||||
GC.Collect();
|
GC.Collect();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public AvaloniaList<string> RevisionFileSearchSuggestion
|
public List<string> RevisionFileSearchSuggestion
|
||||||
{
|
{
|
||||||
get;
|
get => _revisionFileSearchSuggestion;
|
||||||
private set;
|
private set => SetProperty(ref _revisionFileSearchSuggestion, value);
|
||||||
} = [];
|
|
||||||
|
|
||||||
public bool IsRevisionFileSearchSuggestionOpen
|
|
||||||
{
|
|
||||||
get => _isRevisionFileSearchSuggestionOpen;
|
|
||||||
set => SetProperty(ref _isRevisionFileSearchSuggestionOpen, value);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public CommitDetail(Repository repo)
|
public CommitDetail(Repository repo)
|
||||||
|
@ -212,23 +198,17 @@ namespace SourceGit.ViewModels
|
||||||
{
|
{
|
||||||
_repo = null;
|
_repo = null;
|
||||||
_commit = null;
|
_commit = null;
|
||||||
|
_changes = null;
|
||||||
if (_changes != null)
|
_visibleChanges = null;
|
||||||
_changes.Clear();
|
_selectedChanges = null;
|
||||||
if (_visibleChanges != null)
|
|
||||||
_visibleChanges.Clear();
|
|
||||||
if (_selectedChanges != null)
|
|
||||||
_selectedChanges.Clear();
|
|
||||||
|
|
||||||
_signInfo = null;
|
_signInfo = null;
|
||||||
_searchChangeFilter = null;
|
_searchChangeFilter = null;
|
||||||
_diffContext = null;
|
_diffContext = null;
|
||||||
_viewRevisionFileContent = null;
|
_viewRevisionFileContent = null;
|
||||||
_cancelToken = null;
|
_cancelToken = null;
|
||||||
|
|
||||||
WebLinks.Clear();
|
WebLinks.Clear();
|
||||||
_revisionFiles.Clear();
|
_revisionFiles = null;
|
||||||
RevisionFileSearchSuggestion.Clear();
|
_revisionFileSearchSuggestion = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void NavigateTo(string commitSHA)
|
public void NavigateTo(string commitSHA)
|
||||||
|
@ -251,6 +231,11 @@ namespace SourceGit.ViewModels
|
||||||
RevisionFileSearchFilter = string.Empty;
|
RevisionFileSearchFilter = string.Empty;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void CancelRevisionFileSuggestions()
|
||||||
|
{
|
||||||
|
RevisionFileSearchSuggestion = null;
|
||||||
|
}
|
||||||
|
|
||||||
public Models.Commit GetParent(string sha)
|
public Models.Commit GetParent(string sha)
|
||||||
{
|
{
|
||||||
return new Commands.QuerySingleCommit(_repo.FullPath, sha).Result();
|
return new Commands.QuerySingleCommit(_repo.FullPath, sha).Result();
|
||||||
|
@ -322,7 +307,12 @@ namespace SourceGit.ViewModels
|
||||||
if (commit != null)
|
if (commit != null)
|
||||||
{
|
{
|
||||||
var body = new Commands.QueryCommitFullMessage(submoduleRoot, file.SHA).Result();
|
var body = new Commands.QueryCommitFullMessage(submoduleRoot, file.SHA).Result();
|
||||||
var submodule = new Models.RevisionSubmodule() { Commit = commit, FullMessage = body };
|
var submodule = new Models.RevisionSubmodule()
|
||||||
|
{
|
||||||
|
Commit = commit,
|
||||||
|
FullMessage = new Models.CommitFullMessage { Message = body }
|
||||||
|
};
|
||||||
|
|
||||||
Dispatcher.UIThread.Invoke(() => ViewRevisionFileContent = submodule);
|
Dispatcher.UIThread.Invoke(() => ViewRevisionFileContent = submodule);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -332,7 +322,7 @@ namespace SourceGit.ViewModels
|
||||||
ViewRevisionFileContent = new Models.RevisionSubmodule()
|
ViewRevisionFileContent = new Models.RevisionSubmodule()
|
||||||
{
|
{
|
||||||
Commit = new Models.Commit() { SHA = file.SHA },
|
Commit = new Models.Commit() { SHA = file.SHA },
|
||||||
FullMessage = string.Empty,
|
FullMessage = null,
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -622,23 +612,22 @@ namespace SourceGit.ViewModels
|
||||||
private void Refresh()
|
private void Refresh()
|
||||||
{
|
{
|
||||||
_changes = null;
|
_changes = null;
|
||||||
_revisionFiles.Clear();
|
_revisionFiles = null;
|
||||||
|
|
||||||
SignInfo = null;
|
SignInfo = null;
|
||||||
ViewRevisionFileContent = null;
|
ViewRevisionFileContent = null;
|
||||||
Children.Clear();
|
Children = null;
|
||||||
RevisionFileSearchFilter = string.Empty;
|
RevisionFileSearchFilter = string.Empty;
|
||||||
IsRevisionFileSearchSuggestionOpen = false;
|
RevisionFileSearchSuggestion = null;
|
||||||
|
|
||||||
GC.Collect();
|
|
||||||
|
|
||||||
if (_commit == null)
|
if (_commit == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Task.Run(() =>
|
Task.Run(() =>
|
||||||
{
|
{
|
||||||
var fullMessage = new Commands.QueryCommitFullMessage(_repo.FullPath, _commit.SHA).Result();
|
var message = new Commands.QueryCommitFullMessage(_repo.FullPath, _commit.SHA).Result();
|
||||||
Dispatcher.UIThread.Invoke(() => FullMessage = fullMessage);
|
var links = ParseLinksInMessage(message);
|
||||||
|
Dispatcher.UIThread.Invoke(() => FullMessage = new Models.CommitFullMessage { Message = message, Links = links });
|
||||||
});
|
});
|
||||||
|
|
||||||
Task.Run(() =>
|
Task.Run(() =>
|
||||||
|
@ -694,6 +683,49 @@ namespace SourceGit.ViewModels
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private List<Models.Hyperlink> ParseLinksInMessage(string message)
|
||||||
|
{
|
||||||
|
var links = new List<Models.Hyperlink>();
|
||||||
|
if (_repo.Settings.IssueTrackerRules is { Count: > 0 } rules)
|
||||||
|
{
|
||||||
|
foreach (var rule in rules)
|
||||||
|
rule.Matches(links, message);
|
||||||
|
}
|
||||||
|
|
||||||
|
var shas = REG_SHA_FORMAT().Matches(message);
|
||||||
|
for (int i = 0; i < shas.Count; i++)
|
||||||
|
{
|
||||||
|
var sha = shas[i];
|
||||||
|
if (!sha.Success)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
var hash = sha.Groups[1].Value;
|
||||||
|
var test = new Commands.IsCommitSHA(_repo.FullPath, hash).Result();
|
||||||
|
if (!test)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
var start = sha.Index;
|
||||||
|
var len = sha.Length;
|
||||||
|
var intersect = false;
|
||||||
|
foreach (var link in links)
|
||||||
|
{
|
||||||
|
if (link.Intersect(start, len))
|
||||||
|
{
|
||||||
|
intersect = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!intersect)
|
||||||
|
links.Add(new Models.Hyperlink(start, len, hash, true));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (links.Count > 0)
|
||||||
|
links.Sort((l, r) => l.Start - r.Start);
|
||||||
|
|
||||||
|
return links;
|
||||||
|
}
|
||||||
|
|
||||||
private void RefreshVisibleChanges()
|
private void RefreshVisibleChanges()
|
||||||
{
|
{
|
||||||
if (_changes == null)
|
if (_changes == null)
|
||||||
|
@ -813,11 +845,12 @@ namespace SourceGit.ViewModels
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
RevisionFileSearchSuggestion.Clear();
|
RevisionFileSearchSuggestion = suggestion;
|
||||||
RevisionFileSearchSuggestion.AddRange(suggestion);
|
|
||||||
IsRevisionFileSearchSuggestionOpen = suggestion.Count > 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[GeneratedRegex(@"\b([0-9a-fA-F]{6,40})\b")]
|
||||||
|
private static partial Regex REG_SHA_FORMAT();
|
||||||
|
|
||||||
[GeneratedRegex(@"^version https://git-lfs.github.com/spec/v\d+\r?\noid sha256:([0-9a-f]+)\r?\nsize (\d+)[\r\n]*$")]
|
[GeneratedRegex(@"^version https://git-lfs.github.com/spec/v\d+\r?\noid sha256:([0-9a-f]+)\r?\nsize (\d+)[\r\n]*$")]
|
||||||
private static partial Regex REG_LFS_FORMAT();
|
private static partial Regex REG_LFS_FORMAT();
|
||||||
|
|
||||||
|
@ -828,8 +861,9 @@ namespace SourceGit.ViewModels
|
||||||
|
|
||||||
private Repository _repo = null;
|
private Repository _repo = null;
|
||||||
private Models.Commit _commit = null;
|
private Models.Commit _commit = null;
|
||||||
private string _fullMessage = string.Empty;
|
private Models.CommitFullMessage _fullMessage = null;
|
||||||
private Models.CommitSignInfo _signInfo = null;
|
private Models.CommitSignInfo _signInfo = null;
|
||||||
|
private List<string> _children = null;
|
||||||
private List<Models.Change> _changes = null;
|
private List<Models.Change> _changes = null;
|
||||||
private List<Models.Change> _visibleChanges = null;
|
private List<Models.Change> _visibleChanges = null;
|
||||||
private List<Models.Change> _selectedChanges = null;
|
private List<Models.Change> _selectedChanges = null;
|
||||||
|
@ -837,8 +871,8 @@ namespace SourceGit.ViewModels
|
||||||
private DiffContext _diffContext = null;
|
private DiffContext _diffContext = null;
|
||||||
private object _viewRevisionFileContent = null;
|
private object _viewRevisionFileContent = null;
|
||||||
private Commands.Command.CancelToken _cancelToken = null;
|
private Commands.Command.CancelToken _cancelToken = null;
|
||||||
private List<string> _revisionFiles = [];
|
private List<string> _revisionFiles = null;
|
||||||
private string _revisionFileSearchFilter = string.Empty;
|
private string _revisionFileSearchFilter = string.Empty;
|
||||||
private bool _isRevisionFileSearchSuggestionOpen = false;
|
private List<string> _revisionFileSearchSuggestion = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -235,13 +235,17 @@ namespace SourceGit.ViewModels
|
||||||
if (commit != null)
|
if (commit != null)
|
||||||
{
|
{
|
||||||
var body = new Commands.QueryCommitFullMessage(repo, sha).Result();
|
var body = new Commands.QueryCommitFullMessage(repo, sha).Result();
|
||||||
return new Models.RevisionSubmodule() { Commit = commit, FullMessage = body };
|
return new Models.RevisionSubmodule()
|
||||||
|
{
|
||||||
|
Commit = commit,
|
||||||
|
FullMessage = new Models.CommitFullMessage { Message = body }
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
return new Models.RevisionSubmodule()
|
return new Models.RevisionSubmodule()
|
||||||
{
|
{
|
||||||
Commit = new Models.Commit() { SHA = sha },
|
Commit = new Models.Commit() { SHA = sha },
|
||||||
FullMessage = string.Empty,
|
FullMessage = null,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -123,12 +123,20 @@ namespace SourceGit.ViewModels
|
||||||
if (commit != null)
|
if (commit != null)
|
||||||
{
|
{
|
||||||
var message = new Commands.QueryCommitFullMessage(submoduleRoot, obj.SHA).Result();
|
var message = new Commands.QueryCommitFullMessage(submoduleRoot, obj.SHA).Result();
|
||||||
var module = new Models.RevisionSubmodule() { Commit = commit, FullMessage = message };
|
var module = new Models.RevisionSubmodule()
|
||||||
|
{
|
||||||
|
Commit = commit,
|
||||||
|
FullMessage = new Models.CommitFullMessage { Message = message }
|
||||||
|
};
|
||||||
Dispatcher.UIThread.Invoke(() => ViewContent = new FileHistoriesRevisionFile(_file, module));
|
Dispatcher.UIThread.Invoke(() => ViewContent = new FileHistoriesRevisionFile(_file, module));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
var module = new Models.RevisionSubmodule() { Commit = new Models.Commit() { SHA = obj.SHA }, FullMessage = "" };
|
var module = new Models.RevisionSubmodule()
|
||||||
|
{
|
||||||
|
Commit = new Models.Commit() { SHA = obj.SHA },
|
||||||
|
FullMessage = null
|
||||||
|
};
|
||||||
Dispatcher.UIThread.Invoke(() => ViewContent = new FileHistoriesRevisionFile(_file, module));
|
Dispatcher.UIThread.Invoke(() => ViewContent = new FileHistoriesRevisionFile(_file, module));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -118,7 +118,7 @@ namespace SourceGit.ViewModels
|
||||||
|
|
||||||
Task.Run(() =>
|
Task.Run(() =>
|
||||||
{
|
{
|
||||||
var commits = new Commands.QueryCommitsWithFullMessage(repoPath, $"{on.SHA}..HEAD").Result();
|
var commits = new Commands.QueryCommitsForInteractiveRebase(repoPath, on.SHA).Result();
|
||||||
var list = new List<InteractiveRebaseItem>();
|
var list = new List<InteractiveRebaseItem>();
|
||||||
|
|
||||||
foreach (var c in commits)
|
foreach (var c in commits)
|
||||||
|
|
|
@ -95,8 +95,8 @@
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
|
|
||||||
<!-- PARENTS -->
|
<!-- PARENTS -->
|
||||||
<TextBlock Grid.Row="1" Grid.Column="0" Classes="info_label" VerticalAlignment="Top" Margin="0,4,0,0" Text="{DynamicResource Text.CommitDetail.Info.Parents}" IsVisible="{Binding Parents.Count, Converter={x:Static c:IntConverters.IsGreaterThanZero}}"/>
|
<TextBlock Grid.Row="1" Grid.Column="0" Classes="info_label" VerticalAlignment="Top" Margin="0,4,0,0" Text="{DynamicResource Text.CommitDetail.Info.Parents}" IsVisible="{Binding Parents, Converter={x:Static c:ListConverters.IsNotNullOrEmpty}}"/>
|
||||||
<ItemsControl Grid.Row="1" Grid.Column="1" Height="24" Margin="12,0,0,0" ItemsSource="{Binding Parents}" IsVisible="{Binding Parents.Count, Converter={x:Static c:IntConverters.IsGreaterThanZero}}">
|
<ItemsControl Grid.Row="1" Grid.Column="1" Height="24" Margin="12,0,0,0" ItemsSource="{Binding Parents}" IsVisible="{Binding Parents, Converter={x:Static c:ListConverters.IsNotNullOrEmpty}}">
|
||||||
<ItemsControl.ItemsPanel>
|
<ItemsControl.ItemsPanel>
|
||||||
<ItemsPanelTemplate>
|
<ItemsPanelTemplate>
|
||||||
<StackPanel Orientation="Horizontal" VerticalAlignment="Center"/>
|
<StackPanel Orientation="Horizontal" VerticalAlignment="Center"/>
|
||||||
|
@ -133,8 +133,8 @@
|
||||||
</ItemsControl>
|
</ItemsControl>
|
||||||
|
|
||||||
<!-- CHILDREN -->
|
<!-- CHILDREN -->
|
||||||
<TextBlock Grid.Row="2" Grid.Column="0" Classes="info_label" VerticalAlignment="Top" Margin="0,4,0,0" Text="{DynamicResource Text.CommitDetail.Info.Children}" IsVisible="{Binding #ThisControl.Children.Count, Converter={x:Static c:IntConverters.IsGreaterThanZero}}"/>
|
<TextBlock Grid.Row="2" Grid.Column="0" Classes="info_label" VerticalAlignment="Top" Margin="0,4,0,0" Text="{DynamicResource Text.CommitDetail.Info.Children}" IsVisible="{Binding #ThisControl.Children, Converter={x:Static c:ListConverters.IsNotNullOrEmpty}}"/>
|
||||||
<ItemsControl Grid.Row="2" Grid.Column="1" Margin="12,0,0,0" ItemsSource="{Binding #ThisControl.Children}" IsVisible="{Binding #ThisControl.Children.Count, Converter={x:Static c:IntConverters.IsGreaterThanZero}}">
|
<ItemsControl Grid.Row="2" Grid.Column="1" Margin="12,0,0,0" ItemsSource="{Binding #ThisControl.Children}" IsVisible="{Binding #ThisControl.Children, Converter={x:Static c:ListConverters.IsNotNullOrEmpty}}">
|
||||||
<ItemsControl.ItemsPanel>
|
<ItemsControl.ItemsPanel>
|
||||||
<ItemsPanelTemplate>
|
<ItemsPanelTemplate>
|
||||||
<WrapPanel Orientation="Horizontal" VerticalAlignment="Center" ItemHeight="24"/>
|
<WrapPanel Orientation="Horizontal" VerticalAlignment="Center" ItemHeight="24"/>
|
||||||
|
@ -187,8 +187,7 @@
|
||||||
<v:CommitMessagePresenter Grid.Row="4" Grid.Column="1"
|
<v:CommitMessagePresenter Grid.Row="4" Grid.Column="1"
|
||||||
Margin="12,4,8,0"
|
Margin="12,4,8,0"
|
||||||
Classes="primary"
|
Classes="primary"
|
||||||
Message="{Binding #ThisControl.Message}"
|
FullMessage="{Binding #ThisControl.FullMessage}"
|
||||||
IssueTrackerRules="{Binding #ThisControl.IssueTrackerRules}"
|
|
||||||
HorizontalAlignment="Stretch"
|
HorizontalAlignment="Stretch"
|
||||||
TextWrapping="Wrap">
|
TextWrapping="Wrap">
|
||||||
<v:CommitMessagePresenter.DataTemplates>
|
<v:CommitMessagePresenter.DataTemplates>
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
|
using System.Collections.Generic;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
using Avalonia;
|
using Avalonia;
|
||||||
using Avalonia.Collections;
|
|
||||||
using Avalonia.Controls;
|
using Avalonia.Controls;
|
||||||
using Avalonia.Input;
|
using Avalonia.Input;
|
||||||
using Avalonia.Interactivity;
|
using Avalonia.Interactivity;
|
||||||
|
@ -11,13 +11,13 @@ namespace SourceGit.Views
|
||||||
{
|
{
|
||||||
public partial class CommitBaseInfo : UserControl
|
public partial class CommitBaseInfo : UserControl
|
||||||
{
|
{
|
||||||
public static readonly StyledProperty<string> MessageProperty =
|
public static readonly StyledProperty<Models.CommitFullMessage> FullMessageProperty =
|
||||||
AvaloniaProperty.Register<CommitBaseInfo, string>(nameof(Message), string.Empty);
|
AvaloniaProperty.Register<CommitBaseInfo, Models.CommitFullMessage>(nameof(FullMessage));
|
||||||
|
|
||||||
public string Message
|
public Models.CommitFullMessage FullMessage
|
||||||
{
|
{
|
||||||
get => GetValue(MessageProperty);
|
get => GetValue(FullMessageProperty);
|
||||||
set => SetValue(MessageProperty, value);
|
set => SetValue(FullMessageProperty, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static readonly StyledProperty<Models.CommitSignInfo> SignInfoProperty =
|
public static readonly StyledProperty<Models.CommitSignInfo> SignInfoProperty =
|
||||||
|
@ -38,28 +38,19 @@ namespace SourceGit.Views
|
||||||
set => SetValue(SupportsContainsInProperty, value);
|
set => SetValue(SupportsContainsInProperty, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static readonly StyledProperty<AvaloniaList<Models.CommitLink>> WebLinksProperty =
|
public static readonly StyledProperty<List<Models.CommitLink>> WebLinksProperty =
|
||||||
AvaloniaProperty.Register<CommitBaseInfo, AvaloniaList<Models.CommitLink>>(nameof(WebLinks));
|
AvaloniaProperty.Register<CommitBaseInfo, List<Models.CommitLink>>(nameof(WebLinks));
|
||||||
|
|
||||||
public AvaloniaList<Models.CommitLink> WebLinks
|
public List<Models.CommitLink> WebLinks
|
||||||
{
|
{
|
||||||
get => GetValue(WebLinksProperty);
|
get => GetValue(WebLinksProperty);
|
||||||
set => SetValue(WebLinksProperty, value);
|
set => SetValue(WebLinksProperty, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static readonly StyledProperty<AvaloniaList<Models.IssueTrackerRule>> IssueTrackerRulesProperty =
|
public static readonly StyledProperty<List<string>> ChildrenProperty =
|
||||||
AvaloniaProperty.Register<CommitBaseInfo, AvaloniaList<Models.IssueTrackerRule>>(nameof(IssueTrackerRules));
|
AvaloniaProperty.Register<CommitBaseInfo, List<string>>(nameof(Children));
|
||||||
|
|
||||||
public AvaloniaList<Models.IssueTrackerRule> IssueTrackerRules
|
public List<string> Children
|
||||||
{
|
|
||||||
get => GetValue(IssueTrackerRulesProperty);
|
|
||||||
set => SetValue(IssueTrackerRulesProperty, value);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static readonly StyledProperty<AvaloniaList<string>> ChildrenProperty =
|
|
||||||
AvaloniaProperty.Register<CommitBaseInfo, AvaloniaList<string>>(nameof(Children));
|
|
||||||
|
|
||||||
public AvaloniaList<string> Children
|
|
||||||
{
|
{
|
||||||
get => GetValue(ChildrenProperty);
|
get => GetValue(ChildrenProperty);
|
||||||
set => SetValue(ChildrenProperty, value);
|
set => SetValue(ChildrenProperty, value);
|
||||||
|
|
|
@ -20,12 +20,11 @@
|
||||||
<StackPanel Orientation="Vertical">
|
<StackPanel Orientation="Vertical">
|
||||||
<!-- Base Information -->
|
<!-- Base Information -->
|
||||||
<v:CommitBaseInfo Content="{Binding Commit}"
|
<v:CommitBaseInfo Content="{Binding Commit}"
|
||||||
Message="{Binding FullMessage}"
|
FullMessage="{Binding FullMessage}"
|
||||||
SignInfo="{Binding SignInfo}"
|
SignInfo="{Binding SignInfo}"
|
||||||
SupportsContainsIn="True"
|
SupportsContainsIn="True"
|
||||||
WebLinks="{Binding WebLinks}"
|
WebLinks="{Binding WebLinks}"
|
||||||
Children="{Binding Children}"
|
Children="{Binding Children}"/>
|
||||||
IssueTrackerRules="{Binding IssueTrackerRules}"/>
|
|
||||||
|
|
||||||
<!-- Line -->
|
<!-- Line -->
|
||||||
<Rectangle Height=".65" Margin="8" Fill="{DynamicResource Brush.Border2}"/>
|
<Rectangle Height=".65" Margin="8" Fill="{DynamicResource Brush.Border2}"/>
|
||||||
|
|
|
@ -1,10 +1,8 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Text.RegularExpressions;
|
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
using Avalonia;
|
using Avalonia;
|
||||||
using Avalonia.Collections;
|
|
||||||
using Avalonia.Controls;
|
using Avalonia.Controls;
|
||||||
using Avalonia.Controls.Documents;
|
using Avalonia.Controls.Documents;
|
||||||
using Avalonia.Input;
|
using Avalonia.Input;
|
||||||
|
@ -13,27 +11,15 @@ using Avalonia.VisualTree;
|
||||||
|
|
||||||
namespace SourceGit.Views
|
namespace SourceGit.Views
|
||||||
{
|
{
|
||||||
public partial class CommitMessagePresenter : SelectableTextBlock
|
public class CommitMessagePresenter : SelectableTextBlock
|
||||||
{
|
{
|
||||||
[GeneratedRegex(@"\b([0-9a-fA-F]{6,40})\b")]
|
public static readonly StyledProperty<Models.CommitFullMessage> FullMessageProperty =
|
||||||
private static partial Regex REG_SHA_FORMAT();
|
AvaloniaProperty.Register<CommitMessagePresenter, Models.CommitFullMessage>(nameof(FullMessage));
|
||||||
|
|
||||||
public static readonly StyledProperty<string> MessageProperty =
|
public Models.CommitFullMessage FullMessage
|
||||||
AvaloniaProperty.Register<CommitMessagePresenter, string>(nameof(Message));
|
|
||||||
|
|
||||||
public string Message
|
|
||||||
{
|
{
|
||||||
get => GetValue(MessageProperty);
|
get => GetValue(FullMessageProperty);
|
||||||
set => SetValue(MessageProperty, value);
|
set => SetValue(FullMessageProperty, value);
|
||||||
}
|
|
||||||
|
|
||||||
public static readonly StyledProperty<AvaloniaList<Models.IssueTrackerRule>> IssueTrackerRulesProperty =
|
|
||||||
AvaloniaProperty.Register<CommitMessagePresenter, AvaloniaList<Models.IssueTrackerRule>>(nameof(IssueTrackerRules));
|
|
||||||
|
|
||||||
public AvaloniaList<Models.IssueTrackerRule> IssueTrackerRules
|
|
||||||
{
|
|
||||||
get => GetValue(IssueTrackerRulesProperty);
|
|
||||||
set => SetValue(IssueTrackerRulesProperty, value);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override Type StyleKeyOverride => typeof(SelectableTextBlock);
|
protected override Type StyleKeyOverride => typeof(SelectableTextBlock);
|
||||||
|
@ -42,69 +28,36 @@ namespace SourceGit.Views
|
||||||
{
|
{
|
||||||
base.OnPropertyChanged(change);
|
base.OnPropertyChanged(change);
|
||||||
|
|
||||||
if (change.Property == MessageProperty || change.Property == IssueTrackerRulesProperty)
|
if (change.Property == FullMessageProperty)
|
||||||
{
|
{
|
||||||
Inlines!.Clear();
|
Inlines!.Clear();
|
||||||
_inlineCommits.Clear();
|
_inlineCommits.Clear();
|
||||||
_matches = null;
|
|
||||||
_lastHover = null;
|
_lastHover = null;
|
||||||
ClearHoveredIssueLink();
|
ClearHoveredIssueLink();
|
||||||
|
|
||||||
var message = Message;
|
var message = FullMessage?.Message;
|
||||||
if (string.IsNullOrEmpty(message))
|
if (string.IsNullOrEmpty(message))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var matches = new List<Models.Hyperlink>();
|
var links = FullMessage?.Links;
|
||||||
if (IssueTrackerRules is { Count: > 0 } rules)
|
if (links == null || links.Count == 0)
|
||||||
{
|
|
||||||
foreach (var rule in rules)
|
|
||||||
rule.Matches(matches, message);
|
|
||||||
}
|
|
||||||
|
|
||||||
var shas = REG_SHA_FORMAT().Matches(message);
|
|
||||||
for (int i = 0; i < shas.Count; i++)
|
|
||||||
{
|
|
||||||
var sha = shas[i];
|
|
||||||
if (!sha.Success)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
var start = sha.Index;
|
|
||||||
var len = sha.Length;
|
|
||||||
var intersect = false;
|
|
||||||
foreach (var match in matches)
|
|
||||||
{
|
|
||||||
if (match.Intersect(start, len))
|
|
||||||
{
|
|
||||||
intersect = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!intersect)
|
|
||||||
matches.Add(new Models.Hyperlink(start, len, sha.Groups[1].Value, true));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (matches.Count == 0)
|
|
||||||
{
|
{
|
||||||
Inlines.Add(new Run(message));
|
Inlines.Add(new Run(message));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
matches.Sort((l, r) => l.Start - r.Start);
|
|
||||||
_matches = matches;
|
|
||||||
|
|
||||||
var inlines = new List<Inline>();
|
var inlines = new List<Inline>();
|
||||||
var pos = 0;
|
var pos = 0;
|
||||||
foreach (var match in matches)
|
foreach (var link in links)
|
||||||
{
|
{
|
||||||
if (match.Start > pos)
|
if (link.Start > pos)
|
||||||
inlines.Add(new Run(message.Substring(pos, match.Start - pos)));
|
inlines.Add(new Run(message.Substring(pos, link.Start - pos)));
|
||||||
|
|
||||||
var link = new Run(message.Substring(match.Start, match.Length));
|
var run = new Run(message.Substring(link.Start, link.Length));
|
||||||
link.Classes.Add(match.IsCommitSHA ? "commit_link" : "issue_link");
|
run.Classes.Add(link.IsCommitSHA ? "commit_link" : "issue_link");
|
||||||
inlines.Add(link);
|
inlines.Add(run);
|
||||||
|
|
||||||
pos = match.Start + match.Length;
|
pos = link.Start + link.Length;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pos < message.Length)
|
if (pos < message.Length)
|
||||||
|
@ -134,7 +87,7 @@ namespace SourceGit.Views
|
||||||
scrollViewer.LineDown();
|
scrollViewer.LineDown();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (_matches != null)
|
else if (FullMessage is { Links: { Count: > 0 } links })
|
||||||
{
|
{
|
||||||
var point = e.GetPosition(this) - new Point(Padding.Left, Padding.Top);
|
var point = e.GetPosition(this) - new Point(Padding.Left, Padding.Top);
|
||||||
var x = Math.Min(Math.Max(point.X, 0), Math.Max(TextLayout.WidthIncludingTrailingWhitespace, 0));
|
var x = Math.Min(Math.Max(point.X, 0), Math.Max(TextLayout.WidthIncludingTrailingWhitespace, 0));
|
||||||
|
@ -142,25 +95,25 @@ namespace SourceGit.Views
|
||||||
point = new Point(x, y);
|
point = new Point(x, y);
|
||||||
|
|
||||||
var pos = TextLayout.HitTestPoint(point).TextPosition;
|
var pos = TextLayout.HitTestPoint(point).TextPosition;
|
||||||
foreach (var match in _matches)
|
foreach (var link in links)
|
||||||
{
|
{
|
||||||
if (!match.Intersect(pos, 1))
|
if (!link.Intersect(pos, 1))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (match == _lastHover)
|
if (link == _lastHover)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
SetCurrentValue(CursorProperty, Cursor.Parse("Hand"));
|
SetCurrentValue(CursorProperty, Cursor.Parse("Hand"));
|
||||||
|
|
||||||
_lastHover = match;
|
_lastHover = link;
|
||||||
if (!match.IsCommitSHA)
|
if (!link.IsCommitSHA)
|
||||||
{
|
{
|
||||||
ToolTip.SetTip(this, match.Link);
|
ToolTip.SetTip(this, link.Link);
|
||||||
ToolTip.SetIsOpen(this, true);
|
ToolTip.SetIsOpen(this, true);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ProcessHoverCommitLink(match);
|
ProcessHoverCommitLink(link);
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
@ -361,7 +314,6 @@ namespace SourceGit.Views
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<Models.Hyperlink> _matches = null;
|
|
||||||
private Models.Hyperlink _lastHover = null;
|
private Models.Hyperlink _lastHover = null;
|
||||||
private Dictionary<string, Models.Commit> _inlineCommits = new();
|
private Dictionary<string, Models.Commit> _inlineCommits = new();
|
||||||
}
|
}
|
||||||
|
|
|
@ -257,7 +257,7 @@
|
||||||
<ContentControl.DataTemplates>
|
<ContentControl.DataTemplates>
|
||||||
<DataTemplate DataType="m:RevisionSubmodule">
|
<DataTemplate DataType="m:RevisionSubmodule">
|
||||||
<Border Margin="0,0,0,8" BorderThickness="1" BorderBrush="{DynamicResource Brush.Border1}" Background="{DynamicResource Brush.Window}">
|
<Border Margin="0,0,0,8" BorderThickness="1" BorderBrush="{DynamicResource Brush.Border1}" Background="{DynamicResource Brush.Window}">
|
||||||
<v:CommitBaseInfo MaxHeight="256" Margin="0,0,0,4" Content="{Binding Commit}" Message="{Binding FullMessage}"/>
|
<v:CommitBaseInfo MaxHeight="256" Margin="0,0,0,4" Content="{Binding Commit}" FullMessage="{Binding FullMessage}"/>
|
||||||
</Border>
|
</Border>
|
||||||
</DataTemplate>
|
</DataTemplate>
|
||||||
</ContentControl.DataTemplates>
|
</ContentControl.DataTemplates>
|
||||||
|
@ -271,7 +271,7 @@
|
||||||
<Path Width="16" Height="16" Data="{StaticResource Icons.DoubleDown}" HorizontalAlignment="Center" IsVisible="{Binding Old, Converter={x:Static ObjectConverters.IsNotNull}}"/>
|
<Path Width="16" Height="16" Data="{StaticResource Icons.DoubleDown}" HorizontalAlignment="Center" IsVisible="{Binding Old, Converter={x:Static ObjectConverters.IsNotNull}}"/>
|
||||||
|
|
||||||
<Border Margin="0,8,0,0" BorderThickness="1" BorderBrush="Green" Background="{DynamicResource Brush.Window}">
|
<Border Margin="0,8,0,0" BorderThickness="1" BorderBrush="Green" Background="{DynamicResource Brush.Window}">
|
||||||
<v:CommitBaseInfo MaxHeight="256" Margin="0,0,0,4" Content="{Binding New.Commit}" Message="{Binding New.FullMessage}"/>
|
<v:CommitBaseInfo MaxHeight="256" Margin="0,0,0,4" Content="{Binding New.Commit}" FullMessage="{Binding New.FullMessage}"/>
|
||||||
</Border>
|
</Border>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</ScrollViewer>
|
</ScrollViewer>
|
||||||
|
|
|
@ -63,7 +63,7 @@
|
||||||
<Grid RowDefinitions="Auto,*" Margin="8,0">
|
<Grid RowDefinitions="Auto,*" Margin="8,0">
|
||||||
<TextBlock Grid.Row="0" Margin="0,8,0,0" Text="{DynamicResource Text.CommitDetail.Files.Submodule}" FontSize="18" FontWeight="Bold" HorizontalAlignment="Center" Foreground="{DynamicResource Brush.FG2}"/>
|
<TextBlock Grid.Row="0" Margin="0,8,0,0" Text="{DynamicResource Text.CommitDetail.Files.Submodule}" FontSize="18" FontWeight="Bold" HorizontalAlignment="Center" Foreground="{DynamicResource Brush.FG2}"/>
|
||||||
<ScrollViewer Grid.Row="1" Margin="0,16,0,0" HorizontalScrollBarVisibility="Disabled" VerticalScrollBarVisibility="Auto">
|
<ScrollViewer Grid.Row="1" Margin="0,16,0,0" HorizontalScrollBarVisibility="Disabled" VerticalScrollBarVisibility="Auto">
|
||||||
<v:CommitBaseInfo Content="{Binding Commit}" Message="{Binding FullMessage}"/>
|
<v:CommitBaseInfo Content="{Binding Commit}" FullMessage="{Binding FullMessage}"/>
|
||||||
</ScrollViewer>
|
</ScrollViewer>
|
||||||
</Grid>
|
</Grid>
|
||||||
</DataTemplate>
|
</DataTemplate>
|
||||||
|
|
|
@ -44,7 +44,7 @@
|
||||||
<Popup PlacementTarget="{Binding #TxtSearchRevisionFiles}"
|
<Popup PlacementTarget="{Binding #TxtSearchRevisionFiles}"
|
||||||
Placement="BottomEdgeAlignedLeft"
|
Placement="BottomEdgeAlignedLeft"
|
||||||
HorizontalOffset="-8" VerticalAlignment="-8"
|
HorizontalOffset="-8" VerticalAlignment="-8"
|
||||||
IsOpen="{Binding IsRevisionFileSearchSuggestionOpen}">
|
IsOpen="{Binding RevisionFileSearchSuggestion, Converter={x:Static c:ListConverters.IsNotNullOrEmpty}}">
|
||||||
<Border Margin="8" VerticalAlignment="Top" Effect="drop-shadow(0 0 8 #80000000)">
|
<Border Margin="8" VerticalAlignment="Top" Effect="drop-shadow(0 0 8 #80000000)">
|
||||||
<Border Background="{DynamicResource Brush.Popup}" CornerRadius="4" Padding="4" BorderThickness="0.65" BorderBrush="{DynamicResource Brush.Accent}">
|
<Border Background="{DynamicResource Brush.Popup}" CornerRadius="4" Padding="4" BorderThickness="0.65" BorderBrush="{DynamicResource Brush.Accent}">
|
||||||
<ListBox x:Name="SearchSuggestionBox"
|
<ListBox x:Name="SearchSuggestionBox"
|
||||||
|
|
|
@ -23,7 +23,7 @@ namespace SourceGit.Views
|
||||||
}
|
}
|
||||||
else if (e.Key == Key.Down || e.Key == Key.Up)
|
else if (e.Key == Key.Down || e.Key == Key.Up)
|
||||||
{
|
{
|
||||||
if (vm.IsRevisionFileSearchSuggestionOpen)
|
if (vm.RevisionFileSearchSuggestion.Count > 0)
|
||||||
{
|
{
|
||||||
SearchSuggestionBox.Focus(NavigationMethod.Tab);
|
SearchSuggestionBox.Focus(NavigationMethod.Tab);
|
||||||
SearchSuggestionBox.SelectedIndex = 0;
|
SearchSuggestionBox.SelectedIndex = 0;
|
||||||
|
@ -33,12 +33,7 @@ namespace SourceGit.Views
|
||||||
}
|
}
|
||||||
else if (e.Key == Key.Escape)
|
else if (e.Key == Key.Escape)
|
||||||
{
|
{
|
||||||
if (vm.IsRevisionFileSearchSuggestionOpen)
|
vm.CancelRevisionFileSuggestions();
|
||||||
{
|
|
||||||
vm.RevisionFileSearchSuggestion.Clear();
|
|
||||||
vm.IsRevisionFileSearchSuggestionOpen = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
e.Handled = true;
|
e.Handled = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -57,7 +52,7 @@ namespace SourceGit.Views
|
||||||
|
|
||||||
if (e.Key == Key.Escape)
|
if (e.Key == Key.Escape)
|
||||||
{
|
{
|
||||||
vm.RevisionFileSearchSuggestion.Clear();
|
vm.CancelRevisionFileSuggestions();
|
||||||
e.Handled = true;
|
e.Handled = true;
|
||||||
}
|
}
|
||||||
else if (e.Key == Key.Enter && SearchSuggestionBox.SelectedItem is string content)
|
else if (e.Key == Key.Enter && SearchSuggestionBox.SelectedItem is string content)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue