diff --git a/src/Resources/Icons.axaml b/src/Resources/Icons.axaml index a0d5feb6..bcaaf15b 100644 --- a/src/Resources/Icons.axaml +++ b/src/Resources/Icons.axaml @@ -101,4 +101,5 @@ M832 464h-68V240a128 128 0 00-128-128h-248a128 128 0 00-128 128v224H192c-18 0-32 14-32 32v384c0 18 14 32 32 32h640c18 0 32-14 32-32v-384c0-18-14-32-32-32zm-292 237v53a8 8 0 01-8 8h-40a8 8 0 01-8-8v-53a48 48 0 1156 0zm152-237H332V240a56 56 0 0156-56h248a56 56 0 0156 56v224z M832 464H332V240c0-31 25-56 56-56h248c31 0 56 25 56 56v68c0 4 4 8 8 8h56c4 0 8-4 8-8v-68c0-71-57-128-128-128H388c-71 0-128 57-128 128v224h-68c-18 0-32 14-32 32v384c0 18 14 32 32 32h640c18 0 32-14 32-32V496c0-18-14-32-32-32zM540 701v53c0 4-4 8-8 8h-40c-4 0-8-4-8-8v-53c-12-9-20-23-20-39 0-27 22-48 48-48s48 22 48 48c0 16-8 30-20 39z 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 + m 319.21875,-801.79687 c -62.76888,0 -119.97164,17.53932 -171.5625,52.57812 -51.590859,35.0388 -88.971614,81.95982 -112.1875,140.85938 23.215886,58.89955 60.596641,105.89871 112.1875,140.9375 51.59086,35.03879 108.79362,52.57812 171.5625,52.57812 62.76888,0 119.97164,-17.53933 171.5625,-52.57812 51.59086,-35.03879 88.97162,-82.03795 112.1875,-140.9375 -23.21588,-58.89956 -60.59664,-105.82058 -112.1875,-140.85938 -51.59086,-35.0388 -108.79362,-52.57812 -171.5625,-52.57812 z m 0,51.5625 c 48.58139,0 93.20033,12.85703 133.82812,38.4375 40.6278,25.58047 71.70694,60.0152 93.20313,103.4375 -21.49619,43.42229 -52.57533,77.93516 -93.20313,103.51562 -40.62779,25.58047 -85.24673,38.35938 -133.82812,38.35938 -48.58139,0 -93.20033,-12.77891 -133.82812,-38.35938 -40.6278,-25.58046 -71.70694,-60.09333 -93.20313,-103.51562 21.49619,-43.4223 52.57533,-77.85703 93.20313,-103.4375 40.62779,-25.58047 85.24673,-38.4375 133.82812,-38.4375 z m 0,25.85937 c -32.24429,0 -59.6165,11.25712 -82.1875,33.82813 -22.571,22.571 -33.90625,49.94321 -33.90625,82.1875 0,32.24428 11.33525,59.69462 33.90625,82.26562 22.571,22.571 49.94321,33.82813 82.1875,33.82813 32.24429,0 59.6165,-11.25713 82.1875,-33.82813 22.571,-22.571 33.90625,-50.02134 33.90625,-82.26562 0,-32.24429 -11.33525,-59.6165 -33.90625,-82.1875 -22.571,-22.57101 -49.94321,-33.82813 -82.1875,-33.82813 z m 0,46.40625 c 19.34657,0 35.75428,6.76991 49.29688,20.3125 13.54259,13.5426 20.3125,29.9503 20.3125,49.29688 0,19.34657 -6.76991,35.8324 -20.3125,49.375 -13.5426,13.5426 -29.95031,20.3125 -49.29688,20.3125 -19.34657,0 -35.75428,-6.7699 -49.29688,-20.3125 -13.54259,-13.5426 -20.31249,-30.02843 -20.3125,-49.375 0,-19.34658 6.76991,-35.75428 20.3125,-49.29688 13.5426,-13.54259 29.95031,-20.3125 49.29688,-20.3125 z m 458.04688,93.82813 v 193.04687 H 599.53125 v -85.54687 L 440.3125,-317.42187 599.53125,-158.20312 V -243.75 h 324.6875 l 0.3125,-340.39062 z diff --git a/src/Resources/Locales/en_US.axaml b/src/Resources/Locales/en_US.axaml index a7ca7671..58f7ccb8 100644 --- a/src/Resources/Locales/en_US.axaml +++ b/src/Resources/Locales/en_US.axaml @@ -171,6 +171,7 @@ Decrease Number of Visible Lines Increase Number of Visible Lines SELECT FILE TO VIEW CHANGES + Show hidden symbols(space, tab) Open In Merge Tool Discard Changes All local changes in working copy. diff --git a/src/Resources/Locales/zh_CN.axaml b/src/Resources/Locales/zh_CN.axaml index e7f88389..10a75ee0 100644 --- a/src/Resources/Locales/zh_CN.axaml +++ b/src/Resources/Locales/zh_CN.axaml @@ -174,6 +174,7 @@ 减少可见的行数 增加可见的行数 请选择需要对比的文件 + 显示隐藏符号(空格、制表符) 使用外部比对工具查看 放弃更改确认 所有本地址未提交的修改。 diff --git a/src/Resources/Locales/zh_TW.axaml b/src/Resources/Locales/zh_TW.axaml index d8e5e336..be7cf16c 100644 --- a/src/Resources/Locales/zh_TW.axaml +++ b/src/Resources/Locales/zh_TW.axaml @@ -174,6 +174,7 @@ 減少可見的行數 增加可見的行數 請選擇需要對比的檔案 + 顯示隱藏符號(空格、製表符 使用外部比對工具檢視 放棄更改確認 所有本地址未提交的修改。 diff --git a/src/ViewModels/Preference.cs b/src/ViewModels/Preference.cs index b72fb8c4..829f268c 100644 --- a/src/ViewModels/Preference.cs +++ b/src/ViewModels/Preference.cs @@ -320,6 +320,12 @@ namespace SourceGit.ViewModels set; } = 0; + public bool ShowHiddenSymbols + { + get => _showHiddenSymbols; + set => SetProperty(ref _showHiddenSymbols, value); + } + [JsonIgnore] public bool ShouldCheck4UpdateOnStartup { @@ -535,6 +541,7 @@ namespace SourceGit.ViewModels private bool _useSideBySideDiff = false; private bool _useSyntaxHighlighting = false; private bool _enableDiffViewWordWrap = false; + private bool _showHiddenSymbols = false; private Models.ChangeViewMode _unstagedChangeViewMode = Models.ChangeViewMode.List; private Models.ChangeViewMode _stagedChangeViewMode = Models.ChangeViewMode.List; diff --git a/src/Views/DiffView.axaml b/src/Views/DiffView.axaml index 273bf6ce..db3957f5 100644 --- a/src/Views/DiffView.axaml +++ b/src/Views/DiffView.axaml @@ -34,6 +34,14 @@ + + + + diff --git a/src/Views/TextDiffView.axaml b/src/Views/TextDiffView.axaml index 538a0a6e..0726d98e 100644 --- a/src/Views/TextDiffView.axaml +++ b/src/Views/TextDiffView.axaml @@ -22,7 +22,9 @@ IndicatorForeground="{DynamicResource Brush.FG2}" FontFamily="{Binding Source={x:Static vm:Preference.Instance}, Path=MonospaceFont}" UseSyntaxHighlighting="{Binding Source={x:Static vm:Preference.Instance}, Path=UseSyntaxHighlighting}" - WordWrap="{Binding Source={x:Static vm:Preference.Instance}, Path=EnableDiffViewWordWrap}"/> + WordWrap="{Binding Source={x:Static vm:Preference.Instance}, Path=EnableDiffViewWordWrap}" + ShowHiddenSymbols="{Binding Source={x:Static vm:Preference.Instance}, Path=ShowHiddenSymbols}" + /> @@ -40,7 +42,9 @@ IndicatorForeground="{DynamicResource Brush.FG2}" FontFamily="{Binding Source={x:Static vm:Preference.Instance}, Path=MonospaceFont}" UseSyntaxHighlighting="{Binding Source={x:Static vm:Preference.Instance}, Path=UseSyntaxHighlighting}" - WordWrap="{Binding Source={x:Static vm:Preference.Instance}, Path=EnableDiffViewWordWrap}"/> + WordWrap="{Binding Source={x:Static vm:Preference.Instance}, Path=EnableDiffViewWordWrap}" + ShowHiddenSymbols="{Binding Source={x:Static vm:Preference.Instance}, Path=ShowHiddenSymbols}" + /> @@ -57,7 +61,9 @@ IndicatorForeground="{DynamicResource Brush.FG2}" FontFamily="{Binding Source={x:Static vm:Preference.Instance}, Path=MonospaceFont}" UseSyntaxHighlighting="{Binding Source={x:Static vm:Preference.Instance}, Path=UseSyntaxHighlighting}" - WordWrap="{Binding Source={x:Static vm:Preference.Instance}, Path=EnableDiffViewWordWrap}"/> + WordWrap="{Binding Source={x:Static vm:Preference.Instance}, Path=EnableDiffViewWordWrap}" + ShowHiddenSymbols="{Binding Source={x:Static vm:Preference.Instance}, Path=ShowHiddenSymbols}" + /> diff --git a/src/Views/TextDiffView.axaml.cs b/src/Views/TextDiffView.axaml.cs index 45fc7c2a..1ea10970 100644 --- a/src/Views/TextDiffView.axaml.cs +++ b/src/Views/TextDiffView.axaml.cs @@ -105,6 +105,23 @@ namespace SourceGit.Views set => SetValue(UseSyntaxHighlightingProperty, value); } + + /// + /// ShowHiddenSymbols StyledProperty definition + /// + public static readonly StyledProperty ShowHiddenSymbolsProperty = + AvaloniaProperty.Register(nameof(ShowHiddenSymbols)); + + /// + /// Gets or sets the ShowHiddenSymbols property. This StyledProperty + /// indicates thath show hidden symbol like space and tab + /// + public bool ShowHiddenSymbols + { + get => this.GetValue(ShowHiddenSymbolsProperty); + set => SetValue(ShowHiddenSymbolsProperty, value); + } + protected override Type StyleKeyOverride => typeof(TextEditor); public IThemedTextDiffPresenter(TextArea area, TextDocument doc) : base(area, doc) @@ -141,6 +158,12 @@ namespace SourceGit.Views if (change.Property == UseSyntaxHighlightingProperty) UpdateTextMate(); + else if(change.Property == ShowHiddenSymbolsProperty) + { + var showHiddenSymbols = change.NewValue is true; + this.Options.ShowTabs = showHiddenSymbols; + this.Options.ShowSpaces = showHiddenSymbols; + } else if (change.Property == FileNameProperty) Models.TextMateHelper.SetGrammarByFileName(_textMate, FileName); else if (change.Property.Name == "ActualThemeVariant" && change.NewValue != null)