diff --git a/Terminal.Gui/Views/TreeView.cs b/Terminal.Gui/Views/TreeView.cs
index dbdc3dbba..31a03f178 100644
--- a/Terminal.Gui/Views/TreeView.cs
+++ b/Terminal.Gui/Views/TreeView.cs
@@ -597,10 +597,9 @@ namespace Terminal.Gui {
///
public virtual void Draw(ConsoleDriver driver,ColorScheme colorScheme, int y, int availableWidth)
{
-
// Everything on line before the expansion run and branch text
- string prefix = GetLinePrefix(driver);
- var expansion = GetExpandableIcon(driver);
+ Rune[] prefix = GetLinePrefix(driver).ToArray();
+ Rune expansion = GetExpandableIcon(driver);
string lineBody = tree.AspectGetter(Model);
var remainingWidth = availableWidth - (prefix.Length + 1 + lineBody.Length);
@@ -609,7 +608,10 @@ namespace Terminal.Gui {
driver.SetAttribute(colorScheme.Normal);
- driver.AddStr(prefix + expansion);
+ foreach(Rune r in prefix)
+ driver.AddRune(r);
+
+ driver.AddRune(expansion);
driver.SetAttribute(tree.SelectedObject == Model ?
colorScheme.HotFocus :
@@ -628,26 +630,28 @@ namespace Terminal.Gui {
///
///
///
- private string GetLinePrefix (ConsoleDriver driver)
+ private IEnumerable GetLinePrefix (ConsoleDriver driver)
{
// If not showing line branches or this is a root object
- if(!tree.ShowBranchLines)
- return new string(' ',Depth);
-
- string prefix = "";
+ if (!tree.ShowBranchLines) {
+ for(int i = 0; i < Depth; i++) {
+ yield return new Rune(' ');
+ }
+ }
+ // yield indentations with runes appropriate to the state of the parents
foreach(var cur in GetParentBranches().Reverse())
{
if(cur.IsLast())
- prefix += " ";
+ yield return new Rune(' ');
else
- prefix += driver.VLine;
+ yield return driver.VLine;
}
if(IsLast())
- return prefix + driver.LLCorner;
+ yield return driver.LLCorner;
else
- return prefix + driver.LeftTee;
+ yield return driver.LeftTee;
}
///