From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Alan Third Newsgroups: gmane.emacs.bugs Subject: bug#23412: 25.1.50; GUI Emacs on Mac OS X: text is keeping shaking/re-displaying when insert text with external input method Date: Tue, 29 Oct 2019 19:20:45 +0000 Message-ID: <20191029192045.GA57404@breton.holly.idiocy.org> References: <20191028112645.GA18613@breton.holly.idiocy.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="9amGYk9869ThD9tj" Content-Transfer-Encoding: 8bit Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="219232"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Mutt/1.12.0 (2019-05-25) Cc: "23412@debbugs.gnu.org" <23412@debbugs.gnu.org> To: HaiJun Zhang Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue Oct 29 20:21:29 2019 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1iPX3X-000uql-2f for geb-bug-gnu-emacs@m.gmane.org; Tue, 29 Oct 2019 20:21:27 +0100 Original-Received: from localhost ([::1]:33056 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iPX3V-0000WF-AQ for geb-bug-gnu-emacs@m.gmane.org; Tue, 29 Oct 2019 15:21:25 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:44987) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iPX3B-0000UD-Hi for bug-gnu-emacs@gnu.org; Tue, 29 Oct 2019 15:21:09 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iPX38-0005im-Mh for bug-gnu-emacs@gnu.org; Tue, 29 Oct 2019 15:21:05 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:39798) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iPX38-0005iT-GT for bug-gnu-emacs@gnu.org; Tue, 29 Oct 2019 15:21:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1iPX38-0003lh-At for bug-gnu-emacs@gnu.org; Tue, 29 Oct 2019 15:21:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Alan Third Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 29 Oct 2019 19:21:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 23412 X-GNU-PR-Package: emacs Original-Received: via spool by 23412-submit@debbugs.gnu.org id=B23412.157237685814455 (code B ref 23412); Tue, 29 Oct 2019 19:21:02 +0000 Original-Received: (at 23412) by debbugs.gnu.org; 29 Oct 2019 19:20:58 +0000 Original-Received: from localhost ([127.0.0.1]:48619 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iPX34-0003l5-0r for submit@debbugs.gnu.org; Tue, 29 Oct 2019 15:20:58 -0400 Original-Received: from mail-wm1-f42.google.com ([209.85.128.42]:56112) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iPX31-0003kn-6I for 23412@debbugs.gnu.org; Tue, 29 Oct 2019 15:20:55 -0400 Original-Received: by mail-wm1-f42.google.com with SMTP id g24so3839879wmh.5 for <23412@debbugs.gnu.org>; Tue, 29 Oct 2019 12:20:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20161025; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=emRm+2aXTKOXEdeg7aK8GJsPkGRmGx224VhaOhKF4Vk=; b=m60Ig0VqwTc+pfsg8dzUXzjcufB6qbRKK+NFf1JwFpi9e9XfLDSTkmkBWk35MM9MWG EVOxObNlv8ZnktjkwF0Sj8di30gJTs664Y72PKJY5KucxSAMffrP3auNXgPO1meE1kjq e9AiHkTSaGWufiWSUl/dXM+lQ2T2PC3pH6/pwdDG9xU2QqcdWHE2xjyeWb2UHdTTqxep i8QPXybcpNQEQ/E+grktYhIXZKkYb8BFvjHXBu27WEWhAVHwiGRI7fPMzu79CZte5ePO 0SYPJKdF0MupJ3qFf+vfQX05RsdfTg8f67L5F1AhgqoAGbKn7tzaPlD3e52eWIfJE8A3 F7/Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :references:mime-version:content-disposition :content-transfer-encoding:in-reply-to:user-agent; bh=emRm+2aXTKOXEdeg7aK8GJsPkGRmGx224VhaOhKF4Vk=; b=nlyrUx++9sqoJfXAhwz9KaUGs0Q4b7nWsWtOBQnLlMcj7zr3w3DDuprKIBdOESjT0n bf51WE/YAuCzypqulC0MjHeBQw7lImcu62cb1iLo7RvcCwOfSmrtrNTLNcg+YKmfG6qf RIflxnMIbw7eLMkoVYhsQtCeM1h4F4/WiJJ0WW11t2Hc+Md90qbWvHV7816SkCr/QVWW Ofo6YrDu/iovxfJzUaiFV2K8e54RTPFK6Z9gXw+Kv8QWHyHmtTAKlpK9625ioEsVe/aI IVbm+mgrKDQZr0IE57J0dFVVb56q96YZfD7Ztc6cLeFM2uSJ1l58HDqg8RlP9YQK47UD flZg== X-Gm-Message-State: APjAAAWCniqeavDuSTOd1cu3zkAvEC3ZQ7eRj1mZ5uLy81FoaQ/0e51u iiMO4dPOgWauEMnDCvL59cI= X-Google-Smtp-Source: APXvYqx6GxwObLjxQ8RQGhnUdxrGyFMnq6Yd34Kr25bBXEjpgz6aKEXVa0Vx3XtQ55kqnUUtYztXqQ== X-Received: by 2002:a1c:1947:: with SMTP id 68mr5366054wmz.139.1572376849056; Tue, 29 Oct 2019 12:20:49 -0700 (PDT) Original-Received: from breton.holly.idiocy.org (ip6-2001-08b0-03f8-8129-05f7-c8dd-14f5-1780.holly.idiocy.org. [2001:8b0:3f8:8129:5f7:c8dd:14f5:1780]) by smtp.gmail.com with ESMTPSA id h124sm4536295wmf.30.2019.10.29.12.20.47 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 29 Oct 2019 12:20:47 -0700 (PDT) Content-Disposition: inline In-Reply-To: X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:170377 Archived-At: --9amGYk9869ThD9tj Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit On Tue, Oct 29, 2019 at 01:24:11PM +0000, HaiJun Zhang wrote: > I tried the patch. It works well for almost all the use cases except the following one: > Press ESC to cancel the input. The working text will not be cleared > as before. It will be cleared after inputting another char or > pressing ENTER. That makes sense. It looks like there is no explicit clear from the toolkit. > I think there are cases like the above when only > ’ns-unput-working-text is fired without following > ’ns-put-working-text. > > In my modified ns-unput-working-text, it processes these cases. If > the new working text is the same as the old one, then there will be > no following ’ns-put-working-text and it clears the working text. > Maybe the checking can be done in C? I think in C we can get away with just checking whether the new text is empty. If there is any text at all then replacing the working text seems to do the right thing, even if the new text is shorter than the old. I could be wrong, though, I’ve never really used these input methods so don’t know if there are things I’m not testing. New patch attached, please try it and let me know how it goes. -- Alan Third --9amGYk9869ThD9tj Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="0001-Prevent-text-flicker-with-macOS-input-methods-bug-23.patch" >From dd965985108e36ab3e559834963765a23a44ca2b Mon Sep 17 00:00:00 2001 From: Alan Third Date: Mon, 28 Oct 2019 11:21:29 +0000 Subject: [PATCH] Prevent text flicker with macOS input methods (bug#23412) * src/nsterm.m ([EmacsView setMarkedText:selectedRange:]): Don't always delete the working text as ns-put-working-text does that. --- src/nsterm.m | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/nsterm.m b/src/nsterm.m index 5583c6105c..afe7069aae 100644 --- a/src/nsterm.m +++ b/src/nsterm.m @@ -6435,15 +6435,17 @@ - (void)setMarkedText: (id)aString selectedRange: (NSRange)selRange (unsigned long)selRange.length, (unsigned long)selRange.location); - if (workingText != nil) - [self deleteWorkingText]; if ([str length] == 0) - return; + { + [self deleteWorkingText]; + return; + } if (!emacs_event) return; processingCompose = YES; + [workingText release]; workingText = [str copy]; ns_working_text = build_string ([workingText UTF8String]); -- 2.21.0 --9amGYk9869ThD9tj--