Replace line counter with char counter
This commit is contained in:
parent
36b71abfaa
commit
6fcebedeed
3 changed files with 16 additions and 8 deletions
|
@ -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);
|
||||
|
|
|
@ -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 ();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,18 +25,26 @@
|
|||
#include <grub/normal.h>
|
||||
#include <grub/charset.h>
|
||||
|
||||
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;
|
||||
|
|
Loading…
Reference in a new issue