[PATCH v2 3/3] kconfig: show continuation at the end of wrapped lines
From: Julian Braha
Date: Tue Nov 10 2026 - 13:00:59 EST
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@xxxxxxxxx>
---
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