From 9fdbea768d0b2768e9a825ba8ed5dab8c5db4bf8 Mon Sep 17 00:00:00 2001 From: Brandon Thetford Date: Sun, 25 Feb 2024 20:06:39 -0700 Subject: [PATCH] Pull these out into statics so we only pay the price once --- Terminal.Gui/Views/HexView.cs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/Terminal.Gui/Views/HexView.cs b/Terminal.Gui/Views/HexView.cs index ecd2d9e6a..474be71b2 100644 --- a/Terminal.Gui/Views/HexView.cs +++ b/Terminal.Gui/Views/HexView.cs @@ -36,6 +36,8 @@ public class HexView : View private SortedDictionary edits = new (); private bool firstNibble, leftSide; private Stream source; + private static readonly Rune SpaceCharRune = new (' '); + private static readonly Rune PeriodCharRune = new ('.'); /// Initializes a class using layout. /// @@ -401,7 +403,7 @@ public class HexView : View Driver.AddStr (offset >= n && !edited ? " " : string.Format ("{0:x2}", value)); SetAttribute (GetNormalColor ()); - Driver.AddRune ((Rune)' '); + Driver.AddRune (SpaceCharRune); } Driver.AddStr (block + 1 == nblocks ? " " : "| "); @@ -415,17 +417,17 @@ public class HexView : View if (offset >= n && !edited) { - c = (Rune)' '; + c = SpaceCharRune; } else { if (b < 32) { - c = (Rune)'.'; + c = PeriodCharRune; } else if (b > 127) { - c = (Rune)'.'; + c = PeriodCharRune; } else {