Skip to content

Commit

Permalink
Merge pull request #1882 from PathogenDavid/issue-1875
Browse files Browse the repository at this point in the history
Fix `ObjectTextVisualizer` allowing a buffer size of 0
  • Loading branch information
glopesdev authored Jul 9, 2024
2 parents bff1088 + c764f0f commit 553b40e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Bonsai.Design/ObjectTextVisualizer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public class ObjectTextVisualizer : BufferedVisualizer
RichTextBox textBox;
UserControl textPanel;
Queue<string> buffer;
int bufferSize;
int bufferSize = 1;

/// <inheritdoc/>
protected override int TargetInterval => 1000 / 30;
Expand Down Expand Up @@ -164,7 +164,7 @@ public override void Load(IServiceProvider provider)
void textPanel_Paint(object sender, PaintEventArgs e)
{
var lineHeight = AutoScaleHeight * e.Graphics.DpiY / DefaultDpi;
bufferSize = (int)((textBox.ClientSize.Height - 2) / lineHeight);
bufferSize = Math.Max(1, (int)((textBox.ClientSize.Height - 2) / lineHeight));
var textSize = TextRenderer.MeasureText(textBox.Text, textBox.Font);
if (textBox.ClientSize.Width < textSize.Width)
{
Expand Down

0 comments on commit 553b40e

Please sign in to comment.