Breaking layouts in Terminal.app on Mac?
Describe the bug
Excited for the new release! Thanks, team!
When moving from field to field in Mac OS Terminal (zsh or bash) with the tab key or scrolling through options with the arrow keys, lines are duplicated. The duplicates build on each successive action. As noted below, Terminal.app doesn't demonstrate this bug in commit hash aad810dfbce6 and prior but appears around 310cd4a379ac up through the 0.7.0 release.
Setup
Please complete the following information along with version numbers, if applicable.
- Repros in Mac Terminal with zsh or bash in 0.7.0 but not 0.6.0. Several themes/fonts were checked, UTF-8 encoding on, some other settings played with to no avail
- Does not repro in Mac VS Code integrated terminal with zsh or bash (any version)
To Reproduce
Steps to reproduce the behavior:
- Run burger sample in Mac OS Terminal.app.
Screenshots
Additional context
I noticed this bug starting with commit hash 310cd4a379ac. In my development builds, I was running against commit hash aad810dfbce6 in go.mod. IIRC, there was a line fix change that went in some time around there, but I haven't done too much investigation there.
// github.com/charmbracelet/huh v0.0.0-20241127125741-aad810dfbce6 <-- No issue in Terminal
// github.com/charmbracelet/huh v0.0.0-20250331173942-310cd4a379ac <-- Issue in Terminal
hey, thanks for reporting this, I'll take a look
I am experiencing this as well
made a git bisect, culprit is fd4724c71710a7786d9aa5de74d1c1613284546f
Thanks, @caarlos0—Was able to test this out, and I noticed that the issue still persists when using .WithShowHelp(false). You should be able to repro by adding .WithShowHelp(false) to the burger example.
Ah, good catch
I'm out for the next few days, so I'll ping @meowgorithm here to take a look
Additionally when I resize the Mac Terminal window it goes really wild.
(FYI @stalderPascal You might also want to keep an eye on https://github.com/charmbracelet/huh/issues/341, which is tracking redraw on resize and is, IIRC, is not limited to Mac Terminal)
can you check if it still happens on main?
@caarlos0 Still happens on main, as far as I can tell.