charmbracelet / charmbracelet/bubbles

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

Open
#527 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
8.9k
Forks
457
Avg merge
1d 18h
Merged PRs (30d)
5

Description

**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](https://github.com/alecthomas/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.
- OS: macos Sonoma (`14.1.2`)
- Shell: zsh `5.9`
- Terminal Emulator: alacritty `0.13.2`
- Terminal Multiplexer: tmux `3.4` (also reproducible without tmux)
- Locale: en_US.UTF-8

**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!

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.