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

Long terminal prompts are cut off instead of wrapping #3583

Open
detly opened this issue Feb 20, 2024 · 2 comments
Open

Long terminal prompts are cut off instead of wrapping #3583

detly opened this issue Feb 20, 2024 · 2 comments
Labels
bug Something isn't working in dependency In a dependency, not in chezmoi

Comments

@detly
Copy link

detly commented Feb 20, 2024

Describe the bug

Long prompts eg. for removing or overwriting files, are cut off at the right side in the terminal. This makes it impossible to (a) see what the options are and (b) see what they're for.

To reproduce

  1. Add some files with relatively long paths
  2. Maybe resize your terminal to be a bit narrow
  3. Use chezmoi rm to remove them

Expected behavior

I'd expect the prompt to wrap.

Output of command with the --verbose flag

It's the same with or without --verbose. I started with zsh -f to try to reduce variation a bit.

~ ⚬ zsh -f
gary% cd .config/sublime-text/Packages/User 
gary% chezmoi rm Meson.sublime-syntax       
Remove /home/jason/.config/sublime-text/Packages/User/Meson.sublime-syntax and /home/jason/.loca

That's actually it - there's no more text. Here's a screenshot:

Screenshot from 2024-02-20 16-01-45

I can't scroll that eg. by pressing , or reflow it by resizing the window. I can exit it with Q or Ctrl+C.

Output of chezmoi doctor

RESULT    CHECK                       MESSAGE
ok        version                     v2.46.1, commit c65f66a5f1a990ffeb4d7e3f53320cb061f91513, built at 2024-02-11T16:33:13Z, built by goreleaser
ok        latest-version              v2.46.1
ok        os-arch                     linux/amd64 (Ubuntu 23.10 (Mantic Minotaur))
ok        uname                       Linux gary 6.5.0-15-generic #15-Ubuntu SMP PREEMPT_DYNAMIC Tue Jan  9 17:03:36 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux
ok        go-version                  go1.22.0 (gc)
ok        executable                  /snap/chezmoi/842/chezmoi
ok        upgrade-method              snap-refresh
ok        config-file                 ~/.config/chezmoi/chezmoi.toml, last modified 2024-02-05T16:48:15+08:00
warning   source-dir                  ~/.local/share/chezmoi is a git working tree (dirty)
ok        suspicious-entries          no suspicious entries
warning   working-tree                ~/.local/share/chezmoi is a git working tree (dirty)
ok        dest-dir                    ~ is a directory
ok        umask                       002
ok        cd-command                  found /usr/bin/zsh
ok        cd-args                     /usr/bin/zsh
info      diff-command                not set
ok        edit-command                found /snap/bin/micro
ok        edit-args                   /snap/bin/micro
ok        git-command                 found /usr/bin/git, version 2.43.2
ok        merge-command               found /usr/bin/vimdiff
ok        shell-command               found /usr/bin/zsh
ok        shell-args                  /usr/bin/zsh
info      age-command                 age not found in $PATH
ok        gpg-command                 found /usr/bin/gpg, version 2.2.40
info      pinentry-command            not set
info      1password-command           op not found in $PATH
ok        bitwarden-command           found /snap/bin/bw, version 2024.2.0
info      bitwarden-secrets-command   bws not found in $PATH
info      dashlane-command            dcli not found in $PATH
info      doppler-command             doppler not found in $PATH
info      gopass-command              gopass not found in $PATH
info      keepassxc-command           keepassxc-cli not found in $PATH
info      keepassxc-db                not set
info      keeper-command              keeper not found in $PATH
info      lastpass-command            lpass not found in $PATH
info      pass-command                pass not found in $PATH
info      passhole-command            ph not found in $PATH
info      rbw-command                 rbw not found in $PATH
info      vault-command               vault not found in $PATH
info      vlt-command                 vlt not found in $PATH
info      secret-command              not set

Additional context

This is not a recent change, I just haven't gotten around to filing an issue until now.

Chezmoi is installed via Snap, on Ubuntu 23.10. I tried this on Bash, Dash and Zsh, all with the same results.

@twpayne twpayne added bug Something isn't working in dependency In a dependency, not in chezmoi labels Feb 20, 2024
@twpayne
Copy link
Owner

twpayne commented Feb 23, 2024

Thanks for reporting this.

Under the hood, chezmoi uses BubbleTea's textinput component, which isn't aware of the terminal width. There are longstanding bugs open related to this (charmbracelet/bubbles#291, charmbracelet/bubbles#307). Rather than trying to fix this upstream, I'll fork a new text input component.

In the short term you can work around the problem by specifying the --no-tty flag.

@twpayne
Copy link
Owner

twpayne commented Feb 24, 2024

I've opened charmbracelet/bubbles#483 to track this in charmbracelet/bubbles.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working in dependency In a dependency, not in chezmoi
Projects
None yet
Development

No branches or pull requests

2 participants