Bug 552473 - Copying from Eclipse console and pasting directly into Gnumeric truncates long selections
Summary: Copying from Eclipse console and pasting directly into Gnumeric truncates lon...
Status: NEW
Alias: None
Product: Platform
Classification: Eclipse Project
Component: SWT (show other bugs)
Version: 4.13   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Platform-SWT-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords: triaged
Depends on:
Blocks:
 
Reported: 2019-10-28 07:07 EDT by Luke Hutchison CLA
Modified: 2020-02-17 04:08 EST (History)
2 users (show)

See Also:


Attachments
Screenshot of bottom of file being cut off (149.06 KB, image/png)
2019-11-12 11:08 EST, Luke Hutchison CLA
no flags Details
Screenshot of top of file being cut off (133.75 KB, image/png)
2019-11-12 11:08 EST, Luke Hutchison CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Luke Hutchison CLA 2019-10-28 07:07:23 EDT
If I select a lot of console output in Eclipse (tens of thousands of rows, or megabytes in total), then copy to the clipboard, then try to paste into Gnumeric in Linux, either the beginning or the end of the selection, or both, are truncated. 

Instead, if I paste into gedit first, the selection is pasted intact to gedit. Then if I re-copy in gedit and paste into Gnumeric, Gnumeric gets the whole selection just fine.

The problem is only apparent when copying from the Eclipse console and pasting straight into Gnumeric.

I don't know if this is a problem with Gnumeric, or Eclipse, or the interaction of both, but given that there is no issue pasting the exact same content from gedit into Gnumeric, I tend to think Eclipse is playing a role, potentially by not correctly implementing the clipboard protocol or something.

Another strange issue occurs when attempting to copy and paste between Eclipse and Gnumeric -- sometimes you have to hit Ctrl-V two or even three times to paste a large selection of content that was copied in Eclipse -- the first few times the paste operation is ignored (and you can check that it's not just Gnumeric being slow at pasting, by moving the cursor around between paste attempts). Again I don't know if that is Eclipse's fault or not, but it seems somehow related to the first problem.

This has been an issue for many years, and I have worked around it hundreds of times over the years by pasting via gedit. I don't know why I didn't report this sooner...
Comment 1 Eric Williams CLA 2019-10-28 09:18:25 EDT
Can you provide an SWT snippet which generates output that shows your bug? Also, which GTK3 version, Eclipse version, and Linux distribution are you using?
Comment 2 Luke Hutchison CLA 2019-10-28 18:07:53 EDT
Well this has been a problem in Eclipse for at least 12 years, including in the most recent released version, so I don't think the version of Eclipse, Linux or Gnumeric matters, but:

Version: 2019-09 (4.13)
Build id: I20190916-1045

Fedora 30

gnumeric-1.12.45-1.fc30.x86_64

I chose "SWT" as the bug component because I suspect it may be a bug in SWT, but I don't have an SWT code snippet that can replicate the bug. Instead, set the Eclipse console to have unlimited scrollback, then run the following Java code in Eclipse:

        for (int i = 0; i < 50_000; i++) {
            System.out.print(i);
            for (int j = 0; j < 30; j++) {
                System.out.print("\t########");
            }
            System.out.println();
        }

Click on the console output, press Ctrl-A Ctrl-C to copy all, then open Gnumeric, and press Ctrl-V to paste. (You may have to press Ctrl-V two or three times to initiate the paste, as described.) Then press Alt-F, Alt-F, Alt-I to step through the paste import popup (or go Forward -> Forward -> Finish). Look at the top and bottom of the sheet, and observe that the top and/or bottom of the import has been cut off, often in the middle of a line.

Now press Ctrl+N in Gnumeric and repeat the process again. Do it a few times, in order to see that exactly where the pasted contents are cut off is actually random.

Now open gedit, and press Ctrl+V with the same clipboard contents, copied from Eclipse. The file will paste fine. Now press Ctrl+A Ctrl+C to copy all from gedit. Now go back to Gnumeric, and press Ctrl+N Ctrl+V to paste into a new Gnumeric file. The entire contents should be pasted fine.

Incidentally, if you change 50_000 above to 1_000_000, producing a million lines of console output, you get "Unhandled loop exception: Java heap space", which is also not good.
Comment 3 Eric Williams CLA 2019-11-12 10:55:25 EST
(In reply to Luke Hutchison from comment #2)
> Click on the console output, press Ctrl-A Ctrl-C to copy all, then open
> Gnumeric, and press Ctrl-V to paste. (You may have to press Ctrl-V two or
> three times to initiate the paste, as described.) Then press Alt-F, Alt-F,
> Alt-I to step through the paste import popup (or go Forward -> Forward ->
> Finish). Look at the top and bottom of the sheet, and observe that the top
> and/or bottom of the import has been cut off, often in the middle of a line.

Can you clarify what you mean by cut off? Maybe even attach a screenshot so I can see what I'm looking for in Gnumeric.
Comment 4 Luke Hutchison CLA 2019-11-12 11:08:34 EST
Created attachment 280608 [details]
Screenshot of bottom of file being cut off
Comment 5 Luke Hutchison CLA 2019-11-12 11:08:53 EST
Created attachment 280609 [details]
Screenshot of top of file being cut off
Comment 6 Luke Hutchison CLA 2019-11-12 11:10:51 EST
I tried pasting three times. The first time the paste succeeded (all 50k rows produced by the example code were successfully pasted -- the chance of this decreases the longer the copied text is, so increasing the value over 50_000 could increase the chance of failure); the second time the bottom was cut off but the top was intact; the third time both the top and bottom were cut off. See screenshots attached above.
Comment 7 Eric Williams CLA 2019-11-12 12:03:49 EST
Okay, I can reproduce it now as well. I'll look into it for 4.15.
Comment 8 Lakshmi P Shanmugam CLA 2020-02-17 04:08:08 EST
Resetting target, please re-target as required.