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

Bug 64598

Summary: [KeyBindings] interactions: Delete (traversal) key triggers binding *and* sends the key event
Product: [Eclipse Project] Platform Reporter: adrian <stori>
Component: UIAssignee: Paul Webster <pwebster>
Status: RESOLVED INVALID QA Contact:
Severity: normal    
Priority: P3 CC: curtis.windatt.public, edoardo
Version: 3.0   
Target Milestone: ---   
Hardware: All   
OS: All   
Whiteboard:
Bug Depends on: 71016    
Bug Blocks:    
Attachments:
Description Flags
Patch to WorkbenchKeyboard
none
Test case editor plug-in none

Description adrian CLA 2004-05-28 14:00:41 EDT
As of M9, pressing the Delete key activates the Eclipse global delete action via
the key bindings, but *also* sends to my text widget the delete key event (which
it shouldn't, the key binding should have consumed it) - this results in two
characters deleted on every Delete key press...
Comment 1 Kai-Uwe Maetzel CLA 2004-06-02 12:44:09 EDT
Moving to Platform UI.
Comment 2 Douglas Pollock CLA 2004-06-03 13:04:50 EDT
Please try a more recent build, and verify the build number for the one you are 
running.  This was an old problem that was fixed for M8.  See Bug 53489, for 
example. 
Comment 3 adrian CLA 2004-06-03 14:30:19 EDT
Still happens in RC1.

I believe it's not a problem for the StyledText editors because
org.eclipse.ui.texteditor.AbstractTextEditor#createNavigationActions() does this:

   textWidget.setKeyBinding(SWT.DEL, SWT.NULL);

(perhaps for a different reason?!).
Comment 4 Douglas Pollock CLA 2004-06-03 14:42:33 EDT
Could you provide a snippet showing the problem? 
Comment 5 adrian CLA 2004-06-03 15:02:04 EDT
Well, back to the reason the problem doesn't show in TextEditor:  I think the
best snippet would be to remove the line indicated in AbstractTextEditor

   textWidget.setKeyBinding(SWT.DEL, SWT.NULL);

and see that, when pressing the Delete key, first the DELETE_NEXT will be
invoked by the key binding service, and then SWT.DEL will also be activated in
StyledText from the Delete key's event.

If the bug you mentioned (Bug 53489) fixed this very problem, and did it by
unbinding SWT.DEL in StyledText, then it didn't fix the *actual* problem (i.e.,
the key-binding service does not consume the Delete key it had already processed).
Comment 6 Douglas Pollock CLA 2004-07-14 15:41:01 EDT
*** Bug 69960 has been marked as a duplicate of this bug. ***
Comment 7 Douglas Pollock CLA 2004-07-14 15:42:15 EDT
This applies to all traversal keys.  "Esc" is another example.  It affects all 
platforms. 
Comment 8 Douglas Pollock CLA 2004-07-14 15:44:55 EDT
Created attachment 13264 [details]
Patch to WorkbenchKeyboard

"event.doit" should have been set to false not true.
Comment 9 Douglas Pollock CLA 2004-07-14 15:59:41 EDT
The patch has been committed to the 3.1 stream.... 
Comment 10 Michael Van Meekeren CLA 2004-08-03 16:10:36 EDT
This fix has introduced bug 71016 , I am investigating what to do here, but I
think that 71016 is more severe then this bug.
Comment 11 Douglas Pollock CLA 2004-09-22 14:43:09 EDT
I'm not even sure if this is a real problem or not.  However, if you try to use 
"Esc W" as "copy" in a dialog, the dialog simply closes instead.  None of the 
"Esc" prefixed commands seem to work.  This is likely related to this problem.  
If not, another bug needs to be opened.  I200409212000, GTK+ 2.4.9, KDE 3.3.0, 
Linux 2.6.8.1. 
Comment 12 Steve Northover CLA 2004-09-22 15:07:30 EDT
Doug, is there something you are expecting me to look at?
Comment 13 Douglas Pollock CLA 2004-09-22 15:12:40 EDT
Steve: Not at the moment no.  Silenio's been helpful so far.... 
Comment 14 Douglas Pollock CLA 2004-10-12 11:00:12 EDT
*** Bug 76013 has been marked as a duplicate of this bug. ***
Comment 15 Douglas Pollock CLA 2004-10-15 17:24:01 EDT
I believe I found the cause of this problem.  It is not the killing of the 
traversal event, but potentially how the out-of-order keys are processed.  I 
believe what is happening is that the key is being allowed to arrive first and 
then the out-of-order processing is happening.  Hence the duplicate entries. 
 
I've changed this so that out-of-order keys are processed after the traversal 
and before the key down.  This should hopefully correct the problem.  Please 
try out I200410190800 or later, and let me know how it goes. 
Comment 16 Douglas Pollock CLA 2004-10-28 16:08:56 EDT
I've had to do further changes because of Bug 77129.  Please try again in 
I200411010800. 
Comment 17 Douglas Pollock CLA 2005-02-18 16:03:09 EST
No reply.  Closing as WORKSFORME.  Please re-open if this is still a problem....
Comment 18 adrian CLA 2005-09-23 14:39:26 EDT
Finally time to go back to this...  Still a problem in R3.1.0 (the key-binding
service does not consume the Delete key it had already processed).

I'll attach a sample testeditor plug-in, which installs a key listener on an
editor's text widget.  Start eclipse with -console, press Delete/Del key:  the
delete action is invoked via key-binding, but the SWT.DEL key event is also
received in the widget.
Comment 19 adrian CLA 2005-09-23 14:40:51 EDT
Created attachment 27458 [details]
Test case editor plug-in

Testcase editor plug-in (TEST EDITOR).
Comment 20 Michael Van Meekeren CLA 2006-04-21 13:14:17 EDT
Moving Dougs bugs
Comment 21 Paul Webster CLA 2006-09-28 15:13:31 EDT
Is this still a problem in 3.3?

PW
Comment 22 Denis Roy CLA 2007-06-22 09:32:38 EDT
Changes requested on bug 193523
Comment 23 Curtis Windatt CLA 2013-02-11 12:54:51 EST
Closing as INVALID.  Several attempts were made to fix this, but so much has changed in 7 years that this bug serves no purpose.  If this is still an issue, please reopen and attach an updated test case.