diff --git a/src/Resources/Locales/de_DE.axaml b/src/Resources/Locales/de_DE.axaml index 52684679..03355e01 100644 --- a/src/Resources/Locales/de_DE.axaml +++ b/src/Resources/Locales/de_DE.axaml @@ -392,7 +392,6 @@ Commit-Historie Zuletzt geöffnete Tabs beim Starten wiederherstellen Längenvorgabe für Commit-Nachrichten - Sichtbare Vergleichskontextzeilen GIT Remotes automatisch fetchen Auto-Fetch Intervall diff --git a/src/Resources/Locales/en_US.axaml b/src/Resources/Locales/en_US.axaml index 0f275deb..afdc191a 100644 --- a/src/Resources/Locales/en_US.axaml +++ b/src/Resources/Locales/en_US.axaml @@ -391,7 +391,6 @@ History Commits Restore last opened tab(s) on startup Subject Guide Length - Visible Diff Context Lines GIT Fetch remotes automatically Auto Fetch Interval diff --git a/src/Resources/Locales/fr_FR.axaml b/src/Resources/Locales/fr_FR.axaml index da00d216..6cb21693 100644 --- a/src/Resources/Locales/fr_FR.axaml +++ b/src/Resources/Locales/fr_FR.axaml @@ -395,7 +395,6 @@ Historique de commits Restaurer les onglets au démarrage Guide de longueur du sujet - Lignes de contexte visibles (Diff) GIT Fetch les dépôts distants automatiquement Intervalle de fetch auto diff --git a/src/Resources/Locales/pt_BR.axaml b/src/Resources/Locales/pt_BR.axaml index e725dc5a..0b42e4e9 100644 --- a/src/Resources/Locales/pt_BR.axaml +++ b/src/Resources/Locales/pt_BR.axaml @@ -389,7 +389,6 @@ Commits do Histórico Restaurar as últimas abas abertas na inicialização Comprimento do Guia de Assunto - Linhas de Contexto de Diferença Visíveis GIT Buscar remotos automaticamente Intervalo de Busca Automática diff --git a/src/Resources/Locales/zh_CN.axaml b/src/Resources/Locales/zh_CN.axaml index 16f0df3d..e86b8e52 100644 --- a/src/Resources/Locales/zh_CN.axaml +++ b/src/Resources/Locales/zh_CN.axaml @@ -394,7 +394,6 @@ 最大历史提交数 启动时恢复上次打开的仓库 SUBJECT字数检测 - DIFF上下文行数 GIT配置 启用定时自动拉取远程更新 自动拉取间隔 diff --git a/src/Resources/Locales/zh_TW.axaml b/src/Resources/Locales/zh_TW.axaml index 193c25c4..7fe6610e 100644 --- a/src/Resources/Locales/zh_TW.axaml +++ b/src/Resources/Locales/zh_TW.axaml @@ -394,7 +394,6 @@ 最大歷史提交數 啟動時恢復上次開啟的倉庫 SUBJECT字數檢測 - DIFF上下文行數 GIT配置 啟用定時自動拉取遠端更新 自動拉取間隔 diff --git a/src/ViewModels/DiffContext.cs b/src/ViewModels/DiffContext.cs index d15b21a8..c6b0e871 100644 --- a/src/ViewModels/DiffContext.cs +++ b/src/ViewModels/DiffContext.cs @@ -41,6 +41,12 @@ namespace SourceGit.ViewModels private set => SetProperty(ref _content, value); } + public int UnifiedLines + { + get => _unifiedLines; + private set => SetProperty(ref _unifiedLines, value); + } + public DiffContext(string repo, Models.DiffOption option, DiffContext previous = null) { _repo = repo; @@ -50,6 +56,7 @@ namespace SourceGit.ViewModels { _isTextDiff = previous._isTextDiff; _content = previous._content; + _unifiedLines = previous._unifiedLines; } if (string.IsNullOrEmpty(_option.OrgPath) || _option.OrgPath == "/dev/null") @@ -62,20 +69,14 @@ namespace SourceGit.ViewModels public void IncrUnified() { - var pref = Preference.Instance; - pref.DiffViewVisualLineNumbers = pref.DiffViewVisualLineNumbers + 1; + UnifiedLines = _unifiedLines + 1; LoadDiffContent(); } public void DecrUnified() { - var pref = Preference.Instance; - var unified = pref.DiffViewVisualLineNumbers - 1; - if (pref.DiffViewVisualLineNumbers != unified) - { - pref.DiffViewVisualLineNumbers = unified; - LoadDiffContent(); - } + UnifiedLines = Math.Max(4, _unifiedLines - 1); + LoadDiffContent(); } public void OpenExternalMergeTool() @@ -95,10 +96,9 @@ namespace SourceGit.ViewModels return; } - var unified = Preference.Instance.DiffViewVisualLineNumbers; Task.Run(() => { - var latest = new Commands.Diff(_repo, _option, unified).Result(); + var latest = new Commands.Diff(_repo, _option, _unifiedLines).Result(); var rs = null as object; if (latest.TextDiff != null) @@ -233,6 +233,7 @@ namespace SourceGit.ViewModels private readonly Models.DiffOption _option = null; private string _title; private string _fileModeChange = string.Empty; + private int _unifiedLines = 4; private bool _isLoading = true; private bool _isTextDiff = false; private object _content = null; diff --git a/src/ViewModels/Preference.cs b/src/ViewModels/Preference.cs index 63d6fcb1..ed3c0724 100644 --- a/src/ViewModels/Preference.cs +++ b/src/ViewModels/Preference.cs @@ -199,12 +199,6 @@ namespace SourceGit.ViewModels set => SetProperty(ref _showHiddenSymbolsInDiffView, value); } - public int DiffViewVisualLineNumbers - { - get => _diffViewVisualLineNumbers; - set => SetProperty(ref _diffViewVisualLineNumbers, value); - } - public Models.ChangeViewMode UnstagedChangeViewMode { get => _unstagedChangeViewMode; @@ -498,7 +492,6 @@ namespace SourceGit.ViewModels private bool _useSyntaxHighlighting = false; private bool _enableDiffViewWordWrap = false; private bool _showHiddenSymbolsInDiffView = false; - private int _diffViewVisualLineNumbers = 4; private Models.ChangeViewMode _unstagedChangeViewMode = Models.ChangeViewMode.List; private Models.ChangeViewMode _stagedChangeViewMode = Models.ChangeViewMode.List; diff --git a/src/Views/CommitMessagePresenter.cs b/src/Views/CommitMessagePresenter.cs index f8aedf5b..bf19ecc7 100644 --- a/src/Views/CommitMessagePresenter.cs +++ b/src/Views/CommitMessagePresenter.cs @@ -42,7 +42,7 @@ namespace SourceGit.Views if (change.Property == MessageProperty || change.Property == IssueTrackerRulesProperty) { - Inlines.Clear(); + Inlines!.Clear(); _matches = null; ClearHoveredIssueLink(); diff --git a/src/Views/DiffView.axaml b/src/Views/DiffView.axaml index 9e927205..07ed7a77 100644 --- a/src/Views/DiffView.axaml +++ b/src/Views/DiffView.axaml @@ -47,7 +47,7 @@ Command="{Binding DecrUnified}" IsVisible="{Binding IsTextDiff}" ToolTip.Tip="{DynamicResource Text.Diff.VisualLines.Decr}" - IsEnabled="{Binding Source={x:Static vm:Preference.Instance}, Path=DiffViewVisualLineNumbers, Converter={x:Static c:IntConverters.IsGreaterThanFour}}"> + IsEnabled="{Binding UnifiedLines, Converter={x:Static c:IntConverters.IsGreaterThanFour}}"> diff --git a/src/Views/Histories.axaml.cs b/src/Views/Histories.axaml.cs index 8ad7256a..a0828459 100644 --- a/src/Views/Histories.axaml.cs +++ b/src/Views/Histories.axaml.cs @@ -184,7 +184,7 @@ namespace SourceGit.Views if (change.Property == SubjectProperty || change.Property == IssueTrackerRulesProperty) { - Inlines.Clear(); + Inlines!.Clear(); _matches = null; ClearHoveredIssueLink(); diff --git a/src/Views/Preference.axaml b/src/Views/Preference.axaml index 7576ab4e..e13fd7cd 100644 --- a/src/Views/Preference.axaml +++ b/src/Views/Preference.axaml @@ -2,7 +2,6 @@ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" - xmlns:sys="clr-namespace:System;assembly=mscorlib" xmlns:m="using:SourceGit.Models" xmlns:c="using:SourceGit.Converters" xmlns:vm="using:SourceGit.ViewModels" @@ -57,7 +56,7 @@ - + - - - - - - + - -