]> git.ipfire.org Git - thirdparty/grub.git/commitdiff
2010-03-01 Vladimir Serbinenko <phcoder@gmail.com>
authorVladimir 'phcoder' Serbinenko <phcoder@gmail.com>
Mon, 1 Mar 2010 19:58:45 +0000 (20:58 +0100)
committerVladimir 'phcoder' Serbinenko <phcoder@gmail.com>
Mon, 1 Mar 2010 19:58:45 +0000 (20:58 +0100)
Wait for user entry basing on presence of output rather than on errors.

* include/grub/normal.h (grub_normal_get_line_counter): New proto.
(grub_install_newline_hook): Likewise.
* normal/main.c (GRUB_MOD_INIT): Call grub_install_newline_hook.
* normal/menu.c (show_menu): Check line_counter to determine presence
of output.
* normal/term.c (grub_normal_line_counter): New variable.
(grub_normal_get_line_counter): New function.
(grub_install_newline_hook): Likewise.

ChangeLog
include/grub/normal.h
normal/main.c
normal/menu.c
normal/term.c

index 2010872b1ba2d7623e8c7716dd886899aa5b19a0..5ba6dd4eb99f3f5f83247ad90d3cf255e117e546 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+2010-03-01  Vladimir Serbinenko  <phcoder@gmail.com>
+
+       Wait for user entry basing on presence of output rather than on errors.
+
+       * include/grub/normal.h (grub_normal_get_line_counter): New proto.
+       (grub_install_newline_hook): Likewise.
+       * normal/main.c (GRUB_MOD_INIT): Call grub_install_newline_hook.
+       * normal/menu.c (show_menu): Check line_counter to determine presence
+       of output.
+       * normal/term.c (grub_normal_line_counter): New variable.
+       (grub_normal_get_line_counter): New function.
+       (grub_install_newline_hook): Likewise.
+
 2010-03-01  Vladimir Serbinenko  <phcoder@gmail.com>
 
        * commands/cat.c (grub_cmd_cat): Propagate grub_gzfile_open error.
index fad1a41bab9290106ca38be5b166f8321235a650..fe45ddf71a5f2282f3701b114506c90abb69a44b 100644 (file)
@@ -110,4 +110,7 @@ void read_terminal_list (void);
 
 void grub_set_more (int onoff);
 
+int grub_normal_get_line_counter (void);
+void grub_install_newline_hook (void);
+
 #endif /* ! GRUB_NORMAL_HEADER */
index 2306427fc02c08caf79fb461fd15568fea606842..5a546748528dc53e05f64bf4eab94630f15a2ea9 100644 (file)
@@ -654,6 +654,7 @@ GRUB_MOD_INIT(normal)
 
   grub_set_history (GRUB_DEFAULT_HISTORY_SIZE);
 
+  grub_install_newline_hook ();
   grub_register_variable_hook ("pager", 0, grub_env_write_pager);
 
   /* Register a command "normal" for the rescue mode.  */
index c47e83bc295f1ed3953045cf2caf178f14fb13cf..07951dacc5d2d9c210d7b4cc96cfc22bc2962bf1 100644 (file)
@@ -559,14 +559,14 @@ show_menu (grub_menu_t menu, int nested)
         }
       else
         {
+         int lines_before = grub_normal_get_line_counter ();
           grub_errno = GRUB_ERR_NONE;
           grub_menu_execute_entry (e);
-          if (grub_errno != GRUB_ERR_NONE)
-            {
-              grub_print_error ();
-              grub_errno = GRUB_ERR_NONE;
-              grub_wait_after_message ();
-            }
+         grub_print_error ();
+         grub_errno = GRUB_ERR_NONE;
+
+          if (lines_before != grub_normal_get_line_counter ())
+           grub_wait_after_message ();
         }
     }
 
index e31d403eed058cb8ad0b13fad7afdeb1654ac79f..7bedd6799423d5ff3cf86295051a20246c765529 100644 (file)
@@ -30,6 +30,14 @@ static unsigned grub_more_lines;
 /* If the more pager is active.  */
 static int grub_more;
 
+static int grub_normal_line_counter = 0;
+
+int
+grub_normal_get_line_counter (void)
+{
+  return grub_normal_line_counter;
+}
+
 static void
 process_newline (void)
 {
@@ -41,6 +49,8 @@ process_newline (void)
       height = grub_term_height (cur);
   grub_more_lines++;
 
+  grub_normal_line_counter++;
+
   if (grub_more && grub_more_lines >= height - 1)
     {
       char key;
@@ -76,6 +86,11 @@ grub_set_more (int onoff)
     grub_more--;
 
   grub_more_lines = 0;
+}
+
+void
+grub_install_newline_hook (void)
+{
   grub_newline_hook = process_newline;
 }
 
@@ -150,7 +165,6 @@ grub_terminal_autoload_free (void)
   grub_term_output_autoload = NULL;
 }
 
-
 /* Read the file terminal.lst for auto-loading.  */
 void
 read_terminal_list (void)