mirror of
https://github.com/sourcegit-scm/sourcegit
synced 2025-05-21 12:15:00 +00:00
enhance: allow to configure editor tab width in preferences window (#1048)
Signed-off-by: leo <longshuang@msn.cn>
This commit is contained in:
parent
11af5d9b29
commit
2137ad9ec9
11 changed files with 98 additions and 19 deletions
|
@ -464,6 +464,7 @@
|
||||||
<x:String x:Key="Text.Preferences.AI.Streaming" xml:space="preserve">Enable Streaming</x:String>
|
<x:String x:Key="Text.Preferences.AI.Streaming" xml:space="preserve">Enable Streaming</x:String>
|
||||||
<x:String x:Key="Text.Preferences.Appearance" xml:space="preserve">APPEARANCE</x:String>
|
<x:String x:Key="Text.Preferences.Appearance" xml:space="preserve">APPEARANCE</x:String>
|
||||||
<x:String x:Key="Text.Preferences.Appearance.DefaultFont" xml:space="preserve">Default Font</x:String>
|
<x:String x:Key="Text.Preferences.Appearance.DefaultFont" xml:space="preserve">Default Font</x:String>
|
||||||
|
<x:String x:Key="Text.Preferences.Appearance.EditorTabWidth" xml:space="preserve">Editor Tab Width</x:String>
|
||||||
<x:String x:Key="Text.Preferences.Appearance.FontSize" xml:space="preserve">Font Size</x:String>
|
<x:String x:Key="Text.Preferences.Appearance.FontSize" xml:space="preserve">Font Size</x:String>
|
||||||
<x:String x:Key="Text.Preferences.Appearance.FontSize.Default" xml:space="preserve">Default</x:String>
|
<x:String x:Key="Text.Preferences.Appearance.FontSize.Default" xml:space="preserve">Default</x:String>
|
||||||
<x:String x:Key="Text.Preferences.Appearance.FontSize.Editor" xml:space="preserve">Editor</x:String>
|
<x:String x:Key="Text.Preferences.Appearance.FontSize.Editor" xml:space="preserve">Editor</x:String>
|
||||||
|
|
|
@ -467,6 +467,7 @@
|
||||||
<x:String x:Key="Text.Preferences.AI.Streaming" xml:space="preserve">启用流式输出</x:String>
|
<x:String x:Key="Text.Preferences.AI.Streaming" xml:space="preserve">启用流式输出</x:String>
|
||||||
<x:String x:Key="Text.Preferences.Appearance" xml:space="preserve">外观配置</x:String>
|
<x:String x:Key="Text.Preferences.Appearance" xml:space="preserve">外观配置</x:String>
|
||||||
<x:String x:Key="Text.Preferences.Appearance.DefaultFont" xml:space="preserve">缺省字体</x:String>
|
<x:String x:Key="Text.Preferences.Appearance.DefaultFont" xml:space="preserve">缺省字体</x:String>
|
||||||
|
<x:String x:Key="Text.Preferences.Appearance.EditorTabWidth" xml:space="preserve">编辑器制表符宽度</x:String>
|
||||||
<x:String x:Key="Text.Preferences.Appearance.FontSize" xml:space="preserve">字体大小</x:String>
|
<x:String x:Key="Text.Preferences.Appearance.FontSize" xml:space="preserve">字体大小</x:String>
|
||||||
<x:String x:Key="Text.Preferences.Appearance.FontSize.Default" xml:space="preserve">默认</x:String>
|
<x:String x:Key="Text.Preferences.Appearance.FontSize.Default" xml:space="preserve">默认</x:String>
|
||||||
<x:String x:Key="Text.Preferences.Appearance.FontSize.Editor" xml:space="preserve">代码编辑器</x:String>
|
<x:String x:Key="Text.Preferences.Appearance.FontSize.Editor" xml:space="preserve">代码编辑器</x:String>
|
||||||
|
|
|
@ -467,6 +467,7 @@
|
||||||
<x:String x:Key="Text.Preferences.AI.Streaming" xml:space="preserve">啟用串流輸出</x:String>
|
<x:String x:Key="Text.Preferences.AI.Streaming" xml:space="preserve">啟用串流輸出</x:String>
|
||||||
<x:String x:Key="Text.Preferences.Appearance" xml:space="preserve">外觀設定</x:String>
|
<x:String x:Key="Text.Preferences.Appearance" xml:space="preserve">外觀設定</x:String>
|
||||||
<x:String x:Key="Text.Preferences.Appearance.DefaultFont" xml:space="preserve">預設字型</x:String>
|
<x:String x:Key="Text.Preferences.Appearance.DefaultFont" xml:space="preserve">預設字型</x:String>
|
||||||
|
<x:String x:Key="Text.Preferences.Appearance.EditorTabWidth" xml:space="preserve">編輯器制表符寬度</x:String>
|
||||||
<x:String x:Key="Text.Preferences.Appearance.FontSize" xml:space="preserve">字型大小</x:String>
|
<x:String x:Key="Text.Preferences.Appearance.FontSize" xml:space="preserve">字型大小</x:String>
|
||||||
<x:String x:Key="Text.Preferences.Appearance.FontSize.Default" xml:space="preserve">預設</x:String>
|
<x:String x:Key="Text.Preferences.Appearance.FontSize.Default" xml:space="preserve">預設</x:String>
|
||||||
<x:String x:Key="Text.Preferences.Appearance.FontSize.Editor" xml:space="preserve">程式碼</x:String>
|
<x:String x:Key="Text.Preferences.Appearance.FontSize.Editor" xml:space="preserve">程式碼</x:String>
|
||||||
|
|
|
@ -111,6 +111,12 @@ namespace SourceGit.ViewModels
|
||||||
set => SetProperty(ref _editorFontSize, value);
|
set => SetProperty(ref _editorFontSize, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int EditorTabWidth
|
||||||
|
{
|
||||||
|
get => _editorTabWidth;
|
||||||
|
set => SetProperty(ref _editorTabWidth, value);
|
||||||
|
}
|
||||||
|
|
||||||
public LayoutInfo Layout
|
public LayoutInfo Layout
|
||||||
{
|
{
|
||||||
get => _layout;
|
get => _layout;
|
||||||
|
@ -649,6 +655,7 @@ namespace SourceGit.ViewModels
|
||||||
private bool _useSystemWindowFrame = false;
|
private bool _useSystemWindowFrame = false;
|
||||||
private double _defaultFontSize = 13;
|
private double _defaultFontSize = 13;
|
||||||
private double _editorFontSize = 13;
|
private double _editorFontSize = 13;
|
||||||
|
private int _editorTabWidth = 4;
|
||||||
private LayoutInfo _layout = new LayoutInfo();
|
private LayoutInfo _layout = new LayoutInfo();
|
||||||
|
|
||||||
private int _maxHistoryCommits = 20000;
|
private int _maxHistoryCommits = 20000;
|
||||||
|
|
|
@ -58,6 +58,7 @@
|
||||||
Foreground="{DynamicResource Brush.FG1}"
|
Foreground="{DynamicResource Brush.FG1}"
|
||||||
FontFamily="{DynamicResource Fonts.Monospace}"
|
FontFamily="{DynamicResource Fonts.Monospace}"
|
||||||
FontSize="{Binding Source={x:Static vm:Preferences.Instance}, Path=EditorFontSize}"
|
FontSize="{Binding Source={x:Static vm:Preferences.Instance}, Path=EditorFontSize}"
|
||||||
|
TabWidth="{Binding Source={x:Static vm:Preferences.Instance}, Path=EditorTabWidth}"
|
||||||
BlameData="{Binding Data}"/>
|
BlameData="{Binding Data}"/>
|
||||||
|
|
||||||
<!-- Not supported mask (for binary files) -->
|
<!-- Not supported mask (for binary files) -->
|
||||||
|
|
|
@ -260,6 +260,15 @@ namespace SourceGit.Views
|
||||||
set => SetValue(BlameDataProperty, value);
|
set => SetValue(BlameDataProperty, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static readonly StyledProperty<int> TabWidthProperty =
|
||||||
|
AvaloniaProperty.Register<BlameTextEditor, int>(nameof(TabWidth), 4);
|
||||||
|
|
||||||
|
public int TabWidth
|
||||||
|
{
|
||||||
|
get => GetValue(TabWidthProperty);
|
||||||
|
set => SetValue(TabWidthProperty, value);
|
||||||
|
}
|
||||||
|
|
||||||
protected override Type StyleKeyOverride => typeof(TextEditor);
|
protected override Type StyleKeyOverride => typeof(TextEditor);
|
||||||
|
|
||||||
public BlameTextEditor() : base(new TextArea(), new TextDocument())
|
public BlameTextEditor() : base(new TextArea(), new TextDocument())
|
||||||
|
@ -268,6 +277,10 @@ namespace SourceGit.Views
|
||||||
ShowLineNumbers = false;
|
ShowLineNumbers = false;
|
||||||
WordWrap = false;
|
WordWrap = false;
|
||||||
|
|
||||||
|
Options.IndentationSize = TabWidth;
|
||||||
|
Options.EnableHyperlinks = false;
|
||||||
|
Options.EnableEmailHyperlinks = false;
|
||||||
|
|
||||||
_textMate = Models.TextMateHelper.CreateForEditor(this);
|
_textMate = Models.TextMateHelper.CreateForEditor(this);
|
||||||
|
|
||||||
TextArea.LeftMargins.Add(new LineNumberMargin() { Margin = new Thickness(8, 0) });
|
TextArea.LeftMargins.Add(new LineNumberMargin() { Margin = new Thickness(8, 0) });
|
||||||
|
@ -280,8 +293,6 @@ namespace SourceGit.Views
|
||||||
TextArea.TextView.ContextRequested += OnTextViewContextRequested;
|
TextArea.TextView.ContextRequested += OnTextViewContextRequested;
|
||||||
TextArea.TextView.VisualLinesChanged += OnTextViewVisualLinesChanged;
|
TextArea.TextView.VisualLinesChanged += OnTextViewVisualLinesChanged;
|
||||||
TextArea.TextView.Margin = new Thickness(4, 0);
|
TextArea.TextView.Margin = new Thickness(4, 0);
|
||||||
TextArea.TextView.Options.EnableHyperlinks = false;
|
|
||||||
TextArea.TextView.Options.EnableEmailHyperlinks = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Render(DrawingContext context)
|
public override void Render(DrawingContext context)
|
||||||
|
@ -350,6 +361,10 @@ namespace SourceGit.Views
|
||||||
Text = string.Empty;
|
Text = string.Empty;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (change.Property == TabWidthProperty)
|
||||||
|
{
|
||||||
|
Options.IndentationSize = TabWidth;
|
||||||
|
}
|
||||||
else if (change.Property.Name == "ActualThemeVariant" && change.NewValue != null)
|
else if (change.Property.Name == "ActualThemeVariant" && change.NewValue != null)
|
||||||
{
|
{
|
||||||
Models.TextMateHelper.SetThemeByApp(_textMate);
|
Models.TextMateHelper.SetThemeByApp(_textMate);
|
||||||
|
|
|
@ -148,7 +148,7 @@
|
||||||
<TabItem.Header>
|
<TabItem.Header>
|
||||||
<TextBlock Classes="tab_header" Text="{DynamicResource Text.Preferences.Appearance}"/>
|
<TextBlock Classes="tab_header" Text="{DynamicResource Text.Preferences.Appearance}"/>
|
||||||
</TabItem.Header>
|
</TabItem.Header>
|
||||||
<Grid Margin="8" RowDefinitions="32,32,32,32,32,32,32,Auto" ColumnDefinitions="Auto,*">
|
<Grid Margin="8" RowDefinitions="32,32,32,32,32,32,32,32,Auto" ColumnDefinitions="Auto,*">
|
||||||
<TextBlock Grid.Row="0" Grid.Column="0"
|
<TextBlock Grid.Row="0" Grid.Column="0"
|
||||||
Text="{DynamicResource Text.Preferences.Appearance.Theme}"
|
Text="{DynamicResource Text.Preferences.Appearance.Theme}"
|
||||||
HorizontalAlignment="Right"
|
HorizontalAlignment="Right"
|
||||||
|
@ -218,10 +218,23 @@
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|
||||||
<TextBlock Grid.Row="4" Grid.Column="0"
|
<TextBlock Grid.Row="4" Grid.Column="0"
|
||||||
|
Text="{DynamicResource Text.Preferences.Appearance.EditorTabWidth}"
|
||||||
|
HorizontalAlignment="Right"
|
||||||
|
Margin="0,0,16,0"/>
|
||||||
|
<Grid Grid.Row="4" Grid.Column="1">
|
||||||
|
<NumericUpDown Minimum="1" Maximum="16" Increment="1"
|
||||||
|
Height="28"
|
||||||
|
Padding="4"
|
||||||
|
BorderThickness="1" BorderBrush="{DynamicResource Brush.Border1}"
|
||||||
|
CornerRadius="3"
|
||||||
|
Value="{Binding EditorTabWidth, Mode=TwoWay}"/>
|
||||||
|
</Grid>
|
||||||
|
|
||||||
|
<TextBlock Grid.Row="5" Grid.Column="0"
|
||||||
Text="{DynamicResource Text.Preferences.Appearance.ThemeOverrides}"
|
Text="{DynamicResource Text.Preferences.Appearance.ThemeOverrides}"
|
||||||
HorizontalAlignment="Right"
|
HorizontalAlignment="Right"
|
||||||
Margin="0,0,16,0"/>
|
Margin="0,0,16,0"/>
|
||||||
<TextBox Grid.Row="4" Grid.Column="1"
|
<TextBox Grid.Row="5" Grid.Column="1"
|
||||||
Height="28"
|
Height="28"
|
||||||
CornerRadius="3"
|
CornerRadius="3"
|
||||||
Text="{Binding ThemeOverrides, Mode=TwoWay}">
|
Text="{Binding ThemeOverrides, Mode=TwoWay}">
|
||||||
|
@ -232,16 +245,16 @@
|
||||||
</TextBox.InnerRightContent>
|
</TextBox.InnerRightContent>
|
||||||
</TextBox>
|
</TextBox>
|
||||||
|
|
||||||
<CheckBox Grid.Row="5" Grid.Column="1"
|
<CheckBox Grid.Row="6" Grid.Column="1"
|
||||||
Content="{DynamicResource Text.Preferences.Appearance.OnlyUseMonoFontInEditor}"
|
Content="{DynamicResource Text.Preferences.Appearance.OnlyUseMonoFontInEditor}"
|
||||||
IsChecked="{Binding OnlyUseMonoFontInEditor, Mode=TwoWay}"/>
|
IsChecked="{Binding OnlyUseMonoFontInEditor, Mode=TwoWay}"/>
|
||||||
|
|
||||||
<CheckBox Grid.Row="6" Grid.Column="1"
|
<CheckBox Grid.Row="7" Grid.Column="1"
|
||||||
Height="32"
|
Height="32"
|
||||||
Content="{DynamicResource Text.Preferences.Appearance.UseFixedTabWidth}"
|
Content="{DynamicResource Text.Preferences.Appearance.UseFixedTabWidth}"
|
||||||
IsChecked="{Binding Source={x:Static vm:Preferences.Instance}, Path=UseFixedTabWidth, Mode=TwoWay}"/>
|
IsChecked="{Binding Source={x:Static vm:Preferences.Instance}, Path=UseFixedTabWidth, Mode=TwoWay}"/>
|
||||||
|
|
||||||
<CheckBox Grid.Row="7" Grid.Column="1"
|
<CheckBox Grid.Row="8" Grid.Column="1"
|
||||||
Height="32"
|
Height="32"
|
||||||
Content="{DynamicResource Text.Preferences.Appearance.UseNativeWindowFrame}"
|
Content="{DynamicResource Text.Preferences.Appearance.UseNativeWindowFrame}"
|
||||||
IsChecked="{Binding Source={x:Static vm:Preferences.Instance}, Path=UseSystemWindowFrame, Mode=OneTime}"
|
IsChecked="{Binding Source={x:Static vm:Preferences.Instance}, Path=UseSystemWindowFrame, Mode=OneTime}"
|
||||||
|
|
|
@ -22,6 +22,7 @@
|
||||||
<DataTemplate DataType="m:RevisionTextFile">
|
<DataTemplate DataType="m:RevisionTextFile">
|
||||||
<v:RevisionTextFileView FontFamily="{DynamicResource Fonts.Monospace}"
|
<v:RevisionTextFileView FontFamily="{DynamicResource Fonts.Monospace}"
|
||||||
FontSize="{Binding Source={x:Static vm:Preferences.Instance}, Path=EditorFontSize}"
|
FontSize="{Binding Source={x:Static vm:Preferences.Instance}, Path=EditorFontSize}"
|
||||||
|
TabWidth="{Binding Source={x:Static vm:Preferences.Instance}, Path=EditorTabWidth}"
|
||||||
Background="{DynamicResource Brush.Contents}"/>
|
Background="{DynamicResource Brush.Contents}"/>
|
||||||
</DataTemplate>
|
</DataTemplate>
|
||||||
|
|
||||||
|
|
|
@ -15,6 +15,15 @@ namespace SourceGit.Views
|
||||||
{
|
{
|
||||||
public class RevisionTextFileView : TextEditor
|
public class RevisionTextFileView : TextEditor
|
||||||
{
|
{
|
||||||
|
public static readonly StyledProperty<int> TabWidthProperty =
|
||||||
|
AvaloniaProperty.Register<RevisionTextFileView, int>(nameof(TabWidth), 4);
|
||||||
|
|
||||||
|
public int TabWidth
|
||||||
|
{
|
||||||
|
get => GetValue(TabWidthProperty);
|
||||||
|
set => SetValue(TabWidthProperty, value);
|
||||||
|
}
|
||||||
|
|
||||||
protected override Type StyleKeyOverride => typeof(TextEditor);
|
protected override Type StyleKeyOverride => typeof(TextEditor);
|
||||||
|
|
||||||
public RevisionTextFileView() : base(new TextArea(), new TextDocument())
|
public RevisionTextFileView() : base(new TextArea(), new TextDocument())
|
||||||
|
@ -22,13 +31,16 @@ namespace SourceGit.Views
|
||||||
IsReadOnly = true;
|
IsReadOnly = true;
|
||||||
ShowLineNumbers = true;
|
ShowLineNumbers = true;
|
||||||
WordWrap = false;
|
WordWrap = false;
|
||||||
|
|
||||||
|
Options.IndentationSize = TabWidth;
|
||||||
|
Options.EnableHyperlinks = false;
|
||||||
|
Options.EnableEmailHyperlinks = false;
|
||||||
|
|
||||||
HorizontalScrollBarVisibility = ScrollBarVisibility.Auto;
|
HorizontalScrollBarVisibility = ScrollBarVisibility.Auto;
|
||||||
VerticalScrollBarVisibility = ScrollBarVisibility.Auto;
|
VerticalScrollBarVisibility = ScrollBarVisibility.Auto;
|
||||||
|
|
||||||
TextArea.LeftMargins[0].Margin = new Thickness(8, 0);
|
TextArea.LeftMargins[0].Margin = new Thickness(8, 0);
|
||||||
TextArea.TextView.Margin = new Thickness(4, 0);
|
TextArea.TextView.Margin = new Thickness(4, 0);
|
||||||
TextArea.TextView.Options.EnableHyperlinks = false;
|
|
||||||
TextArea.TextView.Options.EnableEmailHyperlinks = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnLoaded(RoutedEventArgs e)
|
protected override void OnLoaded(RoutedEventArgs e)
|
||||||
|
@ -69,6 +81,16 @@ namespace SourceGit.Views
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override void OnPropertyChanged(AvaloniaPropertyChangedEventArgs change)
|
||||||
|
{
|
||||||
|
base.OnPropertyChanged(change);
|
||||||
|
|
||||||
|
if (change.Property == TabWidthProperty)
|
||||||
|
{
|
||||||
|
Options.IndentationSize = TabWidth;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void OnTextViewContextRequested(object sender, ContextRequestedEventArgs e)
|
private void OnTextViewContextRequested(object sender, ContextRequestedEventArgs e)
|
||||||
{
|
{
|
||||||
var selected = SelectedText;
|
var selected = SelectedText;
|
||||||
|
|
|
@ -27,6 +27,7 @@
|
||||||
IndicatorForeground="{DynamicResource Brush.FG2}"
|
IndicatorForeground="{DynamicResource Brush.FG2}"
|
||||||
FontFamily="{DynamicResource Fonts.Monospace}"
|
FontFamily="{DynamicResource Fonts.Monospace}"
|
||||||
FontSize="{Binding Source={x:Static vm:Preferences.Instance}, Path=EditorFontSize}"
|
FontSize="{Binding Source={x:Static vm:Preferences.Instance}, Path=EditorFontSize}"
|
||||||
|
TabWidth="{Binding Source={x:Static vm:Preferences.Instance}, Path=EditorTabWidth}"
|
||||||
UseSyntaxHighlighting="{Binding Source={x:Static vm:Preferences.Instance}, Path=UseSyntaxHighlighting}"
|
UseSyntaxHighlighting="{Binding Source={x:Static vm:Preferences.Instance}, Path=UseSyntaxHighlighting}"
|
||||||
WordWrap="{Binding Source={x:Static vm:Preferences.Instance}, Path=EnableDiffViewWordWrap}"
|
WordWrap="{Binding Source={x:Static vm:Preferences.Instance}, Path=EnableDiffViewWordWrap}"
|
||||||
ShowHiddenSymbols="{Binding Source={x:Static vm:Preferences.Instance}, Path=ShowHiddenSymbolsInDiffView}"
|
ShowHiddenSymbols="{Binding Source={x:Static vm:Preferences.Instance}, Path=ShowHiddenSymbolsInDiffView}"
|
||||||
|
@ -59,6 +60,7 @@
|
||||||
IndicatorForeground="{DynamicResource Brush.FG2}"
|
IndicatorForeground="{DynamicResource Brush.FG2}"
|
||||||
FontFamily="{DynamicResource Fonts.Monospace}"
|
FontFamily="{DynamicResource Fonts.Monospace}"
|
||||||
FontSize="{Binding Source={x:Static vm:Preferences.Instance}, Path=EditorFontSize}"
|
FontSize="{Binding Source={x:Static vm:Preferences.Instance}, Path=EditorFontSize}"
|
||||||
|
TabWidth="{Binding Source={x:Static vm:Preferences.Instance}, Path=EditorTabWidth}"
|
||||||
UseSyntaxHighlighting="{Binding Source={x:Static vm:Preferences.Instance}, Path=UseSyntaxHighlighting}"
|
UseSyntaxHighlighting="{Binding Source={x:Static vm:Preferences.Instance}, Path=UseSyntaxHighlighting}"
|
||||||
WordWrap="False"
|
WordWrap="False"
|
||||||
ShowHiddenSymbols="{Binding Source={x:Static vm:Preferences.Instance}, Path=ShowHiddenSymbolsInDiffView}"
|
ShowHiddenSymbols="{Binding Source={x:Static vm:Preferences.Instance}, Path=ShowHiddenSymbolsInDiffView}"
|
||||||
|
@ -81,6 +83,7 @@
|
||||||
IndicatorForeground="{DynamicResource Brush.FG2}"
|
IndicatorForeground="{DynamicResource Brush.FG2}"
|
||||||
FontFamily="{DynamicResource Fonts.Monospace}"
|
FontFamily="{DynamicResource Fonts.Monospace}"
|
||||||
FontSize="{Binding Source={x:Static vm:Preferences.Instance}, Path=EditorFontSize}"
|
FontSize="{Binding Source={x:Static vm:Preferences.Instance}, Path=EditorFontSize}"
|
||||||
|
TabWidth="{Binding Source={x:Static vm:Preferences.Instance}, Path=EditorTabWidth}"
|
||||||
UseSyntaxHighlighting="{Binding Source={x:Static vm:Preferences.Instance}, Path=UseSyntaxHighlighting}"
|
UseSyntaxHighlighting="{Binding Source={x:Static vm:Preferences.Instance}, Path=UseSyntaxHighlighting}"
|
||||||
WordWrap="False"
|
WordWrap="False"
|
||||||
ShowHiddenSymbols="{Binding Source={x:Static vm:Preferences.Instance}, Path=ShowHiddenSymbolsInDiffView}"
|
ShowHiddenSymbols="{Binding Source={x:Static vm:Preferences.Instance}, Path=ShowHiddenSymbolsInDiffView}"
|
||||||
|
|
|
@ -475,6 +475,15 @@ namespace SourceGit.Views
|
||||||
set => SetValue(ShowHiddenSymbolsProperty, value);
|
set => SetValue(ShowHiddenSymbolsProperty, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static readonly StyledProperty<int> TabWidthProperty =
|
||||||
|
AvaloniaProperty.Register<ThemedTextDiffPresenter, int>(nameof(TabWidth), 4);
|
||||||
|
|
||||||
|
public int TabWidth
|
||||||
|
{
|
||||||
|
get => GetValue(TabWidthProperty);
|
||||||
|
set => SetValue(TabWidthProperty, value);
|
||||||
|
}
|
||||||
|
|
||||||
public static readonly StyledProperty<bool> EnableChunkSelectionProperty =
|
public static readonly StyledProperty<bool> EnableChunkSelectionProperty =
|
||||||
AvaloniaProperty.Register<ThemedTextDiffPresenter, bool>(nameof(EnableChunkSelection));
|
AvaloniaProperty.Register<ThemedTextDiffPresenter, bool>(nameof(EnableChunkSelection));
|
||||||
|
|
||||||
|
@ -519,12 +528,13 @@ namespace SourceGit.Views
|
||||||
ShowLineNumbers = false;
|
ShowLineNumbers = false;
|
||||||
BorderThickness = new Thickness(0);
|
BorderThickness = new Thickness(0);
|
||||||
|
|
||||||
|
Options.IndentationSize = TabWidth;
|
||||||
|
Options.EnableHyperlinks = false;
|
||||||
|
Options.EnableEmailHyperlinks = false;
|
||||||
|
|
||||||
_lineStyleTransformer = new LineStyleTransformer(this);
|
_lineStyleTransformer = new LineStyleTransformer(this);
|
||||||
|
|
||||||
TextArea.TextView.Margin = new Thickness(2, 0);
|
TextArea.TextView.Margin = new Thickness(2, 0);
|
||||||
TextArea.TextView.Options.EnableHyperlinks = false;
|
|
||||||
TextArea.TextView.Options.EnableEmailHyperlinks = false;
|
|
||||||
|
|
||||||
TextArea.TextView.BackgroundRenderers.Add(new LineBackgroundRenderer(this));
|
TextArea.TextView.BackgroundRenderers.Add(new LineBackgroundRenderer(this));
|
||||||
TextArea.TextView.LineTransformers.Add(_lineStyleTransformer);
|
TextArea.TextView.LineTransformers.Add(_lineStyleTransformer);
|
||||||
}
|
}
|
||||||
|
@ -734,10 +744,14 @@ namespace SourceGit.Views
|
||||||
}
|
}
|
||||||
else if (change.Property == ShowHiddenSymbolsProperty)
|
else if (change.Property == ShowHiddenSymbolsProperty)
|
||||||
{
|
{
|
||||||
var val = change.NewValue is true;
|
var val = ShowHiddenSymbols;
|
||||||
Options.ShowTabs = val;
|
Options.ShowTabs = val;
|
||||||
Options.ShowSpaces = val;
|
Options.ShowSpaces = val;
|
||||||
}
|
}
|
||||||
|
else if (change.Property == TabWidthProperty)
|
||||||
|
{
|
||||||
|
Options.IndentationSize = TabWidth;
|
||||||
|
}
|
||||||
else if (change.Property == FileNameProperty)
|
else if (change.Property == FileNameProperty)
|
||||||
{
|
{
|
||||||
Models.TextMateHelper.SetGrammarByFileName(_textMate, FileName);
|
Models.TextMateHelper.SetGrammarByFileName(_textMate, FileName);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue