nsAutoString name; parent->GetNodeName(name); printf("SetCaretAfterElement: Parent node: "); wprintf(name.GetUnicode()); printf(" Offset: %d\n\nHTML:\n", offsetInParent+1); nsAutoString Format("text/html"); nsAutoString ContentsAs; OutputToString(ContentsAs, Format, 2); wprintf(ContentsAs.GetUnicode());
PRInt32 offsetInParent; res = GetChildOffset(aElement, parent, offsetInParent);  offsetInParent++; if (NS_SUCCEEDED(res)) {  selection->Collapse(parent, offsetInParent); }
nsHTMLEditor::SetCaretAfterElement(nsIDOMElement* aElement){  nsresult res = NS_ERROR_NULL_POINTER;  // Be sure the element is contained in the document body  if (aElement && IsElementInBody(aElement))  {    nsCOMPtr<nsIDOMSelection> selection;    res = GetSelection(getter_AddRefs(selection));    if (NS_FAILED(res)) return res;    if (!selection) return NS_ERROR_NULL_POINTER;    nsCOMPtr<nsIDOMNode>parent;    res = aElement->GetParentNode(getter_AddRefs(parent));    if (NS_FAILED(res)) return res;    if (!parent) return NS_ERROR_NULL_POINTER;    PRInt32 offsetInParent;    res = GetChildOffset(aElement, parent, offsetInParent);    if (NS_SUCCEEDED(res))    {      // Collapse selection to just after desired element,      res = selection->Collapse(parent, offsetInParent+1);#if 0 //def DEBUG_cmanske      {      nsAutoString name;      parent->GetNodeName(name);      printf("SetCaretAfterElement: Parent node: ");      wprintf(name.GetUnicode());      printf(" Offset: %d\n\nHTML:\n", offsetInParent+1);      nsAutoString Format("text/html");      nsAutoString ContentsAs;      OutputToString(ContentsAs, Format, 2);      wprintf(ContentsAs.GetUnicode());      }#endif    }  }  return res;}