make assumed terminal width on cmd help dynamic
PATCH 1/1 make assumed terminal width on cmd help dynamic
Thanks to nyu and daChaac on IRC
By default with gfxterm loaded and gfxmode set to 640*480 help command produces empty lines see [0] help command assumes a fixed width of 80 but gfxterm in 640*480 has only 77
This is a patch to fix it.
[0] http://img146.imageshack.us/my.php?image=otherlinux26xkernel64biao8.png
* commands/help.c: changed assumed terminal width from 80 to dynamic
help.c (Arbeitskopie) renamed from help.c (Revision 1723) +0 -0
@@ -21,10 +21,11 @@
#include <grub/dl.h>
#include <grub/arg.h>
#include <grub/misc.h>
+#include <grub/term.h>
/* XXX: This has to be changed into a function so the screen can be
optimally used. */
-#define TERM_WIDTH 80
+#define TERM_WIDTH GRUB_TERM_WIDTH
From: "Felix Zielcke" <[email protected]>
Sent: Sunday, July 20, 2008 3:47 PM
To: <[email protected]>
Subject: [PATCH] make assumed terminal width on cmd help dynamic
Quoted 1 line
*
commands/help.c: changed assumed terminal width from 80 to dynamic
* commands/help.c: it was using a fixed terminal width of 80. Made it dynamic
Maybe still not perfect but at least better
|15:51:43| <fzielcke> oh well i really should learn more english |15:51:49| <fzielcke> i think the changelog entry isn't that good
Yes i'm a bit lazy :)
Btw.
|15:40:06| <fzielcke> that's cool I never bothered about grub then I started to use ext4 asked for it on grub-devel bean made a patch |15:40:13| <fzielcke> and now i can give you even something back :)
Felix Zielcke <[email protected]>
* commands/help.c: Include <grub/term.h>. (TERM_WIDTH): Redefined to GRUB_TERM_WIDTH.
Thanks to Marco for the help.
I should have asked before, but i'm more a try and fail guy :)
Quoted 5 lines · Felix Zielcke
Thanks to nyu and daChaac on IRC By default with gfxterm loaded and gfxmode set to 640*480 help command produces empty lines see [0] help command assumes a fixed width of 80 but gfxterm in 640*480 has only 77
This is a patch to fix it.
Here is the changelog entry from the other mail (just resend the patch if you have a new changelog entry):
Felix Zielcke <[email protected]>
* commands/help.c: Include <grub/term.h>. (TERM_WIDTH): Redefined to GRUB_TERM_WIDTH.
(two newlines instead of one)
It would be better to replace all users of TERM_WIDTH to use GRUB_TERM_WIDTH, like you mentioned. Only ugly thing is that this is actually a function...
--
Marco
From: "Marco Gerards" <[email protected]>
Quoted 5 lines
It would be better to replace all users of
TERM_WIDTHto useGRUB_TERM_WIDTH, like you mentioned. Only ugly thing is that this is actually a function...
Here it is.
Felix Zielcke <[email protected]>
* commands/help.c: Include <grub/term.h>.
(TERM_WIDTH): Removed. Updated all uses.
help.c (Arbeitskopie) renamed from help.c (Revision 1723) +0 -0
@@ -21,11 +21,8 @@
#include <grub/dl.h>
#include <grub/arg.h>
#include <grub/misc.h>
+#include <grub/term.h>
-/* XXX: This has to be changed into a function so the screen can be
- optimally used. */
-#define TERM_WIDTH 80
-
static grub_err_tgrub_cmd_help (struct grub_arg_list *state __attribute__ ((unused)), int argc,
char **args)
@@ -43,16 +40,16 @@
{
if (cmd->flags & GRUB_COMMAND_FLAG_CMDLINE)
{
- char description[TERM_WIDTH / 2];
+ char description[GRUB_TERM_WIDTH / 2];
int desclen = grub_strlen (cmd->summary);- /* Make a string with a length of TERM_WIDTH / 2 - 1 filled
+ /* Make a string with a length of GRUB_TERM_WIDTH / 2 - 1 filled
with the description followed by spaces. */
- grub_memset (description, ' ', TERM_WIDTH / 2 - 1);
- description[TERM_WIDTH / 2 - 1] = '\0';
+ grub_memset (description, ' ', GRUB_TERM_WIDTH / 2 - 1);
+ description[GRUB_TERM_WIDTH / 2 - 1] = '\0';
grub_memcpy (description, cmd->summary,- (desclen < TERM_WIDTH / 2 - 1
- ? desclen : TERM_WIDTH / 2 - 1));
+ (desclen < GRUB_TERM_WIDTH / 2 - 1
+ ? desclen : GRUB_TERM_WIDTH / 2 - 1));
grub_printf ("%s%s", description, (cnt++) % 2 ? "\n" : " ");
} Quoted 8 lines · Felix Zielcke
From: "Marco Gerards" <[email protected]>
Quoted 5 lines
It would be better to replace all users of
TERM_WIDTHto useGRUB_TERM_WIDTH, like you mentioned. Only ugly thing is that this is actually a function...
Quoted 8 lines
Here it is.
Felix Zielcke <[email protected]>
*
commands/help.c: Include <grub/term.h>.
(TERM_WIDTH): Removed. Updated all uses.
I would say "Updated all users." or perhaps even "Updated all callers.". English is not my native language, hopefully someone can help us out ;-).
If this is updated, this patch can be applied as far as I am concerned :-)
Quoted 46 lines
Index:
commands/help.c
===================================================================help.c (Arbeitskopie) renamed from help.c (Revision 1723) +1
-4@@ -21,11 +21,8 @@ #include <grub/dl.h> #include <grub/arg.h> #include <grub/misc.h> +#include <grub/term.h> -/* XXX: This has to be changed into a function so the screen can be - optimally used. */ -#define TERM_WIDTH 80 -static
grub_err_tgrub_cmd_help(structgrub_arg_list*state__attribute__((unused)), int argc,
char **args)help.c (Arbeitskopie) renamed from help.c (Revision 1723) +6
-6@@ -43,16 +40,16 @@ { if (cmd->flags & GRUB_COMMAND_FLAG_CMDLINE) { - char description[TERM_WIDTH / 2]; + char description[GRUB_TERM_WIDTH / 2]; int desclen = grub_strlen (cmd->summary); - /* Make a string with a length of TERM_WIDTH / 2 - 1 filled + /* Make a string with a length of GRUB_TERM_WIDTH / 2 - 1 filled with the description followed by spaces. */ - grub_memset (description, ' ', TERM_WIDTH / 2 - 1); - description[TERM_WIDTH / 2 - 1] = '\0'; + grub_memset (description, ' ', GRUB_TERM_WIDTH / 2 - 1); + description[GRUB_TERM_WIDTH / 2 - 1] = '\0'; grub_memcpy (description, cmd->summary, - (desclen < TERM_WIDTH / 2 - 1 - ? desclen : TERM_WIDTH / 2 - 1)); + (desclen < GRUB_TERM_WIDTH / 2 - 1 + ? desclen : GRUB_TERM_WIDTH / 2 - 1)); grub_printf ("%s%s", description, (cnt++) % 2 ? "\n" : " "); }_______________________________________________
Grub-devel mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/grub-devel
Quoted 9 lines · Marco Gerards
Quoted 5 lines
Felix Zielcke <[email protected]>
*
commands/help.c: Include <grub/term.h>.
(TERM_WIDTH): Removed. Updated all uses.I would say "Updated all users." or perhaps even "Updated all callers.". English is not my native language, hopefully someone can help us out ;-).
If someone else wants to commit this patch, feel free to do so with the suggested change for the changelog entry. Otherwise I will commit this patch on monday.
--
Marco
Done.
Quoted 26 lines · Marco Gerards
Quoted 9 lines · Marco Gerards
Quoted 5 lines
Felix Zielcke <[email protected]>
*
commands/help.c: Include <grub/term.h>.
(TERM_WIDTH): Removed. Updated all uses.I would say "Updated all users." or perhaps even "Updated all callers.". English is not my native language, hopefully someone can help us out ;-).
If someone else wants to commit this patch, feel free to do so with the suggested change for the changelog entry. Otherwise I will commit this patch on monday.
--
Marco_______________________________________________
Grub-devel mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/grub-devel
Signature · 5 lines
Robert Millan <GPLv2> I know my rights; I want my phone call! <DRM> What good is a phone call… if you are unable to speak? (as seen on /.)
Am Sonntag, den 27.07.2008, 15:03 +0200 schrieb Robert Millan:
Quoted 2 lines
Done.
Ok, the patch I sent you attached offlist, because the one I posted inline here onlist didn't work for you, had a missing #include "grub/term.h"
Attached is a patch for it.
I don't know if you want to leave changelog untouched or want to remove the
Include <grub/term.h>.
part from the committed part and add a new block above so everyone can see I did again a mistake :)
I really hope I don't make again such a nasty little mistake.
Just in case you want a new changelog entry, but then please don't forgot to remove it from the existing one.
2008-07-27 Felix Zielcke <[email protected]>
* commands/help.c: Include <grub/term.h>.
help.c +1 -0
@@ -21,6 +21,7 @@#include <grub/dl.h> #include <grub/arg.h> #include <grub/misc.h> +#include <grub/term.h> static grub_err_t grub_cmd_help (struct grub_arg_list *state __attribute__ ((unused)), int argc,