This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [RFA 0/4] Improve "show style", use style in "help" and "apropos".


On 5/31/19 2:18 PM, Philippe Waroquiers wrote:
> Improve "show style", have "help" and "apropos" styling their output.
> 
> This patch series improves the "show style" output to let the
> user visualize all the styles with one command.
> 
> "help" and "apropos" commands are now styling their output.
> 
> The "help" testing is also better factorized.

I tried this new feature today, and I admit that I felt a bit lost
with the output.  I think the reason why is that I have pagination
disabled in my .gdbinit, usually preferring to scroll up/down
than to press enter to move pagination to the next page.  So
while scrolling up, it isn't immediately obvious to me where
each of the command's docs are split.

(
 another use for "with":
  (gdb) with pagination off -- apropos -v breakpoint
)

I tried the patchlet below, to add a "-------" separator line
between commands, and to me, the guidelines help.
It also helps when styling is disabled, as with:

  (gdb) | with pagination off -- apropos -v breakpoint | less

WDYT?

>From ce57941ee6e1240f1b7c16374d6f6c18ea12053e Mon Sep 17 00:00:00 2001
From: Pedro Alves <palves@redhat.com>
Date: Tue, 18 Jun 2019 13:25:15 +0100
Subject: [PATCH] apropos

---
 gdb/cli/cli-decode.c | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/gdb/cli/cli-decode.c b/gdb/cli/cli-decode.c
index a6ddd8cc6d8..ca5751dc2f6 100644
--- a/gdb/cli/cli-decode.c
+++ b/gdb/cli/cli-decode.c
@@ -25,6 +25,7 @@
 #include "cli/cli-decode.h"
 #include "cli/cli-style.h"
 #include "common/gdb_optional.h"
+#include "readline/readline.h"
 
 /* Prototypes for local functions.  */
 
@@ -970,7 +971,18 @@ print_doc_of_command (struct cmd_list_element *c, const char *prefix,
      this documentation from the previous command help, in the likely
      case that apropos finds several commands.  */
   if (verbose)
-    fputs_filtered ("\n", stream);
+    {
+      fputc_filtered ('\n', stream);
+
+      int width;
+      rl_get_screen_size (nullptr, &width);
+      if (width > 80)
+	width = 80;
+
+      for (int i = 0; i < width; i++)
+	fputc_filtered ('-', stream);
+      fputc_filtered ('\n', stream);
+    }
 
   fprintf_styled (stream, title_style.style (),
 		  "%s%s", prefix, c->name);
-- 
2.14.5


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]