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 spin --show-output" truncates output to match terminal size #825

Open
wmedlar opened this issue Jan 27, 2025 · 3 comments
Open

"gum spin --show-output" truncates output to match terminal size #825

wmedlar opened this issue Jan 27, 2025 · 3 comments

Comments

@wmedlar
Copy link

wmedlar commented Jan 27, 2025

Describe the bug

gum spin --show-output truncates output from the command to match the size of the current terminal.
For example, if your terminal were 14 lines tall by 80 lines wide, gum spin --show-output would print only first 80 characters from the last 14 lines of output from whatever command was run.

To Reproduce
Steps to reproduce the behavior:

  1. Determine the size of your current terminal. This one is intentionally small to better demonstrate the issue.
$ tput cols
30
$ tput lines
14
  1. Run gum spin with a command that produces larger output than your terminal size. The example command prints the numbers 0 through 100 with fixed-width zero padding of 31 characters. The "ones" place is the 31st character, extending beyond the terminal width, and will be cut off by gum.
$ gum spin --show-output -- printf '%031i\n' {1..100}
000000000000000000000000000007
000000000000000000000000000007
000000000000000000000000000008
000000000000000000000000000008
000000000000000000000000000008
000000000000000000000000000008
000000000000000000000000000008
000000000000000000000000000008
000000000000000000000000000008
000000000000000000000000000008
000000000000000000000000000008
000000000000000000000000000008
000000000000000000000000000009
000000000000000000000000000009
000000000000000000000000000009
000000000000000000000000000009
000000000000000000000000000009
000000000000000000000000000009
000000000000000000000000000009
000000000000000000000000000009
000000000000000000000000000009
000000000000000000000000000009
000000000000000000000000000010

Expected behavior

gum spin --show-output should print the entire, untruncated output of the command once the command returns.

Desktop (please complete the following information):

  • OS: MacOS 14.7
  • Version: 0.15.1

Additional context
Same behavior in both in bash 5.2 and zsh 5.9.

@caarlos0
Copy link
Member

I think then the spinner should go below the output for it to make sense

in any case, I agree it should print the whole output if piped and once finished, not sure if while running, though

@wmedlar
Copy link
Author

wmedlar commented Jan 28, 2025

Sorry, let me edit the issue to clarify the behavior I expect. I'm only expecting the full output once the command completes, not while the command is still running / the spinner is still spinning.

I also noticed that the output is cut off horizontally as well. I'll add reproduction steps for that too.

@wmedlar
Copy link
Author

wmedlar commented Jan 29, 2025

Looks like this might be intended behavior of the bubbletea renderer for both the height truncation and the width truncation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants