Bug 401835 - Paste, pastes text in the wrong editor
Summary: Paste, pastes text in the wrong editor
Status: CLOSED WORKSFORME
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 4.3   Edit
Hardware: PC Windows 10
: P3 major with 8 votes (vote)
Target Milestone: ---   Edit
Assignee: Brian de Alwis CLA
QA Contact:
URL:
Whiteboard:
Keywords: needinfo
: 468612 (view as bug list)
Depends on:
Blocks:
 
Reported: 2013-02-26 16:14 EST by Pascal Rapicault CLA
Modified: 2018-10-30 05:24 EDT (History)
23 users (show)

See Also:


Attachments
Replication example (139.63 KB, image/png)
2015-05-28 08:03 EDT, Michael Houston CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Pascal Rapicault CLA 2013-02-26 16:14:31 EST
I20130219-1600 + a bunch of junk

I'm running into a situation where paste ends up pasting in the editor that had last focus.

At this point I have not been able to reproduce it consistently on a fresh workspace but I've been able to get in this state multiple times during the day. Here is what is happening:
- Open 3 editors on different files (for me those are java files). Let's called them A B and C
- Place your cursor in various position in the editors.
- Now go to an editor A, highlight text, Ctrl+C
- Select the tab of editor B, then select the tab of editor C
- Paste using Ctrl+V, the content is pasted in editor B whereas it is expected to be pasted in C.
Comment 1 Dirk Fauth CLA 2013-02-28 05:02:59 EST
It is not only pasting, it is for several key-bindings.

I realized this also happens for CTRL+D (very bad as lines in another editor gets deleted), DELETE (while Backspace is working, or the other way), CTRL+S ...
Comment 2 Paul Webster CLA 2013-03-01 07:10:05 EST
Are you in multi-tab mode or single tab mode?

And you are switching only using tabs.

PW
Comment 3 Dirk Fauth CLA 2013-03-01 07:19:27 EST
What is a multi-tab mode? Never heard of that before regarding eclipse editors. :)

I use Eclipse the way it opens by default. All editors in the same part stack.

Sometimes I switch using the tabs, sometimes using the key-binding CTRL+F6
Comment 4 Thomas Schindl CLA 2013-03-01 07:24:43 EST
I could in history get into such a state by have 2 Java-Files opened.

-----------8<-----------
MyClassA {
  MyClassB b;
  
  void test() {
     b.unkownMethod();
  }   
}

MyClassB {

}
-----------8<-----------

If I used then the quick-fix to create the unknown method in MyClassB and afterwards started typing there the key-strokes went to the wrong file - but I could not reproduce this anymore with the latest build and the simplified test case from above.
Comment 5 Paul Webster CLA 2013-03-01 07:44:37 EST
(In reply to comment #3)
> What is a multi-tab mode? Never heard of that before regarding eclipse
> editors. :)

That's the default, with editor tabs in one stack.  As opposed to single-tab mode (or unibrow mode :-) where the editor area only shows on tab at a time.

> 
> Sometimes I switch using the tabs, sometimes using the key-binding CTRL+F6

Thanks
PW
Comment 6 Paul Webster CLA 2013-03-01 07:45:59 EST
(In reply to comment #4)
> If I used then the quick-fix to create the unknown method in MyClassB and
> afterwards started typing there the key-strokes went to the wrong file - but
> I could not reproduce this anymore with the latest build and the simplified
> test case from above.

That was bug 394517, fixed in 4.3M5a

PW
Comment 7 Eric Moffatt CLA 2013-03-01 14:37:34 EST
Pascal, just tried the short version of the scenario and can't seem to reproduce it, are you still seeing this lately ?
Comment 8 Pascal Rapicault CLA 2013-03-01 15:45:05 EST
I have not seen this recently.
Comment 9 Dirk Fauth CLA 2013-03-27 10:36:31 EDT
Working with Kepler M6 I still have this issue. Looking into the log files I found this exception everytime shortly before the context issue occurs:

!MESSAGE Exception while dispatching event org.osgi.service.event.Event [topic=org/eclipse/e4/ui/model/ui/ElementContainer/selectedElement/SET] to handler org.eclipse.e4.ui.services.internal.events.UIEventHandler@17ca3ed
!STACK 0
java.lang.ClassCastException: java.lang.Object cannot be cast to org.eclipse.e4.core.commands.EHandlerService
	at org.eclipse.ui.internal.menus.MenuHelper$1.evaluate(MenuHelper.java:240)
	at org.eclipse.e4.ui.internal.workbench.ContributionsAnalyzer.isVisible(ContributionsAnalyzer.java:248)

So it seems to be related to 398925, while having a different effect.
Comment 10 David Bosschaert CLA 2014-08-29 08:57:17 EDT
I am on 4.4 release and am getting hit by this a *lot*. 

Typically i have two Eclpise editors open, split screen side by side. When I want to copy some text from one into the other the text ends up in the wrong editor. 

The cursor is in the correct editor and typing goes to the right editor, but pasting doesn't. It normally goes to the editor where I copied the text from.
Comment 11 David Bosschaert CLA 2014-08-29 08:58:09 EDT
Forgot to mention, I'm on Mac OSX. Not sure if that's important.
Comment 12 Henrik Lindberg CLA 2014-10-02 12:58:16 EDT
I have this problem with SR1 as well on OSx. I have an extra window open, with a split pane. Sometimes the paste goes to another file in the same "split panel", sometimes it goes to the file in the other split panel.
Comment 13 Henrik Lindberg CLA 2014-10-02 13:02:25 EDT
This pretty much randomly destroys files as it is not just for paste - files may be corrupted in the background and you may inadvertently press the key to save it.

Raised to critical.
Comment 14 David Bosschaert CLA 2014-10-03 03:28:01 EDT
Yeah, it's very annoying and in my case a real productivity killer as it really happens a lot and as Henrik says I sometimes inadvertently corrupt other files.

Another thing that I noticed is that it also happens with the code-completion popup window. So I might be typing some text, hit CTRL-SPACE and the code-completion window appears in the wrong pane.
Comment 15 David Bosschaert CLA 2014-10-06 06:08:31 EDT
BTW I am also seeing this problem on the latest Eclipse 4.4.1
Comment 16 Ulrich Grave CLA 2014-10-21 08:42:43 EDT
I have the same problem with 4.4.1.
Comment 17 Thomas Hallgren CLA 2014-10-21 08:56:29 EDT
Me too. This is really bad.
Comment 18 Wojciech Sudol CLA 2014-10-21 09:29:26 EDT
Ulrich, Thomas - what are your operating systems? Does it happen in a specific circumstances? Are there any exceptions in log file (<WORKSPACE>/.metadata/.log)?
Comment 19 Thomas Hallgren CLA 2014-10-21 10:01:36 EDT
(In reply to Wojciech Sudol from comment #18)
> Ulrich, Thomas - what are your operating systems?

I was on a Mac OS/X 10.9 when this happened. I don't see it on my Linux box. I'll check the logs next time and get back to you.
Comment 20 Khalid Alharbi CLA 2014-11-03 12:14:27 EST
This happened to me a lot of times! I'm running Mac OS X 10.7.5, Eclipse Juno version 4.2.2.M20130204-1200 
This is a quite annoying problem as you may overwrite existing files without knowing. Some keyboard shortcuts do not work like (CTRL + SPACE). When I hit COMMAND + V, it pastes the content in the wrong tab even when the focus is on another tab.
Comment 21 Ulrich Grave CLA 2014-11-13 02:04:45 EST
(In reply to Wojciech Sudol from comment #18)
> Ulrich, Thomas - what are your operating systems? Does it happen in a
> specific circumstances? Are there any exceptions in log file
> (<WORKSPACE>/.metadata/.log)?

Running under Windows 7 with SP1. I will check the log file next time. Sometimes it happens very often sometimes not.
Comment 22 Suresh Kumar R CLA 2014-11-16 13:36:07 EST
This is really annoying issue. It happens to be in Mac OS X 10.10.

Version: 4.2.2
Build id: M20130204-1200

The issue as as below. The issue happens regardless of whether Macbook Pro's display holds primary and the additional display has the 

1. Lets say eclipse is running in Display 1 with a file open. I am working on ErLang project for the time being.
2. I open another file in a new tab.
3. Drag that tab to other display. 
4. The file in that tab is opened in a new window in the same display. Note the issue as its not being opened as window in the other display where I dragged and dropped. This is ok, not the main issue.
5. Then I drag and drop the window to the other display from the one where eclipse IDE is running.
6. Now I start editing the file in the new window in secondary display.
7. I copy and paste some text in the secondary display. Copy and paste done using keyboard shortcuts. Both operations done in same display.

The issues are as below.
1. Both copy and paste does not work in the secondary window. Copy operation does not copy selected text to clipboard. Paste operation pastes what was last in the clipboard before copy was done in selected window, in to the tab in IDE of primary display.
2. If focus was not in any tab, then copy/paste does nothing even in primary display.

Copy/paste works fine if done using mouse.
Comment 23 Suresh Kumar R CLA 2014-11-16 13:38:08 EST
I just noticed that even the undo/redo is not working.
Comment 24 Wojciech Sudol CLA 2014-11-17 09:30:56 EST
(In reply to Suresh Kumar R from comment #22)
> Version: 4.2.2

Could you verify if these problems still occur in Eclipse 4.4.1?
Comment 25 Josh Davidson CLA 2014-12-09 12:08:05 EST
This is still a problem in:
Version: Luna Service Release 1 (4.4.1)
Build id: 20140925-1800

I'm using Windows 7 x64.

Happens somewhat frequently for me.  Same observables.  I copy some text and try to paste, nothing happens.  Paste again, nothing happens.  Then discover that Eclipse pasted the text in a previously open editor.

For me, it seems like it be related to moving editors between Eclipse windows and/or cloning.
Comment 26 Josh Davidson CLA 2015-02-18 14:51:23 EST
Happens in 64-bit Linux as well:

Eclipse IDE for C/C++ Developers

Version: Luna Service Release 1a (4.4.1)
Build id: 20150109-0600

Same observables, was copy/pasting and nothing was happening in the active editor.  I decide to exit Eclipse, and it warns me me that file Y has unsaved changes.  Hmmm...that's odd.  I switch to that editor and there are the 100 pastes I tried to make.
Comment 27 Josh Davidson CLA 2015-02-18 14:53:53 EST
Oh, one other thing I noticed that in addition to pastes showing up in the wrong file, the find dialog was also broke.  I brought it up, pasted in a method name (paste worked) and hit find.  No results, despite the string showing up multiple times.  I'm guessing it was searching in the editor it was mysteriously pasting into.
Comment 28 Josh Davidson CLA 2015-05-22 12:15:22 EDT
I think this issue is likely related to: https://bugs.eclipse.org/bugs/show_bug.cgi?id=385278
Comment 29 Dani Megert CLA 2015-05-27 15:41:12 EDT
More detailed steps would help to investigate and solve this issue.
Comment 30 Alexander Vasiljev CLA 2015-05-28 07:43:14 EDT
I also have the same problems. It starts happen when i opened Eclipse on two monitors. With one monitor i have never notice such problems.
OS Ubuntu 14.04
Luna Service Release 1a (4.4.1)
Comment 31 Dani Megert CLA 2015-05-28 07:44:38 EDT
*** Bug 468612 has been marked as a duplicate of this bug. ***
Comment 32 Dani Megert CLA 2015-05-28 07:52:31 EDT
(In reply to Alexander Vasiljev from comment #30)
> I also have the same problems. It starts happen when i opened Eclipse on two
> monitors. With one monitor i have never notice such problems.
> OS Ubuntu 14.04
> Luna Service Release 1a (4.4.1)

Did you drag and drop editors from one window to the other?
Comment 33 Alexander Vasiljev CLA 2015-05-28 08:00:35 EDT
Yes, i have Eclipse opened on two displays. Sometimes i drag files from the editor on one display to the editor on another display.
Comment 34 Michael Houston CLA 2015-05-28 08:03:23 EDT
Created attachment 253896 [details]
Replication example

I can reproduce this with two windows (on the same screen).
OS: OS X 10.10.3
Version: Luna Service Release 2 (4.4.2)
Build id: 20150219-0600

1) Create 2 new windows (Window -> New Window)

2) Open a file in each (different files)

3) Drag a tab from one window to the other

4) Paste text into the tab you just dragged

The text will appear not at the active cursor, but in the last tab selected in the window before the new one was dragged in.
Comment 35 Dani Megert CLA 2015-05-28 08:05:50 EDT
(In reply to Alexander Vasiljev from comment #33)
> Yes, i have Eclipse opened on two displays. Sometimes i drag files from the
> editor on one display to the editor on another display.


(In reply to Michael Houston from comment #34)
> Created attachment 253896 [details]
> Replication example
> 
> I can reproduce this with two windows (on the same screen).
> OS: OS X 10.10.3
> Version: Luna Service Release 2 (4.4.2)
> Build id: 20150219-0600
> 
> 1) Create 2 new windows (Window -> New Window)
> 
> 2) Open a file in each (different files)
> 
> 3) Drag a tab from one window to the other
> 
> 4) Paste text into the tab you just dragged
> 
> The text will appear not at the active cursor, but in the last tab selected
> in the window before the new one was dragged in.


This is bug 445305.
Comment 36 David Bosschaert CLA 2015-05-28 08:07:29 EDT
I have this happening with split editors inside a single window (so I don't need to do Window -> New Window). I created these split editors by simply dragging the tab of an editor for a certain file to the side of the editor so that it shows a split line in the center and then dropping the tab.
Comment 37 Thomas Schindl CLA 2015-05-28 08:16:22 EDT
(In reply to David Bosschaert from comment #36)
> I have this happening with split editors inside a single window (so I don't
> need to do Window -> New Window). I created these split editors by simply
> dragging the tab of an editor for a certain file to the side of the editor
> so that it shows a split line in the center and then dropping the tab.

Dani and others, such a behavior could very well be caused by bug 468048 because the active part is not changing appropriately upon activation so to me it sounds like it is pasting to the wrong Active-Part!
Comment 38 Josh Davidson CLA 2015-06-03 13:03:41 EDT
Still happening in:
Version: Mars Release Candidate 2 (4.5.0RC2)
Build id: 20150528-0540
Comment 39 David Bosschaert CLA 2015-08-04 14:26:54 EDT
It might be me, but I have not seen this happen with the Mars release anymore. So whomever did something that fixed it, good job!
Comment 40 Brian de Alwis CLA 2015-10-14 17:29:28 EDT
Has anybody seen this occur with 4.5.1?  I wonder if the fix for bug 468048 may have solved the issue here.
Comment 41 Pascal Rapicault CLA 2015-10-20 21:26:11 EDT
So far so good.
Comment 42 Brian de Alwis CLA 2015-11-10 18:28:47 EST
Marking as WORKSFORME and we'll re-open if it recurs.
Comment 43 Lars Vogel CLA 2018-10-30 05:24:59 EDT
I have just seen this on Windows 10 but after a restart it worked again.

This has been observed on Windows 10:

- Detach an Editor on a second monitor
- Select a non-detached editor
- Mark text and copy is via Ctrl+C
- Paste it via CTRL+V 


-> Pasted text is pasted into the detached editor