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

Bug 392667

Summary: Selection Not Cleared when deleting first row
Product: [Technology] NatTable Reporter: Thomas M??der <t.s.maeder>
Component: CoreAssignee: Stephan Wahlbrink <sw>
Status: CLOSED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: dirk.fauth, sw
Version: 0.9.0   
Target Milestone: 1.0.0   
Hardware: PC   
OS: Windows 7   
See Also: https://bugs.eclipse.org/bugs/show_bug.cgi?id=383059
Whiteboard:

Description Thomas M??der CLA 2012-10-23 11:45:06 EDT
I have a NatTable which has two rows. When I select the first and then remove it from the underlying model, I get a IStructuralChangeEvent which correctly states that the row range 0, 1 has changed. However, the selection is not cleared.
Comment 1 Thomas M??der CLA 2012-10-23 11:47:52 EDT
I believe the bug was introduced by fixing bug 383059 . The code in SelectionLayerStructuralChangeEventHandler.handleLayerEvent(...) creates the relevant range like this:

Range changedRange = new Range(rectangle.y, rectangle.y + rectangle.height - 1);

This used to work, since 0-lenght ranges would overlap with other ranges. They don't anymore, and correctly so. 

Not sure what the right fix is.
Comment 2 Thomas M??der CLA 2012-10-23 12:12:42 EDT
Actually, just not doing the "-1" at the end seems to work for me.
Comment 3 Stephan Wahlbrink CLA 2012-10-24 09:46:46 EDT
You are right, the end index of a Range is exlusive.
Comment 4 Stephan Wahlbrink CLA 2012-10-24 11:15:16 EDT
Committed f61dfca7d62f960066ad1c94c5fadf51287e1864
Comment 5 Dirk Fauth CLA 2014-07-23 10:18:17 EDT
CLOSED