kenan238 / reblessed

A high-level terminal interface library for node.js.
MIT License
87 stars 10 forks source link

log: fix scrollback line limit #21

Closed anszom closed 6 months ago

anszom commented 1 year ago

There are two issues with the scrollback limit of the Log component.

  1. shiftLine is used incorrectly (two arguments instead of one), so only a single line is removed from the scrollback on each call.
  2. If the caller pushes a huge number of lines on each call, the log can still exceed the scrollback limit.

Issue 1 can be reproduced by any code that repeatedly calls log with a string containing a newline, issue 2 is more theoretical, but this commit fixes both at the same time.