Skip to content

Commit

Permalink
PowerControl: Do not render many separators
Browse files Browse the repository at this point in the history
  • Loading branch information
ayufan committed Dec 14, 2023
1 parent ffe8bf1 commit f5b3140
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions PowerControl/Menu/MenuRoot.cs
Original file line number Diff line number Diff line change
Expand Up @@ -78,13 +78,18 @@ public override string Render(MenuItem? parentSelected)
if (Name != "")
sb.AppendLine(Color(Name, Colors.Blue));

bool lastSelectable = false;

foreach (var item in Items)
{
if (!item.Visible)
continue;
if (!item.Selectable && !lastSelectable)
continue;
var lines = item.Render(Selected).Split("\r\n").Select(line => " " + line);
foreach (var line in lines)
sb.AppendLine(line);
lastSelectable = item.Selectable;
}

return sb.ToString();
Expand Down

0 comments on commit f5b3140

Please sign in to comment.