code folding doesn't like tabs

This commit is contained in:
iAmAsval
2021-06-24 17:11:21 +02:00
parent 37503ec012
commit 648f7c728a
2 changed files with 4 additions and 4 deletions

View File

@@ -20,7 +20,6 @@ namespace FModel.Views.Resources.Controls
private readonly Regex _hexColorRegex = new("\"Hex\": \"(?'target'[0-9A-Fa-f]{3,8})\"$",
RegexOptions.Compiled | RegexOptions.Singleline | RegexOptions.IgnoreCase | RegexOptions.CultureInvariant);
private readonly System.Windows.Controls.ToolTip _toolTip = new();
private JsonFoldingStrategies _manager;
public AvalonEditor()
{
@@ -82,9 +81,7 @@ namespace FModel.Views.Resources.Controls
if (sender is not TextEditor avalonEditor || DataContext is not TabItem tabItem ||
avalonEditor.Document == null || string.IsNullOrEmpty(avalonEditor.Document.Text))
return;
_manager ??= new JsonFoldingStrategies(avalonEditor);
_manager.UpdateFoldings(tabItem.Document);
avalonEditor.Document.FileName = tabItem.Directory + '/' + tabItem.Header.SubstringBeforeLast('.');
if (!tabItem.ShouldScroll) return;

View File

@@ -15,6 +15,7 @@ namespace FModel.Views.Resources.Controls
private readonly Regex _hexColorRegex = new("\"Hex\": \"(?'target'[0-9A-Fa-f]{3,8})\"$",
RegexOptions.Compiled | RegexOptions.Singleline | RegexOptions.IgnoreCase | RegexOptions.CultureInvariant);
private readonly System.Windows.Controls.ToolTip _toolTip = new();
private JsonFoldingStrategies _manager;
public PropertiesPopout(TabItem contextViewModel)
{
@@ -30,6 +31,8 @@ namespace FModel.Views.Resources.Controls
MyAvalonEditor.ScrollToVerticalOffset(contextViewModel.ScrollPosition);
MyAvalonEditor.TextArea.TextView.ElementGenerators.Add(new GamePathElementGenerator());
MyAvalonEditor.TextArea.TextView.ElementGenerators.Add(new HexColorElementGenerator());
_manager = new JsonFoldingStrategies(MyAvalonEditor);
_manager.UpdateFoldings(MyAvalonEditor.Document);
}
private void OnMouseHover(object sender, MouseEventArgs e)