Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

emacs cannot paste unicode characters correctly #94

Closed
kekeimiku opened this issue Feb 12, 2021 · 21 comments
Closed

emacs cannot paste unicode characters correctly #94

kekeimiku opened this issue Feb 12, 2021 · 21 comments

Comments

@kekeimiku
Copy link

kekeimiku commented Feb 12, 2021

recording.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
Copy link
Owner

masm11 commented Feb 15, 2021

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

not clipboard issue, but kill-ring issue?

@kekeimiku
Copy link
Author

Yes, is kill-ring issue...

@kekeimiku kekeimiku changed the title Clipboard cannot paste unicode characters correctly emacs cannot paste unicode characters correctly Feb 16, 2021
@masm11
Copy link
Owner

masm11 commented Feb 16, 2021

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

@kekeimiku
Copy link
Author

kekeimiku commented Feb 17, 2021

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

recording_2021-02-17-104952.mp4

I currently only find chrom(e)ium has problems

@declantsien
Copy link

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
Copy link
Author

kekeimiku commented Feb 17, 2021

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.

recording_2021-02-17-174216.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
Copy link

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
Copy link
Owner

masm11 commented Feb 17, 2021

@Makima0
It does not reproduce with emacs -Q.

Please tell me:

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

@kekeimiku
Copy link
Author

@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

recording_2021-02-17-232100.mp4

@masm11
Copy link
Owner

masm11 commented Feb 17, 2021

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
Copy link
Author

kekeimiku commented Feb 17, 2021

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
Copy link
Owner

masm11 commented Feb 17, 2021

Thanks for the OS and version.

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

@masm11
Copy link
Owner

masm11 commented Feb 19, 2021

confirmed.

@masm11
Copy link
Owner

masm11 commented Feb 19, 2021

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
Copy link
Owner

masm11 commented Feb 20, 2021

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

@kekeimiku
Copy link
Author

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

@declantsien
Copy link

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
Copy link
Owner

masm11 commented Feb 28, 2021

@declanqian reproduced.

@masm11
Copy link
Owner

masm11 commented Mar 1, 2021

@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
Copy link
Owner

masm11 commented Mar 2, 2021

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

@declantsien
Copy link

Cool, it's working. @masm11

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants