[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Need help to debug bugs(#22989, #23412)

From: HaiJun Zhang
Subject: Re: Need help to debug bugs(#22989, #23412)
Date: Sun, 27 Oct 2019 11:43:49 +0000

After some debugging work, I think I find the cause.

When the input method is active, every char inputting triggers two events to emacs. 
The first one is ‘(ns-unput-working-text), which will finally executes the lisp command ns-unput-working-text, which clears the current working text in buffer. 
The second is ‘(ns-put-working-text), which will finally excutes the lisp command ns-put-working-text, which insert the new working text into the buffer.

PS: The working text is the tip chars of the input method. It is not the finally input content. It is the intermediate content of the user input.

The above two operations cause the flicker.

The resolution: 
Don’t redisplay on the first event. Is it possible to disable redisplay for a command?

A workaround: 
Because ns-put-working-text can also clear the old working text. So in ns-unput-working-text, we can clear the working text only when really needed and give the other work to ns-put-working-text.

I modified the ns-unput-working-text. And it works.

(defun ns-unput-working-text ()
   ((and (overlayp ns-working-overlay)
         ;; Still alive?
         (overlay-buffer ns-working-overlay))
 (with-current-buffer (overlay-buffer ns-working-overlay)
   (let ((text (buffer-substring-no-properties
       (overlay-start ns-working-overlay)
       (overlay-end ns-working-overlay))))
  (when (equal text ns-working-text)
    (delete-region (overlay-start ns-working-overlay)
       (overlay-end ns-working-overlay))
    (delete-overlay ns-working-overlay)
    (setq ns-working-overlay nil)))))
   ((integerp ns-working-overlay)
    (let* ((msg (current-message))
     (text (substring msg (- (length msg) ns-working-overlay)))
   (when (equal text ns-working-text)
  (setq msg (substring msg 0 (- (length msg) ns-working-overlay)))
  (message “%s” msg)
  (setq ns-working-overlay nil))))))

在 2019年10月27日 +0800 PM3:12,Eli Zaretskii <address@hidden>,写道:
From: HaiJun Zhang <address@hidden>
CC: "address@hidden" <address@hidden>
Date: Sun, 27 Oct 2019 07:00:04 +0000

Setting redisplay-dont-pause to t causes other problem for emacs after 26.2, which is worse than this one.
See https://lists.gnu.org/archive/html/emacs-devel/2019-01/msg00495.html

Sounds like all of this is specific to NS. So maybe the solution
should also be specific to NS, like maybe the change that you say
started all this should be disable on NS.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]