From 9ab602788a7bfeaf05e382d876a145547cc3e73c Mon Sep 17 00:00:00 2001 From: Ikko Eltociear Ashimine Date: Mon, 24 Feb 2025 10:28:00 +0900 Subject: [PATCH 01/15] docs: update README.md (#1014) comaptible -> compatible --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 60c8543e..256070e2 100644 --- a/README.md +++ b/README.md @@ -132,7 +132,7 @@ For **Linux** users: ## OpenAI -This software supports using OpenAI or other AI service that has an OpenAI comaptible HTTP API to generate commit message. You need configurate the service in `Preference` window. +This software supports using OpenAI or other AI service that has an OpenAI compatible HTTP API to generate commit message. You need configurate the service in `Preference` window. For `OpenAI`: From fa4caa218628169d5f34076732ffa9b35ed040fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=B6ran=20W?= <44604769+goran-w@users.noreply.github.com> Date: Mon, 24 Feb 2025 02:32:19 +0100 Subject: [PATCH 02/15] enhance: add first/last buttons for block-nav, no wrapping (#1015) (#1016) Added 2 new buttons (only visible in block-nav mode), with new icons and new (en_US) strings (First/Last Difference). Implemented these new buttons, and disabled the automatic wrap-around for the prev/next buttons in block-nav mode. --- src/Resources/Icons.axaml | 2 ++ src/Resources/Locales/en_US.axaml | 2 ++ src/ViewModels/BlockNavigation.cs | 28 ++++++++++++++-- src/Views/DiffView.axaml | 28 ++++++++++++++++ src/Views/DiffView.axaml.cs | 14 ++++++++ src/Views/TextDiffView.axaml.cs | 56 +++++++++++++++++++++++++++++++ 6 files changed, 127 insertions(+), 3 deletions(-) diff --git a/src/Resources/Icons.axaml b/src/Resources/Icons.axaml index b7d9c22e..9426d20a 100644 --- a/src/Resources/Icons.axaml +++ b/src/Resources/Icons.axaml @@ -5,6 +5,7 @@ M71 1024V0h661L953 219V1024H71zm808-731-220-219H145V951h735V293zM439 512h-220V219h220V512zm-74-219H292v146h74v-146zm0 512h74v73h-220v-73H292v-146H218V585h147v219zm294-366h74V512H512v-73h74v-146H512V219h147v219zm74 439H512V585h220v293zm-74-219h-74v146h74v-146z M128 256h192a64 64 0 110 128H128a64 64 0 110-128zm576 192h192a64 64 0 010 128h-192a64 64 0 010-128zm-576 192h192a64 64 0 010 128H128a64 64 0 010-128zm576 0h192a64 64 0 010 128h-192a64 64 0 010-128zm0-384h192a64 64 0 010 128h-192a64 64 0 010-128zM128 448h192a64 64 0 110 128H128a64 64 0 110-128zm384-320a64 64 0 0164 64v640a64 64 0 01-128 0V192a64 64 0 0164-64z M832 64H192c-18 0-32 14-32 32v832c0 18 14 32 32 32h640c18 0 32-14 32-32V96c0-18-14-32-32-32zM736 596 624 502 506 596V131h230v318z + M509 546 780 275 871 366 509 728 147 366 238 275zM509 728h-362v128h724v-128z M757 226a143 143 0 00-55 276 96 96 0 01-88 59h-191a187 187 0 00-96 27V312a143 143 0 10-96 0v399a143 143 0 10103 2 96 96 0 0188-59h191a191 191 0 00187-151 143 143 0 00-43-279zM280 130a48 48 0 110 96 48 48 0 010-96zm0 764a48 48 0 110-96 48 48 0 010 96zM757 417a48 48 0 110-96 48 48 0 010 96z M896 128h-64V64c0-35-29-64-64-64s-64 29-64 64v64h-64c-35 0-64 29-64 64s29 64 64 64h64v64c0 35 29 64 64 64s64-29 64-64V256h64c35 0 64-29 64-64s-29-64-64-64zm-204 307C673 481 628 512 576 512H448c-47 0-90 13-128 35V372C394 346 448 275 448 192c0-106-86-192-192-192S64 86 64 192c0 83 54 154 128 180v280c-74 26-128 97-128 180c0 106 86 192 192 192s192-86 192-192c0-67-34-125-84-159c22-20 52-33 84-33h128c122 0 223-85 249-199c-19 4-37 7-57 7c-26 0-51-5-76-13zM256 128c35 0 64 29 64 64s-29 64-64 64s-64-29-64-64s29-64 64-64zm0 768c-35 0-64-29-64-64s29-64 64-64s64 29 64 64s-29 64-64 64z M512 597m-1 0a1 1 0 103 0a1 1 0 10-3 0ZM810 393 732 315 448 600 293 444 214 522l156 156 78 78 362-362z @@ -119,6 +120,7 @@ M996 452 572 28A96 96 0 00504 0H96C43 0 0 43 0 96v408a96 96 0 0028 68l424 424c37 37 98 37 136 0l408-408c37-37 37-98 0-136zM224 320c-53 0-96-43-96-96s43-96 96-96 96 43 96 96-43 96-96 96zm1028 268L844 996c-37 37-98 37-136 0l-1-1L1055 647c34-34 53-79 53-127s-19-93-53-127L663 0h97a96 96 0 0168 28l424 424c37 37 37 98 0 136z M765 118 629 239l-16 137-186 160 54 59 183-168 144 4 136-129 47-43-175-12L827 67zM489 404c-66 0-124 55-124 125s54 121 124 121c66 0 120-55 120-121H489l23-121c-8-4-16-4-23-4zM695 525c0 114-93 207-206 207s-206-94-206-207 93-207 206-207c16 0 27 0 43 4l43-207c-27-4-54-8-85-8-229 0-416 188-416 419s187 419 416 419c225 0 408-180 416-403v-12l-210-4z M144 112h736c18 0 32 14 32 32v736c0 18-14 32-32 32H144c-18 0-32-14-32-32V144c0-18 14-32 32-32zm112 211v72a9 9 0 003 7L386 509 259 615a9 9 0 00-3 7v72a9 9 0 0015 7L493 516a9 9 0 000-14l-222-186a9 9 0 00-15 7zM522 624a10 10 0 00-10 10v60a10 10 0 0010 10h237a10 10 0 0010-10v-60a10 10 0 00-10-10H522z + M170 831 513 489 855 831 960 726 512 278 64 726 170 831zM512 278h448v-128h-896v128h448z M897 673v13c0 51-42 93-93 93h-10c-1 0-2 0-2 0H220c-23 0-42 19-42 42v13c0 23 19 42 42 42h552c14 0 26 12 26 26 0 14-12 26-26 26H220c-51 0-93-42-93-93v-13c0-51 42-93 93-93h20c1-0 2-0 2-0h562c23 0 42-19 42-42v-13c0-11-5-22-13-29-8-7-17-11-28-10H660c-14 0-26-12-26-26 0-14 12-26 26-26h144c24-1 47 7 65 24 18 17 29 42 29 67zM479 98c-112 0-203 91-203 203 0 44 14 85 38 118l132 208c15 24 50 24 66 0l133-209c23-33 37-73 37-117 0-112-91-203-203-203zm0 327c-68 0-122-55-122-122s55-122 122-122 122 55 122 122-55 122-122 122z M912 800a48 48 0 1 1 0 96h-416a48 48 0 1 1 0-96h416z m-704-704A112 112 0 0 1 256 309.184V480h80a48 48 0 0 1 0 96H256v224h81.664a48 48 0 1 1 0 96H256a96 96 0 0 1-96-96V309.248A112 112 0 0 1 208 96z m704 384a48 48 0 1 1 0 96h-416a48 48 0 0 1 0-96h416z m0-320a48 48 0 1 1 0 96h-416a48 48 0 0 1 0-96h416z M30 0 30 30 0 15z diff --git a/src/Resources/Locales/en_US.axaml b/src/Resources/Locales/en_US.axaml index dfc17dee..d2d64d5c 100644 --- a/src/Resources/Locales/en_US.axaml +++ b/src/Resources/Locales/en_US.axaml @@ -252,9 +252,11 @@ File Mode Changed Ignore Whitespace Change LFS OBJECT CHANGE + First Difference Next Difference NO CHANGES OR ONLY EOL CHANGES Previous Difference + Last Difference Save as Patch Show hidden symbols Side-By-Side Diff diff --git a/src/ViewModels/BlockNavigation.cs b/src/ViewModels/BlockNavigation.cs index 709338f8..9a5a926c 100644 --- a/src/ViewModels/BlockNavigation.cs +++ b/src/ViewModels/BlockNavigation.cs @@ -101,12 +101,12 @@ namespace SourceGit.ViewModels return (_current >= 0 && _current < Blocks.Count) ? Blocks[_current] : null; } - public Block GotoNext() + public Block GotoFirst() { if (Blocks.Count == 0) return null; - Current = (_current + 1) % Blocks.Count; + Current = 0; return Blocks[_current]; } @@ -115,7 +115,29 @@ namespace SourceGit.ViewModels if (Blocks.Count == 0) return null; - Current = _current == -1 ? Blocks.Count - 1 : (_current - 1 + Blocks.Count) % Blocks.Count; + if (_current == -1) + Current = 0; + else if (_current > 0) + Current = _current - 1; + return Blocks[_current]; + } + + public Block GotoNext() + { + if (Blocks.Count == 0) + return null; + + if (_current < Blocks.Count - 1) + Current = _current + 1; + return Blocks[_current]; + } + + public Block GotoLast() + { + if (Blocks.Count == 0) + return null; + + Current = Blocks.Count - 1; return Blocks[_current]; } diff --git a/src/Views/DiffView.axaml b/src/Views/DiffView.axaml index aa75c2a0..fccb949d 100644 --- a/src/Views/DiffView.axaml +++ b/src/Views/DiffView.axaml @@ -34,6 +34,20 @@ + + + + (); + textDiff?.GotoFirstChange(); + e.Handled = true; + } + private void OnGotoPrevChange(object _, RoutedEventArgs e) { var textDiff = this.FindDescendantOfType(); @@ -24,5 +31,12 @@ namespace SourceGit.Views textDiff?.GotoNextChange(); e.Handled = true; } + + private void OnGotoLastChange(object _, RoutedEventArgs e) + { + var textDiff = this.FindDescendantOfType(); + textDiff?.GotoLastChange(); + e.Handled = true; + } } } diff --git a/src/Views/TextDiffView.axaml.cs b/src/Views/TextDiffView.axaml.cs index 83bc47e3..323fde03 100644 --- a/src/Views/TextDiffView.axaml.cs +++ b/src/Views/TextDiffView.axaml.cs @@ -543,6 +543,21 @@ namespace SourceGit.Views { } + public void GotoFirstChange() + { + var blockNavigation = BlockNavigation; + if (blockNavigation != null) + { + var prev = blockNavigation.GotoFirst(); + if (prev != null) + { + TextArea.Caret.Line = prev.Start; + ScrollToLine(prev.Start); + } + } + // NOTE: Not implemented (button hidden) for non-block navigation. + } + public void GotoPrevChange() { var blockNavigation = BlockNavigation; @@ -641,6 +656,21 @@ namespace SourceGit.Views } } + public void GotoLastChange() + { + var blockNavigation = BlockNavigation; + if (blockNavigation != null) + { + var next = blockNavigation.GotoLast(); + if (next != null) + { + TextArea.Caret.Line = next.Start; + ScrollToLine(next.Start); + } + } + // NOTE: Not implemented (button hidden) for non-block navigation. + } + public override void Render(DrawingContext context) { base.Render(context); @@ -1682,6 +1712,19 @@ namespace SourceGit.Views InitializeComponent(); } + public void GotoFirstChange() + { + var presenter = this.FindDescendantOfType(); + if (presenter == null) + return; + + presenter.GotoFirstChange(); + if (presenter is SingleSideTextDiffPresenter singleSide) + singleSide.ForceSyncScrollOffset(); + + BlockNavigationIndicator = BlockNavigation?.Indicator ?? string.Empty; + } + public void GotoPrevChange() { var presenter = this.FindDescendantOfType(); @@ -1708,6 +1751,19 @@ namespace SourceGit.Views BlockNavigationIndicator = BlockNavigation?.Indicator ?? string.Empty; } + public void GotoLastChange() + { + var presenter = this.FindDescendantOfType(); + if (presenter == null) + return; + + presenter.GotoLastChange(); + if (presenter is SingleSideTextDiffPresenter singleSide) + singleSide.ForceSyncScrollOffset(); + + BlockNavigationIndicator = BlockNavigation?.Indicator ?? string.Empty; + } + protected override void OnDataContextChanged(EventArgs e) { base.OnDataContextChanged(e); From 52a53cc6976df7ff153209ace0e78bb353e50d94 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Mon, 24 Feb 2025 01:32:32 +0000 Subject: [PATCH 03/15] doc: Update translation status and missing keys --- README.md | 2 +- TRANSLATION.md | 34 ++++++++++++++++++++++++---------- 2 files changed, 25 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index 256070e2..a48af9bd 100644 --- a/README.md +++ b/README.md @@ -47,7 +47,7 @@ ## Translation Status -[![en_US](https://img.shields.io/badge/en__US-%E2%88%9A-brightgreen)](TRANSLATION.md) [![de__DE](https://img.shields.io/badge/de__DE-99.60%25-yellow)](TRANSLATION.md) [![es__ES](https://img.shields.io/badge/es__ES-97.35%25-yellow)](TRANSLATION.md) [![fr__FR](https://img.shields.io/badge/fr__FR-92.18%25-yellow)](TRANSLATION.md) [![it__IT](https://img.shields.io/badge/it__IT-97.61%25-yellow)](TRANSLATION.md) [![pt__BR](https://img.shields.io/badge/pt__BR-91.91%25-yellow)](TRANSLATION.md) [![ru__RU](https://img.shields.io/badge/ru__RU-99.47%25-yellow)](TRANSLATION.md) [![zh__CN](https://img.shields.io/badge/zh__CN-%E2%88%9A-brightgreen)](TRANSLATION.md) [![zh__TW](https://img.shields.io/badge/zh__TW-%E2%88%9A-brightgreen)](TRANSLATION.md) +[![en_US](https://img.shields.io/badge/en__US-%E2%88%9A-brightgreen)](TRANSLATION.md) [![de__DE](https://img.shields.io/badge/de__DE-99.34%25-yellow)](TRANSLATION.md) [![es__ES](https://img.shields.io/badge/es__ES-97.09%25-yellow)](TRANSLATION.md) [![fr__FR](https://img.shields.io/badge/fr__FR-91.93%25-yellow)](TRANSLATION.md) [![it__IT](https://img.shields.io/badge/it__IT-97.35%25-yellow)](TRANSLATION.md) [![pt__BR](https://img.shields.io/badge/pt__BR-91.67%25-yellow)](TRANSLATION.md) [![ru__RU](https://img.shields.io/badge/ru__RU-99.21%25-yellow)](TRANSLATION.md) [![zh__CN](https://img.shields.io/badge/zh__CN-99.74%25-yellow)](TRANSLATION.md) [![zh__TW](https://img.shields.io/badge/zh__TW-99.74%25-yellow)](TRANSLATION.md) > [!NOTE] > You can find the missing keys in [TRANSLATION.md](TRANSLATION.md) diff --git a/TRANSLATION.md b/TRANSLATION.md index c235ea6a..4e96f0ac 100644 --- a/TRANSLATION.md +++ b/TRANSLATION.md @@ -1,4 +1,4 @@ -### de_DE.axaml: 99.60% +### de_DE.axaml: 99.34%
@@ -6,11 +6,13 @@ - Text.BranchUpstreamInvalid - Text.Configure.CustomAction.WaitForExit +- Text.Diff.First +- Text.Diff.Last - Text.Preferences.AI.Streaming
-### es_ES.axaml: 97.35% +### es_ES.axaml: 97.09%
@@ -31,6 +33,8 @@ - Text.DeleteRepositoryNode.Path - Text.DeleteRepositoryNode.TipForGroup - Text.DeleteRepositoryNode.TipForRepository +- Text.Diff.First +- Text.Diff.Last - Text.Preferences.AI.Streaming - Text.Repository.Notifications.Clear - Text.Stash.AutoRestore @@ -39,7 +43,7 @@
-### fr_FR.axaml: 92.18% +### fr_FR.axaml: 91.93%
@@ -60,6 +64,8 @@ - Text.DeleteRepositoryNode.Path - Text.DeleteRepositoryNode.TipForGroup - Text.DeleteRepositoryNode.TipForRepository +- Text.Diff.First +- Text.Diff.Last - Text.InProgress.CherryPick.Head - Text.InProgress.Merge.Operating - Text.InProgress.Rebase.StoppedAt @@ -107,7 +113,7 @@
-### it_IT.axaml: 97.61% +### it_IT.axaml: 97.35%
@@ -127,6 +133,8 @@ - Text.DeleteRepositoryNode.Path - Text.DeleteRepositoryNode.TipForGroup - Text.DeleteRepositoryNode.TipForRepository +- Text.Diff.First +- Text.Diff.Last - Text.Preferences.AI.Streaming - Text.Repository.Notifications.Clear - Text.Stash.AutoRestore @@ -134,7 +142,7 @@
-### pt_BR.axaml: 91.91% +### pt_BR.axaml: 91.67%
@@ -162,6 +170,8 @@ - Text.DeleteRepositoryNode.Path - Text.DeleteRepositoryNode.TipForGroup - Text.DeleteRepositoryNode.TipForRepository +- Text.Diff.First +- Text.Diff.Last - Text.Diff.UseBlockNavigation - Text.Fetch.Force - Text.FileCM.ResolveUsing @@ -204,7 +214,7 @@
-### ru_RU.axaml: 99.47% +### ru_RU.axaml: 99.21%
@@ -213,26 +223,30 @@ - Text.BranchCM.CustomAction - Text.BranchUpstreamInvalid - Text.Configure.CustomAction.Scope.Branch +- Text.Diff.First +- Text.Diff.Last - Text.Preferences.AI.Streaming
-### zh_CN.axaml: 100.00% +### zh_CN.axaml: 99.74%
Missing Keys - +- Text.Diff.First +- Text.Diff.Last
-### zh_TW.axaml: 100.00% +### zh_TW.axaml: 99.74%
Missing Keys - +- Text.Diff.First +- Text.Diff.Last
From 124bdc97f96a30ebcd0572671aed5db26bc6ee81 Mon Sep 17 00:00:00 2001 From: leo Date: Mon, 24 Feb 2025 09:37:34 +0800 Subject: [PATCH 04/15] localization: add missing keys for zh_CN and zh_TW Signed-off-by: leo --- src/Resources/Locales/en_US.axaml | 6 +++--- src/Resources/Locales/zh_CN.axaml | 2 ++ src/Resources/Locales/zh_TW.axaml | 2 ++ 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/Resources/Locales/en_US.axaml b/src/Resources/Locales/en_US.axaml index d2d64d5c..1a83a4da 100644 --- a/src/Resources/Locales/en_US.axaml +++ b/src/Resources/Locales/en_US.axaml @@ -250,13 +250,13 @@ OLD Copy File Mode Changed - Ignore Whitespace Change - LFS OBJECT CHANGE First Difference + Ignore Whitespace Change + Last Difference + LFS OBJECT CHANGE Next Difference NO CHANGES OR ONLY EOL CHANGES Previous Difference - Last Difference Save as Patch Show hidden symbols Side-By-Side Diff diff --git a/src/Resources/Locales/zh_CN.axaml b/src/Resources/Locales/zh_CN.axaml index 115f917e..acfdefd2 100644 --- a/src/Resources/Locales/zh_CN.axaml +++ b/src/Resources/Locales/zh_CN.axaml @@ -253,7 +253,9 @@ 原始大小 复制 文件权限已变化 + 首个差异 忽略空白符号变化 + 最后一个差异 LFS对象变更 下一个差异 没有变更或仅有换行符差异 diff --git a/src/Resources/Locales/zh_TW.axaml b/src/Resources/Locales/zh_TW.axaml index 00933783..dd9092a4 100644 --- a/src/Resources/Locales/zh_TW.axaml +++ b/src/Resources/Locales/zh_TW.axaml @@ -253,7 +253,9 @@ 原始大小 複製 檔案權限已變更 + 第一個差異 忽略空白符號變化 + 最後一個差異 LFS 物件變更 下一個差異 沒有變更或僅有換行字元差異 From 74e5bcb7047d95e38ca116a1fe0ef2ef9c84242e Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Mon, 24 Feb 2025 01:37:52 +0000 Subject: [PATCH 05/15] doc: Update translation status and missing keys --- README.md | 2 +- TRANSLATION.md | 10 ++++------ 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index a48af9bd..a82a43b1 100644 --- a/README.md +++ b/README.md @@ -47,7 +47,7 @@ ## Translation Status -[![en_US](https://img.shields.io/badge/en__US-%E2%88%9A-brightgreen)](TRANSLATION.md) [![de__DE](https://img.shields.io/badge/de__DE-99.34%25-yellow)](TRANSLATION.md) [![es__ES](https://img.shields.io/badge/es__ES-97.09%25-yellow)](TRANSLATION.md) [![fr__FR](https://img.shields.io/badge/fr__FR-91.93%25-yellow)](TRANSLATION.md) [![it__IT](https://img.shields.io/badge/it__IT-97.35%25-yellow)](TRANSLATION.md) [![pt__BR](https://img.shields.io/badge/pt__BR-91.67%25-yellow)](TRANSLATION.md) [![ru__RU](https://img.shields.io/badge/ru__RU-99.21%25-yellow)](TRANSLATION.md) [![zh__CN](https://img.shields.io/badge/zh__CN-99.74%25-yellow)](TRANSLATION.md) [![zh__TW](https://img.shields.io/badge/zh__TW-99.74%25-yellow)](TRANSLATION.md) +[![en_US](https://img.shields.io/badge/en__US-%E2%88%9A-brightgreen)](TRANSLATION.md) [![de__DE](https://img.shields.io/badge/de__DE-99.34%25-yellow)](TRANSLATION.md) [![es__ES](https://img.shields.io/badge/es__ES-97.09%25-yellow)](TRANSLATION.md) [![fr__FR](https://img.shields.io/badge/fr__FR-91.93%25-yellow)](TRANSLATION.md) [![it__IT](https://img.shields.io/badge/it__IT-97.35%25-yellow)](TRANSLATION.md) [![pt__BR](https://img.shields.io/badge/pt__BR-91.67%25-yellow)](TRANSLATION.md) [![ru__RU](https://img.shields.io/badge/ru__RU-99.21%25-yellow)](TRANSLATION.md) [![zh__CN](https://img.shields.io/badge/zh__CN-%E2%88%9A-brightgreen)](TRANSLATION.md) [![zh__TW](https://img.shields.io/badge/zh__TW-%E2%88%9A-brightgreen)](TRANSLATION.md) > [!NOTE] > You can find the missing keys in [TRANSLATION.md](TRANSLATION.md) diff --git a/TRANSLATION.md b/TRANSLATION.md index 4e96f0ac..acecf990 100644 --- a/TRANSLATION.md +++ b/TRANSLATION.md @@ -229,24 +229,22 @@ -### zh_CN.axaml: 99.74% +### zh_CN.axaml: 100.00%
Missing Keys -- Text.Diff.First -- Text.Diff.Last +
-### zh_TW.axaml: 99.74% +### zh_TW.axaml: 100.00%
Missing Keys -- Text.Diff.First -- Text.Diff.Last +
From d4341c119554835d4885dd54ba15bd7fe153cf78 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javier=20J=2E=20Mart=C3=ADnez=20M=2E?= <56406225+jjesus-dev@users.noreply.github.com> Date: Sun, 23 Feb 2025 19:45:39 -0600 Subject: [PATCH 06/15] localization: add missing spanish translations (#1017) --- src/Resources/Locales/es_ES.axaml | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/Resources/Locales/es_ES.axaml b/src/Resources/Locales/es_ES.axaml index a0f35814..24170683 100644 --- a/src/Resources/Locales/es_ES.axaml +++ b/src/Resources/Locales/es_ES.axaml @@ -22,7 +22,9 @@ Rama de Seguimiento: Seguimiento de rama remota Asistente OpenAI + RE-GENERAR Usar OpenAI para generar mensaje de commit + APLICAR CÓMO MENSAJE DE COMMIT Aplicar Patch Error Genera errores y se niega a aplicar el patch @@ -37,6 +39,10 @@ Advertencia Genera advertencias para algunos de estos errores, pero aplica Espacios en Blanco: + Aplicar Stash + Borrar después de aplicar + Restaurar los cambios del índice + Stash: Archivar... Guardar Archivo en: Seleccionar ruta del archivo @@ -53,6 +59,7 @@ Comparar con HEAD Comparar con Worktree Copiar Nombre de Rama + Acción personalizada Eliminar ${0}$... Eliminar {0} ramas seleccionadas Descartar todos los cambios @@ -68,6 +75,7 @@ Renombrar ${0}$... Establecer Rama de Seguimiento... Comparar Ramas + ¡Upstream inválido! Bytes CANCELAR Resetear a Esta Revisión @@ -100,6 +108,7 @@ Nombre Local: Nombre del repositorio. Opcional. Carpeta Padre: + Inicializar y actualizar submodulos URL del Repositorio: CERRAR Editor @@ -152,8 +161,10 @@ Archivo Ejecutable: Nombre: Alcance: + Rama Commit Repositorio + Esperar la acción de salida Dirección de Email Dirección de email GIT @@ -202,6 +213,7 @@ Stash & Reaplicar Nombre de la Nueva Rama: Introduzca el nombre de la rama. + Los espacios serán reemplazados con guiones. Crear Rama Local Crear Etiqueta... Nueva Etiqueta En: @@ -225,8 +237,11 @@ Estás intentando eliminar múltiples ramas a la vez. ¡Asegúrate de revisar antes de tomar acción! Eliminar Remoto Remoto: + Ruta: Destino: + Todos los hijos serán removidos de la lista. Confirmar Eliminación de Grupo + ¡Esto solo lo removera de la lista, no del disco! Confirmar Eliminación de Repositorio Eliminar Submódulo Ruta del Submódulo: @@ -449,6 +464,7 @@ Modelo Nombre Servidor + Activar Transmisión APARIENCIA Fuente por defecto Tamaño de fuente @@ -576,6 +592,7 @@ RAMAS LOCALES Navegar a HEAD Crear Rama + LIMPIAR NOTIFICACIONES Resaltar solo la rama actual en el gráfico Abrir en {0} Abrir en Herramientas Externas @@ -642,6 +659,8 @@ Ruta de almacenamiento de la clave privada SSH INICIAR Stash + Restaurar automáticamente después del stashing + Tus archivos de trabajo permanecen sin cambios, pero se guarda un stash. Incluir archivos no rastreados Mantener archivos staged Mensaje: @@ -721,6 +740,7 @@ INCLUIR ARCHIVOS NO RASTREADOS NO HAY MENSAJES DE ENTRADA RECIENTES NO HAY PLANTILLAS DE COMMIT + Firmar STAGED UNSTAGE UNSTAGE TODO From 89e09d842d6f632e4c2cda52a6715983b44a2c28 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Mon, 24 Feb 2025 01:45:49 +0000 Subject: [PATCH 07/15] doc: Update translation status and missing keys --- README.md | 2 +- TRANSLATION.md | 22 +--------------------- 2 files changed, 2 insertions(+), 22 deletions(-) diff --git a/README.md b/README.md index a82a43b1..0990a39d 100644 --- a/README.md +++ b/README.md @@ -47,7 +47,7 @@ ## Translation Status -[![en_US](https://img.shields.io/badge/en__US-%E2%88%9A-brightgreen)](TRANSLATION.md) [![de__DE](https://img.shields.io/badge/de__DE-99.34%25-yellow)](TRANSLATION.md) [![es__ES](https://img.shields.io/badge/es__ES-97.09%25-yellow)](TRANSLATION.md) [![fr__FR](https://img.shields.io/badge/fr__FR-91.93%25-yellow)](TRANSLATION.md) [![it__IT](https://img.shields.io/badge/it__IT-97.35%25-yellow)](TRANSLATION.md) [![pt__BR](https://img.shields.io/badge/pt__BR-91.67%25-yellow)](TRANSLATION.md) [![ru__RU](https://img.shields.io/badge/ru__RU-99.21%25-yellow)](TRANSLATION.md) [![zh__CN](https://img.shields.io/badge/zh__CN-%E2%88%9A-brightgreen)](TRANSLATION.md) [![zh__TW](https://img.shields.io/badge/zh__TW-%E2%88%9A-brightgreen)](TRANSLATION.md) +[![en_US](https://img.shields.io/badge/en__US-%E2%88%9A-brightgreen)](TRANSLATION.md) [![de__DE](https://img.shields.io/badge/de__DE-99.34%25-yellow)](TRANSLATION.md) [![es__ES](https://img.shields.io/badge/es__ES-99.74%25-yellow)](TRANSLATION.md) [![fr__FR](https://img.shields.io/badge/fr__FR-91.93%25-yellow)](TRANSLATION.md) [![it__IT](https://img.shields.io/badge/it__IT-97.35%25-yellow)](TRANSLATION.md) [![pt__BR](https://img.shields.io/badge/pt__BR-91.67%25-yellow)](TRANSLATION.md) [![ru__RU](https://img.shields.io/badge/ru__RU-99.21%25-yellow)](TRANSLATION.md) [![zh__CN](https://img.shields.io/badge/zh__CN-%E2%88%9A-brightgreen)](TRANSLATION.md) [![zh__TW](https://img.shields.io/badge/zh__TW-%E2%88%9A-brightgreen)](TRANSLATION.md) > [!NOTE] > You can find the missing keys in [TRANSLATION.md](TRANSLATION.md) diff --git a/TRANSLATION.md b/TRANSLATION.md index acecf990..04e121fc 100644 --- a/TRANSLATION.md +++ b/TRANSLATION.md @@ -12,34 +12,14 @@ -### es_ES.axaml: 97.09% +### es_ES.axaml: 99.74%
Missing Keys -- Text.AIAssistant.Regen -- Text.AIAssistant.Use -- Text.ApplyStash -- Text.ApplyStash.DropAfterApply -- Text.ApplyStash.RestoreIndex -- Text.ApplyStash.Stash -- Text.BranchCM.CustomAction -- Text.BranchUpstreamInvalid -- Text.Clone.RecurseSubmodules -- Text.Configure.CustomAction.Scope.Branch -- Text.Configure.CustomAction.WaitForExit -- Text.CreateBranch.Name.WarnSpace -- Text.DeleteRepositoryNode.Path -- Text.DeleteRepositoryNode.TipForGroup -- Text.DeleteRepositoryNode.TipForRepository - Text.Diff.First - Text.Diff.Last -- Text.Preferences.AI.Streaming -- Text.Repository.Notifications.Clear -- Text.Stash.AutoRestore -- Text.Stash.AutoRestore.Tip -- Text.WorkingCopy.SignOff
From 0b7805b2ee3489de0e4b6a3b62782301fa25012b Mon Sep 17 00:00:00 2001 From: leo Date: Mon, 24 Feb 2025 09:49:30 +0800 Subject: [PATCH 08/15] version: Release 2025.06 Signed-off-by: leo --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index 15689348..bb11b3b9 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -2025.05 \ No newline at end of file +2025.06 \ No newline at end of file From 1d037c7c572389bd91d50a22a1105b89bf4fd5c6 Mon Sep 17 00:00:00 2001 From: leo Date: Mon, 24 Feb 2025 21:24:53 +0800 Subject: [PATCH 09/15] feature: add context menu `Save As Patch...` for selected stash (#1018) Signed-off-by: leo --- src/Commands/SaveChangesAsPatch.cs | 13 +++++++++++ src/Resources/Locales/en_US.axaml | 1 + src/Resources/Locales/zh_CN.axaml | 1 + src/Resources/Locales/zh_TW.axaml | 1 + src/ViewModels/StashesPage.cs | 37 ++++++++++++++++++++++++++++++ 5 files changed, 53 insertions(+) diff --git a/src/Commands/SaveChangesAsPatch.cs b/src/Commands/SaveChangesAsPatch.cs index 461bbfb5..b10037a1 100644 --- a/src/Commands/SaveChangesAsPatch.cs +++ b/src/Commands/SaveChangesAsPatch.cs @@ -37,6 +37,19 @@ namespace SourceGit.Commands return true; } + public static bool ProcessStashChanges(string repo, List opts, string saveTo) + { + using (var sw = File.Create(saveTo)) + { + foreach (var opt in opts) + { + if (!ProcessSingleChange(repo, opt, sw)) + return false; + } + } + return true; + } + private static bool ProcessSingleChange(string repo, Models.DiffOption opt, FileStream writer) { var starter = new ProcessStartInfo(); diff --git a/src/Resources/Locales/en_US.axaml b/src/Resources/Locales/en_US.axaml index 1a83a4da..6c397ea0 100644 --- a/src/Resources/Locales/en_US.axaml +++ b/src/Resources/Locales/en_US.axaml @@ -669,6 +669,7 @@ Apply Drop Pop + Save as Patch... Drop Stash Drop: STASHES diff --git a/src/Resources/Locales/zh_CN.axaml b/src/Resources/Locales/zh_CN.axaml index acfdefd2..09c46e95 100644 --- a/src/Resources/Locales/zh_CN.axaml +++ b/src/Resources/Locales/zh_CN.axaml @@ -673,6 +673,7 @@ 应用(apply) 删除(drop) 应用并删除(pop) + 另存为补丁... 丢弃贮藏确认 丢弃贮藏 : 贮藏列表 diff --git a/src/Resources/Locales/zh_TW.axaml b/src/Resources/Locales/zh_TW.axaml index dd9092a4..0eb54676 100644 --- a/src/Resources/Locales/zh_TW.axaml +++ b/src/Resources/Locales/zh_TW.axaml @@ -672,6 +672,7 @@ 套用 (apply) 刪除 (drop) 套用並刪除 (pop) + 另存為修補檔 (patch)... 捨棄擱置變更確認 捨棄擱置變更: 擱置變更 diff --git a/src/ViewModels/StashesPage.cs b/src/ViewModels/StashesPage.cs index 4a3bf933..57b30fd3 100644 --- a/src/ViewModels/StashesPage.cs +++ b/src/ViewModels/StashesPage.cs @@ -4,6 +4,7 @@ using System.IO; using System.Threading.Tasks; using Avalonia.Controls; +using Avalonia.Platform.Storage; using Avalonia.Threading; using CommunityToolkit.Mvvm.ComponentModel; @@ -157,9 +158,45 @@ namespace SourceGit.ViewModels ev.Handled = true; }; + var patch = new MenuItem(); + patch.Header = App.Text("StashCM.SaveAsPatch"); + patch.Icon = App.CreateMenuIcon("Icons.Diff"); + patch.Click += async (_, e) => + { + var storageProvider = App.GetStorageProvider(); + if (storageProvider == null) + return; + + var options = new FilePickerSaveOptions(); + options.Title = App.Text("StashCM.SaveAsPatch"); + options.DefaultExtension = ".patch"; + options.FileTypeChoices = [new FilePickerFileType("Patch File") { Patterns = ["*.patch"] }]; + + var storageFile = await storageProvider.SaveFilePickerAsync(options); + if (storageFile != null) + { + var opts = new List(); + foreach (var c in _changes) + { + if (_untrackedChanges.Contains(c.Path)) + opts.Add(new Models.DiffOption("4b825dc642cb6eb9a060e54bf8d69288fbee4904", _selectedStash.Parents[2], c)); + else + opts.Add(new Models.DiffOption(_selectedStash.Parents[0], _selectedStash.SHA, c)); + } + + var succ = await Task.Run(() => Commands.SaveChangesAsPatch.ProcessStashChanges(_repo.FullPath, opts, storageFile.Path.LocalPath)); + if (succ) + App.SendNotification(_repo.FullPath, App.Text("SaveAsPatchSuccess")); + } + + e.Handled = true; + }; + var menu = new ContextMenu(); menu.Items.Add(apply); menu.Items.Add(drop); + menu.Items.Add(new MenuItem { Header = "-" }); + menu.Items.Add(patch); return menu; } From 1f35e837997148049b2365484b9bbea16ef5bd56 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Mon, 24 Feb 2025 13:25:13 +0000 Subject: [PATCH 10/15] doc: Update translation status and missing keys --- README.md | 2 +- TRANSLATION.md | 18 ++++++++++++------ 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 0990a39d..e89b071c 100644 --- a/README.md +++ b/README.md @@ -47,7 +47,7 @@ ## Translation Status -[![en_US](https://img.shields.io/badge/en__US-%E2%88%9A-brightgreen)](TRANSLATION.md) [![de__DE](https://img.shields.io/badge/de__DE-99.34%25-yellow)](TRANSLATION.md) [![es__ES](https://img.shields.io/badge/es__ES-99.74%25-yellow)](TRANSLATION.md) [![fr__FR](https://img.shields.io/badge/fr__FR-91.93%25-yellow)](TRANSLATION.md) [![it__IT](https://img.shields.io/badge/it__IT-97.35%25-yellow)](TRANSLATION.md) [![pt__BR](https://img.shields.io/badge/pt__BR-91.67%25-yellow)](TRANSLATION.md) [![ru__RU](https://img.shields.io/badge/ru__RU-99.21%25-yellow)](TRANSLATION.md) [![zh__CN](https://img.shields.io/badge/zh__CN-%E2%88%9A-brightgreen)](TRANSLATION.md) [![zh__TW](https://img.shields.io/badge/zh__TW-%E2%88%9A-brightgreen)](TRANSLATION.md) +[![en_US](https://img.shields.io/badge/en__US-%E2%88%9A-brightgreen)](TRANSLATION.md) [![de__DE](https://img.shields.io/badge/de__DE-99.21%25-yellow)](TRANSLATION.md) [![es__ES](https://img.shields.io/badge/es__ES-99.60%25-yellow)](TRANSLATION.md) [![fr__FR](https://img.shields.io/badge/fr__FR-91.81%25-yellow)](TRANSLATION.md) [![it__IT](https://img.shields.io/badge/it__IT-97.23%25-yellow)](TRANSLATION.md) [![pt__BR](https://img.shields.io/badge/pt__BR-91.55%25-yellow)](TRANSLATION.md) [![ru__RU](https://img.shields.io/badge/ru__RU-99.08%25-yellow)](TRANSLATION.md) [![zh__CN](https://img.shields.io/badge/zh__CN-%E2%88%9A-brightgreen)](TRANSLATION.md) [![zh__TW](https://img.shields.io/badge/zh__TW-%E2%88%9A-brightgreen)](TRANSLATION.md) > [!NOTE] > You can find the missing keys in [TRANSLATION.md](TRANSLATION.md) diff --git a/TRANSLATION.md b/TRANSLATION.md index 04e121fc..024cd035 100644 --- a/TRANSLATION.md +++ b/TRANSLATION.md @@ -1,4 +1,4 @@ -### de_DE.axaml: 99.34% +### de_DE.axaml: 99.21%
@@ -9,10 +9,11 @@ - Text.Diff.First - Text.Diff.Last - Text.Preferences.AI.Streaming +- Text.StashCM.SaveAsPatch
-### es_ES.axaml: 99.74% +### es_ES.axaml: 99.60%
@@ -20,10 +21,11 @@ - Text.Diff.First - Text.Diff.Last +- Text.StashCM.SaveAsPatch
-### fr_FR.axaml: 91.93% +### fr_FR.axaml: 91.81%
@@ -88,12 +90,13 @@ - Text.SHALinkCM.NavigateTo - Text.Stash.AutoRestore - Text.Stash.AutoRestore.Tip +- Text.StashCM.SaveAsPatch - Text.WorkingCopy.CommitToEdit - Text.WorkingCopy.SignOff
-### it_IT.axaml: 97.35% +### it_IT.axaml: 97.23%
@@ -119,10 +122,11 @@ - Text.Repository.Notifications.Clear - Text.Stash.AutoRestore - Text.Stash.AutoRestore.Tip +- Text.StashCM.SaveAsPatch
-### pt_BR.axaml: 91.67% +### pt_BR.axaml: 91.55%
@@ -189,12 +193,13 @@ - Text.SHALinkCM.NavigateTo - Text.Stash.AutoRestore - Text.Stash.AutoRestore.Tip +- Text.StashCM.SaveAsPatch - Text.WorkingCopy.CommitToEdit - Text.WorkingCopy.SignOff
-### ru_RU.axaml: 99.21% +### ru_RU.axaml: 99.08%
@@ -206,6 +211,7 @@ - Text.Diff.First - Text.Diff.Last - Text.Preferences.AI.Streaming +- Text.StashCM.SaveAsPatch
From c6747f72f9fc712229b87783bc8d8a735f119647 Mon Sep 17 00:00:00 2001 From: leo Date: Tue, 25 Feb 2025 10:53:42 +0800 Subject: [PATCH 11/15] feature: auto-select first change in commit details panel and revision/branch compare panel (#1019) Signed-off-by: leo --- src/Models/OpenAI.cs | 2 +- src/ViewModels/CommitDetail.cs | 16 ++++---- src/ViewModels/Repository.cs | 6 +++ src/ViewModels/WorkingCopy.cs | 2 +- src/Views/BranchCompare.axaml | 1 + src/Views/ChangeCollectionView.axaml.cs | 53 +++++++++++++++++++++---- src/Views/CommitChanges.axaml | 1 + src/Views/LauncherTabsSelector.axaml.cs | 6 +-- src/Views/Repository.axaml.cs | 2 +- src/Views/RevisionCompare.axaml | 1 + src/Views/TextDiffView.axaml.cs | 2 +- 11 files changed, 71 insertions(+), 21 deletions(-) diff --git a/src/Models/OpenAI.cs b/src/Models/OpenAI.cs index 264230c6..76daacd0 100644 --- a/src/Models/OpenAI.cs +++ b/src/Models/OpenAI.cs @@ -36,7 +36,7 @@ namespace SourceGit.Models { if (startIdx > 0) OnReceive(buffer.Substring(0, startIdx)); - + var endIdx = buffer.IndexOf(">", startIdx + 1, StringComparison.Ordinal); if (endIdx <= startIdx) { diff --git a/src/ViewModels/CommitDetail.cs b/src/ViewModels/CommitDetail.cs index d90e97d6..702a757c 100644 --- a/src/ViewModels/CommitDetail.cs +++ b/src/ViewModels/CommitDetail.cs @@ -25,8 +25,15 @@ namespace SourceGit.ViewModels public int ActivePageIndex { - get => _activePageIndex; - set => SetProperty(ref _activePageIndex, value); + get => _repo.CommitDetailActivePageIndex; + set + { + if (_repo.CommitDetailActivePageIndex != value) + { + _repo.CommitDetailActivePageIndex = value; + OnPropertyChanged(); + } + } } public Models.Commit Commit @@ -617,11 +624,7 @@ namespace SourceGit.ViewModels _changes = null; _revisionFiles.Clear(); - FullMessage = string.Empty; SignInfo = null; - Changes = []; - VisibleChanges = null; - SelectedChanges = null; ViewRevisionFileContent = null; Children.Clear(); RevisionFileSearchFilter = string.Empty; @@ -821,7 +824,6 @@ namespace SourceGit.ViewModels }; private Repository _repo = null; - private int _activePageIndex = 0; private Models.Commit _commit = null; private string _fullMessage = string.Empty; private Models.CommitSignInfo _signInfo = null; diff --git a/src/ViewModels/Repository.cs b/src/ViewModels/Repository.cs index 6e8a5290..104ff60b 100644 --- a/src/ViewModels/Repository.cs +++ b/src/ViewModels/Repository.cs @@ -453,6 +453,12 @@ namespace SourceGit.ViewModels private set => SetProperty(ref _isAutoFetching, value); } + public int CommitDetailActivePageIndex + { + get; + set; + } = 0; + public Repository(bool isBare, string path, string gitDir) { IsBare = isBare; diff --git a/src/ViewModels/WorkingCopy.cs b/src/ViewModels/WorkingCopy.cs index ce2a2ac1..afaf5868 100644 --- a/src/ViewModels/WorkingCopy.cs +++ b/src/ViewModels/WorkingCopy.cs @@ -1466,7 +1466,7 @@ namespace SourceGit.ViewModels return unstaged; var visible = new List(); - + foreach (var c in unstaged) { if (c.Path.Contains(_unstagedFilter, StringComparison.OrdinalIgnoreCase)) diff --git a/src/Views/BranchCompare.axaml b/src/Views/BranchCompare.axaml index 04b77306..f73860c5 100644 --- a/src/Views/BranchCompare.axaml +++ b/src/Views/BranchCompare.axaml @@ -134,6 +134,7 @@ diff --git a/src/Views/ChangeCollectionView.axaml.cs b/src/Views/ChangeCollectionView.axaml.cs index d6982dda..6ef79861 100644 --- a/src/Views/ChangeCollectionView.axaml.cs +++ b/src/Views/ChangeCollectionView.axaml.cs @@ -85,6 +85,15 @@ namespace SourceGit.Views set => SetValue(ChangesProperty, value); } + public static readonly StyledProperty AutoSelectFirstChangeProperty = + AvaloniaProperty.Register(nameof(AutoSelectFirstChange), false); + + public bool AutoSelectFirstChange + { + get => GetValue(AutoSelectFirstChangeProperty); + set => SetValue(AutoSelectFirstChangeProperty, value); + } + public static readonly StyledProperty> SelectedChangesProperty = AvaloniaProperty.Register>(nameof(SelectedChanges)); @@ -205,9 +214,9 @@ namespace SourceGit.Views base.OnPropertyChanged(change); if (change.Property == ViewModeProperty) - UpdateDataSource(false); - else if (change.Property == ChangesProperty) UpdateDataSource(true); + else if (change.Property == ChangesProperty) + UpdateDataSource(false); else if (change.Property == SelectedChangesProperty) UpdateSelection(); } @@ -292,9 +301,9 @@ namespace SourceGit.Views } } - private void UpdateDataSource(bool disableEvents) + private void UpdateDataSource(bool onlyViewModeChange) { - _disableSelectionChangingEvent = disableEvents; + _disableSelectionChangingEvent = !onlyViewModeChange; var changes = Changes; if (changes == null || changes.Count == 0) @@ -324,7 +333,19 @@ namespace SourceGit.Views MakeTreeRows(rows, tree.Tree); tree.Rows.AddRange(rows); - if (selected.Count > 0) + if (!onlyViewModeChange && AutoSelectFirstChange) + { + foreach (var row in tree.Rows) + { + if (row.Change != null) + { + tree.SelectedRows.Add(row); + SetCurrentValue(SelectedChangesProperty, [row.Change]); + break; + } + } + } + else if (selected.Count > 0) { var sets = new HashSet(); foreach (var c in selected) @@ -346,16 +367,34 @@ namespace SourceGit.Views { var grid = new ViewModels.ChangeCollectionAsGrid(); grid.Changes.AddRange(changes); - if (selected.Count > 0) + + if (!onlyViewModeChange && AutoSelectFirstChange) + { + grid.SelectedChanges.Add(changes[0]); + SetCurrentValue(SelectedChangesProperty, [changes[0]]); + } + else if (selected.Count > 0) + { grid.SelectedChanges.AddRange(selected); + } + Content = grid; } else { var list = new ViewModels.ChangeCollectionAsList(); list.Changes.AddRange(changes); - if (selected.Count > 0) + + if (!onlyViewModeChange && AutoSelectFirstChange) + { + list.SelectedChanges.Add(changes[0]); + SetCurrentValue(SelectedChangesProperty, [changes[0]]); + } + else if (selected.Count > 0) + { list.SelectedChanges.AddRange(selected); + } + Content = list; } diff --git a/src/Views/CommitChanges.axaml b/src/Views/CommitChanges.axaml index 377be944..2fac9365 100644 --- a/src/Views/CommitChanges.axaml +++ b/src/Views/CommitChanges.axaml @@ -49,6 +49,7 @@ ViewMode="{Binding Source={x:Static vm:Preferences.Instance}, Path=CommitChangeViewMode}" Changes="{Binding VisibleChanges}" SelectedChanges="{Binding SelectedChanges, Mode=TwoWay}" + AutoSelectFirstChange="True" ContextRequested="OnChangeContextRequested"/> diff --git a/src/Views/LauncherTabsSelector.axaml.cs b/src/Views/LauncherTabsSelector.axaml.cs index 01c5fa0d..61d7a966 100644 --- a/src/Views/LauncherTabsSelector.axaml.cs +++ b/src/Views/LauncherTabsSelector.axaml.cs @@ -39,7 +39,7 @@ namespace SourceGit.Views } public static readonly RoutedEvent PageSelectedEvent = - RoutedEvent.Register(nameof(PageSelected), RoutingStrategies.Tunnel | RoutingStrategies.Bubble); + RoutedEvent.Register(nameof(PageSelected), RoutingStrategies.Tunnel | RoutingStrategies.Bubble); public event EventHandler PageSelected { @@ -74,7 +74,7 @@ namespace SourceGit.Views private void OnPageSelectionChanged(object sender, SelectionChangedEventArgs e) { - if (sender is ListBox { SelectedItem : ViewModels.LauncherPage page }) + if (sender is ListBox { SelectedItem: ViewModels.LauncherPage page }) { _isProcessingSelection = true; RaiseEvent(new LauncherTabSelectedEventArgs(page)); @@ -88,7 +88,7 @@ namespace SourceGit.Views { if (_isProcessingSelection) return; - + VisiblePages.Clear(); if (Pages == null) diff --git a/src/Views/Repository.axaml.cs b/src/Views/Repository.axaml.cs index 53bb2d53..2b3b7c30 100644 --- a/src/Views/Repository.axaml.cs +++ b/src/Views/Repository.axaml.cs @@ -522,7 +522,7 @@ namespace SourceGit.Views private void OnRemoveSelectedHistoriesFilter(object sender, RoutedEventArgs e) { - if (DataContext is ViewModels.Repository repo && sender is Button { DataContext: Models.Filter filter}) + if (DataContext is ViewModels.Repository repo && sender is Button { DataContext: Models.Filter filter }) repo.RemoveHistoriesFilter(filter); e.Handled = true; diff --git a/src/Views/RevisionCompare.axaml b/src/Views/RevisionCompare.axaml index 46b667ac..73703ff1 100644 --- a/src/Views/RevisionCompare.axaml +++ b/src/Views/RevisionCompare.axaml @@ -99,6 +99,7 @@ diff --git a/src/Views/TextDiffView.axaml.cs b/src/Views/TextDiffView.axaml.cs index 323fde03..dccbb9b2 100644 --- a/src/Views/TextDiffView.axaml.cs +++ b/src/Views/TextDiffView.axaml.cs @@ -1006,7 +1006,7 @@ namespace SourceGit.Views if (startPosition.Location > endPosition.Location) (startPosition, endPosition) = (endPosition, startPosition); - + var startIdx = Math.Min(startPosition.Line - 1, lines.Count - 1); var endIdx = Math.Min(endPosition.Line - 1, lines.Count - 1); From 4d740f4731432e637ca1bb5f195ce9b307b4e805 Mon Sep 17 00:00:00 2001 From: leo Date: Tue, 25 Feb 2025 11:09:12 +0800 Subject: [PATCH 12/15] feature: auto-select the first change when selected stash changed (#1019) Signed-off-by: leo --- src/ViewModels/StashesPage.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ViewModels/StashesPage.cs b/src/ViewModels/StashesPage.cs index 57b30fd3..9e220234 100644 --- a/src/ViewModels/StashesPage.cs +++ b/src/ViewModels/StashesPage.cs @@ -89,7 +89,7 @@ namespace SourceGit.ViewModels private set { if (SetProperty(ref _changes, value)) - SelectedChange = null; + SelectedChange = value is { Count: >0 } ? value[0] : null; } } From a0786bf9cc12f6e1b29078eed8357879e023098d Mon Sep 17 00:00:00 2001 From: leo Date: Tue, 25 Feb 2025 14:37:03 +0800 Subject: [PATCH 13/15] fix: pulling with empty repository (no local branch) crashes this app (#1020) Signed-off-by: leo --- src/ViewModels/Repository.cs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/ViewModels/Repository.cs b/src/ViewModels/Repository.cs index 104ff60b..85b819c4 100644 --- a/src/ViewModels/Repository.cs +++ b/src/ViewModels/Repository.cs @@ -663,6 +663,12 @@ namespace SourceGit.ViewModels return; } + if (_currentBranch == null) + { + App.RaiseException(_fullpath, "Can NOT found current branch!!!"); + return; + } + var pull = new Pull(this, null); if (autoStart && pull.SelectedBranch != null) ShowAndStartPopup(pull); From 79306ad73bbd2b6f0872cbb32d348a0b105b50e4 Mon Sep 17 00:00:00 2001 From: leo Date: Tue, 25 Feb 2025 19:50:09 +0800 Subject: [PATCH 14/15] fix: `ptyxis` does not start with given working directory (#1005) Signed-off-by: leo --- src/Native/Linux.cs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/Native/Linux.cs b/src/Native/Linux.cs index a24f1b65..fec110b2 100644 --- a/src/Native/Linux.cs +++ b/src/Native/Linux.cs @@ -65,13 +65,16 @@ namespace SourceGit.Native { var home = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile); var cwd = string.IsNullOrEmpty(workdir) ? home : workdir; + var terminal = OS.ShellOrTerminal; var startInfo = new ProcessStartInfo(); startInfo.WorkingDirectory = cwd; - startInfo.FileName = OS.ShellOrTerminal; + startInfo.FileName = terminal; - if (OS.ShellOrTerminal.EndsWith("wezterm", StringComparison.OrdinalIgnoreCase)) + if (terminal.EndsWith("wezterm", StringComparison.OrdinalIgnoreCase)) startInfo.Arguments = $"start --cwd \"{cwd}\""; + else if (terminal.EndsWith("ptyxis", StringComparison.OrdinalIgnoreCase)) + startInfo.Arguments = $"--working-directory=\"{cwd}\""; try { From a7e254cac658ec288de30b490a1eaabbc4a3aa83 Mon Sep 17 00:00:00 2001 From: leo Date: Wed, 26 Feb 2025 09:50:54 +0800 Subject: [PATCH 15/15] fix: multiple bindings for `IsVisible` property of Button Signed-off-by: leo --- src/Views/DiffView.axaml | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/Views/DiffView.axaml b/src/Views/DiffView.axaml index fccb949d..3644f8fc 100644 --- a/src/Views/DiffView.axaml +++ b/src/Views/DiffView.axaml @@ -37,7 +37,6 @@