charmbracelet / bubbles

TUI components for Bubble Tea 🫧
MIT License
5.24k stars 247 forks source link

viewport: ANSI color information seems to be bleeding into surrounding text #527

Open dhth opened 2 months ago

dhth commented 2 months ago

Describe the bug Color highlighting in the viewport bubble seems to be getting messed up when the content has ANSI color codes (like those generated using chroma). This seems to be the case regardless of whether "high performance rendering" mode is ON or OFF (although the way the color highlighting breaks seems to be different between the two). Maybe I'm missing something super obvious, but, for the life of me, I couldn't figure out how to get it working.

Setup Please complete the following information along with version numbers, if applicable.

To Reproduce Steps to reproduce the behavior:

  1. Clone https://github.com/dhth/bbteavpdemo
  2. go build .
  3. ./bbteavpdemo -lib=btea
  4. Scroll around for a bit; color highlighting breaks every now and then.
  5. ./bbteavpdemo -lib=btea -hp (for high performance rendering mode)
  6. Scroll around for a bit; color highlighting breaks every now and then.
  7. ./bbteavpdemo -lib=tview (to compare behaviour with tview)
  8. Scroll around for a bit; color highlighting seems to work as expected.

Source Code https://github.com/dhth/bbteavpdemo

Expected behavior ANSI color highlighting should not bleed into surrounding text.

Screenshots Here's a video demonstrating the issue. image

Love what y'll do; thanks in advance!