Skip to content

Commit

Permalink
Handle tabfolding edge-case inside python editor. (#14004) (#14005)
Browse files Browse the repository at this point in the history
(cherry picked from commit 054ef8c)
  • Loading branch information
reddyashish authored May 18, 2023
1 parent 6275224 commit 5c3962b
Showing 1 changed file with 4 additions and 7 deletions.
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

0 comments on commit 5c3962b

Please sign in to comment.