Problem: 1336165

Title: (Views, GridViews) TTextGridView::DoFulfillPromise

Received: Mar 29 1996 11:52AM


There is a Bug in TTextGridView::DoFulfillPromise (MacApp 3.3) that will result in a wrongly formattet Text when dragging out of a TTextGridView
case 'TEXT':
        {
                CSelectedCellIterator   iter(this);
                GridCell                                lastCell = gZeroPt;
                TStream                                 *flavorStream = promisedItem->GetDataStream();
                CStr255                                 text;
 
                for (GridCell aCell = iter.FirstCell(); iter.More(); aCell =iter.NextCell())
                {
                        this->GetText(aCell, text);
                        flavorStream->WriteBytes(&text[1], text.Length());
 
                        if (aCell.v > lastCell.v)   // CurrentCell is more to the right
                                flavorStream->WriteCharacter('\n');     // *** Newline is wrong here ***
                        else
                                flavorStream->WriteCharacter('\t');
                        lastCell = aCell;
                }
                FreeIfObject(flavorStream);
I think the following code should replace the above:
case 'TEXT':
        {
                CSelectedCellIterator   iter(this);
                GridCell                                lastCell = gZeroPt;
                TStream                                 *flavorStream = promisedItem->GetDataStream();
                CStr255                                 text;
 
                for (GridCell aCell = lastCell; iter.More(); aCell = iter.NextCell())
                {
                        this->GetText(aCell, text);
                        flavorStream->WriteBytes(&text[1], text.Length());
 
                        if (aCell.v > lastCell.v)       // CurrentCell is more to the right
                                flavorStream->WriteCharacter('\t');     // Tab before next field
                        else
                                flavorStream->WriteCharacter('\v');
                        lastCell = aCell;
                }
                FreeIfObject(flavorStream);

Fix:

Fixed. (Not with the included solution, it was wrong) [but actual change not reported].