From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTPS id 72A23385782D for ; Mon, 7 Mar 2022 22:14:17 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 72A23385782D Received: from mail-wr1-f70.google.com (mail-wr1-f70.google.com [209.85.221.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-647-aFmrn5cqN6OueawYU11IPg-1; Mon, 07 Mar 2022 17:14:15 -0500 X-MC-Unique: aFmrn5cqN6OueawYU11IPg-1 Received: by mail-wr1-f70.google.com with SMTP id z16-20020adff1d0000000b001ef7dc78b23so4937848wro.12 for ; Mon, 07 Mar 2022 14:14:15 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=HVSOrcHTssuUKBl05CYoalmc7DV+W//5AXwEteU32/s=; b=LabmBvLFC+V+NZ7YSYCy8lpmSHkplHey2LZGHJOgBJNoJWNMuOAl0BxgAxZHup6QIW BH6W7qypNOFgaJ2l2GmgJIOV9E0WyfGyaIeGxtqzSmNXx1ybtX7LsoTWxu9zS4/5XUSA t8CGQxsTdyVs8hduIRYrGSPlz6c5g7cqXyOyECgFIDu9zTOGmciLh3HJkM4y4TPoBHzS qXtVylExn9pjAhxltDANxaIqPDASpeqcTVZQ4Nf7i9ybJ2PUCpVa4PRQhEtYWU5IVajD NuEWtxA1pMDz75QB1JTFvLrH48+Pfh8fWiJWMOASkpOxr2I8YEaISGVORtQXz1edPvPM tO8g== X-Gm-Message-State: AOAM533Pp93tSY7BckMyO9kcl5u8laK5KvsNDYqdpN980y7uKznlWDow rVNUBMEf5QZUe6m0/IGGkd+BdyY+mECXDSURlB8URBBVp6BtXYy6cXTZmdp9EwobUAtoYckkTPD Gu7s5R/G5bM1QG4VUSaJf998L/BGxUfwmLeZUQ8Bv+ANzpxrlVbXplGJlWoHpKlBrTaW3NShQXA == X-Received: by 2002:adf:b64c:0:b0:1e3:16d0:3504 with SMTP id i12-20020adfb64c000000b001e316d03504mr9805533wre.333.1646691251210; Mon, 07 Mar 2022 14:14:11 -0800 (PST) X-Google-Smtp-Source: ABdhPJwM2VcOiiUlUJSEwIlCo5/dIptzZVKbFpQGg37VL+wuIQyTaYPXq59+l32z2VF5bYkzbYPpHg== X-Received: by 2002:adf:b64c:0:b0:1e3:16d0:3504 with SMTP id i12-20020adfb64c000000b001e316d03504mr9805516wre.333.1646691250885; Mon, 07 Mar 2022 14:14:10 -0800 (PST) Received: from localhost (host86-134-151-205.range86-134.btcentralplus.com. [86.134.151.205]) by smtp.gmail.com with ESMTPSA id r5-20020a5d4945000000b001f06372fa9fsm18696908wrs.54.2022.03.07.14.14.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Mar 2022 14:14:10 -0800 (PST) From: Andrew Burgess To: gdb-patches@sourceware.org Cc: Andrew Burgess Subject: [PATCHv3 14/15] gdb/tui: relax restrictions on window max height and width Date: Mon, 7 Mar 2022 22:13:46 +0000 Message-Id: X-Mailer: git-send-email 2.25.4 In-Reply-To: References: MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII" X-Spam-Status: No, score=-11.8 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_SHORT, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H5, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Mar 2022 22:14:18 -0000 This commit removes some arbitrary adjustments made in tui_cmd_window::max_height, tui_win_info::max_height, and tui_win_info::max_width. These member functions all subtract some constant from the theoretical maximum height or width. I've looked back through the history a little and can see no real reason why these adjustments should be needed, with these adjustments removed all the existing tui tests still pass. However, retaining these restrictions causes some bugs, consider: (gdb) tui new-layout hsrc {-horizontal src 1 cmd 1} 1 When this layout is selected with current master, gdb will leave a 4 line gap at the bottom of the terminal. The problem is that the maximum height is restricted, for the cmd window, to 4 less than the terminal height. By removing this restriction gdb is able to size the windows to the complete terminal height, and the layout is done correctly. This 4 line restriction is also what prevents this layout from working correctly: (gdb) tui new-layout conly cmd 1 Previously, this layout would present a cmd window only, but there would be a 4 line gap at the bottom of the terminal. This issue was mentioned in an earlier commit in this series (when a different bug was fixed), but with this commit, the above layout now correctly fills the terminal. The associated test is updated. After removing the adjustment in tui_cmd_window::max_height, the implementation is now the same as the implementation in the parent class tui_win_info, so I've completely removed the max_height call from tui_cmd_window. --- gdb/testsuite/gdb.tui/new-layout.exp | 4 +++- gdb/tui/tui-command.c | 6 ------ gdb/tui/tui-command.h | 2 -- gdb/tui/tui-win.c | 4 ++-- 4 files changed, 5 insertions(+), 11 deletions(-) diff --git a/gdb/testsuite/gdb.tui/new-layout.exp b/gdb/testsuite/gdb.tui/new-layout.exp index 883c7601be7..e662b1f0b18 100644 --- a/gdb/testsuite/gdb.tui/new-layout.exp +++ b/gdb/testsuite/gdb.tui/new-layout.exp @@ -76,6 +76,8 @@ set layouts \ "21.*return 0.*$hex
"] \ [list example4 "src 1 status 0 {-horizontal cmd 1 regs 1} 1" \ {{0 0 80 11} {40 12 40 12}} ""] \ + [list example5 "{-horizontal src 1 cmd 1} 1 status 0" \ + {{0 0 40 23}} ""] \ [list cmd_only "cmd 1" {} ""]] # Helper function to verify a list of boxes. @@ -136,7 +138,7 @@ foreach_with_prefix layout $layouts { Term::check_region_contents "info win output" \ 0 0 80 24 [multi_line "info win\\s+" \ "Name\\s+Lines\\s+Columns\\s+Focus\\s+" \ - "cmd\\s+20\\s+80\\s+\\(has focus\\)\\s+" \ + "cmd\\s+24\\s+80\\s+\\(has focus\\)\\s+" \ "$gdb_prompt\\s+"] } } diff --git a/gdb/tui/tui-command.c b/gdb/tui/tui-command.c index fa8af970b0a..0f6c395f567 100644 --- a/gdb/tui/tui-command.c +++ b/gdb/tui/tui-command.c @@ -31,12 +31,6 @@ /* See tui-command.h. */ -int -tui_cmd_window::max_height () const -{ - return tui_term_height () - 4; -} - void tui_cmd_window::resize (int height_, int width_, int origin_x, int origin_y) { diff --git a/gdb/tui/tui-command.h b/gdb/tui/tui-command.h index 06cc24f6faf..6c354361d1d 100644 --- a/gdb/tui/tui-command.h +++ b/gdb/tui/tui-command.h @@ -31,8 +31,6 @@ struct tui_cmd_window : public tui_win_info DISABLE_COPY_AND_ASSIGN (tui_cmd_window); - int max_height () const override; - void refresh_window () override { } diff --git a/gdb/tui/tui-win.c b/gdb/tui/tui-win.c index 98dfcc76534..0165fe6c012 100644 --- a/gdb/tui/tui-win.c +++ b/gdb/tui/tui-win.c @@ -955,7 +955,7 @@ tui_set_win_width_command (const char *arg, int from_tty) int tui_win_info::max_height () const { - return tui_term_height () - 2; + return tui_term_height (); } /* See tui-data.h. */ @@ -963,7 +963,7 @@ tui_win_info::max_height () const int tui_win_info::max_width () const { - return tui_term_width () - 2; + return tui_term_width (); } static void -- 2.25.4