Fix single newlines not collapsed in commands panel in rich mode#1844
Open
JSap0914 wants to merge 2 commits into
Open
Fix single newlines not collapsed in commands panel in rich mode#1844JSap0914 wants to merge 2 commits into
JSap0914 wants to merge 2 commits into
Conversation
In _make_command_help, the condition guarding newline collapsing was inverted: it used `markup_mode != MARKUP_MODE_RICH` instead of `markup_mode != MARKUP_MODE_MARKDOWN`, which is consistent with the rest of the file (_get_help_text and _get_parameter_help both use the MARKUP_MODE_MARKDOWN form). Effect of the bug: when rich_markup_mode='rich' (the default), any subcommand whose help text contained a single newline within its first paragraph would appear as multiple rows in the Commands panel—one row per line—instead of collapsing to a single space-joined line. The fix changes the one condition so that: - rich mode: single newlines are collapsed to spaces (correct behaviour) - markdown mode: single newlines are left for the Markdown renderer Adds a parametrized regression test covering both modes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Bug
In
_make_command_help(used to render each command's help text in the Commands panel), the condition guarding newline collapsing was inverted:This meant:
Every other function in the file uses
markup_mode != MARKUP_MODE_MARKDOWNfor the same guard (_get_help_text,_get_parameter_help).Reproducer
Before fix – Commands panel:
After fix:
Fix
Change the one condition in
_make_command_help:Verification
Result: 2 passed (rich mode and markdown mode both collapse correctly).