All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] make assumed terminal width on cmd help dynamic
@ 2008-07-20 13:47 Felix Zielcke
  2008-07-20 13:53 ` Felix Zielcke
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Felix Zielcke @ 2008-07-20 13:47 UTC (permalink / raw)
  To: grub-devel

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

Index: commands/help.c
===================================================================
--- commands/help.c     (Revision 1723)
+++ commands/help.c     (Arbeitskopie)
@@ -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
 



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] make assumed terminal width on cmd help dynamic
  2008-07-20 13:47 [PATCH] make assumed terminal width on cmd help dynamic Felix Zielcke
@ 2008-07-20 13:53 ` Felix Zielcke
  2008-07-20 14:08 ` Felix Zielcke
  2008-07-20 18:16 ` Marco Gerards
  2 siblings, 0 replies; 9+ messages in thread
From: Felix Zielcke @ 2008-07-20 13:53 UTC (permalink / raw)
  To: The development of GRUB 2

From: "Felix Zielcke" <fzielcke@z-51.de>
Sent: Sunday, July 20, 2008 3:47 PM
To: <grub-devel@gnu.org>
Subject: [PATCH] make assumed terminal width on cmd help dynamic


> * 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 :) 




^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] make assumed terminal width on cmd help dynamic
  2008-07-20 13:47 [PATCH] make assumed terminal width on cmd help dynamic Felix Zielcke
  2008-07-20 13:53 ` Felix Zielcke
@ 2008-07-20 14:08 ` Felix Zielcke
  2008-07-20 18:16 ` Marco Gerards
  2 siblings, 0 replies; 9+ messages in thread
From: Felix Zielcke @ 2008-07-20 14:08 UTC (permalink / raw)
  To: The development of GRUB 2

Felix Zielcke <fzielcke@z-51.de>


	* 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 :) 



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] make assumed terminal width on cmd help dynamic
  2008-07-20 13:47 [PATCH] make assumed terminal width on cmd help dynamic Felix Zielcke
  2008-07-20 13:53 ` Felix Zielcke
  2008-07-20 14:08 ` Felix Zielcke
@ 2008-07-20 18:16 ` Marco Gerards
  2008-07-20 18:52   ` Felix Zielcke
  2 siblings, 1 reply; 9+ messages in thread
From: Marco Gerards @ 2008-07-20 18:16 UTC (permalink / raw)
  To: The development of GRUB 2

"Felix Zielcke" <fzielcke@z-51.de> writes:

> 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 <fzielcke@z-51.de>


	* 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




^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] make assumed terminal width on cmd help dynamic
  2008-07-20 18:16 ` Marco Gerards
@ 2008-07-20 18:52   ` Felix Zielcke
  2008-07-20 19:41     ` Marco Gerards
  0 siblings, 1 reply; 9+ messages in thread
From: Felix Zielcke @ 2008-07-20 18:52 UTC (permalink / raw)
  To: The development of GRUB 2

From: "Marco Gerards" <mgerards@xs4all.nl>

> 
> 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...
> 

Here it is.


Felix Zielcke <fzielcke@z-51.de>


	* commands/help.c: Include <grub/term.h>.
	(TERM_WIDTH): Removed.  Updated all uses.



Index: commands/help.c
===================================================================
--- commands/help.c     (Revision 1723)
+++ commands/help.c     (Arbeitskopie)
@@ -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_t
 grub_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" : " ");
            } 



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] make assumed terminal width on cmd help dynamic
  2008-07-20 18:52   ` Felix Zielcke
@ 2008-07-20 19:41     ` Marco Gerards
  2008-07-26  9:14       ` Marco Gerards
  0 siblings, 1 reply; 9+ messages in thread
From: Marco Gerards @ 2008-07-20 19:41 UTC (permalink / raw)
  To: The development of GRUB 2

"Felix Zielcke" <fzielcke@z-51.de> writes:

> From: "Marco Gerards" <mgerards@xs4all.nl>
>
>>
>> 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...
>>
>
> Here it is.
>
>
> Felix Zielcke <fzielcke@z-51.de>
>
>
> 	* 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 :-)

> Index: commands/help.c
> ===================================================================
> --- commands/help.c     (Revision 1723)
> +++ commands/help.c     (Arbeitskopie)
> @@ -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_t
> grub_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" : " ");
>            }
>
>
> _______________________________________________
> Grub-devel mailing list
> Grub-devel@gnu.org
> http://lists.gnu.org/mailman/listinfo/grub-devel




^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] make assumed terminal width on cmd help dynamic
  2008-07-20 19:41     ` Marco Gerards
@ 2008-07-26  9:14       ` Marco Gerards
  2008-07-27 13:03         ` Robert Millan
  0 siblings, 1 reply; 9+ messages in thread
From: Marco Gerards @ 2008-07-26  9:14 UTC (permalink / raw)
  To: The development of GRUB 2

Marco Gerards <mgerards@xs4all.nl> writes:

>> Felix Zielcke <fzielcke@z-51.de>
>>
>>
>> 	* 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




^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] make assumed terminal width on cmd help dynamic
  2008-07-26  9:14       ` Marco Gerards
@ 2008-07-27 13:03         ` Robert Millan
  2008-07-27 15:50           ` Felix Zielcke
  0 siblings, 1 reply; 9+ messages in thread
From: Robert Millan @ 2008-07-27 13:03 UTC (permalink / raw)
  To: The development of GRUB 2


Done.

On Sat, Jul 26, 2008 at 11:14:30AM +0200, Marco Gerards wrote:
> Marco Gerards <mgerards@xs4all.nl> writes:
> 
> >> Felix Zielcke <fzielcke@z-51.de>
> >>
> >>
> >> 	* 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
> Grub-devel@gnu.org
> http://lists.gnu.org/mailman/listinfo/grub-devel
> 

-- 
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 /.)



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] make assumed terminal width on cmd help dynamic
  2008-07-27 13:03         ` Robert Millan
@ 2008-07-27 15:50           ` Felix Zielcke
  0 siblings, 0 replies; 9+ messages in thread
From: Felix Zielcke @ 2008-07-27 15:50 UTC (permalink / raw)
  To: The development of GRUB 2

[-- Attachment #1: Type: text/plain, Size: 722 bytes --]

Am Sonntag, den 27.07.2008, 15:03 +0200 schrieb Robert Millan:
> 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 <fzielcke@z-51.de>

        * commands/help.c: Include <grub/term.h>.


[-- Attachment #2: help_include.diff --]
[-- Type: text/x-patch, Size: 374 bytes --]

Index: commands/help.c
===================================================================
--- commands/help.c	(Revision 1739)
+++ commands/help.c	(Arbeitskopie)
@@ -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,

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2008-07-27 15:51 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-07-20 13:47 [PATCH] make assumed terminal width on cmd help dynamic Felix Zielcke
2008-07-20 13:53 ` Felix Zielcke
2008-07-20 14:08 ` Felix Zielcke
2008-07-20 18:16 ` Marco Gerards
2008-07-20 18:52   ` Felix Zielcke
2008-07-20 19:41     ` Marco Gerards
2008-07-26  9:14       ` Marco Gerards
2008-07-27 13:03         ` Robert Millan
2008-07-27 15:50           ` Felix Zielcke

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.