[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
NSTableView bug fix
From: |
Andreas Höschler |
Subject: |
NSTableView bug fix |
Date: |
Sat, 17 Oct 2020 11:21:06 +0200 |
Hi all,
I sent the below fix to the group a while ago. Has this already been integrated
into the repository (by someone with write privileges)? I haven't seen any
feedback on this and just want to make sure it does not get lost.
Thanks,
Andreas
***
> On 11 Oct 2020, at 19:54, Andreas Höschler via Discussion list for the
> GNUstep programming environment <discuss-gnustep@gnu.org> wrote:
>
> Hi Fred,
>
> I just hunted down a bug in NSTableView. A test app would be an application
> with a tableview with a couple of columns with formatters. Entering data
> stops working once a cell with a formatter was hit. This is due to
>
> NSTableView.m - (void) validateEditing
>
> existing without setting _isValidating back to NO.
>
> The following fix (see the line marked with // <-------) does the trick.
> Could anyone please integrate this fix into the repository? :-)
>
> Thanks a lot,
>
> Andreas
>
> ***
>
> - (void) validateEditing
> {
> if (_textObject && (_isValidating == NO))
> {
> NSFormatter *formatter;
> NSString *string;
> id newObjectValue = nil;
> BOOL validatedOK = YES;
>
> // Avoid potential recursive sequences...
> _isValidating = YES;
>
> formatter = [_editedCell formatter];
> string = AUTORELEASE([[_textObject text] copy]);
>
> if (formatter != nil)
> {
> NSString *error;
>
> if ([formatter getObjectValue: &newObjectValue forString: string
> errorDescription: &error] == YES)
> {
> [_editedCell setObjectValue: newObjectValue];
>
> if (_dataSource_editable)
> {
> NSTableColumn *tb;
>
> tb = [_tableColumns objectAtIndex: _editedColumn];
>
> [self _setObjectValue: newObjectValue
> forTableColumn: tb
> row: _editedRow];
> }
> _isValidating = NO; return; // <-------
> }
> else
> {
> SEL sel =
> @selector(control:didFailToFormatString:errorDescription:);
>
> if ([_delegate respondsToSelector: sel])
> {
> validatedOK = [_delegate control: self
> didFailToFormatString: string
> errorDescription: error];
> }
> // Allow an empty string to fall through
> else if (![string isEqualToString: @""])
> {
> validatedOK = NO;
> }
> }
> }
>
> if (validatedOK)
> {
> [_editedCell setStringValue: string];
>
> if (_dataSource_editable)
> {
> NSTableColumn *tb;
>
> tb = [_tableColumns objectAtIndex: _editedColumn];
>
> [self _setObjectValue: string forTableColumn: tb row: _editedRow];
> }
> }
>
> // Avoid potential recursive sequences...
> _isValidating = NO;
> }
> }
>
>
- NSTableView bug fix,
Andreas Höschler <=