* [PATCH v2 0/1] Add paging instructions to interactive prompt @ 2022-10-31 19:35 Robbie Harwood 2022-10-31 19:35 ` [PATCH v2 1/1] normal: " Robbie Harwood 0 siblings, 1 reply; 5+ messages in thread From: Robbie Harwood @ 2022-10-31 19:35 UTC (permalink / raw) To: grub-devel; +Cc: Robbie Harwood, dkiper, javierm, phcoder, mchang 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(-) -- 2.35.1 ^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH v2 1/1] normal: Add paging instructions to interactive prompt 2022-10-31 19:35 [PATCH v2 0/1] Add paging instructions to interactive prompt Robbie Harwood @ 2022-10-31 19:35 ` Robbie Harwood 2022-11-03 15:58 ` Daniel Kiper 0 siblings, 1 reply; 5+ messages in thread From: Robbie Harwood @ 2022-10-31 19:35 UTC (permalink / raw) To: grub-devel; +Cc: Robbie Harwood, dkiper, javierm, phcoder, mchang 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 <rharwood@redhat.com> --- grub-core/normal/main.c | 4 +++- grub-core/normal/term.c | 6 ++++++ include/grub/normal.h | 1 + 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/grub-core/normal/main.c b/grub-core/normal/main.c index cb0e8e7fd2..d9d7c4ad28 100644 --- a/grub-core/normal/main.c +++ b/grub-core/normal/main.c @@ -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; diff --git a/grub-core/normal/term.c b/grub-core/normal/term.c index c073eb4898..eec439d9b5 100644 --- a/grub-core/normal/term.c +++ b/grub-core/normal/term.c @@ -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, diff --git a/include/grub/normal.h b/include/grub/normal.h index 218cbabcca..556fd0fada 100644 --- a/include/grub/normal.h +++ b/include/grub/normal.h @@ -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); -- 2.35.1 ^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH v2 1/1] normal: Add paging instructions to interactive prompt 2022-10-31 19:35 ` [PATCH v2 1/1] normal: " Robbie Harwood @ 2022-11-03 15:58 ` Daniel Kiper 2022-11-03 21:50 ` Robbie Harwood 0 siblings, 1 reply; 5+ messages in thread From: Daniel Kiper @ 2022-11-03 15:58 UTC (permalink / raw) To: Robbie Harwood; +Cc: grub-devel, javierm, phcoder, mchang On Mon, Oct 31, 2022 at 03:35:49PM -0400, Robbie Harwood wrote: > 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 <rharwood@redhat.com> > --- > grub-core/normal/main.c | 4 +++- > grub-core/normal/term.c | 6 ++++++ > include/grub/normal.h | 1 + > 3 files changed, 10 insertions(+), 1 deletion(-) > > diff --git a/grub-core/normal/main.c b/grub-core/normal/main.c > index cb0e8e7fd2..d9d7c4ad28 100644 > --- a/grub-core/normal/main.c > +++ b/grub-core/normal/main.c > @@ -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 ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v2 1/1] normal: Add paging instructions to interactive prompt 2022-11-03 15:58 ` Daniel Kiper @ 2022-11-03 21:50 ` Robbie Harwood 2022-11-04 12:59 ` Daniel Kiper 0 siblings, 1 reply; 5+ messages in thread From: Robbie Harwood @ 2022-11-03 21:50 UTC (permalink / raw) To: Daniel Kiper; +Cc: grub-devel, javierm, phcoder, mchang [-- Attachment #1: Type: text/plain, Size: 1726 bytes --] Daniel Kiper <dkiper@net-space.pl> writes: > On Mon, Oct 31, 2022 at 03:35:49PM -0400, Robbie Harwood wrote: >> 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 <rharwood@redhat.com> >> --- >> grub-core/normal/main.c | 4 +++- >> grub-core/normal/term.c | 6 ++++++ >> include/grub/normal.h | 1 + >> 3 files changed, 10 insertions(+), 1 deletion(-) >> >> diff --git a/grub-core/normal/main.c b/grub-core/normal/main.c >> index cb0e8e7fd2..d9d7c4ad28 100644 >> --- a/grub-core/normal/main.c >> +++ b/grub-core/normal/main.c >> @@ -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? 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 [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 861 bytes --] ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v2 1/1] normal: Add paging instructions to interactive prompt 2022-11-03 21:50 ` Robbie Harwood @ 2022-11-04 12:59 ` Daniel Kiper 0 siblings, 0 replies; 5+ messages in thread From: Daniel Kiper @ 2022-11-04 12:59 UTC (permalink / raw) To: Robbie Harwood; +Cc: grub-devel, javierm, phcoder, mchang On Thu, Nov 03, 2022 at 05:50:51PM -0400, Robbie Harwood wrote: > Daniel Kiper <dkiper@net-space.pl> writes: > > On Mon, Oct 31, 2022 at 03:35:49PM -0400, Robbie Harwood wrote: > >> 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 <rharwood@redhat.com> > >> --- > >> grub-core/normal/main.c | 4 +++- > >> grub-core/normal/term.c | 6 ++++++ > >> include/grub/normal.h | 1 + > >> 3 files changed, 10 insertions(+), 1 deletion(-) > >> > >> diff --git a/grub-core/normal/main.c b/grub-core/normal/main.c > >> index cb0e8e7fd2..d9d7c4ad28 100644 > >> --- a/grub-core/normal/main.c > >> +++ b/grub-core/normal/main.c > >> @@ -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? > > 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? > 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 ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2022-11-04 12:59 UTC | newest] Thread overview: 5+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2022-10-31 19:35 [PATCH v2 0/1] Add paging instructions to interactive prompt Robbie Harwood 2022-10-31 19:35 ` [PATCH v2 1/1] normal: " Robbie Harwood 2022-11-03 15:58 ` Daniel Kiper 2022-11-03 21:50 ` Robbie Harwood 2022-11-04 12:59 ` Daniel Kiper
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.