From: Michal Marek <mmarek@suse.cz>
To: "\"Vadim Bendebury (вб)\"" <vbendeb@google.com>
Cc: linux-kbuild@vger.kernel.org
Subject: Re: [PATCH] wrap long help lines
Date: Sat, 12 Dec 2009 12:27:56 +0100 [thread overview]
Message-ID: <4B237E3C.2080603@suse.cz> (raw)
In-Reply-To: <3b09bd800912110901t106bb3a6td581537e151d5ce0@mail.gmail.com>
Vadim Bendebury (вб) napsal(a):
> Hi Michal, thank you for your comments. Please see my further questions below:
>
> 2009/12/11 Michal Marek <mmarek@suse.cz>:
>> Vadim Bendebury napsal(a):
>>> Help text for certain config options is very extensive (the text includes all
>>> config options which the option in question depends on). Long lines are not
>>> wrapped, making it impossible to see the list.
>>>
>>> This patch adds a function to wrap long lines to fit the screen width and
>>> makes sure the function is invoked after help text is prepared.
>> Hi Vadim,
>>
>> I think that wrapping long lines in menuconfig is a good idea, but I
>> have a few problems with your patch.
>>
>
> this was just an attempt to get the discussion going :-)
>
>>> diff --git a/scripts/kconfig/expr.c b/scripts/kconfig/expr.c
>>> index edd3f39..2aa49e8 100644
>>> --- a/scripts/kconfig/expr.c
>>> +++ b/scripts/kconfig/expr.c
>>> @@ -1083,6 +1083,8 @@ void expr_print(struct expr *e, void (*fn)(void *, struct symbol *, const char *
>>> }
>>> if (expr_compare_type(prevtoken, e->type) > 0)
>>> fn(data, NULL, ")");
>>> +
>>> + str_screen_wrap(data, "||");
>>> }
>> expr_print() is not the right place to do it. data is a opaque pointer,
>> you can't assume that it's a pointer to struct gstr. qconf passes some
>> class pointer here, there is code to dump symbol info to a filehandle.
>> This should be done in the actual interface program, not in this generic
>> code.
>>
>
> well, I picked this spot because this is where just the last line of
> the text might require wrapping, this makes the wrapping function
> simpler.
>
> What do you think of mconf:show_help() before invoking
> show_help_text() - is it the right spot to plug this in? Do you have a
> suggestion?
If you look at the expr_print() prototype, it takes a pointer to a
callback and a data argument. This callback gets repeatedly called to
store or display parts of the text. So you could create a new callback
that pastes the parts together and inserts a newline if needed. That
way, you don't have to memcpy() the text around afterwards.
> And this brings the main question: how do we tell the window width in
> different modes? Do we care to do this wrap in other than text
> terminal modes?
Qt and Gtk use widgets that take care of proper wrapping. oldconfig just
prints the text on the terminal which does the wrapping (not at word
boundaries, but that's IMO not an issue). So it's really just menuconfig
(and nconfig, but porting your change to nconfig should be trivial).
Michal
next prev parent reply other threads:[~2009-12-12 11:27 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-12-11 17:01 [PATCH] wrap long help lines Vadim Bendebury (вб)
2009-12-12 11:27 ` Michal Marek [this message]
2009-12-13 3:59 ` Vadim Bendebury (вб)
2009-12-14 14:19 ` Michal Marek
-- strict thread matches above, loose matches on Subject: below --
2009-12-11 5:14 Vadim Bendebury (вб)
2009-12-10 16:36 [PATCH} " Vadim Bendebury
2009-12-10 16:57 ` Randy Dunlap
2009-12-10 17:13 ` Vadim Bendebury (вб)
2009-12-11 14:34 ` Michal Marek
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=4B237E3C.2080603@suse.cz \
--to=mmarek@suse.cz \
--cc=linux-kbuild@vger.kernel.org \
--cc=vbendeb@google.com \
/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;
as well as URLs for NNTP newsgroup(s).