diff --git a/README.md b/README.md index 382c514f..d49fb1e4 100644 --- a/README.md +++ b/README.md @@ -47,7 +47,7 @@ ## Translation Status -[![en_US](https://img.shields.io/badge/en__US-100%25-brightgreen)](TRANSLATION.md) [![de__DE](https://img.shields.io/badge/de__DE-99.57%25-yellow)](TRANSLATION.md) [![es__ES](https://img.shields.io/badge/es__ES-99.14%25-yellow)](TRANSLATION.md) [![fr__FR](https://img.shields.io/badge/fr__FR-98.42%25-yellow)](TRANSLATION.md) [![pt__BR](https://img.shields.io/badge/pt__BR-99.14%25-yellow)](TRANSLATION.md) [![ru__RU](https://img.shields.io/badge/ru__RU-100.00%25-brightgreen)](TRANSLATION.md) [![zh__CN](https://img.shields.io/badge/zh__CN-100.00%25-brightgreen)](TRANSLATION.md) [![zh__TW](https://img.shields.io/badge/zh__TW-100.00%25-brightgreen)](TRANSLATION.md) +[![en_US](https://img.shields.io/badge/en__US-100%25-brightgreen)](TRANSLATION.md) [![de__DE](https://img.shields.io/badge/de__DE-100.00%25-brightgreen)](TRANSLATION.md) [![es__ES](https://img.shields.io/badge/es__ES-99.14%25-yellow)](TRANSLATION.md) [![fr__FR](https://img.shields.io/badge/fr__FR-98.42%25-yellow)](TRANSLATION.md) [![pt__BR](https://img.shields.io/badge/pt__BR-99.14%25-yellow)](TRANSLATION.md) [![ru__RU](https://img.shields.io/badge/ru__RU-100.00%25-brightgreen)](TRANSLATION.md) [![zh__CN](https://img.shields.io/badge/zh__CN-100.00%25-brightgreen)](TRANSLATION.md) [![zh__TW](https://img.shields.io/badge/zh__TW-100.00%25-brightgreen)](TRANSLATION.md) ## How to Use diff --git a/TRANSLATION.md b/TRANSLATION.md index ccfc4df7..5967d21e 100644 --- a/TRANSLATION.md +++ b/TRANSLATION.md @@ -1,12 +1,10 @@ -### de_DE.axaml: 99.57% +### de_DE.axaml: 100.00%
Missing Keys -- Text.Repository.FilterCommits.Default -- Text.Repository.FilterCommits.Exclude -- Text.Repository.FilterCommits.Include +
diff --git a/src/Resources/Locales/de_DE.axaml b/src/Resources/Locales/de_DE.axaml index 68310dee..200d3638 100644 --- a/src/Resources/Locales/de_DE.axaml +++ b/src/Resources/Locales/de_DE.axaml @@ -58,7 +58,7 @@ Lösche alle ausgewählten {0} Branches Alle Änderungen verwerfen Fast-Forward zu ${0}$ - Fetche ${0}$ nach ${1}$... + Fetche ${0}$ in ${1}$ hinein... Git Flow - Abschließen ${0}$ Merge ${0}$ in ${1}$ hinein... Pull ${0}$ @@ -162,8 +162,8 @@ TICKETSYSTEM Beispiel für Github-Regel hinzufügen Beispiel für Jira-Regel hinzufügen - Beispiel für eine Gitlab Issue Regel einfügen - Beispiel für einen Gitlab Merge Request einfügen + Beispiel für Gitlab Issue Regel einfügen + Beispiel für Gitlab Merge Request einfügen Neue Regel Ticketnummer Regex-Ausdruck: Name: @@ -171,7 +171,7 @@ Verwende bitte $1, $2 um auf Regex-Gruppenwerte zuzugreifen. OPEN AI Bevorzugter Service: - Wenn der 'Bevorzugte Service' aktiviert ist, wird SourceGit nur dieses Repository nutzen. Ansonsten wird, wenn mehrere Services verfügbar sind, eine Kontextmenü zur Auswahl angezeigt. + Der ausgewählte 'Bevorzugte Service' wird nur in diesem Repository gesetzt und verwendet. Wenn keiner gesetzt ist und mehrere Servies verfügbar sind wird ein Kontextmenü zur Auswahl angezeigt. HTTP Proxy HTTP Proxy für dieses Repository Benutzername @@ -265,7 +265,7 @@ Ziel: Ausgewählte Gruppe bearbeiten Ausgewähltes Repository bearbeiten - Führe benutzerte Aktion aus + Führe benutzerdefinierte Aktion aus Name der Aktion: Fast-Forward (ohne Auschecken) Fetch @@ -535,7 +535,7 @@ Änderungen automatisch von Remote fetchen... Aufräumen (GC & Prune) Führt `git gc` auf diesem Repository aus. - Alles löschen + Filter aufheben Repository Einstellungen WEITER Benutzerdefinierte Aktionen @@ -543,6 +543,9 @@ Aktiviere '--reflog' Option Öffne im Datei-Browser Suche Branches/Tags/Submodule + Aufheben + Im Graph ausblenden + Im Graph filtern LOKALE BRANCHES Zum HEAD wechseln Aktiviere '--first-parent' Option @@ -601,7 +604,7 @@ START Stash Inklusive nicht-verfolgter Dateien - Behalte Dateien des Stages + Behalte gestagte Dateien Name: Optional. Name dieses Stashes Nur gestagte Änderungen diff --git a/src/ViewModels/CommitDetail.cs b/src/ViewModels/CommitDetail.cs index ef060f04..7ef8ce85 100644 --- a/src/ViewModels/CommitDetail.cs +++ b/src/ViewModels/CommitDetail.cs @@ -293,7 +293,7 @@ namespace SourceGit.ViewModels history.Icon = App.CreateMenuIcon("Icons.Histories"); history.Click += (_, ev) => { - var window = new Views.FileHistories() { DataContext = new FileHistories(_repo, change.Path) }; + var window = new Views.FileHistories() { DataContext = new FileHistories(_repo, change.Path, _commit.SHA) }; window.Show(); ev.Handled = true; }; @@ -434,7 +434,7 @@ namespace SourceGit.ViewModels history.Icon = App.CreateMenuIcon("Icons.Histories"); history.Click += (_, ev) => { - var window = new Views.FileHistories() { DataContext = new FileHistories(_repo, file.Path) }; + var window = new Views.FileHistories() { DataContext = new FileHistories(_repo, file.Path, _commit.SHA) }; window.Show(); ev.Handled = true; }; diff --git a/src/ViewModels/FileHistories.cs b/src/ViewModels/FileHistories.cs index 035cadfd..52ed6b01 100644 --- a/src/ViewModels/FileHistories.cs +++ b/src/ViewModels/FileHistories.cs @@ -57,14 +57,14 @@ namespace SourceGit.ViewModels private set => SetProperty(ref _viewContent, value); } - public FileHistories(Repository repo, string file) + public FileHistories(Repository repo, string file, string commit = null) { _repo = repo; _file = file; Task.Run(() => { - var commits = new Commands.QueryCommits(_repo.FullPath, $"-n 10000 -- \"{file}\"", false).Result(); + var commits = new Commands.QueryCommits(_repo.FullPath, $"-n 10000 {commit} -- \"{file}\"", false).Result(); Dispatcher.UIThread.Invoke(() => { IsLoading = false; diff --git a/src/Views/CommitRefsPresenter.cs b/src/Views/CommitRefsPresenter.cs index fc3233a5..e8a66da0 100644 --- a/src/Views/CommitRefsPresenter.cs +++ b/src/Views/CommitRefsPresenter.cs @@ -38,7 +38,7 @@ namespace SourceGit.Views } public static readonly StyledProperty BackgroundProperty = - AvaloniaProperty.Register(nameof(Background), null); + AvaloniaProperty.Register(nameof(Background), Brushes.Transparent); public IBrush Background { @@ -56,7 +56,7 @@ namespace SourceGit.Views } public static readonly StyledProperty UseGraphColorProperty = - AvaloniaProperty.Register(nameof(UseGraphColor), false); + AvaloniaProperty.Register(nameof(UseGraphColor)); public bool UseGraphColor { @@ -96,7 +96,6 @@ namespace SourceGit.Views var x = 1.0; foreach (var item in _items) { - var iconRect = new RoundedRect(new Rect(x, 0, 16, 16), new CornerRadius(2, 0, 0, 2)); var entireRect = new RoundedRect(new Rect(x, 0, item.Width, 16), new CornerRadius(2)); if (item.IsHead) diff --git a/src/Views/TextDiffView.axaml b/src/Views/TextDiffView.axaml index 52b0d084..f0e3976a 100644 --- a/src/Views/TextDiffView.axaml +++ b/src/Views/TextDiffView.axaml @@ -13,28 +13,40 @@ - + + + + + + + - + + + + + diff --git a/src/Views/TextDiffView.axaml.cs b/src/Views/TextDiffView.axaml.cs index 79045751..b74347ce 100644 --- a/src/Views/TextDiffView.axaml.cs +++ b/src/Views/TextDiffView.axaml.cs @@ -46,6 +46,18 @@ namespace SourceGit.Views } } + public record TextDiffViewRange + { + public int StartIdx { get; set; } = 0; + public int EndIdx { get; set; } = 0; + + public TextDiffViewRange(int startIdx, int endIdx) + { + StartIdx = startIdx; + EndIdx = endIdx; + } + } + public class ThemedTextDiffPresenter : TextEditor { public class VerticalSeperatorMargin : AbstractMargin @@ -211,7 +223,6 @@ namespace SourceGit.Views if (presenter == null) return new Size(0, 0); - var maxLineNumber = presenter.GetMaxLineNumber(); var typeface = TextView.CreateTypeface(); var test = new FormattedText( $"-", @@ -482,6 +493,15 @@ namespace SourceGit.Views get => GetValue(SelectedChunkProperty); set => SetValue(SelectedChunkProperty, value); } + + public static readonly StyledProperty DisplayRangeProperty = + AvaloniaProperty.Register(nameof(DisplayRange), new TextDiffViewRange(0, 0)); + + public TextDiffViewRange DisplayRange + { + get => GetValue(DisplayRangeProperty); + set => SetValue(DisplayRangeProperty, value); + } public static readonly StyledProperty CurrentChangeBlockIdxProperty = AvaloniaProperty.Register(nameof(CurrentChangeBlockIdx)); @@ -526,25 +546,11 @@ namespace SourceGit.Views public void GotoPrevChange() { - var view = TextArea.TextView; - var lines = GetLines(); - var firstLineIdx = lines.Count; - foreach (var line in view.VisualLines) - { - if (line.IsDisposed || line.FirstDocumentLine == null || line.FirstDocumentLine.IsDeleted) - continue; - - var index = line.FirstDocumentLine.LineNumber - 1; - if (index >= lines.Count) - continue; - - if (firstLineIdx > index) - firstLineIdx = index; - } - + var firstLineIdx = DisplayRange.StartIdx; if (firstLineIdx <= 1) return; - + + var lines = GetLines(); var firstLineType = lines[firstLineIdx].Type; var prevLineType = lines[firstLineIdx - 1].Type; var isChangeFirstLine = firstLineType != Models.TextDiffLineType.Normal && firstLineType != Models.TextDiffLineType.Indicator; @@ -583,22 +589,8 @@ namespace SourceGit.Views public void GotoNextChange() { - var view = TextArea.TextView; var lines = GetLines(); - var lastLineIdx = -1; - foreach (var line in view.VisualLines) - { - if (line.IsDisposed || line.FirstDocumentLine == null || line.FirstDocumentLine.IsDeleted) - continue; - - var index = line.FirstDocumentLine.LineNumber - 1; - if (index >= lines.Count) - continue; - - if (lastLineIdx < index) - lastLineIdx = index; - } - + var lastLineIdx = DisplayRange.EndIdx; if (lastLineIdx >= lines.Count - 1) return; @@ -671,6 +663,7 @@ namespace SourceGit.Views TextArea.TextView.PointerEntered += OnTextViewPointerChanged; TextArea.TextView.PointerMoved += OnTextViewPointerChanged; TextArea.TextView.PointerWheelChanged += OnTextViewPointerWheelChanged; + TextArea.TextView.VisualLinesChanged += OnTextViewVisualLinesChanged; UpdateTextMate(); } @@ -683,6 +676,7 @@ namespace SourceGit.Views TextArea.TextView.PointerEntered -= OnTextViewPointerChanged; TextArea.TextView.PointerMoved -= OnTextViewPointerChanged; TextArea.TextView.PointerWheelChanged -= OnTextViewPointerWheelChanged; + TextArea.TextView.VisualLinesChanged -= OnTextViewVisualLinesChanged; if (_textMate != null) { @@ -790,6 +784,34 @@ namespace SourceGit.Views } } + private void OnTextViewVisualLinesChanged(object sender, EventArgs e) + { + if (!TextArea.TextView.VisualLinesValid) + { + SetCurrentValue(DisplayRangeProperty, new TextDiffViewRange(0, 0)); + return; + } + + var lines = GetLines(); + var start = int.MaxValue; + var count = 0; + foreach (var line in TextArea.TextView.VisualLines) + { + if (line.IsDisposed || line.FirstDocumentLine == null || line.FirstDocumentLine.IsDeleted) + continue; + + var index = line.FirstDocumentLine.LineNumber - 1; + if (index >= lines.Count) + continue; + + count++; + if (start > index) + start = index; + } + + SetCurrentValue(DisplayRangeProperty, new TextDiffViewRange(start, start + count)); + } + protected void TrySetChunk(TextDiffViewChunk chunk) { var old = SelectedChunk; @@ -1107,12 +1129,8 @@ namespace SourceGit.Views private void OnTextViewScrollGotFocus(object sender, GotFocusEventArgs e) { - if (EnableChunkSelection && sender is ScrollViewer viewer) - { - var area = viewer.FindDescendantOfType