All of lore.kernel.org
 help / color / mirror / Atom feed
From: Robert Millan <rmh@aybabtu.com>
To: The development of GRUB 2 <grub-devel@gnu.org>
Subject: Re: [PATCH] fix flickering timeout message for slow terminals (gfxterm)
Date: Tue, 15 Jan 2008 00:18:55 +0100	[thread overview]
Message-ID: <20080114231855.GA18277@thorin> (raw)
In-Reply-To: <20080114203225.GA21792@nubol.oskuro.net>

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

On Mon, Jan 14, 2008 at 09:32:25PM +0100, Jordi Mallach wrote:
> Hi Robert,
> 
> On Mon, Jan 14, 2008 at 03:10:15PM +0100, Robert Millan wrote:
> > +      char *prelude = "   The highlighted entry will be booted automatically in";
> > +      grub_printf ("%s %ds.    ", second_stage ? "" : prelude, timeout);
> 
> As you feared, this is not nice from a i18n POV. Concatenating strings
> like this will make the message untranslatable for a number of
> languages.

Is this better?

-- 
Robert Millan

<GPLv2> I know my rights; I want my phone call!
<DRM> What use is a phone call, if you are unable to speak?
(as seen on /.)

[-- Attachment #2: flickering_timeout.diff --]
[-- Type: text/x-diff, Size: 2092 bytes --]


	* normal/menu.c (run_menu): Move timeout message to a separate
	(local) function, print_timeout().  Use print_timeout() once during
	initial draw to print the whole message, and again in every clock
	tick to update only the number of seconds.

diff -x '*~' -x configure -x config.h.in -urp grub2/normal/menu.c time/normal/menu.c
--- grub2/normal/menu.c	2008-01-05 13:10:28.000000000 +0100
+++ time/normal/menu.c	2008-01-15 00:18:12.000000000 +0100
@@ -314,6 +314,21 @@ run_menu (grub_menu_t menu, int nested)
   int first, offset;
   unsigned long saved_time;
   int default_entry;
+  int timeout;
+
+  auto void print_timeout (int);
+  void print_timeout (int second_stage)
+    {
+      /* NOTE: Do not remove the trailing space characters.
+         They are required to clear the line.  */
+      char *msg = "   The highlighted entry will be booted automatically in %ds.    ";
+      char *msg_end = grub_strchr (msg, '%');
+
+      grub_gotoxy (second_stage ? (msg_end - msg) : 0, GRUB_TERM_HEIGHT - 3);
+      grub_printf (second_stage ? msg_end : msg, timeout);
+      grub_gotoxy (GRUB_TERM_CURSOR_X, GRUB_TERM_FIRST_ENTRY_Y + offset);
+      grub_refresh ();
+    };
   
   first = 0;
   
@@ -340,11 +355,14 @@ run_menu (grub_menu_t menu, int nested)
   print_entries (menu, first, offset);
   grub_refresh ();
 
+  timeout = get_timeout ();
+
+  if (timeout > 0)
+    print_timeout (0);
+
   while (1)
     {
       int c;
-      int timeout;
-
       timeout = get_timeout ();
       
       if (timeout > 0)
@@ -357,16 +375,8 @@ run_menu (grub_menu_t menu, int nested)
 	      timeout--;
 	      set_timeout (timeout);
 	      saved_time = current_time;
+	      print_timeout (1);
 	    }
-	  
-	  grub_gotoxy (0, GRUB_TERM_HEIGHT - 3);
-	  /* NOTE: Do not remove the trailing space characters.
-	     They are required to clear the line.  */
-	  grub_printf ("\
-   The highlighted entry will be booted automatically in %d s.    ",
-		       timeout);
-	  grub_gotoxy (GRUB_TERM_CURSOR_X, GRUB_TERM_FIRST_ENTRY_Y + offset);
-	  grub_refresh ();
 	}
 
       if (timeout == 0)

  reply	other threads:[~2008-01-14 23:21 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-01-14 14:10 [PATCH] fix flickering timeout message for slow terminals (gfxterm) Robert Millan
2008-01-14 20:32 ` Jordi Mallach
2008-01-14 23:18   ` Robert Millan [this message]
2008-01-15 22:54     ` Jordi Mallach
2008-01-21 10:33       ` Marco Gerards
2008-01-21 14:18         ` Pavel Roskin
2008-01-21 14:47           ` Robert Millan
2008-01-21 15:10           ` Marco Gerards
2008-01-21 15:44             ` Robert Millan
2008-01-21 16:52               ` Marco Gerards
2008-01-21 16:59                 ` Robert Millan
2008-01-14 20:32 ` Yoshinori K. Okuji
2008-01-14 20:47   ` Robert Millan
2008-01-15 12:25     ` Marco Gerards
2008-01-15 12:41       ` Robert Millan
2008-01-15 12:51         ` Marco Gerards
2008-01-15 14:04           ` Robert Millan

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=20080114231855.GA18277@thorin \
    --to=rmh@aybabtu.com \
    --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.