From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from eggs.gnu.org (eggs.gnu.org [IPv6:2001:470:142:3::10]) by sourceware.org (Postfix) with ESMTPS id 084063858D28 for ; Sat, 28 Jan 2023 08:35:51 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 084063858D28 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gnu.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gnu.org Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pLggg-0003Bf-8D; Sat, 28 Jan 2023 03:35:50 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=uXobN/MsAKBKsjWxaU5ZS8xZ6khiUjei5DAQK8EcM1Y=; b=o7MGrfS+ak5T D3wXjYz+04Dvz8pGHijZh+oM0ojZomAiN9CrENTX2nIe3x3uaszf2iF3XB7r2hKebu47Ek1XKumXB fB/WaMSdaDGpeEZOHhOfVZhrdYnnei7+aHcqZPPekmQMbX9dH1z7KHoqoSnku3B51K4J24LP6Dqgy VsjWut4eqsAKr68QoIMttAdu338qWDseKRfAQjzVe2OwUWXshCF4UitjvKvTT0spP7RQcz29JEpP5 usWbMsErIeSnwBqYa9KoPiCdLzgBdoOgB2VfbdhctjuRnRmMkuCT3z44rw0F72LrQV7y4shv7nO9z r33qOFIP/2OK3C9gUA9kaA==; Received: from [87.69.77.57] (helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pLggf-0002Sf-Gz; Sat, 28 Jan 2023 03:35:49 -0500 Date: Sat, 28 Jan 2023 10:35:38 +0200 Message-Id: <838rhnawf9.fsf@gnu.org> From: Eli Zaretskii To: strager Cc: gdb-patches@sourceware.org In-Reply-To: (message from strager via Gdb-patches on Fri, 27 Jan 2023 16:42:58 -0800) Subject: Re: [PATCH] gdb/tui: add 'set tui mouse-events off' to restore mouse selection References: X-Spam-Status: No, score=1.9 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_BARRACUDACENTRAL,SPF_HELO_PASS,SPF_PASS,TXREP autolearn=no autolearn_force=no version=3.4.6 X-Spam-Level: * X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: > Date: Fri, 27 Jan 2023 16:42:58 -0800 > From: strager via Gdb-patches > > Rationale: > I use the mouse with my terminal to select and copy text. In gdb, I use > the mouse to select a function name to set a breakpoint, or a variable > name to print, for example. > > When gdb is compiled with ncurses mouse support, gdb's TUI mode > intercepts mouse events. Left-clicking and dragging, which would > normally select text, seems to do nothing. This means I cannot select > text using my mouse anymore. This makes it harder to set breakpoints, > print variables, etc. > > Solution: > I tried to fix this issue by editing the 'mousemask' call to only enable > buttons 4 and 5. However, this still caused my terminal (gnome-terminal) > to not allow text to be selected. The only way I could make it work is > by calling 'mousemask (0, NULL);'. But doing so disables the mouse code > entirely, which other people might want. > > I therefore decided to make a setting in gdb called 'tui mouse-events'. > If enabled (the default), the behavior is as it is now: terminal mouse > events are given to gdb, disabling the terminal's default behavior. > If disabled (opt-in), the behavior is as it was before the year 2020: > terminal mouse events are not given to gdb, therefore the mouse can be > used to select and copy text. Thanks. > --- gdb/NEWS > +++ gdb/NEWS > @@ -17,6 +17,13 @@ maintenance print record-instruction [ N ] > prints how GDB would undo the N-th previous instruction, and if N is > positive, it prints how GDB will redo the N-th following instruction. > > +set tui mouse-events [on|off] > +show tui mouse-events > + When on (default), the TUI will interpret mouse clicks (including > scroll wheel > + presses), overwriting the terminal's default behavior (usually text > + selection). When off, the TUI will preserve the terminal's default behavior > + for mouse events. Instead of talking about overriding the terminal's behavior, this text should say that the mouse events are interpreted either by GDB or by the terminal. > +Set whether the TUI source window is displayed in ``compact'' form. > +The default display uses more space for line numbers and starts the > +source text at the next tab stop; the compact display uses only as > +much space as is needed for the line numbers in the current file, and > +only a single space to separate the line numbers from the source. This part sounds unrelated?