discuss-gnustep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSTableView bug fix


From: Gregory Casamento
Subject: Re: NSTableView bug fix
Date: Sat, 17 Oct 2020 07:18:07 -0400


Andreas,

For future reference, it is usually best to clone the repository and create a branch, then create a PR for consideration by the maintainer of that repo, in this case, Fred Kiefer.  This is not a hard and fast rule, but it allows us to keep all contributions tracked in one place.

Your change looks okay to me, but Fred has primary responsibility for libs-gui, so I defer to his judgment.

Yours, GC

On Sat, Oct 17, 2020 at 5:22 AM Andreas Höschler via Discussion list for the GNUstep programming environment <discuss-gnustep@gnu.org> wrote:
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;
>     }
> }
>
>





--
Gregory Casamento
GNUstep Lead Developer / OLC, Principal Consultant
http://www.gnustep.org - http://heronsperch.blogspot.com
https://www.patreon.com/bePatron?u=352392 - Become a Patron
https://gf.me/u/x8m3sx - My GNUstep GoFundMe


reply via email to

[Prev in Thread] Current Thread [Next in Thread]