From: Jonas Fonseca <jonas.fonseca@gmail.com>
To: Giuseppe Bilotta <giuseppe.bilotta@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: [PATCH] Popup menu
Date: Sun, 22 Feb 2009 13:15:21 +0100 [thread overview]
Message-ID: <2c6b72b30902220415q2d3cfa7dmd5fd584c89acbecc@mail.gmail.com> (raw)
In-Reply-To: <1235302820-32526-1-git-send-email-giuseppe.bilotta@gmail.com>
On Sun, Feb 22, 2009 at 12:40, Giuseppe Bilotta
<giuseppe.bilotta@gmail.com> wrote:
> Make the menu into a popup window that complements the status prompt.
>
> Signed-off-by: Giuseppe Bilotta <giuseppe.bilotta@gmail.com>
> ---
>
> We should probably consider using the high-level menu and panel features from
> ncurses if we want to do anything more complex.
First of all very cute. I take it as a comment that the menu thing I
added yesterday leaves a lot to be desired. :) I certainly agree it is
limited and would have liked to make it similar to Vim's horizontal
menu, but gave up when it got too complicated.
About using the menu, panel and maybe even the form library: Yes, it
might make sense but then again I had also hoped to maybe at some
point try to get tig running on just the terminfo interface. But I
don't know if there is any compelling reason for doing this anymore,
other than reducing the dependencies a bit.
BTW, the code doesn't handle resizing or background loading (try
starting with `tig --stat` and immediately press 'o'). To fix this I
don't know if it would be better to "rip off" the status window and
use this as the menu window. It would require a few flags to make the
resize code do the right thing.
> tig.c | 117 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-
> 1 files changed, 115 insertions(+), 2 deletions(-)
>
> diff --git a/tig.c b/tig.c
> index 20a40b9..017b05f 100644
> --- a/tig.c
> +++ b/tig.c
> @@ -6542,6 +6542,100 @@ utf8_length(const char **start, size_t skip, int *width, size_t max_width, int *
> +static void
> +menu_select(int index)
> +{
> + WINDOW *win = menu.win;
> + int width = menu.width-2;
> + if (menu.selected >= 0) {
> + menu_set_line_attr(menu.selected, LINE_TITLE_FOCUS);
> + }
> + if (index >= 0) {
> + menu_set_line_attr(index, LINE_CURSOR);
> + }
> + menu.selected = index;
> + menu_popup();
> +}
>
tig.c: In function 'menu_select':
tig.c:6629: warning: unused variable 'width'
tig.c:6628: warning: unused variable 'win'
--
Jonas Fonseca
next prev parent reply other threads:[~2009-02-22 12:17 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-02-22 11:40 [PATCH] Popup menu Giuseppe Bilotta
2009-02-22 11:40 ` [PATCH] 'tig branch' opens tig in branch view Giuseppe Bilotta
2009-02-22 12:15 ` Jonas Fonseca [this message]
2009-02-22 12:57 ` [PATCH] Popup menu Giuseppe Bilotta
2009-02-22 12:26 ` Felipe Contreras
2009-02-22 13:00 ` Giuseppe Bilotta
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=2c6b72b30902220415q2d3cfa7dmd5fd584c89acbecc@mail.gmail.com \
--to=jonas.fonseca@gmail.com \
--cc=git@vger.kernel.org \
--cc=giuseppe.bilotta@gmail.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).