eclipse-jdt / eclipse.jdt.debug

Eclipse Public License 2.0
16 stars 50 forks source link

Delete while typing in conditional breakpoint editor area deletes breakpoint #308

Closed Madjosz closed 1 month ago

Madjosz commented 1 year ago

Transfer of Bug 573604

Problem

When editing the condition of a conditional breakpoint in the editor area of the breakpoints view: If I hit Delete in an empty editor OR at the end of the input, instead of deleting nothing of your input, the breakpoint itself will be deleted from the list of all breakpoints.

This even gets worse if you hold the Delete key because you want to delete a whole bunch of characters before the caret. Once all characters are deleted and you hit the end of your input, it will start to delete all your breakpoints because after your conditional breakpoint gets deleted the next breakpoint on the list gets the focus and will also be deleted. With this it is easily possible to delete all your breakpoints at once by accident.

Can be reproduced on Mac with Fn + Delete.

If you activate "Show key binding when command is invoked" in Preferences -> General -> Keys, you will see "Delete - Delete \n Delete the selection".

I did a little testing on older Eclipse version and this bug is present at least since 4.2.2 (Juno). It is not present in 3.7.2 (Indigo). I did not check the version chaos in between these two versions apart from 4.0 where the Breakpoint view doesn't work at all since it does not show any of my breakpoints.

This bug does not occur in other input fields like the Hit count.

Expected behaviour

Do not delete breakpoints at all when the focus is in the editor area.

Screencapture

hitting DELETE 3 times in a row

Tested with

Eclipse SDK

Working Version Build id
✔️ Version: 3.7.2 Build id: M20120208-0800
Version: 4.2.2 Build id: M20130204-1200
Version: 2023-12 (4.30) Build id: I20230911-1800

Java

openjdk version "1.8.0_382" OpenJDK Runtime Environment (Temurin)(build 1.8.0_382-b05) OpenJDK 64-Bit Server VM (Temurin)(build 25.382-b05, mixed mode)

openjdk version "20.0.2" 2023-07-18 OpenJDK Runtime Environment Temurin-20.0.2+9 (build 20.0.2+9) OpenJDK 64-Bit Server VM Temurin-20.0.2+9 (build 20.0.2+9, mixed mode, sharing)

Operating System

Microsoft Windows 10 Pro 10.0.19045

iloveeclipse commented 1 year ago

Can reproduce on latest master / Linux too. Patch is welcome.

opcoach commented 1 month ago

Can not reproduce it on Mac Sequoia 15.0 with Eclipse 2024-09 and jdt.debug.ui 3.13.500.v20240822.

I select my breakpoint in the list, it is highlighted in blue, then I focus on the condition field, (the breakpoint selected is now highlighted in gray). Then I selected a text in the condition and hit Fn Delete (on Mac), the text is deleted, but not the breakpoint. If I select it in the list (when hightlighted in blue), and hit Fn Delete, the breakpoint is deleted, which is the nominal case...

I tried also to select the breakpoint in the list, then focus on the java editor, and then focus directly in the condition field, and hit Fn Delete, and once again only the selected text is deleted..

I would say this bug has been fixed.

Madjosz commented 1 month ago

Indeed this seems to be fixed in 4.33. I could not track what the actual fix was but it was introduced somwhere between 353005075c1ab3df53959b3deee9299cfbb7d934 (4.32 release, not working) and 9470d2b259dca40d18388f479c0ac7eca8d9fb88 (working). Thanks to whoever fixed it and @opcoach for testing.