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 DCEBB3858423 for ; Sun, 6 Feb 2022 14:13:28 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org DCEBB3858423 Received: from mail-ed1-f71.google.com (mail-ed1-f71.google.com [209.85.208.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-219-a0V34LIUN1qxHD47o1wzag-1; Sun, 06 Feb 2022 09:13:27 -0500 X-MC-Unique: a0V34LIUN1qxHD47o1wzag-1 Received: by mail-ed1-f71.google.com with SMTP id m4-20020a50cc04000000b0040edb9d147cso5280975edi.15 for ; Sun, 06 Feb 2022 06:13:27 -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=QMg1NP85jVzAHsYoZUORVOfeUaUodaiCa8TsD5f/Z6w=; b=W1r3XNcZ7usMyewPRJoSMltff1cOWYQtTDrbl75atpTA+XSc8Xm6GAi2D9yGt5x3hG SCpZyoXysbmmOo2aU5ddSJBtxSK0zKElas2ri/EFx1X1QBfCOjrg/DnuxM7sarqUUisw 4tQ7xPywahc8uBhloGYLiS/Pfa1wQIAkQJOh11PZgN4YiFeL3bRzPJ4Zl6jm6iQweCvz viCkocopoy7zv4SndoqT2SIHTOblVKsBlxjiQn3iKstoYeaVSib8KXrdbIbETIzz/UkC EJIKmK3gbEgs2estMPvEyBnL10azpAwOtLUnr3k+hRxIvAuQStEb0r1H3NRinm+sG++y xD6Q== X-Gm-Message-State: AOAM532nu+SxkR/PT4ZWBAVxV+Q6wGFavak6MXyT5afvjeUC/biQ76VA xjSJwG+YDdtMrQI1BoEjSa5BlXNm7mzlGuJpxSHHARG5rIs4AWbpVD7mgWTTIQuo/KgDsHMFhn5 V3Ardxqp3v9mWtZt9u2T4L5xOHonpC/gD6MDm+ifKmUxCH1mCSIUPosioH9h8fi8SGAvklietZQ == X-Received: by 2002:a17:907:2946:: with SMTP id et6mr6347953ejc.437.1644156805742; Sun, 06 Feb 2022 06:13:25 -0800 (PST) X-Google-Smtp-Source: ABdhPJxWHjDl3e2JCs+g7Lt2Qym+G4kt0OXknELj0w/r8yMaLkcnr7OKpC8UNchYzDIff+lMGUUa/A== X-Received: by 2002:a17:907:2946:: with SMTP id et6mr6347938ejc.437.1644156805453; Sun, 06 Feb 2022 06:13:25 -0800 (PST) Received: from localhost (92.40.178.42.threembb.co.uk. [92.40.178.42]) by smtp.gmail.com with ESMTPSA id k15sm698108eds.34.2022.02.06.06.13.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 06 Feb 2022 06:13:25 -0800 (PST) From: Andrew Burgess To: gdb-patches@sourceware.org Cc: Andrew Burgess Subject: [PATCHv2 14/15] gdb/tui: relax restrictions on window max height and width Date: Sun, 6 Feb 2022 14:12:52 +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=-12.4 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_LOW, 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: Sun, 06 Feb 2022 14:13:30 -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 d7fd8411a66..6ff65052396 100644 --- a/gdb/tui/tui-win.c +++ b/gdb/tui/tui-win.c @@ -986,7 +986,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. */ @@ -994,7 +994,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