From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: Additional xterm-mouse cleanup Date: Wed, 24 Feb 2021 22:56:31 -0500 Message-ID: References: <4ab742d461a50a1b9a0debba781a18ad@finder.org> <3e616ab0b40a4141c8688e9cdc95cdfc@finder.org> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="13188"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) Cc: "jared--- via \"Emacs development discussions.\"" To: Jared Finder Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Thu Feb 25 04:57:19 2021 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lF7mB-0003K1-46 for ged-emacs-devel@m.gmane-mx.org; Thu, 25 Feb 2021 04:57:19 +0100 Original-Received: from localhost ([::1]:56576 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lF7m9-0002ET-SL for ged-emacs-devel@m.gmane-mx.org; Wed, 24 Feb 2021 22:57:17 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:33532) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lF7lb-0001m5-On for emacs-devel@gnu.org; Wed, 24 Feb 2021 22:56:43 -0500 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:26775) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lF7lY-00032w-Sc for emacs-devel@gnu.org; Wed, 24 Feb 2021 22:56:42 -0500 Original-Received: from pmg2.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id 6D43180CFF; Wed, 24 Feb 2021 22:56:39 -0500 (EST) Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id BB57180229; Wed, 24 Feb 2021 22:56:37 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1614225397; bh=p815XvUolP4iGwBf2YT+zcLlPMM4SD0hAT174bAJaoY=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From; b=Q3gsJuJxdpt4fRWzIo3apJ3ETFLeFl5m4ErQ7N4FFPDBX/PBims8cT/DF7ZhOu3iD K2vLhHlGQmvPTmel9Y+szvNNmKkG2O3JeJBuFILHz+VciL1k4DikANTShTEPtJK8CK fvqFiSs6X6psBQyq397h+L0tR/tT6eX9dg3ChcuvbMNDxCcfv3W6SNE65NCXTs190v TvwAOTpuCFHCuXjpkE6WSNDkQsMi3htJCEatPQxgRpjcTAzefPsf3G0F/h22lwMy8a iqFTyz++WwRZ5nRsTI9pztR4p4hjLZWX1sIt4E6rAQSp+sKW5tqbZQalQZwdwIRlBW 1R9yT07HCv5Yg== Original-Received: from alfajor (unknown [216.154.41.47]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 7F1E11203E2; Wed, 24 Feb 2021 22:56:37 -0500 (EST) In-Reply-To: <3e616ab0b40a4141c8688e9cdc95cdfc@finder.org> (Jared Finder's message of "Wed, 03 Feb 2021 22:54:10 -0800") Received-SPF: pass client-ip=132.204.25.50; envelope-from=monnier@iro.umontreal.ca; helo=mailscanner.iro.umontreal.ca X-Spam_score_int: -42 X-Spam_score: -4.3 X-Spam_bar: ---- X-Spam_report: (-4.3 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:265603 Archived-At: Sorry for not answering earlier. > Ah, got it. I agree, it is mostly straightforward. To do this properly > required making an assumption that .timestamp=0 for SELECT_WINDOW_EVENT is > ok. Looking through the C code, I don't see any location that reads > .timestamp for the SELECT_WINDOW_EVENT, so I make it uniformly > 0 throughout. Updated patch attached. Looks good to me. >>>> [ Oh ... how I hate that echo area code. ] >> I have the impression that a whole lot of code can run between the >> `clear_message` and your code, so I don't immediately see why we can be >> sure that `echo_area_buffer[1]` indeed always contains the thing before >> the `clear_message`. And if it doesn't, then maybe we shouldn't try to >> revert the echo message. > > Good point. I will update my patch to have a copy of the echo area made > inside read_key_sequence. I don't see this in your patch, so I assume it'll be in a subsequent patch. >> I agree it doesn't seem easy, but in my experience "do and later undo" >> sooner or later leads to extra difficulties so I tend to prefer "delay >> the do until we're sure we want to perform it". > I completely agree with the sentiment, but I do not think it is the right > tradeoff. To delay until we're sure, we'd need to have some sort of > assumption of how terminal escape sequences are received that normal humans > would never do. Consider that the following key sequence is a mouse movement > escape sequence but is completely possible for a human to type slowly: > > ESC [ < 3 5 ; 1 9 ; 3 4 m > > What should the echo area display if it has read "ESC ["? At this point, > input-decode-map still doesn't know if this is a xterm escape sequence or > not. Right, so indeed the best we can do is to record the clear in such a way that we can undo it as faithfully as possible. This also begs the question of what I mean by "*the* clear" since there's presumably going to be one clear per byte in the above sequence. > Or to use a metaphor: this feels like you're asking for heart bypass surgery > before putting a bandage over a cut on Mr. Echo Area's elbow. Actually, I suspect it's worse than bypass surgery, because it requires an oracle. Stefan