Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 377417 - [syntax highlighting] enclosing bracket highlighting inconsistent with non-zero selection
Summary: [syntax highlighting] enclosing bracket highlighting inconsistent with non-ze...
Status: RESOLVED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: Text (show other bugs)
Version: 3.8   Edit
Hardware: PC Windows 7
: P3 normal (vote)
Target Milestone: 3.8 M7   Edit
Assignee: Deepak Azad CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-04-23 11:12 EDT by Markus Keller CLA
Modified: 2012-04-27 08:14 EDT (History)
2 users (show)

See Also:


Attachments
fix (1.30 KB, text/plain)
2012-04-27 07:21 EDT, Deepak Azad CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Markus Keller CLA 2012-04-23 11:12:30 EDT
if (1 < 2)
    System.out.println("hi");

                                highlighted brackets:
                                ---------------------
- put caret before first '('    enclosing block
- Shift+ArrowRight              (1 < 2)
- Shift+ArrowRight              (1 < 2)
- Shift+ArrowDown               enclosing block
- Shift+ArrowUp                 enclosing block

=> we have different highlights for the same selection depending on the selection change sequence
Comment 1 Dani Megert CLA 2012-04-27 04:13:59 EDT
The latest patch in comment 372516 improves this but there's still an issue when expanding the selection into the bracket: it starts to select the enclosing braces instead of staying inside the ( ).
Comment 2 Deepak Azad CLA 2012-04-27 06:08:34 EDT
(In reply to comment #0)
> if (1 < 2)
>     System.out.println("hi");
> 
>                                 highlighted brackets:
>                                 ---------------------
> - put caret before first '('    enclosing block
> - Shift+ArrowRight              (1 < 2)
> - Shift+ArrowRight              (1 < 2)

Selection is '(1' and ( ) are highlighted because the avoid-computation logic thinks there is no need to recompute in this case.

> - Shift+ArrowDown               enclosing block
> - Shift+ArrowUp                 enclosing block

Selection is '(1' and { } are highlighted and a computation happens which finds { } as the enclosing brackets. 

> => we have different highlights for the same selection depending on the
> selection change sequence

The fix from bug 372516 causes the computation to happen in both the above cases and hence { } are highlighted all the time...
Comment 3 Deepak Azad CLA 2012-04-27 07:21:20 EDT
Created attachment 214685 [details]
fix

I still think that the existing behavior is better and that { } should be highlighted here, but since I am outnumbered here is the fix.

All current tests pass but I will probably add some more tests later today.