Bug 191665 - [Clipboard] paste ignores sometimes the last line
Summary: [Clipboard] paste ignores sometimes the last line
Status: RESOLVED DUPLICATE of bug 153809
Alias: None
Product: Platform
Classification: Eclipse Project
Component: SWT (show other bugs)
Version: 3.3   Edit
Hardware: PC Linux
: P3 major (vote)
Target Milestone: ---   Edit
Assignee: Duong Nguyen CLA
QA Contact:
URL:
Whiteboard:
Keywords: needinfo
Depends on:
Blocks:
 
Reported: 2007-06-08 05:41 EDT by Jens Seidel CLA
Modified: 2007-06-13 13:53 EDT (History)
6 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jens Seidel CLA 2007-06-08 05:41:37 EDT
Build ID: 3.3RC2

Steps To Reproduce:
Sorry I failed to reproduce the error and that's why I haven't reported it earlier (I see it since a few months).
Nevertheless it happens regularly (a few times per day):

If I try to copy and paste text for a C/C++ project in the editor (or cut and insert) the last line is sometimes not inserted. If I press Ctrl+X to cut text all lines are removed but copying nevertheless ignores the last line.

I will try to make it reproducable but maybe you can fix it 
without further information as well ...

More information:
Comment 1 Kim Horne CLA 2007-06-08 09:29:48 EDT
Is this only happening in C/C++ editors or normal text or Java editors as well?
Comment 2 Jens Seidel CLA 2007-06-08 12:49:49 EDT
(In reply to comment #1)
> Is this only happening in C/C++ editors or normal text or Java editors as well?

Sorry, I do not have access to Java files. I just edited C++ files ... 

Comment 3 Kim Horne CLA 2007-06-08 13:01:35 EDT
But you must have access to .txt files or could easily make one...  Does it happen with them?  
Comment 4 Kevin McGuire CLA 2007-06-11 13:39:26 EDT
Please reproduce with an SDK level example (as Kim suggests) and reopen with the additional information. We need to determine first if this is a CDT problem or platform problem.
Comment 5 Jens Seidel CLA 2007-06-12 07:48:22 EDT
(In reply to comment #4)
> Please reproduce with an SDK level example (as Kim suggests) and reopen with
> the additional information. We need to determine first if this is a CDT problem
> or platform problem.

I tried again to reproduce it and think this error only occurs for C++ files.

It is not possible to reproduce it directly. Nevertheless I noticed that the
following example file hello.cpp (without quotes) is sufficient to show this error:

"line1"
"  line2"
"  line3"
"line4  "
" "

Try to mark the first "l" in line2 up to "3" (I did not marked the end
of line). Now copy and paste it via Ctrl+C/Ctrl+V to the last line and
you get either
line2
  line3
or
line2

This error should not need more than 5 minutes to occur.
I use CDT 4.0 RC3.
Comment 6 Anton Leherbauer CLA 2007-06-12 08:52:55 EDT
Did you check the log for an error message?
Comment 7 Jens Seidel CLA 2007-06-12 09:08:22 EDT
(In reply to comment #6)
> Did you check the log for an error message?

Yes, I did. The log is empty (at least for the time of testing).
I know it's no fun to reproduce this problem :-) Nevertheless since it
could cause data loss it should be considered as a major bug.
Comment 8 Jens Seidel CLA 2007-06-12 09:30:58 EDT
To give you a few more hints:

I now installed a new clean Eclipse 3.3 RC4, installed
CDT 4.0 RC3 via Help menu, created a new C++ project (Hello
World), deleted the old test.cpp content and was able to
reproduce the problem with my example multiple times in
only two minutes.

So it is not related to any non standard formatter option, ...
Comment 9 Anton Leherbauer CLA 2007-06-12 10:06:11 EDT
Do you know if this happens on Windows too? So far I could not reproduce it there.
Comment 10 Jens Seidel CLA 2007-06-12 10:32:29 EDT
(In reply to comment #9)
> Do you know if this happens on Windows too? So far I could not reproduce it
> there.

No, and there is no way for me to test it until they fix there license :-)

Comment 11 Anton Leherbauer CLA 2007-06-12 10:55:42 EDT
I now tried with the same setup (Eclipse 3.3 RC4, CDT 4.0 RC3) on Linux, but without success. You are indicating that it does not happen every time, so could you describe what you are doing to repeat it (Ctrl+V again, or first undo, then Ctrl+V, etc.)?
Is line 5 the "last line" you are referring to in comment 5, or is it the line below?
Did you try with a new workspace?
Which JVM are you using?
Anything else, that might shed some light on this?
Comment 12 Jens Seidel CLA 2007-06-12 11:26:21 EDT
(In reply to comment #11)
> I now tried with the same setup (Eclipse 3.3 RC4, CDT 4.0 RC3) on Linux, but
> without success. You are indicating that it does not happen every time, so
> could you describe what you are doing to repeat it (Ctrl+V again, or first
> undo, then Ctrl+V, etc.)?

Now I was able to get this error in the second iteration of:
 * Move the cursor (via cursor keys, no mouse) to "l" in line2
 * Hold Shift, press cursor down key and the End key, release Shift
 * Ctrl+C
 * Press cursor down twice, cursor is now on the first empty line in
   the second column
 * Ctrl+V
 * Ctrl+Z
 * Goto step 1

> Is line 5 the "last line" you are referring to in comment 5?

Yes, but is should not matter. There can also be multiple lines
following.

Please note that my "test" file is very exotic. A normal file
should show this error as well (not sure whether it will occur so often
but it will occur!).

> Did you try with a new workspace?

Yes.

> Which JVM are you using?

$ java -version
java version "1.6.0_01"
Java(TM) SE Runtime Environment (build 1.6.0_01-b06)
Java HotSpot(TM) 64-Bit Server VM (build 1.6.0_01-b06, mixed mode)

It's a 64 bit Java as I'm working on a Intel(R) Core(TM)2 Quad CPU @ 2.40GHz. I'm not sure but I think I observed this error also a few
weeks ago when I used a 32 bit JVM on an older PC.

I extracted
 eclipse-SDK-3.3RC4-linux-gtk-x86_64.tar.gz
and installed via Help->Update
 cdt-4.0.0-RC2-linux.x86_64.tar.gz

> Anything else, that might shed some light on this?
 
I use a German locale (de_DE.UTF-8).

Sorry, I have no further ideas. I would start now valgrind
for a C++ program :-)
Comment 13 Jens Seidel CLA 2007-06-12 11:40:50 EDT
I tried it again on a different PC (via ssh connection).

$ java -version
java version "1.5.0_10"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_10-b03)
Java HotSpot(TM) 64-Bit Server VM (build 1.5.0_10-b03, mixed mode)

Eclipse 3.2.0, I20060602-1317
CDT 3.1.0.200606261600

The error occurs as well but the behaviour is much more funny:
Each second time both lines are pasted, all other times only one
(cyclic)!!

So the error exists already since some time ...
Comment 14 Anton Leherbauer CLA 2007-06-13 03:44:58 EDT
Hm, still no success (or failure, rather).
Could you check, if the clipboard actually contains both lines?
Is it maybe a drawing problem? Could you try saving the file and reopening when only line2 got pasted?
Does it depend on the typing speed?

Actually, if the same (or worse) happens with CDT 3.1.x, then I'd guess that it also happens with the Eclipse Text Editor, because the smart paste feature (which would be to blame here) was added in 4.0.
Comment 15 Jens Seidel CLA 2007-06-13 07:55:55 EDT
(In reply to comment #14)
> Could you check, if the clipboard actually contains both lines?

I did not know that X has a clipboard :-) I knew only of the selection
buffer. OK, I found the program xclipboard and it indeed doesn't show the second line on errors!

But the really funny behaviour is the following: If xclipboard is open during the test the error does *not* occur at all! (I tested Eclipse 3.2 only, as the
problem is directly reproducable in it.)

> Is it maybe a drawing problem? Could you try saving the file and reopening when
> only line2 got pasted?

No, line2 is not saved.

> Does it depend on the typing speed?

No. but I noticed another reason. In comment 12 I explained that I press the End key to get to the end of line2. If I use the Left cursor key the problem does not occur!

> Actually, if the same (or worse) happens with CDT 3.1.x, then I'd guess that it
> also happens with the Eclipse Text Editor, because the smart paste feature
> (which would be to blame here) was added in 4.0.

Oops, sorry. You're right. Now that it is 100% reproducable it was easy to
verify this for a .txt file in a generic project. Sorry that you tried it so
long without success.

I tried my sequence also in other programs such as mcedit (only 3 times),
kwrite (multiple minutes, it uses also the clipboard as I verified) but could not reproduce it there. xedit, the ancient X editor, doesn't support copy and paste (only selection mode via 3 mouse button), so I could not test it. 

PS: Both PC's I tested are OpenSuse 10.2 (X86-64) systems.
Comment 16 Anton Leherbauer CLA 2007-06-13 10:06:53 EDT
Sending back to Platform.
Comment 17 Kim Horne CLA 2007-06-13 10:16:35 EDT
Passing to SWT for comment.
Comment 18 Steve Northover CLA 2007-06-13 10:55:54 EDT
Could this be the Klipper bug where the clipboard gets stolen/locked?  Duong to investigate.
Comment 19 Jens Seidel CLA 2007-06-13 11:19:09 EDT
(In reply to comment #18)
> Could this be the Klipper bug where the clipboard gets stolen/locked?  Duong to
> investigate.

After killing klipper according to http://bugzilla.gnome.org/show_bug.cgi?id=172881
the problem does no longer occur.

$ klipper --version
Qt: 3.3.7
KDE: 3.5.5 "release 45" 
Klipper: v0.9.7


Thanks 

Comment 20 Steve Northover CLA 2007-06-13 12:32:34 EDT
Duong, close as a dup?
Comment 21 Bogdan Gheorghe CLA 2007-06-13 13:50:44 EDT
Maybe mark it as a dup of Bug 153809?
Comment 22 Duong Nguyen CLA 2007-06-13 13:53:00 EDT

*** This bug has been marked as a duplicate of bug 153809 ***