From patchwork Tue Jun 18 13:09:32 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pedro Alves X-Patchwork-Id: 33180 Received: (qmail 35657 invoked by alias); 18 Jun 2019 13:09:37 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 35649 invoked by uid 89); 18 Jun 2019 13:09:37 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-26.9 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 spammy=guidelines, H*RU:209.85.221.65, UD:cli-style.h, HX-Spam-Relays-External:209.85.221.65 X-HELO: mail-wr1-f65.google.com Received: from mail-wr1-f65.google.com (HELO mail-wr1-f65.google.com) (209.85.221.65) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 18 Jun 2019 13:09:35 +0000 Received: by mail-wr1-f65.google.com with SMTP id n9so13954417wru.0 for ; Tue, 18 Jun 2019 06:09:35 -0700 (PDT) Return-Path: Received: from ?IPv6:2001:8a0:f913:f700:56ee:75ff:fe8d:232b? ([2001:8a0:f913:f700:56ee:75ff:fe8d:232b]) by smtp.gmail.com with ESMTPSA id r5sm22241196wrg.10.2019.06.18.06.09.32 (version=TLS1_3 cipher=AEAD-AES128-GCM-SHA256 bits=128/128); Tue, 18 Jun 2019 06:09:33 -0700 (PDT) Subject: Re: [RFA 0/4] Improve "show style", use style in "help" and "apropos". To: Philippe Waroquiers , gdb-patches@sourceware.org References: <20190531131903.21203-1-philippe.waroquiers@skynet.be> From: Pedro Alves Message-ID: <02aed9b6-1ce0-b48f-ed01-ef0fc0fa20b5@redhat.com> Date: Tue, 18 Jun 2019 14:09:32 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.2.1 MIME-Version: 1.0 In-Reply-To: <20190531131903.21203-1-philippe.waroquiers@skynet.be> 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 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);