mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Julian Braha <julianbraha@gmail.com>
To: nathan@kernel.org, nsc@kernel.org
Cc: ojeda@kernel.org, a.hindborg@kernel.org, nico@fluxnic.net,
	rdunlap@infradead.org, grahamr@qti.qualcomm.com,
	jakub.git@horky.net, linux-kbuild@vger.kernel.org,
	linux-kernel@vger.kernel.org, rust-for-linux@vger.kernel.org,
	Julian Braha <julianbraha@gmail.com>
Subject: [PATCH v2 0/3] kconfig: wrap long expressions in menuconfig
Date: Tue, 10 Nov 2026 17:35:23 +0000	[thread overview]
Message-ID: <20261110173526.1548434-1-julianbraha@gmail.com> (raw)

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/20261010095001.265759-1-julianbraha@gmail.com/
---
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(-)

-- 
2.56.0


             reply	other threads:[~2026-11-10 17:35 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-10 17:35 Julian Braha [this message]
2026-11-10 17:35 ` [PATCH v2 1/3] kconfig: print the output of expr_alloc_and() instead of printing '&&' Julian Braha
2026-11-10 17:35 ` [PATCH v2 2/3] kconfig: wrap long expressions in menuconfig Julian Braha
2026-11-10 17:35 ` [PATCH v2 3/3] kconfig: show continuation at the end of wrapped lines Julian Braha

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261110173526.1548434-1-julianbraha@gmail.com \
    --to=julianbraha@gmail.com \
    --cc=a.hindborg@kernel.org \
    --cc=grahamr@qti.qualcomm.com \
    --cc=jakub.git@horky.net \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nathan@kernel.org \
    --cc=nico@fluxnic.net \
    --cc=nsc@kernel.org \
    --cc=ojeda@kernel.org \
    --cc=rdunlap@infradead.org \
    --cc=rust-for-linux@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®