kconfig: wrap long expressions in menuconfig
Get series with b4
b4 am [email protected]Versions newest first · linked by author and title
- v2 Latest3 patches 1 replyIn review
- v11 patch 4 repliesSuperseded
Changes in v2 from the cover letter
- add '\' at end of wrapped lines to indicate continuation (self-review)
- use expr_alloc_and() instead of printing literal ' && ' (self-review)
- properly support trailing '!' and leading spaces (sashiko / Nathan)
Patches in v2 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/3 | kconfig: print the output of expr_alloc_and() instead of printing '&&'scripts/ | +7 | 0 replies | |
| 2/3 | kconfig: wrap long expressions in menuconfigscripts/ scripts/ scripts/ +3 more | +35 | 1 reply | |
| 3/3 | kconfig: show continuation at the end of wrapped linesscripts/ | +4 | 0 replies |
Reviews trailers per patch
No Reviewed-by, Acked-by or Tested-by trailers for v2 yet.
Cover letter [PATCH v2 0/3] kconfig: wrap long expressions in menuconfig
In an offline conversation, Miguel Ojeda reported that scrolling horizontally in menuconfig's search to read RUST's dependencies has been slowing down debugging.
Let's wrap expressions (like in the 'Depends on', 'Selected by', or 'Range' sections) between tokens at the end of the window, such that each line begins with the same indentation. Ensure the '!' negation stays attached to the left side of the option symbol, and keep the value annotation attached to the right side when wrapping.
Additionally, write a '\' at the end of wrapped lines, to visually indicate to the reader that the line continues.
Patch 1 cleans up the existing expression printing for 'select' and 'imply' (which ANDs the select/imply targets), to properly call expr_alloc_and() and print the output of that function, instead of printing a literal ' && '. This is necessary to ensure that any '&&' at the end of those lines will wrap properly in patch 2.
Patch 2 makes the wrapping change primarily in expr_print_gstr_helper(), which already handles writing expression tokens to a growable string, but now also keeps track of the wrapping info in the 'gstr' struct because this helper is called multiple times per expression.
Patch 3 adds a visible continuation '\' to the end of each wrapped line. This is because some line wraps are not otherwise obvious to the reader, for example if a line ends with a symbol instead of an operator. (Below example uses an 80-column terminal)
Here, it would be less obvious without '\' (GPIO_TQMX86):
Depends on: GPIOLIB [=y] && (MFD_TQMX86 [=y] || COMPILE_TEST [=y]) \
&& HAS_IOPORT_MAP [=y]Note that the 'help' textbox uses the same expression printer as search, so this has the side effect of improving the formatting in 'help', too.
In the future, we should consider a larger revamp that would wrap all text in the search window, allowing us to safely disable horizontal scrolling.
---
Changes since v1:
- add '\' at end of wrapped lines to indicate continuation (self-review)
- use expr_alloc_and() instead of printing literal ' && ' (self-review)
- properly support trailing '!' and leading spaces (sashiko / Nathan)
Link to v1:
https://lore.kernel.org/all/[email protected]/
---
Julian Braha (3):
kconfig: print the output of expr_alloc_and() instead of printing '&&'
kconfig: wrap long expressions in menuconfig
kconfig: show continuation at the end of wrapped lines
scripts/kconfig/expr.c | 33 ++++++++++++++++++++++++--------- scripts/kconfig/lkc.h | 6 +++++- scripts/kconfig/mconf.c | 2 +- scripts/kconfig/menu.c | 24 +++++++++++++----------- scripts/kconfig/nconf.c | 2 +- scripts/kconfig/util.c | 2 ++ 6 files changed, 46 insertions(+), 23 deletions(-)
Signature · 1 line
2.56.0