diff --git a/ChangeLog b/ChangeLog index 25d8d68e4..7b70d0bc7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2011-12-18 Eric Wasylishen + + * Source/NSTableView.m (-_isCellEditableColumn:row:): Tweak + criteria for determining cell editability:: + - the delegate (if present) must say YES + - and the cell itself must return YES for isEditable + - and the table column must return YES for isEditable + Previously you could edit cells that returned NO for + isEditable if the column they were in was editable. + 2011-12-18 Eric Wasylishen * Source/NSTableHeaderView.m (-initWithCoder:): Remove unneeded diff --git a/Source/NSTableView.m b/Source/NSTableView.m index fa5cc0e24..0221f10a6 100644 --- a/Source/NSTableView.m +++ b/Source/NSTableView.m @@ -6530,17 +6530,15 @@ For a more detailed explanation, -setSortDescriptors:. */ row: (int) rowIndex { - NSTableColumn *tableColumn; + NSTableColumn *tableColumn = [_tableColumns objectAtIndex: columnIndex]; + NSCell *cell = [tableColumn dataCellForRow: rowIndex]; + + BOOL cellIsEditable = [cell isEditable]; + BOOL columnIsEditable = [tableColumn isEditable]; + BOOL delegateAllowsEditing = [self _shouldEditTableColumn: tableColumn + row: rowIndex]; - tableColumn = [_tableColumns objectAtIndex: columnIndex]; - // If the column is editable, the cell always is - if ([tableColumn isEditable]) - { - // otherwise ask the delegate, if any. - return [self _shouldEditTableColumn: tableColumn row: rowIndex]; - } - - return NO; + return cellIsEditable && columnIsEditable && delegateAllowsEditing; } - (void) _willDisplayCell: (NSCell*)cell