From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id 0rJmIBKba1/jYwAAWB0awg (envelope-from ) for ; Wed, 23 Sep 2020 14:59:30 -0400 Received: by simark.ca (Postfix, from userid 112) id 754BE1EE05; Wed, 23 Sep 2020 14:59:30 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=MAILING_LIST_MULTI, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id 4288F1E990 for ; Wed, 23 Sep 2020 14:59:27 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 86BBB3870908; Wed, 23 Sep 2020 18:59:26 +0000 (GMT) Received: from rock.gnat.com (rock.gnat.com [IPv6:2620:20:4000:0:a9e:1ff:fe9b:1d1]) by sourceware.org (Postfix) with ESMTP id B38C73857C45 for ; Wed, 23 Sep 2020 18:59:24 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org B38C73857C45 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=adacore.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=tromey@adacore.com Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id 65B84117645; Wed, 23 Sep 2020 14:59:24 -0400 (EDT) X-Virus-Scanned: Debian amavisd-new at gnat.com Received: from rock.gnat.com ([127.0.0.1]) by localhost (rock.gnat.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id o7p0xI05MgBv; Wed, 23 Sep 2020 14:59:24 -0400 (EDT) Received: from murgatroyd.Home (75-166-120-119.hlrn.qwest.net [75.166.120.119]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by rock.gnat.com (Postfix) with ESMTPSA id 233A4117644; Wed, 23 Sep 2020 14:59:24 -0400 (EDT) From: Tom Tromey To: gdb-patches@sourceware.org Subject: [PATCH] Don't let TUI focus on locator Date: Wed, 23 Sep 2020 12:59:21 -0600 Message-Id: <20200923185921.1006372-1-tromey@adacore.com> X-Mailer: git-send-email 2.26.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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: , Cc: Tom Tromey Errors-To: gdb-patches-bounces@sourceware.org Sender: "Gdb-patches" PR tui/26638 notes that the C-x o binding can put the focus on the locator window. However, this is not useful and did not happen historically. This patch changes the TUI to skip this window when switching focus. gdb/ChangeLog 2020-09-23 Tom Tromey PR tui/26638: * tui/tui-data.c (tui_next_win): Exclude the locator. (tui_prev_win): Rewrite. --- gdb/ChangeLog | 6 ++++++ gdb/tui/tui-data.c | 35 +++++++++++++++++++++++++++-------- 2 files changed, 33 insertions(+), 8 deletions(-) diff --git a/gdb/tui/tui-data.c b/gdb/tui/tui-data.c index 8f7d257e945..0d2b2219439 100644 --- a/gdb/tui/tui-data.c +++ b/gdb/tui/tui-data.c @@ -23,6 +23,7 @@ #include "symtab.h" #include "tui/tui.h" #include "tui/tui-data.h" +#include "tui/tui-stack.h" #include "tui/tui-win.h" #include "tui/tui-wingeneral.h" #include "tui/tui-winsource.h" @@ -113,9 +114,18 @@ tui_next_win (struct tui_win_info *cur_win) auto iter = std::find (tui_windows.begin (), tui_windows.end (), cur_win); gdb_assert (iter != tui_windows.end ()); - ++iter; - if (iter == tui_windows.end ()) - return tui_windows[0]; + gdb_assert (cur_win != tui_locator_win_info_ptr ()); + /* This won't loop forever since we can't have just a locator + window. */ + while (true) + { + ++iter; + if (iter == tui_windows.end ()) + iter = tui_windows.begin (); + if (*iter != tui_locator_win_info_ptr ()) + break; + } + return *iter; } @@ -125,12 +135,21 @@ tui_next_win (struct tui_win_info *cur_win) struct tui_win_info * tui_prev_win (struct tui_win_info *cur_win) { - auto iter = std::find (tui_windows.begin (), tui_windows.end (), cur_win); - gdb_assert (iter != tui_windows.end ()); + auto iter = std::find (tui_windows.rbegin (), tui_windows.rend (), cur_win); + gdb_assert (iter != tui_windows.rend ()); + + gdb_assert (cur_win != tui_locator_win_info_ptr ()); + /* This won't loop forever since we can't have just a locator + window. */ + while (true) + { + ++iter; + if (iter == tui_windows.rend ()) + iter = tui_windows.rbegin (); + if (*iter != tui_locator_win_info_ptr ()) + break; + } - if (iter == tui_windows.begin ()) - return tui_windows.back (); - --iter; return *iter; } -- 2.26.2