Skip to content

Fix: Ensure fish completion handles multiline help strings correctly#3126

Merged
AndreasBackx merged 4 commits intopallets:mainfrom
ReneSoltes:main
Apr 29, 2026
Merged

Fix: Ensure fish completion handles multiline help strings correctly#3126
AndreasBackx merged 4 commits intopallets:mainfrom
ReneSoltes:main

Conversation

@ReneSoltes
Copy link
Copy Markdown
Contributor

This pull request addresses issue #3043 by correctly handling multiline help strings when generating shell completion scripts for the fish shell.

Problem:
Previously, commands with multiline help text would cause errors or incorrect completion behavior in fish shell due to improper escaping of newlines within the help strings.

Changes:

  • Modified src/click/shell_completion.py to correctly escape newline characters (\n) within help texts before outputting them to the fish completion script.
  • Added a new test case tests/test_shell_completion.py::test_fish_multiline_help_complete to specifically verify that multiline help strings are processed correctly and do not cause errors.
  • The CHANGES.rst file has been updated to include this fix, referencing issue Multi-line help text is not handled correctly in fish #3043.
  • The .gitignore file was also updated as part of the pre-commit hooks.

fixes #3043

@Rowlando13 Rowlando13 requested a review from kdeldycke April 29, 2026 05:56
@Rowlando13 Rowlando13 changed the base branch from stable to main April 29, 2026 07:04
@AndreasBackx AndreasBackx merged commit 19fd4d6 into pallets:main Apr 29, 2026
12 checks passed
@AndreasBackx
Copy link
Copy Markdown
Collaborator

Thanks again for these fixes, apologies it took us a bit longer. Thanks as well @Rowlando13 for the rebase!

kdeldycke added a commit to kdeldycke/click that referenced this pull request Apr 30, 2026
Link to PR in changelog, move implementation details to Python code, fix changed version and align `.gitignore` syntax
@kdeldycke
Copy link
Copy Markdown
Collaborator

kdeldycke commented Apr 30, 2026

@AndreasBackx you missed some details about the documentation. I fixed them in: c07cd75 (part of #3393).

@kdeldycke kdeldycke added this to the 8.4.0 milestone Apr 30, 2026
@kdeldycke kdeldycke added bug f:completion feature: shell completion labels Apr 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug f:completion feature: shell completion

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Multi-line help text is not handled correctly in fish

3 participants