Possible Duplicate:
How about newlines within comments?

I've been irritated by the following thing on Stack Overflow lately.

When I comment on a question or answer, the newlines I add just won't hold.

I would've liked some structure in my comments. Or at least some basic newline chars so I can organize my comments into clean paragraphs at least.

I've been trying to do it here: Moving items from one tableView to another tableView with consolidation

Why is commenting the way it is now?

Consider you edit your question as I've just did. Wouldn't it make some answers invalid? Wouldn't it be more handy to continue on the question?


From Comment Privileges

You should submit a comment if you want to:

  • Request clarification from the author;
  • Leave constructive criticism that guides the author in improving the post;
  • Add relevant but minor or transient information to a post (e.g. a link to a related question, or an alert to the author that the question has been updated).

So Comments are not for paragraphs and some thing like that. If your suggestion is too big, then edit the stuff or answer something new.


Comments are designed for short sentences asking for clarification of points in the question or answer and hence don't have any formatting beyond the use of backticks for code elements.

If your response to a comment is such that it requires formatting into paragraphs (or includes a lot of code) then you should really be thinking "is a comment really the best place for this information?". You should be editing the question or answer to include this information.

If it's someone else's answer perhaps you should be adding your own.

  • The problem is that I don't want another answer but a detailed response to the answer someone else gives me. For this formatting comments would be extremely useful. – Totumus Maximus Nov 28 '11 at 9:29
  • @TotumusMaximus - I'm not clear. Do you want to add a detailed response or do you want the other person to do that? If it's the latter then they should be adding that information to their question/answer. – ChrisF Nov 28 '11 at 9:38
  • Sorry. I want to be able to make a detailed response to their answers. (But I would also like someone else to be able to write a same detailed comment to my answers if needed.) – Totumus Maximus Nov 28 '11 at 9:42
  • @TotumusMaximus - can you link to a question where you've tried to do this? Edit your question. – ChrisF Nov 28 '11 at 9:44
  • Done. It's a pretty complicated problem in my case and it needs some detailed comments if I want some quality answers. The manner of commenting I would like to have helps the one I'm commenting on sorting out the information he would need better. – Totumus Maximus Nov 28 '11 at 9:59
  • 1
    @TotumusMaximus - I stand by the answer - you should update your question (as you have done). Just add a comment stating "I've updated my question" – ChrisF Nov 28 '11 at 10:01
  • Alright I catch your drift. But consider this: Wouldn't updating a question potentially invalidate other answers/comments and thus make the thread more of a mess? I'll update my question to this. – Totumus Maximus Nov 28 '11 at 10:13
  • 1
    @TotumusMaximus - that is a risk, but if your question was missing some important information in the first place every subsequent answer is going to miss that information too. – ChrisF Nov 28 '11 at 12:40

Comments are meant to be minor clarifications and are treated as "second class" citizens.

If you feel that you need to structure and add paragraphs, it's very likely that they need to be in the question themselves.


If the example you're giving is the second revision in the question you linked to that would be a terrible thing to try and put in a comment!

It looks like what you did was edit your answer, changing the original code. What I would recommend is to append to your answer. I typically do it with a bold EDIT: or UPDATE: and a reason for the update, followed by relevant in formation. Possibly mentioning a specific user. Here's an example with a ridiculous number of updates

So in your example, you could have done:

UPDATE: as per @tarmes' suggestion, here is my revised code that should do the movement:

    UITableView *senderTableView = //retrieves the table with the data here.
    UITableView *receiverTableView = //retrieves the table which gets the data here.

    NSArray *selectedRows = senderTableView.indexPathsForSelectedRows;

    //sort selected rows from lowest indexPath.row to highest
    selectedRows = [selectedRows sortedArrayUsingSelector:@selector(compare:)];

    //build up target rows (all objects to be moved)
    NSMutableArray *targetRows = [[NSMutableArray alloc] init];
    for (int i = 0; i<selectedRows.count; i++) 
        NSIndexPath *path = [selectedRows objectAtIndex:i];
        [targetRows addObject:[senderTableView.listOfItems objectAtIndex:path.row]];

    //delete rows at active
    for (int i = selectedRows.count-1; i >= 0; i--) 
        NSIndexPath *path = [selectedRows objectAtIndex:i];

        //check what item you are deleting. act upon the status. Parent- and HoldingCells cant be selected so only check for basic and childs
        MyCellObject *item = [senderTableView.listOfItems objectAtIndex:path.row];
        if (item.consolidatedState == ConsolidationTypeChild) 
            for (int j = path.row; j >= 0; j--) 
                MyCellObject *consolidatedItem = [senderTableView.listOfItems objectAtIndex:j];
                if (consolidatedItem.consolidatedState == ConsolidationTypeParent) 
                    //copy the consolidated item but with 1 less quantity
                    MyCellObject *newItem = [consolidatedItem copyWithOneLessQuantity]; //creates a copy of the object with 1 less quantity.

                    if (newItem.quantity > 1)
                        newItem.consolidatedState = ConsolidationTypeParent;
                        [senderTableView.listOfItems replaceObjectAtIndex:j withObject:newItem];
                    else if (newItem.quantity == 1)
                        newItem.consolidatedState = ConsolidationTypeBasic;
                        [senderTableView.listOfItems removeObjectAtIndex:j];

                        MyCellObject *child = [senderTableView.listOfItems objectAtIndex:j+1];

                        child.consolidatedState = ConsolidationTypeBasic;

                        [senderTableView.listOfItems replaceObjectAtIndex:j+1 withObject:child];
                        [senderTableView.listOfItems removeObject:consolidatedItem];
                    [senderTableView reloadData];
        [senderTableView.listOfItems removeObjectAtIndex:path.row];
    [senderTableView deleteRowsAtIndexPaths:selectedRows withRowAnimation:UITableViewRowAnimationTop];

    //make new indexpaths for row animation
    NSMutableArray *newRows = [[NSMutableArray alloc] init];
    for (int i = 0; i < targetRows.count; i++) 
        NSIndexPath *newPath = [NSIndexPath indexPathForRow:i+receiverTableView.listOfItems.count inSection:0];
        [newRows addObject:newPath];
        DLog(@"%i", i);

        //scroll to newest items
        [receiverTableView setContentOffset:CGPointMake(0, fmaxf(receiverTableView.contentSize.height - recieverTableView.frame.size.height, 0.0)) animated:YES];

    //add rows at target
    for (int i = 0; i < targetRows.count; i++) 
        MyCellObject *insertedItem = [targetRows objectAtIndex:i];

        //all moved items will be brought into the standard (basic) consolidationType
        insertedItem.consolidatedState = ConsolidationTypeBasic;

        [receiverTableView.ListOfItems insertObject:insertedItem atIndex:receiverTableView.ListOfItems.count];

    [receiverTableView insertRowsAtIndexPaths:newRows withRowAnimation:UITableViewRowAnimationNone];

But it's still not working because of some reason here.

Not the answer you're looking for? Browse other questions tagged .