Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle TabFolding edge-case inside python editor. #14004

Merged
merged 1 commit into from
May 18, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 4 additions & 7 deletions src/Libraries/PythonNodeModelsWpf/TabFoldingStrategy.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
using Dynamo.UI.Controls;
using ICSharpCode.AvalonEdit.Document;
using ICSharpCode.AvalonEdit.Folding;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Media.Animation;
using ICSharpCode.AvalonEdit.Document;
using ICSharpCode.AvalonEdit.Folding;

namespace PythonNodeModelsWpf
{
Expand Down Expand Up @@ -73,7 +70,7 @@ internal IEnumerable<NewFolding> CreateNewFoldingsByLine(ITextSource document)
}
else if (tabLevel != currentTabLevel && currentTabLevel < tabLevel)
{
while (currentTabLevel < tabLevel)
while (currentTabLevel < tabLevel && startOffsets.Any())
{
// we close all nested tabs
var tempFolding = new NewFolding();
Expand All @@ -92,7 +89,7 @@ internal IEnumerable<NewFolding> CreateNewFoldingsByLine(ITextSource document)
}
else if (whiteSpaces == 0 && tabLevel > 0)
{
while(tabLevel> 0)
while(tabLevel> 0 && startOffsets.Any())
{
// we close all nested tabs
var tempFolding = new NewFolding();
Expand Down