Add paging instructions to interactive prompt
v2 cover Add paging instructions to interactive prompt
This patch replaces the earlier "Enable pager by default" from Peter and Javier with the solution requested by Vladimir.
Be well,
--Robbie
Robbie Harwood (1):
normal: Add paging instructions to interactive prompt
grub-core/normal/main.c | 4 +++- grub-core/normal/term.c | 6 ++++++ include/grub/normal.h | 1 + 3 files changed, 10 insertions(+), 1 deletion(-)
Signature · 1 line
2.35.1
PATCH v2 1/1 normal: Add paging instructions to interactive prompt
Conditionally add instructions for enabling paging to the prompt of interactive shells. This is not an ideal solution, as ineractive users must always run a command in order to get the behavior they want, but it avoids problematic interactions between prompting and sourcing files.
--- grub-core/normal/main.c | 4 +++- grub-core/normal/term.c | 6 ++++++ include/grub/normal.h | 1 + 3 files changed, 10 insertions(+), 1 deletion(-)
grub-core/normal/main.c +3 -1
@@ -411,9 +411,11 @@ grub_normal_read_line_real (char **line, int cont, int nested)if (cont)/* TRANSLATORS: it's command line prompt. */ prompt =_ (">" ); -else +else if (grub_get_more ())/* TRANSLATORS: it's command line prompt. */ prompt =_ ("grub>" ); +else + prompt =_ ("(enable paging with `set pager=1`) grub>" );if (!prompt)return grub_errno;
grub-core/normal/term.c +6 -0
@@ -128,6 +128,12 @@ grub_set_more (int onoff)grub_normal_reset_more (); } +int +grub_get_more (void ) +{ +return grub_more; +} +enum {GRUB_CP437_UPDOWNARROW =0x12 ,
include/grub/normal.h +1 -0
@@ -133,6 +133,7 @@ void read_crypto_list (const char *prefix);void read_terminal_list (const char *prefix);void grub_set_more (int onoff); +int grub_get_more (void );void grub_normal_reset_more (void );
Signature · 1 line
2.35.1
Re: [PATCH v2 1/1] normal: Add paging instructions to interactive prompt
Quoted 17 lines · Robbie Harwood
Conditionally add instructions for enabling paging to the prompt of interactive shells. This is not an ideal solution, as ineractive users must always run a command in order to get the behavior they want, but it avoids problematic interactions between prompting and sourcing files.
Signed-off-by Robbie Harwood <[email protected]>--- grub-core/normal/main.c | 4 +++- grub-core/normal/term.c | 6 ++++++ include/grub/normal.h | 1 + 3 files changed, 10 insertions(+), 1 deletion(-)grub-core/normal/main.c +0
-0
grub-core/normal/main.c grub_normal_read_line_real (char **line, int cont, int nested) · line 418
Quoted 9 lines
grub-core/normal/main.c +3
-1@@ -411,9 +411,11 @@ grub_normal_read_line_real (char **line, int cont, int nested)if (cont)/* TRANSLATORS: it's command line prompt. */ prompt =_ (">" ); -else +else if (grub_get_more ())/* TRANSLATORS: it's command line prompt. */ prompt =_ ("grub>" ); +else + prompt =_ ("(enable paging with `set pager=1`) grub>" );
Do we really need to update prompt? Why do not print it once at the top of the screen after entering into normal mode first time?
Daniel
Re: [PATCH v2 1/1] normal: Add paging instructions to interactive prompt
Quoted 22 lines · Daniel Kiper
Quoted 21 lines · Robbie Harwood
Conditionally add instructions for enabling paging to the prompt of interactive shells. This is not an ideal solution, as ineractive users must always run a command in order to get the behavior they want, but it avoids problematic interactions between prompting and sourcing files.
Signed-off-by Robbie Harwood <[email protected]>--- grub-core/normal/main.c | 4 +++- grub-core/normal/term.c | 6 ++++++ include/grub/normal.h | 1 + 3 files changed, 10 insertions(+), 1 deletion(-)grub-core/normal/main.c +0
-1@@ -411,9 +411,11 @@ grub_normal_read_line_real (char **line, int cont, int nested)if (cont)/* TRANSLATORS: it's command line prompt. */ prompt =_ (">" ); -else
Quoted 8 lines
grub-core/normal/main.c grub_normal_read_line_real (char **line, int cont, int nested) · line 418
Quoted 5 lines
grub-core/normal/main.c +3
-0+else if (grub_get_more ())/* TRANSLATORS: it's command line prompt. */ prompt =_ ("grub>" ); +else + prompt =_ ("(enable paging with `set pager=1`) grub>" );Do we really need to update prompt? Why do not print it once at the top of the screen after entering into normal mode first time?
My thinking was this: if a user enters the command prompt from the menu and types "help", then not only is it not paginated, but the instructions for enabling pagination have scrolled off the screen. Rereading I do see that you and Vladimir were after the initial blob, not the command line prompt. I don't know if I agree that's sufficient... will think about it more, I guess.
Be well,
--Robbie
Re: [PATCH v2 1/1] normal: Add paging instructions to interactive prompt
Quoted 32 lines · Robbie Harwood
Quoted 22 lines · Daniel Kiper
Quoted 21 lines · Robbie Harwood
Conditionally add instructions for enabling paging to the prompt of interactive shells. This is not an ideal solution, as ineractive users must always run a command in order to get the behavior they want, but it avoids problematic interactions between prompting and sourcing files.
Signed-off-by Robbie Harwood <[email protected]>--- grub-core/normal/main.c | 4 +++- grub-core/normal/term.c | 6 ++++++ include/grub/normal.h | 1 + 3 files changed, 10 insertions(+), 1 deletion(-)grub-core/normal/main.c +0
-1@@ -411,9 +411,11 @@ grub_normal_read_line_real (char **line, int cont, int nested)if (cont)/* TRANSLATORS: it's command line prompt. */ prompt =_ (">" ); -else Quoted 8 lines
grub-core/normal/main.c grub_normal_read_line_real (char **line, int cont, int nested) · line 418
Quoted 5 lines
grub-core/normal/main.c +3
-0+else if (grub_get_more ())/* TRANSLATORS: it's command line prompt. */ prompt =_ ("grub>" ); +else + prompt =_ ("(enable paging with `set pager=1`) grub>" );Do we really need to update prompt? Why do not print it once at the top of the screen after entering into normal mode first time?
Quoted 3 lines
My thinking was this: if a user enters the command prompt from the menu and types "help", then not only is it not paginated, but the instructions for enabling pagination have scrolled off the screen.
Why do not add instructions for enabling pagination at the end of "help" command print out?
Quoted 3 lines
Rereading I do see that you and Vladimir were after the initial blob, not the command line prompt. I don't know if I agree that's sufficient... will think about it more, I guess.
OK...
Daniel