Compare commits

..

No commits in common. "6a0cf30db262143b2e04effbd0a8f38c7c937100" and "e4870759f7889a4f3a2f8ab7df54fb309e00798a" have entirely different histories.

6 changed files with 35 additions and 27 deletions

View file

@ -97,7 +97,7 @@ For `OpenAI`:
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
## External Tools

View file

@ -41,7 +41,7 @@ namespace SourceGit.Native
finder.Fleet(FindJetBrainsFleet);
finder.FindJetBrainsFromToolbox(() => $"{Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData)}/JetBrains/Toolbox");
finder.SublimeText(() => FindExecutable("subl"));
finder.Zed(() => FindExecutable("zeditor"));
finder.Zed(() => FindExecutable("zed"));
return finder.Founded;
}

View file

@ -26,12 +26,24 @@ namespace SourceGit.Native
internal string szCSDVersion;
}
[DllImport("ntdll")]
private static extern int RtlGetVersion(ref RTL_OSVERSIONINFOEX lpVersionInformation);
[StructLayout(LayoutKind.Sequential)]
internal struct MARGINS
{
public int cxLeftWidth;
public int cxRightWidth;
public int cyTopHeight;
public int cyBottomHeight;
}
[DllImport("shlwapi.dll", CharSet = CharSet.Unicode, SetLastError = false)]
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)]
private static extern IntPtr ILCreateFromPathW(string pszPath);
@ -48,8 +60,8 @@ namespace SourceGit.Native
v.dwOSVersionInfoSize = (uint)Marshal.SizeOf<RTL_OSVERSIONINFOEX>();
if (RtlGetVersion(ref v) == 0 && (v.dwMajorVersion < 10 || v.dwBuildNumber < 22000))
{
Window.WindowStateProperty.Changed.AddClassHandler<Window>((w, _) => FixWindowFrameOnWin10(w));
Control.LoadedEvent.AddClassHandler<Window>((w, _) => FixWindowFrameOnWin10(w));
Window.WindowStateProperty.Changed.AddClassHandler<Window>((w, _) => ExtendWindowFrame(w));
Control.LoadedEvent.AddClassHandler<Window>((w, _) => ExtendWindowFrame(w));
}
}
@ -194,12 +206,14 @@ namespace SourceGit.Native
Process.Start(start);
}
private void FixWindowFrameOnWin10(Window w)
private void ExtendWindowFrame(Window w)
{
if (w.WindowState != WindowState.Normal)
w.SystemDecorations = SystemDecorations.Full;
else
w.SystemDecorations = SystemDecorations.BorderOnly;
var platformHandle = w.TryGetPlatformHandle();
if (platformHandle == null)
return;
var margins = new MARGINS { cxLeftWidth = 1, cxRightWidth = 1, cyTopHeight = 1, cyBottomHeight = 1 };
DwmExtendFrameIntoClientArea(platformHandle.Handle, ref margins);
}
#region EXTERNAL_EDITOR_FINDER

View file

@ -113,19 +113,11 @@ namespace SourceGit.ViewModels
public void NavigateTo(string commitSHA)
{
var commit = _commits.Find(x => x.SHA.StartsWith(commitSHA, StringComparison.Ordinal));
if (commit == null)
{
AutoSelectedCommit = null;
commit = new Commands.QuerySingleCommit(_repo.FullPath, commitSHA).Result();
}
else
if (commit != null)
{
AutoSelectedCommit = commit;
NavigationId = _navigationId + 1;
}
if (commit != null)
{
if (_detailContext is CommitDetail detail)
{
detail.Commit = commit;
@ -137,10 +129,6 @@ namespace SourceGit.ViewModels
DetailContext = commitDetail;
}
}
else
{
DetailContext = null;
}
}
public void Select(IList commits)

View file

@ -1,5 +1,8 @@
using System.Collections.Generic;
using System.Text.Json.Serialization;
using Avalonia.Media;
using CommunityToolkit.Mvvm.ComponentModel;
namespace SourceGit.ViewModels
@ -18,7 +21,7 @@ namespace SourceGit.ViewModels
set
{
if (SetProperty(ref _color, value))
OnPropertyChanged(nameof(Brush));
Brush = new SolidColorBrush(value);
}
}
@ -46,9 +49,11 @@ namespace SourceGit.ViewModels
set => SetProperty(ref _restoreOnStartup, value);
}
[JsonIgnore]
public IBrush Brush
{
get => new SolidColorBrush(_color);
get => _brush;
private set => SetProperty(ref _brush, value);
}
public void AddRepository(string repo)
@ -61,5 +66,6 @@ namespace SourceGit.ViewModels
private uint _color = 4278221015;
private bool _isActive = false;
private bool _restoreOnStartup = true;
private IBrush _brush = new SolidColorBrush(4278221015);
}
}

View file

@ -451,7 +451,7 @@ namespace SourceGit.Views
return;
// 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 startY = list.Scroll?.Offset.Y ?? 0;
double endY = startY + height + 28;