diff --git a/src/Resources/Locales/en_US.axaml b/src/Resources/Locales/en_US.axaml index 794ecab6..e723a250 100644 --- a/src/Resources/Locales/en_US.axaml +++ b/src/Resources/Locales/en_US.axaml @@ -559,6 +559,7 @@ Show children in the commit details Show tags in commit graph Subject Guide Length + Update current block while scrolling in diff view (Block-Navigation) GIT Enable Auto CRLF Default Clone Dir diff --git a/src/Resources/Locales/zh_CN.axaml b/src/Resources/Locales/zh_CN.axaml index 0f2fe026..adb7bd93 100644 --- a/src/Resources/Locales/zh_CN.axaml +++ b/src/Resources/Locales/zh_CN.axaml @@ -563,6 +563,7 @@ 在提交详情页中显示子提交列表 在提交路线图中显示标签 SUBJECT字数检测 + 启用基于变更块的跳转后,在变更对比页面滚动时更新当前高亮块 GIT配置 自动换行转换 默认克隆路径 diff --git a/src/Resources/Locales/zh_TW.axaml b/src/Resources/Locales/zh_TW.axaml index 068a2fdb..31e115f5 100644 --- a/src/Resources/Locales/zh_TW.axaml +++ b/src/Resources/Locales/zh_TW.axaml @@ -563,6 +563,7 @@ 在提交詳細資訊中顯示後續提交 在路線圖中顯示標籤 提交標題字數偵測 + 啟用「區塊切換變更」時,在變更對比檢視中捲動時更新目前反白的區塊 Git 設定 自動換行轉換 預設複製 (clone) 路徑 diff --git a/src/ViewModels/BlockNavigation.cs b/src/ViewModels/BlockNavigation.cs index bf5e2314..4b150ee8 100644 --- a/src/ViewModels/BlockNavigation.cs +++ b/src/ViewModels/BlockNavigation.cs @@ -93,7 +93,7 @@ namespace SourceGit.ViewModels if (_current >= 0 && _current < Blocks.Count) return Blocks[_current]; - return Blocks.Count > 0 ? Blocks[0] : null; + return null; } public Block GotoFirst() @@ -142,7 +142,7 @@ namespace SourceGit.ViewModels return Blocks[_current]; } - public void AutoUpdate(int start, int end) + public bool AutoUpdate(int start, int end) { if (_current >= 0 && _current < Blocks.Count) { @@ -150,7 +150,7 @@ namespace SourceGit.ViewModels if ((block.Start >= start && block.Start <= end) || (block.End >= start && block.End <= end) || (block.Start <= start && block.End >= end)) - return; + return false; } for (var i = 0; i < Blocks.Count; i++) @@ -162,9 +162,11 @@ namespace SourceGit.ViewModels { Current = i; OnPropertyChanged(nameof(Indicator)); - return; + return true; } } + + return false; } private int _current = -1; diff --git a/src/ViewModels/Preferences.cs b/src/ViewModels/Preferences.cs index c2335910..aaa7863d 100644 --- a/src/ViewModels/Preferences.cs +++ b/src/ViewModels/Preferences.cs @@ -261,6 +261,12 @@ namespace SourceGit.ViewModels set => SetProperty(ref _useBlockNavigationInDiffView, value); } + public bool UpdateBlockNavigationOnScroll + { + get => _updateBlockNavigationOnScroll; + set => SetProperty(ref _updateBlockNavigationOnScroll, value); + } + public int LFSImageActiveIdx { get => _lfsImageActiveIdx; @@ -723,6 +729,7 @@ namespace SourceGit.ViewModels private bool _showHiddenSymbolsInDiffView = false; private bool _useFullTextDiff = false; private bool _useBlockNavigationInDiffView = false; + private bool _updateBlockNavigationOnScroll = true; private int _lfsImageActiveIdx = 0; private bool _enableCompactFoldersInChangesTree = false; diff --git a/src/Views/Preferences.axaml b/src/Views/Preferences.axaml index cdb0940a..ae7270ff 100644 --- a/src/Views/Preferences.axaml +++ b/src/Views/Preferences.axaml @@ -46,7 +46,7 @@ - + + +