mirror of
https://github.com/sourcegit-scm/sourcegit.git
synced 2025-01-14 00:17:20 -08:00
Compare commits
No commits in common. "6a0cf30db262143b2e04effbd0a8f38c7c937100" and "e4870759f7889a4f3a2f8ab7df54fb309e00798a" have entirely different histories.
6a0cf30db2
...
e4870759f7
6 changed files with 35 additions and 27 deletions
|
@ -97,7 +97,7 @@ For `OpenAI`:
|
||||||
|
|
||||||
For other AI service:
|
For other AI service:
|
||||||
|
|
||||||
* The `Server` should fill in a URL equivalent to OpenAI's `https://api.openai.com/v1/chat/completions`. For example, when using `Ollama`, it should be `http://localhost:11434/v1/chat/completions` instead of `http://localhost:11434/api/generate`
|
* The `Server` should fill in a URL equivalent to OpenAI's `https://api.openai.com/v1/chat/completions`
|
||||||
* The `API Key` is optional that depends on the service
|
* The `API Key` is optional that depends on the service
|
||||||
|
|
||||||
## External Tools
|
## External Tools
|
||||||
|
|
|
@ -41,7 +41,7 @@ namespace SourceGit.Native
|
||||||
finder.Fleet(FindJetBrainsFleet);
|
finder.Fleet(FindJetBrainsFleet);
|
||||||
finder.FindJetBrainsFromToolbox(() => $"{Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData)}/JetBrains/Toolbox");
|
finder.FindJetBrainsFromToolbox(() => $"{Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData)}/JetBrains/Toolbox");
|
||||||
finder.SublimeText(() => FindExecutable("subl"));
|
finder.SublimeText(() => FindExecutable("subl"));
|
||||||
finder.Zed(() => FindExecutable("zeditor"));
|
finder.Zed(() => FindExecutable("zed"));
|
||||||
return finder.Founded;
|
return finder.Founded;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -26,12 +26,24 @@ namespace SourceGit.Native
|
||||||
internal string szCSDVersion;
|
internal string szCSDVersion;
|
||||||
}
|
}
|
||||||
|
|
||||||
[DllImport("ntdll")]
|
[StructLayout(LayoutKind.Sequential)]
|
||||||
private static extern int RtlGetVersion(ref RTL_OSVERSIONINFOEX lpVersionInformation);
|
internal struct MARGINS
|
||||||
|
{
|
||||||
|
public int cxLeftWidth;
|
||||||
|
public int cxRightWidth;
|
||||||
|
public int cyTopHeight;
|
||||||
|
public int cyBottomHeight;
|
||||||
|
}
|
||||||
|
|
||||||
[DllImport("shlwapi.dll", CharSet = CharSet.Unicode, SetLastError = false)]
|
[DllImport("shlwapi.dll", CharSet = CharSet.Unicode, SetLastError = false)]
|
||||||
private static extern bool PathFindOnPath([In, Out] StringBuilder pszFile, [In] string[] ppszOtherDirs);
|
private static extern bool PathFindOnPath([In, Out] StringBuilder pszFile, [In] string[] ppszOtherDirs);
|
||||||
|
|
||||||
|
[DllImport("ntdll")]
|
||||||
|
private static extern int RtlGetVersion(ref RTL_OSVERSIONINFOEX lpVersionInformation);
|
||||||
|
|
||||||
|
[DllImport("dwmapi.dll")]
|
||||||
|
private static extern int DwmExtendFrameIntoClientArea(IntPtr hwnd, ref MARGINS margins);
|
||||||
|
|
||||||
[DllImport("shell32.dll", CharSet = CharSet.Unicode, SetLastError = false)]
|
[DllImport("shell32.dll", CharSet = CharSet.Unicode, SetLastError = false)]
|
||||||
private static extern IntPtr ILCreateFromPathW(string pszPath);
|
private static extern IntPtr ILCreateFromPathW(string pszPath);
|
||||||
|
|
||||||
|
@ -48,8 +60,8 @@ namespace SourceGit.Native
|
||||||
v.dwOSVersionInfoSize = (uint)Marshal.SizeOf<RTL_OSVERSIONINFOEX>();
|
v.dwOSVersionInfoSize = (uint)Marshal.SizeOf<RTL_OSVERSIONINFOEX>();
|
||||||
if (RtlGetVersion(ref v) == 0 && (v.dwMajorVersion < 10 || v.dwBuildNumber < 22000))
|
if (RtlGetVersion(ref v) == 0 && (v.dwMajorVersion < 10 || v.dwBuildNumber < 22000))
|
||||||
{
|
{
|
||||||
Window.WindowStateProperty.Changed.AddClassHandler<Window>((w, _) => FixWindowFrameOnWin10(w));
|
Window.WindowStateProperty.Changed.AddClassHandler<Window>((w, _) => ExtendWindowFrame(w));
|
||||||
Control.LoadedEvent.AddClassHandler<Window>((w, _) => FixWindowFrameOnWin10(w));
|
Control.LoadedEvent.AddClassHandler<Window>((w, _) => ExtendWindowFrame(w));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -194,12 +206,14 @@ namespace SourceGit.Native
|
||||||
Process.Start(start);
|
Process.Start(start);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void FixWindowFrameOnWin10(Window w)
|
private void ExtendWindowFrame(Window w)
|
||||||
{
|
{
|
||||||
if (w.WindowState != WindowState.Normal)
|
var platformHandle = w.TryGetPlatformHandle();
|
||||||
w.SystemDecorations = SystemDecorations.Full;
|
if (platformHandle == null)
|
||||||
else
|
return;
|
||||||
w.SystemDecorations = SystemDecorations.BorderOnly;
|
|
||||||
|
var margins = new MARGINS { cxLeftWidth = 1, cxRightWidth = 1, cyTopHeight = 1, cyBottomHeight = 1 };
|
||||||
|
DwmExtendFrameIntoClientArea(platformHandle.Handle, ref margins);
|
||||||
}
|
}
|
||||||
|
|
||||||
#region EXTERNAL_EDITOR_FINDER
|
#region EXTERNAL_EDITOR_FINDER
|
||||||
|
|
|
@ -113,19 +113,11 @@ namespace SourceGit.ViewModels
|
||||||
public void NavigateTo(string commitSHA)
|
public void NavigateTo(string commitSHA)
|
||||||
{
|
{
|
||||||
var commit = _commits.Find(x => x.SHA.StartsWith(commitSHA, StringComparison.Ordinal));
|
var commit = _commits.Find(x => x.SHA.StartsWith(commitSHA, StringComparison.Ordinal));
|
||||||
if (commit == null)
|
if (commit != null)
|
||||||
{
|
|
||||||
AutoSelectedCommit = null;
|
|
||||||
commit = new Commands.QuerySingleCommit(_repo.FullPath, commitSHA).Result();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
AutoSelectedCommit = commit;
|
AutoSelectedCommit = commit;
|
||||||
NavigationId = _navigationId + 1;
|
NavigationId = _navigationId + 1;
|
||||||
}
|
|
||||||
|
|
||||||
if (commit != null)
|
|
||||||
{
|
|
||||||
if (_detailContext is CommitDetail detail)
|
if (_detailContext is CommitDetail detail)
|
||||||
{
|
{
|
||||||
detail.Commit = commit;
|
detail.Commit = commit;
|
||||||
|
@ -137,10 +129,6 @@ namespace SourceGit.ViewModels
|
||||||
DetailContext = commitDetail;
|
DetailContext = commitDetail;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
DetailContext = null;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Select(IList commits)
|
public void Select(IList commits)
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Text.Json.Serialization;
|
||||||
|
|
||||||
using Avalonia.Media;
|
using Avalonia.Media;
|
||||||
|
|
||||||
using CommunityToolkit.Mvvm.ComponentModel;
|
using CommunityToolkit.Mvvm.ComponentModel;
|
||||||
|
|
||||||
namespace SourceGit.ViewModels
|
namespace SourceGit.ViewModels
|
||||||
|
@ -18,7 +21,7 @@ namespace SourceGit.ViewModels
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
if (SetProperty(ref _color, value))
|
if (SetProperty(ref _color, value))
|
||||||
OnPropertyChanged(nameof(Brush));
|
Brush = new SolidColorBrush(value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -46,9 +49,11 @@ namespace SourceGit.ViewModels
|
||||||
set => SetProperty(ref _restoreOnStartup, value);
|
set => SetProperty(ref _restoreOnStartup, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[JsonIgnore]
|
||||||
public IBrush Brush
|
public IBrush Brush
|
||||||
{
|
{
|
||||||
get => new SolidColorBrush(_color);
|
get => _brush;
|
||||||
|
private set => SetProperty(ref _brush, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void AddRepository(string repo)
|
public void AddRepository(string repo)
|
||||||
|
@ -61,5 +66,6 @@ namespace SourceGit.ViewModels
|
||||||
private uint _color = 4278221015;
|
private uint _color = 4278221015;
|
||||||
private bool _isActive = false;
|
private bool _isActive = false;
|
||||||
private bool _restoreOnStartup = true;
|
private bool _restoreOnStartup = true;
|
||||||
|
private IBrush _brush = new SolidColorBrush(4278221015);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -451,7 +451,7 @@ namespace SourceGit.Views
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Calculate drawing area.
|
// Calculate drawing area.
|
||||||
double width = Bounds.Width - 273 - histories.AuthorNameColumnWidth.Value;
|
double width = Bounds.Width - 156 - 96 - histories.AuthorNameColumnWidth.Value;
|
||||||
double height = Bounds.Height;
|
double height = Bounds.Height;
|
||||||
double startY = list.Scroll?.Offset.Y ?? 0;
|
double startY = list.Scroll?.Offset.Y ?? 0;
|
||||||
double endY = startY + height + 28;
|
double endY = startY + height + 28;
|
||||||
|
|
Loading…
Reference in a new issue