Compare commits

..

6 commits

Author SHA1 Message Date
leo
6a0cf30db2
fix: wrong width for commit graph
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
2024-09-19 15:59:34 +08:00
leo
a690f77468
readme: update OpenAI usage (#489) 2024-09-19 14:42:19 +08:00
leo
0ed1f369e9
feature: display commit's detail info even if the commit is not shown in histories 2024-09-19 14:38:11 +08:00
leo
5574dd2c38
refactor: a better way to fix window drop shadow effect on Win10 2024-09-19 09:50:27 +08:00
leo
687b58576d
code_style: use readonly property instead of responsive property for Workspace.Brush 2024-09-19 09:21:04 +08:00
leo
33f9ae0cd6
fix: wrong executable file name for Zed editor on Linux (#477) 2024-09-19 09:12:38 +08:00
6 changed files with 27 additions and 35 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`
* 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 `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("zed"));
finder.Zed(() => FindExecutable("zeditor"));
return finder.Founded;
}

View file

@ -26,23 +26,11 @@ namespace SourceGit.Native
internal string szCSDVersion;
}
[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("shlwapi.dll", CharSet = CharSet.Unicode, SetLastError = false)]
private static extern bool PathFindOnPath([In, Out] StringBuilder pszFile, [In] string[] ppszOtherDirs);
[DllImport("shell32.dll", CharSet = CharSet.Unicode, SetLastError = false)]
private static extern IntPtr ILCreateFromPathW(string pszPath);
@ -60,8 +48,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, _) => ExtendWindowFrame(w));
Control.LoadedEvent.AddClassHandler<Window>((w, _) => ExtendWindowFrame(w));
Window.WindowStateProperty.Changed.AddClassHandler<Window>((w, _) => FixWindowFrameOnWin10(w));
Control.LoadedEvent.AddClassHandler<Window>((w, _) => FixWindowFrameOnWin10(w));
}
}
@ -206,14 +194,12 @@ namespace SourceGit.Native
Process.Start(start);
}
private void ExtendWindowFrame(Window w)
private void FixWindowFrameOnWin10(Window w)
{
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);
if (w.WindowState != WindowState.Normal)
w.SystemDecorations = SystemDecorations.Full;
else
w.SystemDecorations = SystemDecorations.BorderOnly;
}
#region EXTERNAL_EDITOR_FINDER

View file

@ -113,11 +113,19 @@ namespace SourceGit.ViewModels
public void NavigateTo(string commitSHA)
{
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;
NavigationId = _navigationId + 1;
}
if (commit != null)
{
if (_detailContext is CommitDetail detail)
{
detail.Commit = commit;
@ -129,6 +137,10 @@ namespace SourceGit.ViewModels
DetailContext = commitDetail;
}
}
else
{
DetailContext = null;
}
}
public void Select(IList commits)

View file

@ -1,8 +1,5 @@
using System.Collections.Generic;
using System.Text.Json.Serialization;
using Avalonia.Media;
using CommunityToolkit.Mvvm.ComponentModel;
namespace SourceGit.ViewModels
@ -21,7 +18,7 @@ namespace SourceGit.ViewModels
set
{
if (SetProperty(ref _color, value))
Brush = new SolidColorBrush(value);
OnPropertyChanged(nameof(Brush));
}
}
@ -49,11 +46,9 @@ namespace SourceGit.ViewModels
set => SetProperty(ref _restoreOnStartup, value);
}
[JsonIgnore]
public IBrush Brush
{
get => _brush;
private set => SetProperty(ref _brush, value);
get => new SolidColorBrush(_color);
}
public void AddRepository(string repo)
@ -66,6 +61,5 @@ 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 - 156 - 96 - histories.AuthorNameColumnWidth.Value;
double width = Bounds.Width - 273 - histories.AuthorNameColumnWidth.Value;
double height = Bounds.Height;
double startY = list.Scroll?.Offset.Y ?? 0;
double endY = startY + height + 28;