From 921d68c01f15e841899f61ea4b8c6f7b47974080 Mon Sep 17 00:00:00 2001 From: leo Date: Fri, 13 Feb 2026 10:44:40 +0800 Subject: [PATCH 1/7] ux: caret brush when pre-edit text is available Signed-off-by: leo --- depends/AvaloniaEdit | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/depends/AvaloniaEdit b/depends/AvaloniaEdit index 77f960a4e..80222a80b 160000 --- a/depends/AvaloniaEdit +++ b/depends/AvaloniaEdit @@ -1 +1 @@ -Subproject commit 77f960a4e61fe3d73fd40a8f6d3b4d4f9ea12027 +Subproject commit 80222a80b3f78d21da7db474d54a0d6a2e526c00 From ce543adbcea2a03a67728f6e060f782d13086e31 Mon Sep 17 00:00:00 2001 From: leo Date: Fri, 13 Feb 2026 11:31:53 +0800 Subject: [PATCH 2/7] ux: pixel perfect rendering for lines Signed-off-by: leo --- src/Views/Blame.axaml.cs | 2 +- src/Views/CommitMessageToolBox.axaml.cs | 4 +++- src/Views/MergeConflictEditor.axaml.cs | 14 +++++++++----- src/Views/TextDiffView.axaml.cs | 18 +++++++++++++----- 4 files changed, 26 insertions(+), 12 deletions(-) diff --git a/src/Views/Blame.axaml.cs b/src/Views/Blame.axaml.cs index 8f68826a2..c23dc311c 100644 --- a/src/Views/Blame.axaml.cs +++ b/src/Views/Blame.axaml.cs @@ -245,7 +245,7 @@ public VerticalSeparatorMargin(BlameTextEditor editor) public override void Render(DrawingContext context) { var pen = new Pen(_editor.BorderBrush); - context.DrawLine(pen, new Point(0, 0), new Point(0, Bounds.Height)); + context.DrawLine(pen, new Point(0.5, 0), new Point(0.5, Bounds.Height)); } protected override Size MeasureOverride(Size availableSize) diff --git a/src/Views/CommitMessageToolBox.axaml.cs b/src/Views/CommitMessageToolBox.axaml.cs index 73bca38f4..d5d9a90ca 100644 --- a/src/Views/CommitMessageToolBox.axaml.cs +++ b/src/Views/CommitMessageToolBox.axaml.cs @@ -136,6 +136,7 @@ public override void Render(DrawingContext context) base.Render(context); var w = Bounds.Width; + var pixelHeight = PixelSnapHelpers.GetPixelSize(this).Height; var pen = new Pen(SubjectLineBrush) { DashStyle = DashStyle.Dash }; if (SubjectLength == 0) @@ -153,7 +154,7 @@ public override void Render(DrawingContext context) context.DrawText(formatted, new Point(4, 2)); - var y = 6 + formatted.Height; + var y = PixelSnapHelpers.PixelAlign(6 + formatted.Height, pixelHeight); context.DrawLine(pen, new Point(0, y), new Point(w, y)); } @@ -183,6 +184,7 @@ public override void Render(DrawingContext context) if (line.FirstDocumentLine.LineNumber == _subjectEndLine) { var y = line.GetTextLineVisualYPosition(line.TextLines[^1], VisualYPosition.LineBottom) - view.VerticalOffset + 4; + y = PixelSnapHelpers.PixelAlign(y, pixelHeight); context.DrawLine(pen, new Point(0, y), new Point(w, y)); return; } diff --git a/src/Views/MergeConflictEditor.axaml.cs b/src/Views/MergeConflictEditor.axaml.cs index 4831755e8..5ee5a6fd1 100644 --- a/src/Views/MergeConflictEditor.axaml.cs +++ b/src/Views/MergeConflictEditor.axaml.cs @@ -95,7 +95,7 @@ public class VerticalSeparatorMargin : AbstractMargin public override void Render(DrawingContext context) { var pen = new Pen(Brushes.DarkGray); - context.DrawLine(pen, new Point(0, 0), new Point(0, Bounds.Height)); + context.DrawLine(pen, new Point(0.5, 0), new Point(0.5, Bounds.Height)); } protected override Size MeasureOverride(Size availableSize) @@ -150,6 +150,7 @@ public void Draw(TextView textView, DrawingContext drawingContext) return; var width = textView.Bounds.Width; + var pixelHeight = PixelSnapHelpers.GetPixelSize(_presenter).Height; foreach (var line in textView.VisualLines) { if (line.IsDisposed || line.FirstDocumentLine == null || line.FirstDocumentLine.IsDeleted) @@ -168,15 +169,18 @@ public void Draw(TextView textView, DrawingContext drawingContext) var endY = line.GetTextLineVisualYPosition(line.TextLines[^1], VisualYPosition.LineBottom) - textView.VerticalOffset; var rect = new Rect(0, startY, width, endY - startY); + var alignedTop = PixelSnapHelpers.PixelAlign(startY, pixelHeight); + var alignedBottom = PixelSnapHelpers.PixelAlign(endY, pixelHeight); + var lineState = vm.GetLineState(lineIndex); if (lineState == Models.ConflictLineState.ConflictBlockStart) - drawingContext.DrawLine(new Pen(new SolidColorBrush(Colors.Red, 0.6)), new Point(0, startY + 0.5), new Point(width, startY + 0.5)); + drawingContext.DrawLine(new Pen(new SolidColorBrush(Colors.Red, 0.6)), new Point(0, alignedTop), new Point(width, alignedTop)); else if (lineState == Models.ConflictLineState.ConflictBlockEnd) - drawingContext.DrawLine(new Pen(new SolidColorBrush(Colors.Red, 0.6)), new Point(0, endY - 0.5), new Point(width, endY - 0.5)); + drawingContext.DrawLine(new Pen(new SolidColorBrush(Colors.Red, 0.6)), new Point(0, alignedBottom), new Point(width, alignedBottom)); else if (lineState == Models.ConflictLineState.ResolvedBlockStart) - drawingContext.DrawLine(new Pen(new SolidColorBrush(Colors.Green, 0.6)), new Point(0, startY + 0.5), new Point(width, startY + 0.5)); + drawingContext.DrawLine(new Pen(new SolidColorBrush(Colors.Green, 0.6)), new Point(0, alignedTop), new Point(width, alignedTop)); else if (lineState == Models.ConflictLineState.ResolvedBlockEnd) - drawingContext.DrawLine(new Pen(new SolidColorBrush(Colors.Green, 0.6)), new Point(0, endY - 0.5), new Point(width, endY - 0.5)); + drawingContext.DrawLine(new Pen(new SolidColorBrush(Colors.Green, 0.6)), new Point(0, alignedBottom), new Point(width, alignedBottom)); if (lineState >= Models.ConflictLineState.ResolvedBlockStart) drawingContext.DrawRectangle(new SolidColorBrush(Colors.Green, 0.1), null, rect); diff --git a/src/Views/TextDiffView.axaml.cs b/src/Views/TextDiffView.axaml.cs index b30ceeb98..516b6e8e9 100644 --- a/src/Views/TextDiffView.axaml.cs +++ b/src/Views/TextDiffView.axaml.cs @@ -203,6 +203,7 @@ public void Draw(TextView textView, DrawingContext drawingContext) var lines = _presenter.GetLines(); var width = textView.Bounds.Width; + var pixelHeight = PixelSnapHelpers.GetPixelSize(textView).Height; foreach (var line in textView.VisualLines) { if (line.IsDisposed || line.FirstDocumentLine == null || line.FirstDocumentLine.IsDeleted) @@ -265,10 +266,16 @@ public void Draw(TextView textView, DrawingContext drawingContext) continue; if (index == changeBlock.Start) - drawingContext.DrawLine(changeBlockBorder, new Point(0, startY), new Point(width, startY)); + { + var alignedY = PixelSnapHelpers.PixelAlign(startY, pixelHeight); + drawingContext.DrawLine(changeBlockBorder, new Point(0, alignedY), new Point(width, alignedY)); + } if (index == changeBlock.End) - drawingContext.DrawLine(changeBlockBorder, new Point(0, endY), new Point(width, endY)); + { + var alignedY = PixelSnapHelpers.PixelAlign(endY, pixelHeight); + drawingContext.DrawLine(changeBlockBorder, new Point(0, alignedY), new Point(width, alignedY)); + } } } @@ -488,10 +495,11 @@ public override void Render(DrawingContext context) var brush = new SolidColorBrush(color, 0.1); var pen = new Pen(color.ToUInt32()); var rect = new Rect(0, chunk.Y, Bounds.Width, chunk.Height); + var aligned = PixelSnapHelpers.PixelAlign(rect, PixelSnapHelpers.GetPixelSize(this)); - context.DrawRectangle(brush, null, rect); - context.DrawLine(pen, rect.TopLeft, rect.TopRight); - context.DrawLine(pen, rect.BottomLeft, rect.BottomRight); + context.DrawRectangle(brush, null, aligned); + context.DrawLine(pen, aligned.TopLeft, aligned.TopRight); + context.DrawLine(pen, aligned.BottomLeft, aligned.BottomRight); } protected override void OnLoaded(RoutedEventArgs e) From de4db24179a2aa14db731c530c727873557ae937 Mon Sep 17 00:00:00 2001 From: leo Date: Fri, 13 Feb 2026 16:06:27 +0800 Subject: [PATCH 3/7] ux: add current caret position indicator (only column) Signed-off-by: leo --- src/Resources/Locales/en_US.axaml | 1 + src/Resources/Locales/zh_CN.axaml | 1 + src/Resources/Locales/zh_TW.axaml | 1 + src/Views/CommitMessageToolBox.axaml | 25 ++++++++++++++++++++++--- src/Views/CommitMessageToolBox.axaml.cs | 19 ++++++++++++++++++- 5 files changed, 43 insertions(+), 4 deletions(-) diff --git a/src/Resources/Locales/en_US.axaml b/src/Resources/Locales/en_US.axaml index ff8d98383..bdd14810a 100644 --- a/src/Resources/Locales/en_US.axaml +++ b/src/Resources/Locales/en_US.axaml @@ -186,6 +186,7 @@ SHA Signer: Open in Browser + COL Enter commit message. Please use an empty-line to separate subject and description! SUBJECT Compare diff --git a/src/Resources/Locales/zh_CN.axaml b/src/Resources/Locales/zh_CN.axaml index 3222d0b29..9260b56b3 100644 --- a/src/Resources/Locales/zh_CN.axaml +++ b/src/Resources/Locales/zh_CN.axaml @@ -190,6 +190,7 @@ 提交指纹 签名者 : 浏览器中查看 + 请输入提交的信息。注意:主题与具体描述中间需要空白行分隔! 主题 比较 diff --git a/src/Resources/Locales/zh_TW.axaml b/src/Resources/Locales/zh_TW.axaml index d156206b6..95ea3fb55 100644 --- a/src/Resources/Locales/zh_TW.axaml +++ b/src/Resources/Locales/zh_TW.axaml @@ -190,6 +190,7 @@ 提交編號 簽署人: 在瀏覽器中檢視 + 請輸入提交訊息,標題與詳細描述之間請使用單行空白區隔。 標題 比較 diff --git a/src/Views/CommitMessageToolBox.axaml b/src/Views/CommitMessageToolBox.axaml index 3f247b646..2e0aa324d 100644 --- a/src/Views/CommitMessageToolBox.axaml +++ b/src/Views/CommitMessageToolBox.axaml @@ -35,7 +35,7 @@ Background="{DynamicResource Brush.Window}" BorderThickness="0" CornerRadius="0,0,4,4"> - +