[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Table view bug?
Re: Table view bug?
Sun, 26 Jan 2014 23:01:26 +0100
Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.2.0
On 19.01.2014 23:35, Fred Kiefer wrote:
> On 17.01.2014 20:14, David Chisnall wrote:
>> I'm seeing some odd behaviour with NSTableView. My table column is
>> editable and my delegate's -tableView:objectValueForTableColumn:row:
>> returns a string. I can then click on the string and edit it and
>> everything works as expected. If, however, the delegate returns
>> either the empty string (@"") or nil, then it usually doesn't let me
>> edit it. When I double click, the field editor appears, but I can't
>> type into it. Sometimes it appears and I can type into it, but it
>> loses the first character (or, sometimes, the first character that I
>> type with shift pressed).
> I am able to reproduce this behaviour and the problem with the empty
> string seems only to happen when it is the first cell in the table view
> that gets edited. After editing another cell it seems to work fine.
> And sometimes it works when you click on the empty cell and move the
> focus to a different window and then back again. It is almost as if the
> text view used as the cell editor does not accept key events.
> But the problem seems to be deeper. In NSTextView
> replaceCharactersInRange:withString: we end up in the case
> ([_textStorage length] == 0) and there the created attributed string
> seems to be nil. I am really confused here, as this can never be.
It turns out that here my debugger was lying to me. The attributed
string and the text storage both were OK. Only immediately after the
value of the editor got reset to the empty string. This is caused by the
code in GSTheme -drawTableViewRow:clipRect:inView:, that resets the
value of the cell to be drawn, even if it is being edited. Most likely
we should not draw that cell at all. I changed the code to at least not
set the value for the cell and now it seems to work. Please give it a try.