Skip to content

Commit 5c3962b

Browse files
authored
Handle tabfolding edge-case inside python editor. (#14004) (#14005)
(cherry picked from commit 054ef8c)
1 parent 6275224 commit 5c3962b

1 file changed

Lines changed: 4 additions & 7 deletions

File tree

src/Libraries/PythonNodeModelsWpf/TabFoldingStrategy.cs

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,8 @@
1-
using Dynamo.UI.Controls;
2-
using ICSharpCode.AvalonEdit.Document;
3-
using ICSharpCode.AvalonEdit.Folding;
41
using System;
52
using System.Collections.Generic;
63
using System.Linq;
7-
using System.Text;
8-
using System.Windows.Media.Animation;
4+
using ICSharpCode.AvalonEdit.Document;
5+
using ICSharpCode.AvalonEdit.Folding;
96

107
namespace PythonNodeModelsWpf
118
{
@@ -73,7 +70,7 @@ internal IEnumerable<NewFolding> CreateNewFoldingsByLine(ITextSource document)
7370
}
7471
else if (tabLevel != currentTabLevel && currentTabLevel < tabLevel)
7572
{
76-
while (currentTabLevel < tabLevel)
73+
while (currentTabLevel < tabLevel && startOffsets.Any())
7774
{
7875
// we close all nested tabs
7976
var tempFolding = new NewFolding();
@@ -92,7 +89,7 @@ internal IEnumerable<NewFolding> CreateNewFoldingsByLine(ITextSource document)
9289
}
9390
else if (whiteSpaces == 0 && tabLevel > 0)
9491
{
95-
while(tabLevel> 0)
92+
while(tabLevel> 0 && startOffsets.Any())
9693
{
9794
// we close all nested tabs
9895
var tempFolding = new NewFolding();

0 commit comments

Comments
 (0)