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

JBR-7254 Impossible to copy/paste files in Project tree #398

Merged
merged 2 commits into from
Jun 18, 2024

Conversation

mkartashev
Copy link
Collaborator

JBR-7254 Impossible to copy/paste files in Project tree

@mkartashev mkartashev self-assigned this Jun 4, 2024
Copy link
Member

@NikitkoCent NikitkoCent left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm still in the process of reviewing, but have noticed that the patch doesn't work for multiple selected files, unlike under XToolkit or on macOS (haven't tested with Windows).

@mkartashev
Copy link
Collaborator Author

I'm still in the process of reviewing, but have noticed that the patch doesn't work for multiple selected files, unlike under XToolkit or on macOS (haven't tested with Windows).

Does it work for you under XToolkit when you copy a group of files from outside of IDEA, like from a file manager? It doesn't for me. When you copy within IDEA, it doesn't really go through the clipboard, there's a shortcut that can't be used with Wayland, in which case it will likely remain a limitation of WLToolkit for the foreseeable future. I will, nonetheless, look into this further.

BTW, copying a group of files from IDEA to a file manager works both with WLToolkit and XToolkit.

@mkartashev
Copy link
Collaborator Author

Copying of group of files has been fixed; the problem was the delimiter character: in encoding, \0 was used, while decoding was done using \n.
This, however, doesn't always work for some projects in IDEA. Seems like some work is needed on the IDEA side as well after this has been merged.

@NikitkoCent
Copy link
Member

NikitkoCent commented Jun 12, 2024

I'm still in the process of reviewing, but have noticed that the patch doesn't work for multiple selected files, unlike under XToolkit or on macOS (haven't tested with Windows).

Does it work for you under XToolkit when you copy a group of files from outside of IDEA, like from a file manager?

It does (at least under XWayland):
Screencast from 12-06-24 17:15:22.webm

Ubuntu 22.04.4 + Gnome 42.9 under Wayland

@NikitkoCent
Copy link
Member

NikitkoCent commented Jun 12, 2024

Copying of group of files has been fixed; the problem was the delimiter character: in encoding, \0 was used, while decoding was done using \n. This, however, doesn't always work for some projects in IDEA.

Pasting two empty files copied from one directory to another within the same empty project doesn't work on my side. However, I can paste those files through the Gnome file manager.
Screencast from 12-06-24 18:06:31.webm

Here're the logs (excluding pasting in the Gnome file manager):

2024-06-12 17:57:22,074 [  16313]   FINE - sun.awt.wl.WLClipboard - Clipboard: About to offer new contents using Wayland event serial 8079
2024-06-12 17:57:22,075 [  16314]   FINE - sun.awt.wl.WLClipboard - Clipboard: New one is available in these integer formats: [3, 2, 4, 18, 0, 20, 21, 22, 23, 1, 17, 16, 10, 11, 12, 13, 14, 15, 9]
2024-06-12 17:57:22,075 [  16314]   FINE - sun.awt.wl.WLClipboard - Clipboard: formats mapping 3 -> UTF8_STRING
2024-06-12 17:57:22,075 [  16314]   FINE - sun.awt.wl.WLClipboard - Clipboard: formats mapping 2 -> TEXT
2024-06-12 17:57:22,075 [  16314]   FINE - sun.awt.wl.WLClipboard - Clipboard: formats mapping 4 -> STRING
2024-06-12 17:57:22,075 [  16314]   FINE - sun.awt.wl.WLClipboard - Clipboard: formats mapping 18 -> text/plain;charset=UTF-16
2024-06-12 17:57:22,075 [  16314]   FINE - sun.awt.wl.WLClipboard - Clipboard: formats mapping 0 -> text/plain;charset=utf-8
2024-06-12 17:57:22,075 [  16314]   FINE - sun.awt.wl.WLClipboard - Clipboard: formats mapping 20 -> text/plain;charset=UTF-16BE
2024-06-12 17:57:22,075 [  16314]   FINE - sun.awt.wl.WLClipboard - Clipboard: formats mapping 21 -> text/plain;charset=UTF-16LE
2024-06-12 17:57:22,075 [  16314]   FINE - sun.awt.wl.WLClipboard - Clipboard: formats mapping 22 -> text/plain;charset=ISO-8859-1
2024-06-12 17:57:22,075 [  16314]   FINE - sun.awt.wl.WLClipboard - Clipboard: formats mapping 23 -> text/plain;charset=US-ASCII
2024-06-12 17:57:22,075 [  16314]   FINE - sun.awt.wl.WLClipboard - Clipboard: formats mapping 1 -> text/plain
2024-06-12 17:57:22,075 [  16314]   FINE - sun.awt.wl.WLClipboard - Clipboard: formats mapping 17 -> FILE_NAME
2024-06-12 17:57:22,075 [  16314]   FINE - sun.awt.wl.WLClipboard - Clipboard: formats mapping 16 -> text/uri-list
2024-06-12 17:57:22,075 [  16314]   FINE - sun.awt.wl.WLClipboard - Clipboard: formats mapping 10 -> text/uri-list;charset=UTF-16
2024-06-12 17:57:22,075 [  16314]   FINE - sun.awt.wl.WLClipboard - Clipboard: formats mapping 11 -> text/uri-list;charset=UTF-8
2024-06-12 17:57:22,075 [  16314]   FINE - sun.awt.wl.WLClipboard - Clipboard: formats mapping 12 -> text/uri-list;charset=UTF-16BE
2024-06-12 17:57:22,075 [  16314]   FINE - sun.awt.wl.WLClipboard - Clipboard: formats mapping 13 -> text/uri-list;charset=UTF-16LE
2024-06-12 17:57:22,075 [  16314]   FINE - sun.awt.wl.WLClipboard - Clipboard: formats mapping 14 -> text/uri-list;charset=ISO-8859-1
2024-06-12 17:57:22,075 [  16314]   FINE - sun.awt.wl.WLClipboard - Clipboard: formats mapping 15 -> text/uri-list;charset=US-ASCII
2024-06-12 17:57:22,075 [  16314]   FINE - sun.awt.wl.WLClipboard - Clipboard: formats mapping 9 -> x-special/gnome-copied-files
2024-06-12 17:57:22,075 [  16314]   FINE - sun.awt.wl.WLClipboard - Clipboard: Offering new contents (com.intellij.ide.PsiCopyPasteManager$MyTransferable@59707814) in these MIME formats: [UTF8_STRING, TEXT, STRING, text/plain;charset=UTF-16, text/plain;charset=utf-8, text/plain;charset=UTF-16BE, text/plain;charset=UTF-16LE, text/plain;charset=ISO-8859-1, text/plain;charset=US-ASCII, text/plain, FILE_NAME, text/uri-list, text/uri-list;charset=UTF-16, text/uri-list;charset=UTF-8, text/uri-list;charset=UTF-16BE, text/uri-list;charset=UTF-16LE, text/uri-list;charset=ISO-8859-1, text/uri-list;charset=US-ASCII, x-special/gnome-copied-files]
2024-06-12 17:57:22,076 [  16315]   FINE - sun.awt.wl.WLClipboard - Clipboard: will write contents (com.intellij.ide.PsiCopyPasteManager$MyTransferable@59707814) in format text/plain;charset=utf-8 to fd=204
2024-06-12 17:57:22,077 [  16316]   FINE - sun.awt.wl.WLClipboard - Clipboard: data flavor: java.awt.datatransfer.DataFlavor[mimetype=application/x-java-serialized-object;representationclass=java.lang.String]
2024-06-12 17:57:22,077 [  16316]   FINE - sun.awt.wl.WLClipboard - Clipboard: about to write 11 bytes to java.io.FileOutputStream@8968c27
2024-06-12 17:57:22,085 [  16324]   FINE - sun.awt.wl.WLClipboard - Clipboard: new format is available for 94740103347296: x-special/gnome-copied-files
2024-06-12 17:57:22,085 [  16324]   FINE - sun.awt.wl.WLClipboard - Clipboard: new format is available for 94740103347296: text/uri-list;charset=US-ASCII
2024-06-12 17:57:22,085 [  16324]   FINE - sun.awt.wl.WLClipboard - Clipboard: new format is available for 94740103347296: text/uri-list;charset=ISO-8859-1
2024-06-12 17:57:22,085 [  16324]   FINE - sun.awt.wl.WLClipboard - Clipboard: new format is available for 94740103347296: text/uri-list;charset=UTF-16LE
2024-06-12 17:57:22,085 [  16324]   FINE - sun.awt.wl.WLClipboard - Clipboard: new format is available for 94740103347296: text/uri-list;charset=UTF-16BE
2024-06-12 17:57:22,085 [  16324]   FINE - sun.awt.wl.WLClipboard - Clipboard: new format is available for 94740103347296: text/uri-list;charset=UTF-8
2024-06-12 17:57:22,085 [  16324]   FINE - sun.awt.wl.WLClipboard - Clipboard: new format is available for 94740103347296: text/uri-list;charset=UTF-16
2024-06-12 17:57:22,085 [  16324]   FINE - sun.awt.wl.WLClipboard - Clipboard: new format is available for 94740103347296: text/uri-list
2024-06-12 17:57:22,085 [  16324]   FINE - sun.awt.wl.WLClipboard - Clipboard: new format is available for 94740103347296: FILE_NAME
2024-06-12 17:57:22,085 [  16324]   FINE - sun.awt.wl.WLClipboard - Clipboard: new format is available for 94740103347296: text/plain
2024-06-12 17:57:22,085 [  16324]   FINE - sun.awt.wl.WLClipboard - Clipboard: new format is available for 94740103347296: text/plain;charset=US-ASCII
2024-06-12 17:57:22,085 [  16324]   FINE - sun.awt.wl.WLClipboard - Clipboard: new format is available for 94740103347296: text/plain;charset=ISO-8859-1
2024-06-12 17:57:22,085 [  16324]   FINE - sun.awt.wl.WLClipboard - Clipboard: new format is available for 94740103347296: text/plain;charset=UTF-16LE
2024-06-12 17:57:22,085 [  16324]   FINE - sun.awt.wl.WLClipboard - Clipboard: new format is available for 94740103347296: text/plain;charset=UTF-16BE
2024-06-12 17:57:22,085 [  16324]   FINE - sun.awt.wl.WLClipboard - Clipboard: new format is available for 94740103347296: text/plain;charset=utf-8
2024-06-12 17:57:22,085 [  16324]   FINE - sun.awt.wl.WLClipboard - Clipboard: new format is available for 94740103347296: text/plain;charset=UTF-16
2024-06-12 17:57:22,085 [  16324]   FINE - sun.awt.wl.WLClipboard - Clipboard: new format is available for 94740103347296: STRING
2024-06-12 17:57:22,085 [  16324]   FINE - sun.awt.wl.WLClipboard - Clipboard: new format is available for 94740103347296: TEXT
2024-06-12 17:57:22,085 [  16324]   FINE - sun.awt.wl.WLClipboard - Clipboard: new format is available for 94740103347296: UTF8_STRING
2024-06-12 17:57:22,085 [  16324]   FINE - sun.awt.wl.WLClipboard - Clipboard: Lost ownership of our clipboard
2024-06-12 17:57:22,085 [  16324]   FINE - sun.awt.wl.WLClipboard - Clipboard: new clipboard is available: 94740103347296
2024-06-12 17:57:22,360 [  16599]   INFO - #o.j.j.b.i.CompilerReferenceIndex - backward reference index version doesn't exist
2024-06-12 17:57:22,365 [  16604]   INFO - #c.i.c.b.IsUpToDateCheckStartupActivity - suitable consumer is not found
2024-06-12 17:57:22,392 [  16631]   INFO - #c.i.w.i.i.GlobalWorkspaceModel - Sync global entities with mutable entity storage
2024-06-12 17:57:22,396 [  16635]   INFO - #c.i.w.i.i.j.s.JpsProjectModelSynchronizer - Attempt 1: Apply JPS storage (iml files)
2024-06-12 17:57:22,429 [  16668]   INFO - #c.i.w.i.i.EntitiesOrphanageImpl - Update orphanage. 0 modules added
2024-06-12 17:57:22,431 [  16670]   INFO - #c.i.w.i.i.j.s.JpsProjectModelSynchronizer - Attempt 1: Changes were successfully applied
2024-06-12 17:57:22,432 [  16671]   INFO - #c.i.w.i.i.j.s.DelayedProjectSynchronizer$Util - Workspace model loaded from cache. Syncing real project state into workspace model in 83 ms. Thread[#25,DefaultDispatcher-worker-6,5,main]
2024-06-12 17:57:25,948 [  20187]   FINE - sun.awt.wl.WLClipboard - Clipboard: requested content of clipboard with handle 94740103347296 in format 3
2024-06-12 17:57:25,948 [  20187]   FINE - sun.awt.wl.WLClipboard - Clipboard: will read data from 267 in format UTF8_STRING
2024-06-12 17:57:25,949 [  20188]   FINE - sun.awt.wl.WLClipboard - Clipboard: will write contents (com.intellij.ide.PsiCopyPasteManager$MyTransferable@59707814) in format UTF8_STRING to fd=268
2024-06-12 17:57:25,949 [  20188]   FINE - sun.awt.wl.WLClipboard - Clipboard: data flavor: java.awt.datatransfer.DataFlavor[mimetype=application/x-java-serialized-object;representationclass=java.lang.String]
2024-06-12 17:57:25,949 [  20188]   FINE - sun.awt.wl.WLClipboard - Clipboard: about to write 11 bytes to java.io.FileOutputStream@ca919ed
2024-06-12 17:57:25,949 [  20188]   FINE - sun.awt.wl.WLClipboard - Clipboard: read data from 267: 11 bytes
2024-06-12 17:57:26,006 [  20245]   FINE - sun.awt.wl.WLClipboard - Clipboard: requested content of clipboard with handle 94740103347296 in format 3
2024-06-12 17:57:26,006 [  20245]   FINE - sun.awt.wl.WLClipboard - Clipboard: will read data from 267 in format UTF8_STRING
2024-06-12 17:57:26,007 [  20246]   FINE - sun.awt.wl.WLClipboard - Clipboard: will write contents (com.intellij.ide.PsiCopyPasteManager$MyTransferable@59707814) in format UTF8_STRING to fd=268
2024-06-12 17:57:26,007 [  20246]   FINE - sun.awt.wl.WLClipboard - Clipboard: data flavor: java.awt.datatransfer.DataFlavor[mimetype=application/x-java-serialized-object;representationclass=java.lang.String]
2024-06-12 17:57:26,007 [  20246]   FINE - sun.awt.wl.WLClipboard - Clipboard: about to write 11 bytes to java.io.FileOutputStream@49ab861c
2024-06-12 17:57:26,007 [  20246]   FINE - sun.awt.wl.WLClipboard - Clipboard: read data from 267: 11 bytes
2024-06-12 17:57:26,049 [  20288]   FINE - sun.awt.wl.WLClipboard - Clipboard: requested content of clipboard with handle 94740103347296 in format 3
2024-06-12 17:57:26,049 [  20288]   FINE - sun.awt.wl.WLClipboard - Clipboard: will read data from 267 in format UTF8_STRING
2024-06-12 17:57:26,050 [  20289]   FINE - sun.awt.wl.WLClipboard - Clipboard: will write contents (com.intellij.ide.PsiCopyPasteManager$MyTransferable@59707814) in format UTF8_STRING to fd=268
2024-06-12 17:57:26,050 [  20289]   FINE - sun.awt.wl.WLClipboard - Clipboard: data flavor: java.awt.datatransfer.DataFlavor[mimetype=application/x-java-serialized-object;representationclass=java.lang.String]
2024-06-12 17:57:26,050 [  20289]   FINE - sun.awt.wl.WLClipboard - Clipboard: about to write 11 bytes to java.io.FileOutputStream@44e3c02e
2024-06-12 17:57:26,050 [  20289]   FINE - sun.awt.wl.WLClipboard - Clipboard: read data from 267: 11 bytes
2024-06-12 17:57:26,052 [  20291]   FINE - sun.awt.wl.WLClipboard - Clipboard: requested content of clipboard with handle 94740103347296 in format 3
2024-06-12 17:57:26,052 [  20291]   FINE - sun.awt.wl.WLClipboard - Clipboard: will read data from 267 in format UTF8_STRING
2024-06-12 17:57:26,053 [  20292]   FINE - sun.awt.wl.WLClipboard - Clipboard: will write contents (com.intellij.ide.PsiCopyPasteManager$MyTransferable@59707814) in format UTF8_STRING to fd=268
2024-06-12 17:57:26,053 [  20292]   FINE - sun.awt.wl.WLClipboard - Clipboard: data flavor: java.awt.datatransfer.DataFlavor[mimetype=application/x-java-serialized-object;representationclass=java.lang.String]
2024-06-12 17:57:26,053 [  20292]   FINE - sun.awt.wl.WLClipboard - Clipboard: about to write 11 bytes to java.io.FileOutputStream@78288b21
2024-06-12 17:57:26,053 [  20292]   FINE - sun.awt.wl.WLClipboard - Clipboard: read data from 267: 11 bytes
2024-06-12 17:57:26,054 [  20293]   FINE - sun.awt.wl.WLClipboard - Clipboard: requested content of clipboard with handle 94740103347296 in format 3
2024-06-12 17:57:26,054 [  20293]   FINE - sun.awt.wl.WLClipboard - Clipboard: will read data from 267 in format UTF8_STRING
2024-06-12 17:57:26,055 [  20294]   FINE - sun.awt.wl.WLClipboard - Clipboard: will write contents (com.intellij.ide.PsiCopyPasteManager$MyTransferable@59707814) in format UTF8_STRING to fd=268
2024-06-12 17:57:26,055 [  20294]   FINE - sun.awt.wl.WLClipboard - Clipboard: data flavor: java.awt.datatransfer.DataFlavor[mimetype=application/x-java-serialized-object;representationclass=java.lang.String]
2024-06-12 17:57:26,055 [  20294]   FINE - sun.awt.wl.WLClipboard - Clipboard: about to write 11 bytes to java.io.FileOutputStream@3c8a93b8
2024-06-12 17:57:26,056 [  20295]   FINE - sun.awt.wl.WLClipboard - Clipboard: read data from 267: 11 bytes
2024-06-12 17:57:27,991 [  22230]   FINE - sun.awt.wl.WLClipboard - Clipboard: requested content of clipboard with handle 94740103347296 in format 3
2024-06-12 17:57:27,992 [  22231]   FINE - sun.awt.wl.WLClipboard - Clipboard: will read data from 271 in format UTF8_STRING
2024-06-12 17:57:27,992 [  22231]   FINE - sun.awt.wl.WLClipboard - Clipboard: will write contents (com.intellij.ide.PsiCopyPasteManager$MyTransferable@59707814) in format UTF8_STRING to fd=272
2024-06-12 17:57:27,992 [  22231]   FINE - sun.awt.wl.WLClipboard - Clipboard: data flavor: java.awt.datatransfer.DataFlavor[mimetype=application/x-java-serialized-object;representationclass=java.lang.String]
2024-06-12 17:57:27,992 [  22231]   FINE - sun.awt.wl.WLClipboard - Clipboard: about to write 11 bytes to java.io.FileOutputStream@29847953
2024-06-12 17:57:27,993 [  22232]   FINE - sun.awt.wl.WLClipboard - Clipboard: read data from 271: 11 bytes

@NikitkoCent
Copy link
Member

Pasting of multiple files copied from outside of the IDE works well though. As far as I understand from the logs, copying within IDE writes the files list to the clipboard as plain text instead of an uri list (or smth else?)

@mkartashev
Copy link
Collaborator Author

Pasting two empty files copied from one directory to another within the same empty project doesn't work on my side.

Are you sure you have the latest commit? This scenario started working on my side with the recent changes.
Screencast from 13-06-24 14:35:17.webm

@NikitkoCent
Copy link
Member

NikitkoCent commented Jun 13, 2024

Pasting two empty files copied from one directory to another within the same empty project doesn't work on my side.

Are you sure you have the latest commit? This scenario started working on my side with the recent changes. Screencast from 13-06-24 14:35:17.webm

Ok, I confirm it works in PyCharm Nightly, but does not work in IDEA Nightly (e.g. today's build).
Double checked everything, even built your branch in a new separate worktree.

Whenever I remove -Dawt.toolkit.name=WLToolkit from the VM options, it starts working.

@mkartashev
Copy link
Collaborator Author

If the "Paste" dialog does not appear, you may be experiencing JBR-7290. Could you please re-try with a workaround for that issue (-Dswing.bufferPerWindow=false)? I was not able to reproduce the pasting problem with IDEA (built on June 13) either, short of experiencing JBR-7290 occasionally.

@NikitkoCent
Copy link
Member

@mkartashev,
Unfortunately, neither the workaround -Dswing.bufferPerWindow=false nor the fix of JBR-7290 has helped. Here's the logs from PyCharm, which doesn't have this issue:

2024-06-18 04:30:00,552 [ 212007]   FINE - sun.awt.wl.WLClipboard - Clipboard: About to offer new contents using Wayland event serial 54900
2024-06-18 04:30:00,553 [ 212008]   FINE - sun.awt.wl.WLClipboard - Clipboard: New one is available in these integer formats: [1, 2, 3, 13, 0, 15, 16, 17, 18, 19, 12, 11, 5, 6, 7, 8, 9, 10, 4]
2024-06-18 04:30:00,553 [ 212008]   FINE - sun.awt.wl.WLClipboard - Clipboard: formats mapping 1 -> UTF8_STRING
2024-06-18 04:30:00,553 [ 212008]   FINE - sun.awt.wl.WLClipboard - Clipboard: formats mapping 2 -> TEXT
2024-06-18 04:30:00,553 [ 212008]   FINE - sun.awt.wl.WLClipboard - Clipboard: formats mapping 3 -> STRING
2024-06-18 04:30:00,553 [ 212008]   FINE - sun.awt.wl.WLClipboard - Clipboard: formats mapping 13 -> text/plain;charset=UTF-16
2024-06-18 04:30:00,553 [ 212008]   FINE - sun.awt.wl.WLClipboard - Clipboard: formats mapping 0 -> text/plain;charset=utf-8
2024-06-18 04:30:00,553 [ 212008]   FINE - sun.awt.wl.WLClipboard - Clipboard: formats mapping 15 -> text/plain;charset=UTF-16BE
2024-06-18 04:30:00,553 [ 212008]   FINE - sun.awt.wl.WLClipboard - Clipboard: formats mapping 16 -> text/plain;charset=UTF-16LE
2024-06-18 04:30:00,553 [ 212008]   FINE - sun.awt.wl.WLClipboard - Clipboard: formats mapping 17 -> text/plain;charset=ISO-8859-1
2024-06-18 04:30:00,553 [ 212008]   FINE - sun.awt.wl.WLClipboard - Clipboard: formats mapping 18 -> text/plain;charset=US-ASCII
2024-06-18 04:30:00,553 [ 212008]   FINE - sun.awt.wl.WLClipboard - Clipboard: formats mapping 19 -> text/plain
2024-06-18 04:30:00,553 [ 212008]   FINE - sun.awt.wl.WLClipboard - Clipboard: formats mapping 12 -> FILE_NAME
2024-06-18 04:30:00,553 [ 212008]   FINE - sun.awt.wl.WLClipboard - Clipboard: formats mapping 11 -> text/uri-list
2024-06-18 04:30:00,553 [ 212008]   FINE - sun.awt.wl.WLClipboard - Clipboard: formats mapping 5 -> text/uri-list;charset=UTF-16
2024-06-18 04:30:00,553 [ 212008]   FINE - sun.awt.wl.WLClipboard - Clipboard: formats mapping 6 -> text/uri-list;charset=UTF-8
2024-06-18 04:30:00,553 [ 212008]   FINE - sun.awt.wl.WLClipboard - Clipboard: formats mapping 7 -> text/uri-list;charset=UTF-16BE
2024-06-18 04:30:00,553 [ 212008]   FINE - sun.awt.wl.WLClipboard - Clipboard: formats mapping 8 -> text/uri-list;charset=UTF-16LE
2024-06-18 04:30:00,553 [ 212008]   FINE - sun.awt.wl.WLClipboard - Clipboard: formats mapping 9 -> text/uri-list;charset=ISO-8859-1
2024-06-18 04:30:00,553 [ 212008]   FINE - sun.awt.wl.WLClipboard - Clipboard: formats mapping 10 -> text/uri-list;charset=US-ASCII
2024-06-18 04:30:00,553 [ 212008]   FINE - sun.awt.wl.WLClipboard - Clipboard: formats mapping 4 -> x-special/gnome-copied-files
2024-06-18 04:30:00,553 [ 212008]   FINE - sun.awt.wl.WLClipboard - Clipboard: Offering new contents (com.intellij.ide.PsiCopyPasteManager$MyTransferable@f7a39b3) in these MIME formats: [UTF8_STRING, TEXT, STRING, text/plain;charset=UTF-16, text/plain;charset=utf-8, text/plain;charset=UTF-16BE, text/plain;charset=UTF-16LE, text/plain;charset=ISO-8859-1, text/plain;charset=US-ASCII, text/plain, FILE_NAME, text/uri-list, text/uri-list;charset=UTF-16, text/uri-list;charset=UTF-8, text/uri-list;charset=UTF-16BE, text/uri-list;charset=UTF-16LE, text/uri-list;charset=ISO-8859-1, text/uri-list;charset=US-ASCII, x-special/gnome-copied-files]
2024-06-18 04:30:00,554 [ 212009]   FINE - sun.awt.wl.WLClipboard - Clipboard: will write contents (com.intellij.ide.PsiCopyPasteManager$MyTransferable@f7a39b3) in format text/plain;charset=utf-8 to fd=185
2024-06-18 04:30:00,554 [ 212009]   FINE - sun.awt.wl.WLClipboard - Clipboard: data flavor: java.awt.datatransfer.DataFlavor[mimetype=application/x-java-serialized-object;representationclass=java.lang.String]
2024-06-18 04:30:00,554 [ 212009]   FINE - sun.awt.wl.WLClipboard - Clipboard: about to write 11 bytes to java.io.FileOutputStream@7e2972a3
2024-06-18 04:30:00,563 [ 212018]   FINE - sun.awt.wl.WLClipboard - Clipboard: new format is available for 93945361639392: x-special/gnome-copied-files
2024-06-18 04:30:00,564 [ 212019]   FINE - sun.awt.wl.WLClipboard - Clipboard: new format is available for 93945361639392: text/uri-list;charset=US-ASCII
2024-06-18 04:30:00,564 [ 212019]   FINE - sun.awt.wl.WLClipboard - Clipboard: new format is available for 93945361639392: text/uri-list;charset=ISO-8859-1
2024-06-18 04:30:00,564 [ 212019]   FINE - sun.awt.wl.WLClipboard - Clipboard: new format is available for 93945361639392: text/uri-list;charset=UTF-16LE
2024-06-18 04:30:00,564 [ 212019]   FINE - sun.awt.wl.WLClipboard - Clipboard: new format is available for 93945361639392: text/uri-list;charset=UTF-16BE
2024-06-18 04:30:00,564 [ 212019]   FINE - sun.awt.wl.WLClipboard - Clipboard: new format is available for 93945361639392: text/uri-list;charset=UTF-8
2024-06-18 04:30:00,564 [ 212019]   FINE - sun.awt.wl.WLClipboard - Clipboard: new format is available for 93945361639392: text/uri-list;charset=UTF-16
2024-06-18 04:30:00,564 [ 212019]   FINE - sun.awt.wl.WLClipboard - Clipboard: new format is available for 93945361639392: text/uri-list
2024-06-18 04:30:00,564 [ 212019]   FINE - sun.awt.wl.WLClipboard - Clipboard: new format is available for 93945361639392: FILE_NAME
2024-06-18 04:30:00,564 [ 212019]   FINE - sun.awt.wl.WLClipboard - Clipboard: new format is available for 93945361639392: text/plain
2024-06-18 04:30:00,564 [ 212019]   FINE - sun.awt.wl.WLClipboard - Clipboard: new format is available for 93945361639392: text/plain;charset=US-ASCII
2024-06-18 04:30:00,564 [ 212019]   FINE - sun.awt.wl.WLClipboard - Clipboard: new format is available for 93945361639392: text/plain;charset=ISO-8859-1
2024-06-18 04:30:00,564 [ 212019]   FINE - sun.awt.wl.WLClipboard - Clipboard: new format is available for 93945361639392: text/plain;charset=UTF-16LE
2024-06-18 04:30:00,564 [ 212019]   FINE - sun.awt.wl.WLClipboard - Clipboard: new format is available for 93945361639392: text/plain;charset=UTF-16BE
2024-06-18 04:30:00,564 [ 212019]   FINE - sun.awt.wl.WLClipboard - Clipboard: new format is available for 93945361639392: text/plain;charset=utf-8
2024-06-18 04:30:00,564 [ 212019]   FINE - sun.awt.wl.WLClipboard - Clipboard: new format is available for 93945361639392: text/plain;charset=UTF-16
2024-06-18 04:30:00,564 [ 212019]   FINE - sun.awt.wl.WLClipboard - Clipboard: new format is available for 93945361639392: STRING
2024-06-18 04:30:00,564 [ 212019]   FINE - sun.awt.wl.WLClipboard - Clipboard: new format is available for 93945361639392: TEXT
2024-06-18 04:30:00,564 [ 212019]   FINE - sun.awt.wl.WLClipboard - Clipboard: new format is available for 93945361639392: UTF8_STRING
2024-06-18 04:30:00,564 [ 212019]   FINE - sun.awt.wl.WLClipboard - Clipboard: Lost ownership of our clipboard
2024-06-18 04:30:00,564 [ 212019]   FINE - sun.awt.wl.WLClipboard - Clipboard: new clipboard is available: 93945361639392
2024-06-18 04:30:02,153 [ 213608]   INFO - #c.i.d.u.SqlDialects - SQL dialects initialized in 8 ms
2024-06-18 04:30:03,963 [ 215418]   FINE - sun.awt.wl.WLClipboard - Clipboard: requested content of clipboard with handle 93945361639392 in format 7
2024-06-18 04:30:03,963 [ 215418]   FINE - sun.awt.wl.WLClipboard - Clipboard: will read data from 186 in format text/uri-list;charset=UTF-16BE
2024-06-18 04:30:03,964 [ 215419]   FINE - sun.awt.wl.WLClipboard - Clipboard: will write contents (com.intellij.ide.PsiCopyPasteManager$MyTransferable@f7a39b3) in format text/uri-list;charset=UTF-16BE to fd=187
2024-06-18 04:30:03,964 [ 215419]   FINE - sun.awt.wl.WLClipboard - Clipboard: data flavor: java.awt.datatransfer.DataFlavor[mimetype=text/uri-list;representationclass=java.lang.String]
2024-06-18 04:30:03,964 [ 215419]   FINE - sun.awt.wl.WLClipboard - Clipboard: about to write 107 bytes to java.io.FileOutputStream@7a16e9be
2024-06-18 04:30:03,964 [ 215419]   FINE - sun.awt.wl.WLClipboard - Clipboard: read data from 186: 107 bytes
2024-06-18 04:30:03,964 [ 215419]   FINE - sun.awt.wl.WLClipboard - Clipboard: requested content of clipboard with handle 93945361639392 in format 1
2024-06-18 04:30:03,964 [ 215419]   FINE - sun.awt.wl.WLClipboard - Clipboard: will read data from 186 in format UTF8_STRING
2024-06-18 04:30:03,965 [ 215420]   FINE - sun.awt.wl.WLClipboard - Clipboard: will write contents (com.intellij.ide.PsiCopyPasteManager$MyTransferable@f7a39b3) in format UTF8_STRING to fd=187
2024-06-18 04:30:03,965 [ 215420]   FINE - sun.awt.wl.WLClipboard - Clipboard: data flavor: java.awt.datatransfer.DataFlavor[mimetype=application/x-java-serialized-object;representationclass=java.lang.String]
2024-06-18 04:30:03,965 [ 215420]   FINE - sun.awt.wl.WLClipboard - Clipboard: about to write 11 bytes to java.io.FileOutputStream@3f147898
2024-06-18 04:30:03,965 [ 215420]   FINE - sun.awt.wl.WLClipboard - Clipboard: read data from 186: 11 bytes
2024-06-18 04:30:03,965 [ 215420]   FINE - sun.awt.wl.WLClipboard - Clipboard: requested content of clipboard with handle 93945361639392 in format 5
2024-06-18 04:30:03,965 [ 215420]   FINE - sun.awt.wl.WLClipboard - Clipboard: will read data from 186 in format text/uri-list;charset=UTF-16
2024-06-18 04:30:03,965 [ 215420]   FINE - sun.awt.wl.WLClipboard - Clipboard: will write contents (com.intellij.ide.PsiCopyPasteManager$MyTransferable@f7a39b3) in format text/uri-list;charset=UTF-16 to fd=187
2024-06-18 04:30:03,965 [ 215420]   FINE - sun.awt.wl.WLClipboard - Clipboard: data flavor: java.awt.datatransfer.DataFlavor[mimetype=text/uri-list;representationclass=java.lang.String]
2024-06-18 04:30:03,965 [ 215420]   FINE - sun.awt.wl.WLClipboard - Clipboard: about to write 107 bytes to java.io.FileOutputStream@3be86546
2024-06-18 04:30:03,966 [ 215421]   FINE - sun.awt.wl.WLClipboard - Clipboard: read data from 186: 107 bytes
2024-06-18 04:30:03,966 [ 215421]   FINE - sun.awt.wl.WLClipboard - Clipboard: requested content of clipboard with handle 93945361639392 in format 9
2024-06-18 04:30:03,966 [ 215421]   FINE - sun.awt.wl.WLClipboard - Clipboard: will read data from 186 in format text/uri-list;charset=ISO-8859-1
2024-06-18 04:30:03,966 [ 215421]   FINE - sun.awt.wl.WLClipboard - Clipboard: will write contents (com.intellij.ide.PsiCopyPasteManager$MyTransferable@f7a39b3) in format text/uri-list;charset=ISO-8859-1 to fd=187
2024-06-18 04:30:03,966 [ 215421]   FINE - sun.awt.wl.WLClipboard - Clipboard: data flavor: java.awt.datatransfer.DataFlavor[mimetype=text/uri-list;representationclass=java.lang.String]
2024-06-18 04:30:03,966 [ 215421]   FINE - sun.awt.wl.WLClipboard - Clipboard: about to write 107 bytes to java.io.FileOutputStream@ee1a4f2
2024-06-18 04:30:03,966 [ 215421]   FINE - sun.awt.wl.WLClipboard - Clipboard: read data from 186: 107 bytes
2024-06-18 04:30:03,966 [ 215421]   FINE - sun.awt.wl.WLClipboard - Clipboard: requested content of clipboard with handle 93945361639392 in format 10
2024-06-18 04:30:03,966 [ 215421]   FINE - sun.awt.wl.WLClipboard - Clipboard: will read data from 186 in format text/uri-list;charset=US-ASCII
2024-06-18 04:30:03,967 [ 215422]   FINE - sun.awt.wl.WLClipboard - Clipboard: will write contents (com.intellij.ide.PsiCopyPasteManager$MyTransferable@f7a39b3) in format text/uri-list;charset=US-ASCII to fd=187
2024-06-18 04:30:03,967 [ 215422]   FINE - sun.awt.wl.WLClipboard - Clipboard: data flavor: java.awt.datatransfer.DataFlavor[mimetype=text/uri-list;representationclass=java.lang.String]
2024-06-18 04:30:03,967 [ 215422]   FINE - sun.awt.wl.WLClipboard - Clipboard: about to write 107 bytes to java.io.FileOutputStream@43f7e789
2024-06-18 04:30:03,967 [ 215422]   FINE - sun.awt.wl.WLClipboard - Clipboard: read data from 186: 107 bytes
2024-06-18 04:30:03,967 [ 215422]   FINE - sun.awt.wl.WLClipboard - Clipboard: requested content of clipboard with handle 93945361639392 in format 8
2024-06-18 04:30:03,967 [ 215422]   FINE - sun.awt.wl.WLClipboard - Clipboard: will read data from 186 in format text/uri-list;charset=UTF-16LE
2024-06-18 04:30:03,967 [ 215422]   FINE - sun.awt.wl.WLClipboard - Clipboard: will write contents (com.intellij.ide.PsiCopyPasteManager$MyTransferable@f7a39b3) in format text/uri-list;charset=UTF-16LE to fd=187
2024-06-18 04:30:03,968 [ 215423]   FINE - sun.awt.wl.WLClipboard - Clipboard: data flavor: java.awt.datatransfer.DataFlavor[mimetype=text/uri-list;representationclass=java.lang.String]
2024-06-18 04:30:03,968 [ 215423]   FINE - sun.awt.wl.WLClipboard - Clipboard: about to write 107 bytes to java.io.FileOutputStream@5f3b87d7
2024-06-18 04:30:03,968 [ 215423]   FINE - sun.awt.wl.WLClipboard - Clipboard: read data from 186: 107 bytes
2024-06-18 04:30:03,968 [ 215423]   FINE - sun.awt.wl.WLClipboard - Clipboard: requested content of clipboard with handle 93945361639392 in format 12
2024-06-18 04:30:03,968 [ 215423]   FINE - sun.awt.wl.WLClipboard - Clipboard: will read data from 186 in format FILE_NAME
2024-06-18 04:30:03,968 [ 215423]   FINE - sun.awt.wl.WLClipboard - Clipboard: will write contents (com.intellij.ide.PsiCopyPasteManager$MyTransferable@f7a39b3) in format FILE_NAME to fd=187
2024-06-18 04:30:03,968 [ 215423]   FINE - sun.awt.wl.WLClipboard - Clipboard: data flavor: java.awt.datatransfer.DataFlavor[mimetype=application/x-java-file-list;representationclass=java.util.List]
2024-06-18 04:30:03,969 [ 215424]   FINE - sun.awt.wl.WLClipboard - Clipboard: about to write 97 bytes to java.io.FileOutputStream@24c4fd05
2024-06-18 04:30:03,969 [ 215424]   FINE - sun.awt.wl.WLClipboard - Clipboard: read data from 186: 97 bytes
2024-06-18 04:30:03,969 [ 215424]   FINE - sun.awt.wl.WLClipboard - Clipboard: requested content of clipboard with handle 93945361639392 in format 6
2024-06-18 04:30:03,969 [ 215424]   FINE - sun.awt.wl.WLClipboard - Clipboard: will read data from 186 in format text/uri-list;charset=UTF-8
2024-06-18 04:30:03,969 [ 215424]   FINE - sun.awt.wl.WLClipboard - Clipboard: will write contents (com.intellij.ide.PsiCopyPasteManager$MyTransferable@f7a39b3) in format text/uri-list;charset=UTF-8 to fd=187
2024-06-18 04:30:03,969 [ 215424]   FINE - sun.awt.wl.WLClipboard - Clipboard: data flavor: java.awt.datatransfer.DataFlavor[mimetype=text/uri-list;representationclass=java.lang.String]
2024-06-18 04:30:03,969 [ 215424]   FINE - sun.awt.wl.WLClipboard - Clipboard: about to write 107 bytes to java.io.FileOutputStream@58f38dbb
2024-06-18 04:30:03,970 [ 215425]   FINE - sun.awt.wl.WLClipboard - Clipboard: read data from 186: 107 bytes
2024-06-18 04:30:03,970 [ 215425]   FINE - sun.awt.wl.WLClipboard - Clipboard: requested content of clipboard with handle 93945361639392 in format 4
2024-06-18 04:30:03,970 [ 215425]   FINE - sun.awt.wl.WLClipboard - Clipboard: will read data from 186 in format x-special/gnome-copied-files
2024-06-18 04:30:03,970 [ 215425]   FINE - sun.awt.wl.WLClipboard - Clipboard: will write contents (com.intellij.ide.PsiCopyPasteManager$MyTransferable@f7a39b3) in format x-special/gnome-copied-files to fd=187
2024-06-18 04:30:03,970 [ 215425]   FINE - sun.awt.wl.WLClipboard - Clipboard: data flavor: java.awt.datatransfer.DataFlavor[mimetype=x-special/gnome-copied-files;representationclass=java.io.InputStream]
2024-06-18 04:30:03,970 [ 215425]   FINE - sun.awt.wl.WLClipboard - Clipboard: about to write 112 bytes to java.io.FileOutputStream@5b75bc4d
2024-06-18 04:30:03,970 [ 215425]   FINE - sun.awt.wl.WLClipboard - Clipboard: read data from 186: 112 bytes
2024-06-18 04:30:03,970 [ 215425]   FINE - sun.awt.wl.WLClipboard - Clipboard: requested content of clipboard with handle 93945361639392 in format 11
2024-06-18 04:30:03,970 [ 215425]   FINE - sun.awt.wl.WLClipboard - Clipboard: will read data from 186 in format text/uri-list
2024-06-18 04:30:03,971 [ 215426]   FINE - sun.awt.wl.WLClipboard - Clipboard: will write contents (com.intellij.ide.PsiCopyPasteManager$MyTransferable@f7a39b3) in format text/uri-list to fd=187
2024-06-18 04:30:03,971 [ 215426]   FINE - sun.awt.wl.WLClipboard - Clipboard: data flavor: java.awt.datatransfer.DataFlavor[mimetype=application/x-java-file-list;representationclass=java.util.List]
2024-06-18 04:30:03,971 [ 215426]   FINE - sun.awt.wl.WLClipboard - Clipboard: about to write 114 bytes to java.io.FileOutputStream@74027c03
2024-06-18 04:30:03,971 [ 215426]   FINE - sun.awt.wl.WLClipboard - Clipboard: read data from 186: 114 bytes

The difference I see here is that in IDEA case the clipboard is read only in 1 format (3 -> UTF8_STRING) several times, while in PyCharm case the clipboard is read in many different formats 1 time per format. IDK why this happens though.

@NikitkoCent
Copy link
Member

After some digging of the IntelliJ platform, I've got more details of how to reproduce the issue.
You need to select a few files in a way that the last chosen file doesn't have any extension (so it's a file without a dot in the name). E.g. the bug can be reproduced if the copied files had been selected in the following order:

MyJavaClass.java
file

And can't be reproduced if the files had been selected in the opposite order:

file
MyJavaClass.java

Moreover now I think that the issue should be fixed on the IntelliJ side, not in JBR. Thus there's nothing more to do about the patch, so LGTM (and file a separate issue about the problem).

@mkartashev mkartashev merged commit e73d5f1 into jbr21 Jun 18, 2024
@mkartashev mkartashev deleted the mkartash/JBR-7254 branch June 18, 2024 10:04
@mkartashev
Copy link
Collaborator Author

A separate issue was filed to track the remaining problem:
IJPL-156798 Wayland: cannot paste a group of files with no extension

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

Successfully merging this pull request may close these issues.

2 participants