mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-23 15:11:16 +00:00
menuconfig: wrap long help lines
Help text for certain config options is very extensive (the text includes the names of all other options the option in question depends on). Long lines are not wrapped, making it impossible to see the list without scrolling horizontally. This patch adds some logic which wraps help screen lines at word boundaries to prevent truncating. Tested by running ARCH=powerpc make menuconfig O=/tmp/build which shows that the long lines are now wrapped, and ARCH=powerpc make xconfig O=/tmp/build to demonstrate that it still compiles and operates as expected. Signed-off-by: Vadim Bendebury <vbendeb@google.com> Signed-off-by: Michal Marek <mmarek@suse.cz>
This commit is contained in:
parent
5358db0b0e
commit
da60fbbcb6
4 changed files with 33 additions and 2 deletions
|
@ -1097,9 +1097,32 @@ void expr_fprint(struct expr *e, FILE *out)
|
|||
|
||||
static void expr_print_gstr_helper(void *data, struct symbol *sym, const char *str)
|
||||
{
|
||||
str_append((struct gstr*)data, str);
|
||||
struct gstr *gs = (struct gstr*)data;
|
||||
const char *sym_str = NULL;
|
||||
|
||||
if (sym)
|
||||
str_printf((struct gstr*)data, " [=%s]", sym_get_string_value(sym));
|
||||
sym_str = sym_get_string_value(sym);
|
||||
|
||||
if (gs->max_width) {
|
||||
unsigned extra_length = strlen(str);
|
||||
const char *last_cr = strrchr(gs->s, '\n');
|
||||
unsigned last_line_length;
|
||||
|
||||
if (sym_str)
|
||||
extra_length += 4 + strlen(sym_str);
|
||||
|
||||
if (!last_cr)
|
||||
last_cr = gs->s;
|
||||
|
||||
last_line_length = strlen(gs->s) - (last_cr - gs->s);
|
||||
|
||||
if ((last_line_length + extra_length) > gs->max_width)
|
||||
str_append(gs, "\\\n");
|
||||
}
|
||||
|
||||
str_append(gs, str);
|
||||
if (sym)
|
||||
str_printf(gs, " [=%s]", sym_str);
|
||||
}
|
||||
|
||||
void expr_gstr_print(struct expr *e, struct gstr *gs)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue