Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gum input mangling prompt (docs need updated) #586

Closed
tj-smith47 opened this issue May 21, 2024 · 2 comments · Fixed by #634
Closed

gum input mangling prompt (docs need updated) #586

tj-smith47 opened this issue May 21, 2024 · 2 comments · Fixed by #634
Assignees
Labels
bug Something isn't working cmd/input

Comments

@tj-smith47
Copy link

Describe the bug
Previously functional gum input blocks in a script my company uses are now mangled - r

To Reproduce
Consider the following block in a script:

#!/usr/bin/env bash

REPO_NAME=$(gum input --prompt "Enter the name (title case) of the repository to add a devcontainer files (e.g., Some API): ")
[[ -z "${REPO_NAME}" ]] && (echo "No repository name provided. Exiting."; exit 1)

The input received is correct if typed, but it's a poor user experience not being able to see text when typing in a field that isn't a password.

Expected behavior
No random newlines, all prompt text shows, input visible as I type.

Screenshots
Given the above excerpt from the script, this is the output (before it was on a single line, text was visible):
Screenshot 2024-05-20 at 17 32 24

Desktop (please complete the following information):

  • OS: macOS
  • Browser N/A
  • Version: 14.5

Additional context
Nothing changed in the script since it last worked flawlessly, so it seems to be the recent upgrade to gum.

@tj-smith47
Copy link
Author

tj-smith47 commented May 21, 2024

I just figured out setting --width resolves this - it seems unintentional to push the burden of counting the length of each line to the user when previously this wasn't necessary. If not, it was not listed in the changelog, and uses of --width were subtly added to examples rather than an obvious indication it's now required. Previously, pressing Ctrl+C during a gum choose did not print a unable to run confirm: user aborted message. This compromises the cleanliness of it's use in scripts. The changelog was posed as though there weren't any breaking changes (given that none were provided), but this has not been my experience.

@tj-smith47 tj-smith47 changed the title gum input mangling prompt gum input mangling prompt (docs need updated) May 21, 2024
@caarlos0
Copy link
Member

you can also use --width 0 to use the terminal size

@caarlos0 caarlos0 added the bug Something isn't working label Jul 24, 2024
@caarlos0 caarlos0 self-assigned this Jul 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working cmd/input
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants