Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 240344

Summary: Paste in bultin-browser goes to address field instead of form input field
Product: [Eclipse Project] Platform Reporter: Robin Rosenberg <robin.rosenberg>
Component: User AssistanceAssignee: Chris Goldthorpe <cgold>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: ccc, cgold, grant_gayed, kaloyan, makandre, pwebster
Version: 3.4   
Target Milestone: 3.5 M4   
Hardware: Other   
OS: Linux   
Whiteboard:
Attachments:
Description Flags
Screenshot
none
Patch none

Description Robin Rosenberg CLA 2008-07-10 11:02:08 EDT
Build ID: I20080617-2000

Steps To Reproduce:

Launch a web application into the built-in browser that has a form. 

Click in a form field to place the cursor there.

Press Ctrl-V or Select Edit/Paste in the menu. In either case the cliboard content is appended to the address bar in the browser.
Comment 1 Carl Anderson CLA 2008-07-11 16:10:40 EDT
The Platform actually provides the browser via a SWT widget.
Comment 2 Grant Gayed CLA 2008-07-14 17:11:02 EDT
I don't see the behaviour you're describing, but I do see copy/cut/paste/selectAll no longer working in the Internal Web Browser view in 3.4.  I've investigated this and found that it's not a Browser problem (these keys work well in a stand-alone Browser case), but there were Browser changes made during 3.4 that have resulted in the eclipse workbench mistakenly eating these keys rather than leaving them for Mozilla to handle.

Taking ownership for now while determining how to handle this.  The Browser could fix this by providing new copy/cut/paste/selectAll() api for the workbench to invoke, but at this point I'm not sure if this is the thing to do.
Comment 3 Grant Gayed CLA 2008-08-29 15:38:46 EDT
I believe this will be fixed by the fix for bug 243210 (I know the Browser != AWT but I think the cause was the same).  Can you try 3.4.1 build http://download.eclipse.org/eclipse/downloads/drops/M20080827-2000/index.php and follow up here whether this helps?
Comment 4 Robin Rosenberg CLA 2008-08-29 16:16:25 EDT
Unfortunately there is no change. Paste in any field goes to the address bar and cut doesn't work in any form field.

According to the build logs the build for the platform I'm using (linux x86 gtk) is broken in a test called Browser9.
Comment 5 Grant Gayed CLA 2008-08-29 16:36:28 EDT
The Browser9 test failure is not a problem.

To investigate this I'll have to reproduce it.  Can you give me complete steps, including what to download, etc?  I live quite far below the level of web apps.
Comment 6 Robin Rosenberg CLA 2008-08-30 03:50:55 EDT
A few more version numbers, not sure if they are relevant.
libgtk+1.2-1.2.10-48mdv2008.1
libgtkmm2.4_1-2.12.7-1mdv2008.1
libgtk+2.0_0-devel-2.12.9-2mdv2008.1
libgtk+-x11-2.0_0-2.12.9-2mdv2008.1
libgtk-linux-fb-2.0_0-2.4.14-6mdk
gtk+2.0-2.12.9-2mdv2008.1
libgtkhtml2_0-2.11.1-2mdv2008.1
libgtk+2.0_0-2.12.9-2mdv2008.1

1. Download http://download.eclipse.org/eclipse/downloads/drops/M20080827-2000/download.php?dropFile=eclipse-SDK-M20080827-2000-linux-gtk.tar.gz

2. Extract the archive into a new folder

2. Start eclipse and give it a new workspace

3. Create a new java project 'X' in the workspace

4. Create a new file x.html in the new project
   So now we have a web browser inside eclipse

6. Change the url in the web browsers address bar to some page that has a form, i.e. http://google.com

7. Get some text into the clipboard
   (copy this line)

8. Plance the cursor in the google input form field

9. Either using Ctrl or Edit/Paste
   The pasted text appears in the address bar, not the input field

Comment 7 Robin Rosenberg CLA 2008-08-30 03:52:05 EDT
Created attachment 111344 [details]
Screenshot
Comment 8 Grant Gayed CLA 2008-09-03 12:00:23 EDT
I see, so it happens specifically when the Browser is opened as an editor, not as a view.  I see this happen on win32 as well.

TextAction.paste() is setting the text on the Combo, which seems wrong.  I'm not sure if this is UA or UI, so trying UI first.
Comment 9 Chris Goldthorpe CLA 2008-10-08 16:26:00 EDT
Assigning to UI for comment.
Comment 10 Paul Webster CLA 2008-10-08 20:55:19 EDT
Right, so org.eclipse.ui.internal.browser.TextAction is only dealing with the combo and org.eclipse.ui.internal.browser.WebBrowserEditorActionBarContributor.setActiveEditor(IEditorPart) is calling the action code to provide CUT, COPY, and PASTE for that specific web editor.

If the editor is going to provide a specific cut, copy, and paste, then like org.eclipse.ui.actions.TextActionHandler it has to delegate to the in-focus component in a way that allows it to work, deciding between the Combo and the browser widget (my example, TextActionHandler only deals with multiple Text widgets in one editor).

What if you simply remove these actions (delete them completely)?  When I did that, the native behaviour for Combo and for the Browser widget seemed to do what I want.  The only behaviour that was a little odd was select all (it worked on each widget and you needed to depend on colour to determine which one would be copied to the clipboard).


PW
Comment 11 Kevin McGuire CLA 2008-10-29 13:37:23 EDT
Ping Chris for reply to comment #10
Comment 12 Chris Goldthorpe CLA 2008-10-29 14:03:22 EDT
Based on Paul's analysis it looks like you should reassign this bug back to UA and I'll try that solution to see how it works.
Comment 13 Paul Webster CLA 2008-11-03 10:12:06 EST
*** Bug 253081 has been marked as a duplicate of this bug. ***
Comment 14 Chris Goldthorpe CLA 2008-11-03 12:20:21 EST
Created attachment 116835 [details]
Patch

This removes the override of the global actions for cut, copy and paste. I cannot detect any negative impact as a result of removing these.
Comment 15 Chris Goldthorpe CLA 2008-11-03 12:21:36 EST
Fixed in HEAD.
Comment 16 Kaloyan Raev CLA 2008-11-03 12:24:20 EST
Is it possible to have this patch in 3.4.2, too. June 2009 sounds really far away in the future. 
Comment 17 Chris Goldthorpe CLA 2008-11-05 16:44:56 EST
I'm hesitant to fix it for 3.4.2 because I have got burned in the past with bug fixes in point releases which cause regressions (Bug 252887). If this was for 3.4.1 I would probably have said yes but for 3.4.2 the PMC has asked us to only fix high severity bugs. If you can make a good case for why this is high severity I may be able get it into 3.4.2.
Comment 18 Kaloyan Raev CLA 2008-11-06 11:55:59 EST
Please, check the duplicated bug 253081. 
The problem with the Paste action leads to bad user experience when working with the Mylyn Task editor against a Trac repository. In the Trac use case the Task editor embeds the build-in browser. It is very often to paste things like hyperlinks, class names, etc. when writing comments in Trac. 
This bug could drive users back from using Mylyn Trac integration. 
Comment 19 Chris Goldthorpe CLA 2008-11-06 12:57:42 EST
OK you've convinced me. Are you in a position to test out this fix before I backpatch the 3.4 maintenance stream.
Comment 20 Kaloyan Raev CLA 2008-11-06 13:00:45 EST
Yes, I will apply the patch on top of 3.4.1 and will update you. 
Comment 21 Kaloyan Raev CLA 2008-11-11 15:40:15 EST
I have applied the patch on top of 3.4.1.
Ctrl+X/C/V work as expected. But the Edit > Cut/Copy/Paste menu actions don't work when the selection/focus is inside the browser's body. Is this behaviour expected?
Comment 22 Paul Webster CLA 2008-11-12 08:00:06 EST
(In reply to comment #21)
> I have applied the patch on top of 3.4.1.
> Ctrl+X/C/V work as expected. But the Edit > Cut/Copy/Paste menu actions don't
> work when the selection/focus is inside the browser's body. Is this behaviour
> expected?

yes.  The same limitation applies to the Browser View as well.  Unless you provide a handler to eclipse for that part, Edit>Cut/Copy/Paste will not work.

Since this fix for non-SWT Text widgets is to say we're not handled at all (so the native behaviour can take over) eclipse has no way to execute copy from the menu.

The solution involves the part providing a handler, and that handler being able to delegate to the focus widget (like a CCombo) or tell the browser (cut/copy/paste) which will only work if the browser provides programmatic access to that functionality.

PW
Comment 23 Kaloyan Raev CLA 2008-11-12 08:03:40 EST
Then I would say that applying the patch in the 3.4.x stream is as good as in the 3.5 stream. 
Comment 24 Chris Goldthorpe CLA 2008-11-13 16:24:45 EST
Since there is a side effect of removing this event handler I am not too inclined to port the fix to the maintenance stream. This bug has been around for a few releases and is more of an annoyance than a serious bug which causes data loss. Given the above I think the fix does not meet the criteria for inclusion in Eclipse 3.4.2.