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

Incorrect line wrapping for tasks with long descriptions #93

Closed
jonhoo opened this issue Aug 2, 2023 · 0 comments · Fixed by #94
Closed

Incorrect line wrapping for tasks with long descriptions #93

jonhoo opened this issue Aug 2, 2023 · 0 comments · Fixed by #94

Comments

@jonhoo
Copy link
Contributor

jonhoo commented Aug 2, 2023

To reproduce:

  1. Define a task whose description is long enough to wrap in your terminal.
  2. Make your terminal fairly narrow.
  3. Run kraken q ls.
  4. Notice that the wrapped lines of the description (that is, every line except the first for each task) is wrapped very narrowly.

This happens because we use the subsequent_ident argument to textwrap.wrap:

https://github.com/kraken-build/kraken-build/blob/fcb55055a56ec703729315b462820cfd363c26bb/kraken-core/src/kraken/core/cli/main.py#L324-L328

And subsequent_indent counts towards the line length of each line except the first. In other words, if the terminal is 120 wide and remaining_width = 60, we'll end up passing 120-60 space characters to subsequent_lines, and those will be counted against the remaining_width we pass as the width argument. Which effectively means there is zero remaining space, and so textwrap dutifully wraps the remaining lines as aggressively as it can.

The solution here is probably to not pass subsequent_indent, and instead just prepend the spaces onto each line (except the first) that textwrap.wrap returns.

jonhoo added a commit to jonhoo/kraken-build that referenced this issue Aug 2, 2023
jonhoo added a commit to jonhoo/kraken-build that referenced this issue Aug 2, 2023
@tetigi tetigi closed this as completed in #94 Aug 3, 2023
tetigi pushed a commit that referenced this issue Aug 3, 2023
* kraken-core/: fix: Correct multi-line description wrapping

Fixes #93

* Okay black, settle down
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

Successfully merging a pull request may close this issue.

1 participant