From: Andrew Burgess Date: Tue, 1 Feb 2022 21:46:29 +0000 (+0000) Subject: gdb: fix formatting for help set/show extended-prompt X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=2f6b20e2e06eab6c9adbcb678eff1c2114079dde;p=binutils-gdb.git gdb: fix formatting for help set/show extended-prompt The formatting of the help text for 'help set extended-prompt' and 'help show extended-prompt' is a little off. Here's the offending snippet: Substitutions are applied to VALUE to compute the real prompt. The currently defined substitutions are: \[ Begins a sequence of non-printing characters. \\ A backslash. \] Ends a sequence of non-printing characters. \e The ESC character. Notice that the line for '\[' is indented more that the others. Turns out this is due to how we build this help text, something which is done in Python. We extended a classes __doc__ string with some dynamically generated text. The classes doc string looks like this: """Set the extended prompt. Usage: set extended-prompt VALUE Substitutions are applied to VALUE to compute the real prompt. The currently defined substitutions are: """ Notice the closing """ are in a line of their own, and include some white space just before. It's this extra white space that's causing the problem. Fix the formatting issue by moving the """ to the end of the previous line. I then add the extra newline in at the point where the doc string is merged with the dynamically generated text. Now everything lines up correctly. --- diff --git a/gdb/python/lib/gdb/command/prompt.py b/gdb/python/lib/gdb/command/prompt.py index 1491c6a3e65..8dfa8ed91ef 100644 --- a/gdb/python/lib/gdb/command/prompt.py +++ b/gdb/python/lib/gdb/command/prompt.py @@ -28,12 +28,11 @@ class _ExtendedPrompt(gdb.Parameter): Substitutions are applied to VALUE to compute the real prompt. - The currently defined substitutions are: - """ + The currently defined substitutions are:""" # Add the prompt library's dynamically generated help to the # __doc__ string. - __doc__ = __doc__ + gdb.prompt.prompt_help() + __doc__ = __doc__ + "\n" + gdb.prompt.prompt_help() set_doc = "Set the extended prompt." show_doc = "Show the extended prompt."