huh icon indicating copy to clipboard operation
huh copied to clipboard

Breaking layouts in Terminal.app on Mac?

Open hxlnt opened this issue 10 months ago • 5 comments

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:

  1. Run burger sample in Mac OS Terminal.app.

Screenshots

Image

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

hxlnt avatar Apr 16 '25 21:04 hxlnt

hey, thanks for reporting this, I'll take a look

caarlos0 avatar Apr 17 '25 12:04 caarlos0

I am experiencing this as well

emaadali avatar Apr 24 '25 21:04 emaadali

made a git bisect, culprit is fd4724c71710a7786d9aa5de74d1c1613284546f

caarlos0 avatar Apr 29 '25 17:04 caarlos0

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.

hxlnt avatar May 01 '25 20:05 hxlnt

Ah, good catch

I'm out for the next few days, so I'll ping @meowgorithm here to take a look

caarlos0 avatar May 03 '25 12:05 caarlos0

Additionally when I resize the Mac Terminal window it goes really wild.

Image

stalderPascal avatar Jun 02 '25 13:06 stalderPascal

(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)

hxlnt avatar Jun 02 '25 21:06 hxlnt

can you check if it still happens on main?

caarlos0 avatar Jun 03 '25 12:06 caarlos0

@caarlos0 Still happens on main, as far as I can tell.

kbrgl avatar Jul 18 '25 07:07 kbrgl