This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.
Summary: | Go to matching brace selects 'wrong' right-brace character | ||
---|---|---|---|
Product: | php | Reporter: | RobertJohnson |
Component: | Editor | Assignee: | Tomas Mysik <tmysik> |
Status: | RESOLVED FIXED | ||
Severity: | normal | CC: | junichi11, tmysik |
Priority: | P4 | ||
Version: | 7.4 | ||
Hardware: | All | ||
OS: | All | ||
Issue Type: | DEFECT | Exception Reporter: | |
Attachments: |
Image to show example of bad right-brace selection, cursor at position 4 should select the brace before it.
patch patch v2 |
Created attachment 157049 [details]
patch
I've created a patch. Thanks.
Could you please review it? Thanks! @junichi11: Please, would it be possible to add a test for it? Thanks. (In reply to Tomas Mysik from comment #3) > @junichi11: Please, would it be possible to add a test for it? Thanks. I'll try it. I recreate a patch (with tests) because I would like to change my patch a little. Thanks. Created attachment 157120 [details]
patch v2
I recreated a patch(added changes and tests). Could you please review it? Thanks.
Patch applied, thanks a lot! http://hg.netbeans.org/web-main/rev/2bb7640fc463 Integrated into 'main-silver', will be available in build *201511060002* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress) Changeset: http://hg.netbeans.org/main-silver/rev/2bb7640fc463 User: Tomas Mysik <tmysik@netbeans.org> Log: #240157 - Go to matching brace selects 'wrong' right-brace character Patch contributed by junichi11@netbeans.org. |
Created attachment 143747 [details] Image to show example of bad right-brace selection, cursor at position 4 should select the brace before it. Your matching brace technology is excellent - when the cursor is before *or after* a brace, it is assumed to be one end of a pair. When the key to move to the matching brace is pressed, the cursor should find the matching brace, and if the key is repeated it should move back to the original brace - a cursor position toggle. The problem is when there are 2 consecutive right-hand braces. In the example picture attached, the brace before the cursor should be selected, not the one after it. To demonstrate why, follow these instructions using the line in the attached picture: 1. Put the cursor at position 3. 2. Press 'matching-brace' key 3. Press 'matching-brace' again - the cursor returns to position 4, selecting the following brace. The cursor position is correct, but the brace selection is wrong, and it is only a problem in this one scenario. 4. Further key presses move to a different pair of braces. My suggestion is that when the cursor is positioned between 2 right-hand braces, the brace prior to the cursor should be selected, not the one after. It becomes more important when the opposite brace is not visible in the editor. By repeating the brace-match key, you should never switch to a pair of braces different to the one that was selected on the first key press.