mirror of
https://github.com/sourcegit-scm/sourcegit
synced 2025-05-20 19:55: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
|
@ -475,6 +475,15 @@ namespace SourceGit.Views
|
|||
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 =
|
||||
AvaloniaProperty.Register<ThemedTextDiffPresenter, bool>(nameof(EnableChunkSelection));
|
||||
|
||||
|
@ -519,12 +528,13 @@ namespace SourceGit.Views
|
|||
ShowLineNumbers = false;
|
||||
BorderThickness = new Thickness(0);
|
||||
|
||||
Options.IndentationSize = TabWidth;
|
||||
Options.EnableHyperlinks = false;
|
||||
Options.EnableEmailHyperlinks = false;
|
||||
|
||||
_lineStyleTransformer = new LineStyleTransformer(this);
|
||||
|
||||
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.LineTransformers.Add(_lineStyleTransformer);
|
||||
}
|
||||
|
@ -734,10 +744,14 @@ namespace SourceGit.Views
|
|||
}
|
||||
else if (change.Property == ShowHiddenSymbolsProperty)
|
||||
{
|
||||
var val = change.NewValue is true;
|
||||
var val = ShowHiddenSymbols;
|
||||
Options.ShowTabs = val;
|
||||
Options.ShowSpaces = val;
|
||||
}
|
||||
else if (change.Property == TabWidthProperty)
|
||||
{
|
||||
Options.IndentationSize = TabWidth;
|
||||
}
|
||||
else if (change.Property == FileNameProperty)
|
||||
{
|
||||
Models.TextMateHelper.SetGrammarByFileName(_textMate, FileName);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue