unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Alan Third <alan@idiocy.org>
To: HaiJun Zhang <netjune@outlook.com>
Cc: "23412@debbugs.gnu.org" <23412@debbugs.gnu.org>
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	[thread overview]
Message-ID: <20191029192045.GA57404@breton.holly.idiocy.org> (raw)
In-Reply-To: <PS1PR03MB3606935695D958777B1192ADB7610@PS1PR03MB3606.apcprd03.prod.outlook.com>

[-- Attachment #1: Type: text/plain, Size: 1185 bytes --]

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

[-- Attachment #2: 0001-Prevent-text-flicker-with-macOS-input-methods-bug-23.patch --]
[-- Type: text/plain, Size: 1087 bytes --]

From dd965985108e36ab3e559834963765a23a44ca2b Mon Sep 17 00:00:00 2001
From: Alan Third <alan@idiocy.org>
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


  reply	other threads:[~2019-10-29 19:20 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <bebc4ca8-0a58-4ea0-8fb1-4dbb6d18e335@Spark>
2016-05-01  8:54 ` bug#23412: 25.1.50; GUI Emacs on Mac OS X: text is keeping shaking/re-displaying when insert text with external input method Chunyang Xu
2016-05-01 15:07   ` Eli Zaretskii
2016-05-01 15:35     ` Chunyang Xu
2016-05-27 19:16   ` Alan Third
2016-05-27 20:13     ` Chunyang Xu
2017-04-26 17:43   ` hylom
2017-05-01 12:26   ` bug#23412: Can this bug be fixed now? 张海君
2019-10-27 11:49   ` bug#23412: 25.1.50; GUI Emacs on Mac OS X: text is keeping shaking/re-displaying when insert text with external input method HaiJun Zhang
2019-10-28 11:26     ` Alan Third
2019-10-29 13:24       ` HaiJun Zhang
2019-10-29 19:20         ` Alan Third [this message]
2019-10-30  1:15           ` HaiJun Zhang
2019-10-31 20:53             ` Alan Third
2019-12-05 11:21               ` Stefan Kangas
2019-12-05 14:43                 ` Alan Third
2019-12-04 11:19   ` bug#23412: tsuucat via Bug reports for GNU Emacs, the Swiss army knife of text editors
2019-12-04 22:50     ` bug#23412: HaiJun Zhang
2019-12-17  9:18   ` bug#23412: 25.1.50; GUI Emacs on Mac OS X: text is keeping shaking/re-displaying when insert text with external input method tsuucat via Bug reports for GNU Emacs, the Swiss army knife of text editors
2019-12-17 20:28     ` Alan Third
2019-12-18 15:55       ` tsuucat via Bug reports for GNU Emacs, the Swiss army knife of text editors
2019-12-18 20:44         ` Alan Third
2019-12-19  0:31           ` tsuucat via Bug reports for GNU Emacs, the Swiss army knife of text editors
2019-12-19  2:05             ` HaiJun Zhang
2019-12-19  5:57               ` tsuucat via Bug reports for GNU Emacs, the Swiss army knife of text editors
2019-12-19  6:14                 ` HaiJun Zhang
2019-12-19  6:22                   ` HaiJun Zhang
2019-12-19  7:02                 ` HaiJun Zhang
2019-12-21 22:54                 ` Alan Third
2019-12-22  3:33                   ` Eli Zaretskii
2019-12-22  7:24                   ` tsuucat via Bug reports for GNU Emacs, the Swiss army knife of text editors
2019-12-22 11:51                     ` Alan Third
2019-12-22 17:14                       ` Eli Zaretskii
2019-12-22 11:32                   ` HaiJun Zhang
2019-12-22 12:02                     ` Alan Third

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20191029192045.GA57404@breton.holly.idiocy.org \
    --to=alan@idiocy.org \
    --cc=23412@debbugs.gnu.org \
    --cc=netjune@outlook.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).