From 6fcebedeeda11d284a35ca231e7cce95be9e6d49 Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Tue, 23 Mar 2010 16:51:53 +0100 Subject: [PATCH] Replace line counter with char counter --- include/grub/normal.h | 2 +- normal/menu.c | 4 ++-- normal/term.c | 18 +++++++++++++----- 3 files changed, 16 insertions(+), 8 deletions(-) diff --git a/include/grub/normal.h b/include/grub/normal.h index 6ec14d31a..a5352cdcf 100644 --- a/include/grub/normal.h +++ b/include/grub/normal.h @@ -112,7 +112,7 @@ void read_terminal_list (void); void grub_set_more (int onoff); -int grub_normal_get_line_counter (void); +int grub_normal_get_char_counter (void); void grub_install_newline_hook (void); void grub_xputs_normal (const char *str); diff --git a/normal/menu.c b/normal/menu.c index e96c99efd..60311970f 100644 --- a/normal/menu.c +++ b/normal/menu.c @@ -558,13 +558,13 @@ show_menu (grub_menu_t menu, int nested) } else { - int lines_before = grub_normal_get_line_counter (); + int chars_before = grub_normal_get_char_counter (); grub_errno = GRUB_ERR_NONE; grub_menu_execute_entry (e); grub_print_error (); grub_errno = GRUB_ERR_NONE; - if (lines_before != grub_normal_get_line_counter ()) + if (chars_before != grub_normal_get_char_counter ()) grub_wait_after_message (); } } diff --git a/normal/term.c b/normal/term.c index 9488f68bc..493127b65 100644 --- a/normal/term.c +++ b/normal/term.c @@ -25,18 +25,26 @@ #include #include +struct term_state +{ + struct term_state *next; + struct grub_unicode_glyph *backlog; + int numlines; + char *term_name; +}; + /* The amount of lines counted by the pager. */ static unsigned grub_more_lines; /* If the more pager is active. */ static int grub_more; -static int grub_normal_line_counter = 0; +static int grub_normal_char_counter = 0; int -grub_normal_get_line_counter (void) +grub_normal_get_char_counter (void) { - return grub_normal_line_counter; + return grub_normal_char_counter; } static void @@ -50,8 +58,6 @@ 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; @@ -340,6 +346,8 @@ putglyph (const struct grub_unicode_glyph *c, struct grub_term_output *term) .estimated_width = 1 }; + grub_normal_char_counter++; + if (c->base == '\t' && term->getxy) { int n;