From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Po Lu Newsgroups: gmane.emacs.devel Subject: Re: [PATCH] On the nasty "ghost key" problem on NS Date: Fri, 04 Nov 2022 08:32:53 +0800 Message-ID: <87leord0ei.fsf@yahoo.com> References: Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="9188"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: emacs-devel@gnu.org To: Kai Ma Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Fri Nov 04 01:43:38 2022 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 1oqko5-0002J8-Cx for ged-emacs-devel@m.gmane-mx.org; Fri, 04 Nov 2022 01:43:37 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oqkmx-0000cO-0b; Thu, 03 Nov 2022 20:42:27 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oqkdx-0002B4-6B for emacs-devel@gnu.org; Thu, 03 Nov 2022 20:33:09 -0400 Original-Received: from sonic305-22.consmr.mail.ne1.yahoo.com ([66.163.185.148]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oqkdu-0006To-Ei for emacs-devel@gnu.org; Thu, 03 Nov 2022 20:33:08 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1667521983; bh=csjhTgTYtCb5T8lV93Tu93fcBF2xGmMOc8Dn54UqdEM=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From:Subject:Reply-To; b=dpsMoMBF7BKDrAW8dRjiUgw81bZbCBcTWK6IUvq516k4vCkh9ITN5VlL3exF8oUWIr2kCasGIe+wqgnjVbZ6untCF53j2hANKUVDD17WVbUeca1rLP4X8uYtvOQ3UFEgkFT941oNMkKFEYmEXdP038wcuMMQsiKVLujJdJQcSjZQXqG95ooX6k5jijRIjGtq23KwNrixLzJTozQsW6BCC9LgYlLsBVSvDMpqWkad2PMdrFUh3gQleZwFsRXvsTW6QcL0ditwM/I8AfayeCKsiY8K/SkIFkndg2WvDULVKIAywNnmn/oxfu00X4ACrEOeNJYZFcqFYnXb5E+TfvRD1g== X-SONIC-DKIM-SIGN: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1667521983; bh=uQvJ8FAaZPjx21fMbcFg4cXU5LB+bpJONKsyZ/rqCPx=; h=X-Sonic-MF:From:To:Subject:Date:From:Subject; b=qYb49hnKCj8Y+vXaID3P68TzM6U4wQJfQAWR8bvuJ8ZztZoI0Sn4CZKpm7GRENXUrIhQsrFjuB0i9k5/KrIzpuE3tiL82pitGRgAMPc+lpkPZivnRtUGrx74EFCZe3ClJk4SHm1/IRJKl0PJg0HRca5AjQdOHGP4g3fTxTsG1XyStbAO2fRfONYVCwLP0X7vuvJaJkIQsHzDhOXkgUsYhOAt51OQR1eBg36pfvTxVERoq+jFLDKdMJ63xu0ewVZtrSBSkaTaIFTNB0GO6C1dnV/+/6vhQ5AUXIVb3b1f0QaMcykye3CnORwJDF4PGhRHZrECj4I22/La9EW7mbSVAg== X-YMail-OSG: iymUKQIVM1luzOrrjZWupXCcl_.YMMbTT_tHhfPLo6vhHbdf4JV1ON3z8Gl4pS2 .1YFu__Dcv2sMqmpCowZapYM48jI.sOC_3rMpFq2Rfd4Oa9WCeIFDC__C70TS0doGH3kEbqJcTBE BmX4ppxOxWtIG.h.W_1wJY.ZB0H9MznHjAEjSBl10oBkRilTyS7leUzj4bZQwcpDvpnFS14qN8Dx T2aTqLufJBIOV7rP.r2yc.yV61EchirYfi9oKyGy2aeaUNsXdJEhrf3wYcurnXnXBlT6C8c21vOo CiHBiLXNYuHOz3BBQ4ZnNB2mnal50.iaBypGGlUB_FyhA4HQHsz8kalGvQ3ehJcIFKi.C0tso0df v.04CbrRCWUiFZAi7voxN_ZFYB19KgUIfmJdYYe8c.bXLNr91An434yfggJZ3h5S.0Nh9Ckw5ZFt IZ969z7h6JZ0Inwrby7e6vnWhM5b6tXfDUjPc42.vZzJZaQpKx_U1pvcPbXjVDBv5FEsRK5EDWbj eCAjNpFESqJ9gbU3KL0LuVlGhyPRvfIFzDn5x20eJihy72vXHHHQben7K_JoBt8pTZrHUiUV4h_A uCW81nkwNiABjamoK9GzmWdJP8udEqE7wnHeMTb.IeCyvv8StYuKwWJ3heLL5GXuwkXg9d2ujgka H7L9xw_Y_Mh3mPK7YF7eXp_IX60Lp0GQXuZDxgROij3sQazNv6lMP6LmNuaOkz_ZKLclxGGzAA21 OvcUZQsZORiT4dDOgTweWXr_tYwuoItCZ4QuwZBo4ToTEvkyY2EOfGofEdJmc3naAvQMBdJ8C0F_ aMJRl2rgR_5CWbzPsAgONke1fT.xPkK6wS1PQZYhI4 X-Sonic-MF: Original-Received: from sonic.gate.mail.ne1.yahoo.com by sonic305.consmr.mail.ne1.yahoo.com with HTTP; Fri, 4 Nov 2022 00:33:03 +0000 Original-Received: by hermes--production-sg3-6c8895b545-mnqst (Yahoo Inc. Hermes SMTP Server) with ESMTPA ID fdf2b80439b525e1a32fb01a8e262ed0; Fri, 04 Nov 2022 00:32:59 +0000 (UTC) In-Reply-To: (Kai Ma's message of "Fri, 4 Nov 2022 02:07:39 +0800") X-Mailer: WebService/1.1.20783 mail.backend.jedi.jws.acl:role.jedi.acl.token.atz.jws.hermes.yahoo Received-SPF: pass client-ip=66.163.185.148; envelope-from=luangruo@yahoo.com; helo=sonic305-22.consmr.mail.ne1.yahoo.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, 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.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: "Emacs-devel" Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:299106 Archived-At: Kai Ma writes: > Hi all, > > Attached is a one-liner patch to the =E2=80=9Cghost key=E2=80=9D problem = on NS. (The name is made up by me.) I didn=E2=80=99t have luck finding a bu= g report (but it did happen to many to-be-liberated Mac users [1-3]), so I = decided to directly send it here. > > On certain occasions (*), the key event buffer is not cleared to be > empty even if the events have been processed. This results in a nasty > problem: when you press a key, say =E2=80=9Cy=E2=80=9D, a key that is pre= ssed earlier > will be prepended to the current key. There=E2=80=99s no way to reset the > event buffer. > > This problem is highly unpredictable, making it very hard to reproduce. A= probably quicker way: hack Emacs=E2=80=99 C codebase with corfu-auto and c= itre-mode. > > (*) The root cause is still not clear to me. It=E2=80=99s observed that > sometimes, the [interpretKeyEvents] call seems not to return. (Blocked > inside Cocoa?) And the supposedly matched =E2=80=9Cremove=E2=80=9D is nev= er > called. Now =E2=80=9CnsEvArray=E2=80=9D is left with an earlier keyDown e= vent, and > since =E2=80=9CnsEvArray=E2=80=9D is static, you have the problem as desc= ribed > above. I guess it may be some Cocoa internal changes that caused this. > > This patch is just a workaround, but it improves the current user experie= nce a bit. I am sorry, but this patch breaks compose processing. So we're certainly not installing anything like this in Emacs 29. I will try to figure out a way to reproduce the bug and why it actually happens.