Skip to content

Commit

Permalink
Ensure single row display for text visualizer
Browse files Browse the repository at this point in the history
  • Loading branch information
glopesdev committed Jul 15, 2023
1 parent 8c17d83 commit 88249a3
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions Bonsai.Design/ObjectTextVisualizer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
using Bonsai.Design;
using System.Drawing;
using System.Reactive;
using System.Text.RegularExpressions;

[assembly: TypeVisualizer(typeof(ObjectTextVisualizer), Target = typeof(object))]

Expand Down Expand Up @@ -40,8 +41,10 @@ protected override void ShowBuffer(IList<Timestamped<object>> values)
/// <inheritdoc/>
public override void Show(object value)
{
value = value ?? string.Empty;
buffer.Enqueue(value.ToString());
value ??= string.Empty;
var text = value.ToString();
text = Regex.Replace(text, @"\r|\n", string.Empty);
buffer.Enqueue(text);
while (buffer.Count > bufferSize)
{
buffer.Dequeue();
Expand Down

0 comments on commit 88249a3

Please sign in to comment.