From: Carles Pina i Estany <carles@pina.cat>
To: grub-devel@gnu.org
Subject: menu loop (patch)
Date: Thu, 17 Jul 2008 23:22:27 +0200 [thread overview]
Message-ID: <20080717212227.GA11725@pina.cat> (raw)
[-- Attachment #1: Type: text/plain, Size: 779 bytes --]
Hello,
I'm a Grub user (thanks for your nice work!) and I always wanted to have
a menu that "loops". Like, if you press down and you are in the last
option it goes to the first one, and if you press up but you are int he
first option goes to the last.
Attached comes a patch against revision 1718.
Of course, feel free to comment anything about it. I'm open to change,
fix, etc.
I also don't know if this functionality is not in Grub because you
thought that was better to not have this functionality.
I've copied/change a few lines (after the patch, lines 425-428 are the
same than lines 347-350). I don't think that it's needed to refactor but
if you think so I can do it.
Thank you,
--
Carles Pina i Estany GPG id: 0x8CBDAE64
http://pinux.info Manresa - Barcelona
[-- Attachment #2: menu_loop.patch --]
[-- Type: text/x-diff, Size: 835 bytes --]
Index: normal/menu.c
===================================================================
--- normal/menu.c (revision 1717)
+++ normal/menu.c (working copy)
@@ -420,6 +420,17 @@
first--;
print_entries (menu, first, offset);
}
+ else if (first==0)
+ {
+ // Highlight the last entry
+ offset = menu->size - 1;
+ if (offset > GRUB_TERM_NUM_ENTRIES - 1)
+ {
+ first = offset - (GRUB_TERM_NUM_ENTRIES - 1);
+ offset = GRUB_TERM_NUM_ENTRIES - 1;
+ }
+ print_entries (menu, first, offset);
+ }
break;
case 14:
@@ -440,6 +451,13 @@
print_entries (menu, first, offset);
}
}
+ else
+ {
+ // Highlight the first entry
+ first=0;
+ offset=0;
+ print_entries (menu, first, offset);
+ }
break;
case '\n':
next reply other threads:[~2008-07-17 21:43 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-07-17 21:22 Carles Pina i Estany [this message]
2008-07-19 15:40 ` menu loop (patch) Robert Millan
2008-07-19 17:21 ` Carles Pina i Estany
2008-07-19 19:52 ` Robert Millan
2008-07-19 22:12 ` Carles Pina i Estany
2008-07-19 23:26 ` Isaac Dupree
2008-07-19 23:31 ` Carles Pina i Estany
2008-07-19 23:45 ` Isaac Dupree
2008-07-20 4:24 ` Colin D Bennett
2008-07-19 17:34 ` Colin D Bennett
2008-07-19 19:58 ` Robert Millan
2008-07-19 20:31 ` Yoshinori K. Okuji
2008-07-19 22:06 ` Carles Pina i Estany
2008-07-19 22:15 ` Robert Millan
2008-07-19 22:28 ` Colin D Bennett
-- strict thread matches above, loose matches on Subject: below --
2008-07-20 6:21 chaac
2008-07-20 8:49 ` Carles Pina i Estany
2008-07-22 21:40 ` Robert Millan
2008-08-05 7:15 ` Vesa Jääskeläinen
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=20080717212227.GA11725@pina.cat \
--to=carles@pina.cat \
--cc=grub-devel@gnu.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.