ucoruh commented on issue #3962: URL: https://github.com/apache/netbeans/issues/3962#issuecomment-1935066154
## Issue Description and Environment Details - **Product Version:** Apache NetBeans IDE 20 - **Java Version:** 11.0.21; OpenJDK 64-Bit Server VM 11.0.21+9 - **Runtime Environment:** OpenJDK Runtime Environment 11.0.21+9 - **Operating System:** Windows 11 version 10.0, amd64; Cp1252; en_US (nb) ## Issue Reproduction Steps 1. Start the IDE. 2. Copy text from the NetBeans editor and paste into Notepad++ (this works on the first attempt). 3. Attempt to copy text from the NetBeans editor a second time and paste into Notepad++ (this does not work). 4. Copying text from Notepad++ and pasting it back into NetBeans results in the text copied in step 2 being pasted. 5. Copying text within NetBeans and pasting it within NetBeans works. After completing this step, copying and pasting to Notepad++ also works. ## Observation It appears that when copying text from NetBeans, the action is cached and awaits pasting into the NetBeans editor. Until the copied text is pasted back into NetBeans, further copy-paste actions are blocked. However, copying from Notepad++ to NetBeans does not exhibit this problem, suggesting an issue with how NetBeans handles the system clipboard. ## Solution and Investigation Upon examining the source code, I located a potential cause within the clipboard handling mechanism mentioned in https://github.com/apache/netbeans/issues/3962#issuecomment-1233619736 ```java if (System.getProperty("netbeans.slow.system.clipboard.hack") != null) { // NOI18N slowSystemClipboard = Boolean.getBoolean("netbeans.slow.system.clipboard.hack"); // NOI18N } else if (Utilities.isMac()) { slowSystemClipboard = false; } else { slowSystemClipboard = true; } ``` The property `netbeans.slow.system.clipboard.hack` was set to `false` in `netbeans.conf`, which resolved the issue. This modification skips the problematic clipboard behavior, avoiding the addition of AWT event listeners for clipboard management when `slowSystemClipboard` is false: ```java if (slowSystemClipboard) { Toolkit.getDefaultToolkit().addAWTEventListener( this, AWTEvent.WINDOW_EVENT_MASK); } ``` After applying this change, NetBeans directly accesses items from the system clipboard without interference. ## Configuration Applied ```plaintext netbeans_default_options="-J-Dnetbeans.slow.system.clipboard.hack=false [...]" ``` This adjustment effectively bypasses the issue, suggesting a workaround by modifying the clipboard handling behavior in NetBeans. Should the issue reoccur, I will provide further updates. However, after multiple resets of the IDE following this adjustment, the problem has not been reproduced. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: notifications-unsubscr...@netbeans.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: notifications-unsubscr...@netbeans.apache.org For additional commands, e-mail: notifications-h...@netbeans.apache.org For further information about the NetBeans mailing lists, visit: https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists