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 3/3] kconfig: show continuation at the end of wrapped lines
Date: Tue, 10 Nov 2026 17:35:26 +0000	[thread overview]
Message-ID: <20261110173526.1548434-4-julianbraha@gmail.com> (raw)
In-Reply-To: <20261110173526.1548434-1-julianbraha@gmail.com>

Add 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 name 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]

Signed-off-by: Julian Braha <julianbraha@gmail.com>
---
 scripts/kconfig/expr.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/scripts/kconfig/expr.c b/scripts/kconfig/expr.c
index 0b3f2d7bc809..a539b617b62f 100644
--- a/scripts/kconfig/expr.c
+++ b/scripts/kconfig/expr.c
@@ -1167,12 +1167,15 @@ static void expr_print_gstr_helper(void *data, struct symbol *sym, const char *s
 		if (sym_str && sym->type != S_UNKNOWN)
 			extra_length += 4 + strlen(sym_str);
 
+		extra_length += strlen(" \\");
 		last_line_length = strlen(last_cr ? last_cr + 1 : gs->s);
 
 		if (last_line_length > gs->indent + prefix_len &&
 		    last_line_length + extra_length > gs->max_width) {
 			gs->s[gs->wrap_pos] = '\0';
-			str_printf(gs, "\n%*s", gs->indent, "");
+			if (gs->s[gs->wrap_pos - 1] != ' ')
+				str_append(gs, " ");
+			str_printf(gs, "\\\n%*s", gs->indent, "");
 			while (prefix_len--)
 				str_append(gs, "!");
 			if (!sym)
-- 
2.56.0


      parent 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 [PATCH v2 0/3] kconfig: wrap long expressions in menuconfig Julian Braha
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 ` Julian Braha [this message]

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-4-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®