jroimartin / gocui

Minimalist Go package aimed at creating Console User Interfaces.
BSD 3-Clause "New" or "Revised" License
9.85k stars 610 forks source link

View buffer too large #150

Open akomic opened 6 years ago

akomic commented 6 years ago

I'm working on project where main view is behaving like "tail -f" on file that can become pretty large. The issue is when View has around 1000 lines moving through it (cursor) is becoming really slow and utilizes CPU a lot. As far as I can see there is no way to remove older lines from View to keep it fixed/maximum length.

I'm thinking of implementing ring buffer View for gocui and hints in which direction I should go are welcome. Should i go around rewriting view buffer completely in gocui or implementing separate type of buffer (ring buffer)?

Thanks

robaho commented 5 years ago

You might be interested in my fork which fixes this, github.com/robaho/gocui

It also has some other enhancements to make color changes in the context of logging easier - that is, you don't have to manually send escape sequences. See the github.com/robaho/go-trader project for examples of its usage.