Menu control for NPAGE and PPAGE
PATCH 1/1 Menu control for NPAGE and PPAGE
Hello,
(This patch includes the changes for GRUB_TERM_NPAGE/PPAGE macros, that I sent in a previous mail)
ChangeLog:
--------
2008-09-20 Carles Pina i Estany <[email protected]>
* normal/menu.c (run_menu): Add Previous and Next Page keys in grub-menu.
* include/grub/powerpc/ieee1275/console.h (GRUB_TERM_NPAGE):
Changed to 0x5100.
(GRUB_TERM_PPAGE): Changed to 0x4900.
* include/grub/sparc64/ieee1275/console.h: Likewise.
* include/grub/i386/pc/console.h: Likewise.
* include/grub/efi/console.h: Likewise.
--------
I've tested using several grub.cfg files.
Feel free to commit or test (I would fix any error, please send a step by step user-case that fails -number of elements in the menu, description of what you do)
Thanks,
Signature · 2 lines
Carles Pina i Estany GPG id: 0x17756391 http://pinux.info
grub/powerpc/ieee1275/console.h +2 -2
@@ -29,8 +29,8 @@#define GRUB_CONSOLE_KEY_BACKSPACE 0x0008#define GRUB_CONSOLE_KEY_HOME 0x4700#define GRUB_CONSOLE_KEY_END 0x4F00 -#define GRUB_CONSOLE_KEY_NPAGE 0x4900 -#define GRUB_CONSOLE_KEY_PPAGE 0x5100 +#define GRUB_CONSOLE_KEY_NPAGE 0x5100 +#define GRUB_CONSOLE_KEY_PPAGE 0x4900/* Initialize the console system. */ void grub_console_init (void );
grub/sparc64/ieee1275/console.h +2 -2
@@ -30,8 +30,8 @@#define GRUB_CONSOLE_KEY_BACKSPACE 0x0008#define GRUB_CONSOLE_KEY_HOME 0x4700#define GRUB_CONSOLE_KEY_END 0x4F00 -#define GRUB_CONSOLE_KEY_NPAGE 0x4900 -#define GRUB_CONSOLE_KEY_PPAGE 0x5100 +#define GRUB_CONSOLE_KEY_NPAGE 0x5100 +#define GRUB_CONSOLE_KEY_PPAGE 0x4900/* Initialize the console system. */ void grub_console_init (void );
grub/i386/pc/console.h +2 -2
@@ -29,8 +29,8 @@#define GRUB_CONSOLE_KEY_BACKSPACE 0x0008#define GRUB_CONSOLE_KEY_HOME 0x4700#define GRUB_CONSOLE_KEY_END 0x4F00 -#define GRUB_CONSOLE_KEY_NPAGE 0x4900 -#define GRUB_CONSOLE_KEY_PPAGE 0x5100 +#define GRUB_CONSOLE_KEY_NPAGE 0x5100 +#define GRUB_CONSOLE_KEY_PPAGE 0x4900#ifndef ASM_FILE
grub/efi/console.h +2 -2
@@ -29,8 +29,8 @@#define GRUB_CONSOLE_KEY_BACKSPACE 0x0008#define GRUB_CONSOLE_KEY_HOME 0x4700#define GRUB_CONSOLE_KEY_END 0x4F00 -#define GRUB_CONSOLE_KEY_NPAGE 0x4900 -#define GRUB_CONSOLE_KEY_PPAGE 0x5100 +#define GRUB_CONSOLE_KEY_NPAGE 0x5100 +#define GRUB_CONSOLE_KEY_PPAGE 0x4900#include <grub/types.h> #include <grub/symbol.h>
menu.c +46 -0
52 lines not on this page · raw message
Quoted 16 lines · Carles Pina i Estany
Hello,
(This patch includes the changes for GRUB_TERM_NPAGE/PPAGE macros, that I sent in a previous mail)
ChangeLog:
--------
2008-09-20 Carles Pina i Estany <[email protected]>
*normal/menu.c(run_menu): Add Previous and Next Page keys in grub-menu.*
include/grub/powerpc/ieee1275/console.h(GRUB_TERM_NPAGE):
Changed to0x5100.
(GRUB_TERM_PPAGE): Changed to0x4900.
Quoted 6 lines
*
include/grub/sparc64/ieee1275/console.h: Likewise.*
include/grub/i386/pc/console.h: Likewise.*
include/grub/efi/console.h: Likewise.
--------
The scancode part is merged already, please update/resync.
menu.c line 472
Quoted 7 lines
menu.c +7
-0+else + { + first = first -GRUB_TERM_NUM_ENTRIES ; + +if (first <0 ) + { + offset = offset + first;
I'd suggest using '+=' and '-=' on these to make it more readable and avoid redundancy.
menu.c line 487
Quoted 9 lines
menu.c +9
-0+case GRUB_TERM_NPAGE : +if (offset==0 ) + { + offset = offset +GRUB_TERM_NUM_ENTRIES -1 ; +if (first+offset>menu->size) + { + offset=menu->size-first-1 ; + } + }
Please add spaces around '==', '>', '+', '-', etc.
menu.c line 497
Quoted 1 line
menu.c +1
-0+if (offset > menu->size -1 || offset >GRUB_TERM_NUM_ENTRIES -1 )
Does this generate a compiler warning?
Signature · 5 lines
Robert Millan The DRM opt-in fallacy: "Your data belongs to us. We will decide when (and how) you may access your data; but nobody's threatening your freedom: we still allow you to remove your data and not access it at all."
Hello,
Quoted 17 lines · Robert Millan
Quoted 16 lines · Carles Pina i Estany
Hello,
(This patch includes the changes for GRUB_TERM_NPAGE/PPAGE macros, that I sent in a previous mail)
ChangeLog:
--------
2008-09-20 Carles Pina i Estany <[email protected]>* normal/menu.c (run_menu): Add Previous and Next Page keys in grub-menu. * include/grub/powerpc/ieee1275/console.h (GRUB_TERM_NPAGE): Changed to 0x5100. (GRUB_TERM_PPAGE): Changed to 0x4900.
Quoted 8 lines
Quoted 6 lines
*
include/grub/sparc64/ieee1275/console.h: Likewise.*
include/grub/i386/pc/console.h: Likewise.*
include/grub/efi/console.h: Likewise.
--------The scancode part is merged already, please update/resync.
done
New ChangeLog entry:
2008-09-24 Carles Pina i Estany <[email protected]>
* normal/menu.c (run_menu): Add Previous and Next Page keys in grub-menu.
Quoted 10 lines
Review
Quoted 7 lines
(quoted diff) +7
-0+ else + { + first = first - GRUB_TERM_NUM_ENTRIES; + + if (first < 0) + { + offset = offset + first;I'd suggest using '+=' and '-=' on these to make it more readable and avoid redundancy.
done!
(I'm not a bit fan of it when there is three operators like in:
offset += GRUB_TERM_NUM_ENTRIES - 1;, but yes, it's shorter :-) )
Quoted 11 lines
Review
Quoted 9 lines
(quoted diff) +9
-0+ case GRUB_TERM_NPAGE: + if (offset==0) + { + offset = offset + GRUB_TERM_NUM_ENTRIES -1 ; + if (first+offset>menu->size) + { + offset=menu->size-first-1; + } + }Please add spaces around '==', '>', '+', '-', etc.
done!
Quoted 3 lines
Review
Quoted 1 line
(quoted diff) +1
-0+ if (offset > menu->size - 1 || offset > GRUB_TERM_NUM_ENTRIES - 1)Does this generate a compiler warning?
no. At least not in my gcc:
carles@pinux:~$ gcc --version gcc (Debian 4.3.1-2) 4.3.1 ....
New patch is attached. I also improved some other thing.
Feedback is welcomed :-)
Signature · 2 lines
Carles Pina i Estany GPG id: 0x17756391 http://pinux.info
menu.c +51 -0
@@ -457,6 +457,57 @@ } }break ; + +case GRUB_TERM_PPAGE : +if (first ==0 ) + { + offset =0 ; + } +else + { + first -=GRUB_TERM_NUM_ENTRIES ; + +if (first <0 ) + { + offset += first; + first =0 ; + } + } +print_entries (menu, first, offset); +break ; + +case GRUB_TERM_NPAGE : +if (offset ==0 ) + { + offset +=GRUB_TERM_NUM_ENTRIES -1 ; +if (first+offset > menu->size) + { + offset = menu -> size-first -1 ; + } + } +else + { + first +=GRUB_TERM_NUM_ENTRIES ; + +if (first + offset >= menu->size) + { + first -=GRUB_TERM_NUM_ENTRIES ; + offset +=GRUB_TERM_NUM_ENTRIES ; + +if (offset > menu->size -1 || + offset >GRUB_TERM_NUM_ENTRIES -1 ) + { + offset = menu->size - first -1 ; + } +if (offset >GRUB_TERM_NUM_ENTRIES ) + { + first += offset -GRUB_TERM_NUM_ENTRIES +1 ; + offset =GRUB_TERM_NUM_ENTRIES -1 ; + } + } + } +print_entries (menu, first, offset); +break ;case '\n' :case '\r' :
Quoted 4 lines · Carles Pina i Estany
New patch is attached. I also improved some other thing.
Feedback is welcomed :-)
There seems to be an off-by-one problem. Try with the attached grub.cfg.
Signature · 5 lines
Robert Millan The DRM opt-in fallacy: "Your data belongs to us. We will decide when (and how) you may access your data; but nobody's threatening your freedom: we still allow you to remove your data and not access it at all."
menuentry 1 {
blah
}
menuentry 2 {
blah
}
menuentry 3 {
blah
}
menuentry 4 {
blah
}
menuentry 5 {
blah
}
menuentry 6 {
blah
}
menuentry 7 {
blah
}
menuentry 8 {
blah
}
menuentry 9 {
blah
}
menuentry 10 {
blah
}
menuentry 11 {
blah
}
Hello,
Quoted 7 lines · Robert Millan
Quoted 4 lines · Carles Pina i Estany
New patch is attached. I also improved some other thing.
Feedback is welcomed :-)
There seems to be an off-by-one problem. Try with the attached grub.cfg.
should be fine now, sorry.
There is two things that I don't like in this world:
a) program menus and menus movements
b) testing my code
:-)
(of course I tested but not this case)
Regards,
Signature · 2 lines
Carles Pina i Estany GPG id: 0x17756391 http://pinux.info
menu.c +51 -0
@@ -457,6 +457,57 @@ } }break ; + +case GRUB_TERM_PPAGE : +if (first ==0 ) + { + offset =0 ; + } +else + { + first -=GRUB_TERM_NUM_ENTRIES ; + +if (first <0 ) + { + offset += first; + first =0 ; + } + } +print_entries (menu, first, offset); +break ; + +case GRUB_TERM_NPAGE : +if (offset ==0 ) + { + offset +=GRUB_TERM_NUM_ENTRIES -1 ; +if (first + offset >= menu->size) + { + offset = menu->size - first -1 ; + } + } +else + { + first +=GRUB_TERM_NUM_ENTRIES ; + +if (first + offset >= menu->size) + { + first -=GRUB_TERM_NUM_ENTRIES ; + offset +=GRUB_TERM_NUM_ENTRIES ; + +if (offset > menu->size -1 || + offset >GRUB_TERM_NUM_ENTRIES -1 ) + { + offset = menu->size - first -1 ; + } +if (offset >GRUB_TERM_NUM_ENTRIES ) + { + first += offset -GRUB_TERM_NUM_ENTRIES +1 ; + offset =GRUB_TERM_NUM_ENTRIES -1 ; + } + } + } +print_entries (menu, first, offset); +break ;case '\n' :case '\r' :
Hi,
Quoted 3 lines · Carles Pina i Estany
There is two things that I don't like in this world:
a) program menus and menus movements
b) testing my code
[...]
Quoted 1 line
(of course I tested but not this case)
well, and want more thing that I don't like: Grub without next/prev page support :-D
Signature · 2 lines
Carles Pina i Estany GPG id: 0x17756391 http://pinux.info
Hello,
Quoted 10 lines · Carles Pina i Estany
Quoted 7 lines · Robert Millan
Quoted 4 lines · Carles Pina i Estany
New patch is attached. I also improved some other thing.
Feedback is welcomed :-)
There seems to be an off-by-one problem. Try with the attached grub.cfg.
should be fine now, sorry.
pinging... somebody has had time to check it?
Signature · 2 lines
Carles Pina i Estany GPG id: 0x17756391 http://pinux.info
Quoted 9 lines · Carles Pina i Estany
Hello,
Quoted 5 lines · Carles Pina i Estany
Quoted 4 lines · Robert Millan
Quoted 3 lines · Carles Pina i Estany
New patch is attached. I also improved some other thing.
Quoted 7 lines
Quoted 5 lines
Quoted 3 lines
Quoted 1 line
Feedback is welcomed :-)
There seems to be an off-by-one problem. Try with the attached grub.cfg.
should be fine now, sorry.
pinging... somebody has had time to check it?
I can commit it if there are no objections and my testing finds no problems.
Signature · 2 lines
Regards, Pavel Roskin
Hi,
Quoted 12 lines · Pavel Roskin
Quoted 11 lines · Carles Pina i Estany
Hello,
Quoted 7 lines · Carles Pina i Estany
Quoted 6 lines · Robert Millan
Quoted 4 lines · Carles Pina i Estany
New patch is attached. I also improved some other thing.
Feedback is welcomed :-)
Quoted 8 lines
Quoted 5 lines
Quoted 3 lines
Quoted 1 line
There seems to be an off-by-one problem. Try with the attached grub.cfg.
should be fine now, sorry.
pinging... somebody has had time to check it?
I can commit it if there are no objections and my testing finds no problems.
I don't think that will be objections, we talked about it some time ago.
I did some testing and Robert did some too (I think), if you test it and you find some problems report it to me, I will fix and we can commit soon or later.
Thanks,
Signature · 2 lines
Carles Pina i Estany GPG id: 0x17756391 http://pinux.info
Quoted 22 lines · Carles Pina i Estany
Hi,
Quoted 18 lines · Pavel Roskin
Quoted 16 lines · Carles Pina i Estany
Hello,
Quoted 10 lines · Carles Pina i Estany
Quoted 7 lines · Robert Millan
Quoted 4 lines · Carles Pina i Estany
New patch is attached. I also improved some other thing.
Feedback is welcomed :-)
There seems to be an off-by-one problem. Try with the attached grub.cfg.
should be fine now, sorry.
pinging... somebody has had time to check it?
Quoted 8 lines
Quoted 2 lines
I can commit it if there are no objections and my testing finds no problems.
I don't think that will be objections, we talked about it some time ago.
I did some testing and Robert did some too (I think), if you test it and you find some problems report it to me, I will fix and we can commit soon or later.
Hi,
Sorry for the delay, I checked this in.
Signature · 5 lines
Robert Millan The DRM opt-in fallacy: "Your data belongs to us. We will decide when (and how) you may access your data; but nobody's threatening your freedom: we still allow you to remove your data and not access it at all."