masm11 / emacs

Mirror of GNU Emacs
http://www.gnu.org/software/emacs/
GNU General Public License v3.0
198 stars 14 forks source link

emacs cannot paste unicode characters correctly #94

Closed kekeimiku closed 3 years ago

kekeimiku commented 3 years ago

https://user-images.githubusercontent.com/36557882/107804096-762f3e00-6d9e-11eb-9ba1-a58d6d0eee3e.mp4

emacs version https://github.com/emacs-mirror/emacs/tree/175ebb010477ff0e174fe5145154397f43dee2d2 Interim solution

(setq wl-copy-process nil)
(defun wl-copy (text)
  (setq wl-copy-process (make-process :name "wl-copy"
                                      :buffer nil
                                      :command '("wl-copy" "-f" "-n")
                                      :connection-type 'pipe))
  (process-send-string wl-copy-process text)
  (process-send-eof wl-copy-process))
(defun wl-paste ()
  (if (and wl-copy-process (process-live-p wl-copy-process)) nil
    (shell-command-to-string "wl-paste -t text -n 2>/dev/null")))
(setq interprogram-cut-function 'wl-copy)
(setq interprogram-paste-function 'wl-paste)
(setq confirm-kill-processes nil)
masm11 commented 3 years ago

WIth clipboard, it does not reproduce. WIth kill-ring, it reproduced.

not clipboard issue, but kill-ring issue?

kekeimiku commented 3 years ago

Yes, is kill-ring issue...

masm11 commented 3 years ago

I fixed it in feature/pgtk on savannah. Please try it.

kekeimiku commented 3 years ago

It is indeed fixed in emacs,but there is still a problem. When I copy unicode from emacs to chrom(e)ium

https://user-images.githubusercontent.com/36557882/108149837-90ef1300-710e-11eb-917a-e0fbbc58e37a.mp4

I currently only find chrom(e)ium has problems

declantsien commented 3 years ago

Don't think this is an issue from Emacs side. If you input some CJK using Firefox(which runs naively under wayland), then copy/paste it into Chromium. Same issue. @Makima0

You can using Chromium extensions like atomic-chrome or Edit with Emacs to input CJK for now.

kekeimiku commented 3 years ago

Don't think this is an issue from Emacs side. If you input some CJK using Firefox(which runs naively under wayland), then copy/paste it into Chromium. Same issue. @Makima0

You can using Chromium extensions like atomic-chrome or Edit with Emacs to input CJK for now.

I can copy normally from alacritty.

https://user-images.githubusercontent.com/36557882/108185738-97e64780-7147-11eb-810e-189ef833931e.mp4

(setq wl-copy-process nil)
(defun wl-copy (text)
  (setq wl-copy-process (make-process :name "wl-copy"
                                      :buffer nil
                                      :command '("wl-copy" "-f" "-n")
                                      :connection-type 'pipe))
  (process-send-string wl-copy-process text)
  (process-send-eof wl-copy-process))
(defun wl-paste ()
  (if (and wl-copy-process (process-live-p wl-copy-process)) nil
    (shell-command-to-string "wl-paste -t text -n 2>/dev/null")))
(setq interprogram-cut-function 'wl-copy)
(setq interprogram-paste-function 'wl-paste)
(setq confirm-kill-processes nil)

If you change the default interprogram-cut-function and interprogram-paste-function of emacs to wl-clip, everything returns to normal. So I think it’s an emacs issue.

declantsien commented 3 years ago

Nice. Indeed it works. @Makima0

Side question. Which input method software are you using when input CJK characters on alacritty? I can't active fcitix 5 on alacritty nor chromium.

masm11 commented 3 years ago

@Makima0 It does not reproduce with emacs -Q.

Please tell me:

kekeimiku commented 3 years ago

@Makima0 It does not reproduce with emacs -Q.

Please tell me:

  • version of gtk
  • version of chromium
  • window manager and its version

gtk3 sway version 1.5.1 Google Chrome 88.0.4324.146

https://user-images.githubusercontent.com/36557882/108225419-e2cb8380-7176-11eb-96e0-90cd7577f25e.mp4

masm11 commented 3 years ago

I installed sway 1.5.1 and downgraded chromium to 88.0.4324.146, but the issue does not reproduce.

What OS do you use? And what is its version?

kekeimiku commented 3 years ago

I installed sway 1.5.1 and downgraded chromium to 88.0.4324.146, but the issue does not reproduce.

What OS do you use? And what is its version?

I use the latest Arch Linux. Use this flag to ensure that chrome runs on Wayland. --enable-features=UseOzonePlatform --ozone-platform=wayland I guess you are using xwayland to run chrome? If you use xwayland , this problem will not occur.

masm11 commented 3 years ago

Thanks for the OS and version.

chromium on wayland?? I didn't know such a thing... ok, I'll try it tomorrow night.

masm11 commented 3 years ago

confirmed.

masm11 commented 3 years ago

Run gtk3-demo, double-click Entry Buffer in Entry, input a unicode string in the entry buffer, and copy and paste it to chromium. The same issue reproduces. Maybe it is gtk's issue or chromium's issue.

I'll look for a work around.

masm11 commented 3 years ago

@Makima0 Fixed in feature/pgtk on savannah. Please try again.

kekeimiku commented 3 years ago

@masm11 The issue has been fixed, thank you very much!

declantsien commented 3 years ago

I have problem yanking text from Chromium Select some text from Chromium(wayland and xwayland) and copy C-c. Open PGTK Emacs, hit C-y. Copied text is not there. Can you guys verify this? @masm11 @Makima0

masm11 commented 3 years ago

@declanqian reproduced.

masm11 commented 3 years ago

@declanqian I'm debugging. This should be a work around until fixed:

(setq x-select-request-type '(UTF8_STRING COMPOUND_TEXT STRING text/plain))
masm11 commented 3 years ago

@declanqian Fixed in feature/pgtk on savannah. Please try it.

declantsien commented 3 years ago

Cool, it's working. @masm11