+InsetTableCell splitCell(InsetTableCell & head, docstring const align_d, bool & hassep)
+{
+ InsetTableCell tail = InsetTableCell(head);
+ tail.getText(0)->setMacrocontextPosition(
+ head.getText(0)->macrocontextPosition());
+ tail.setBuffer(head.buffer());
+
+ DocIterator dit = doc_iterator_begin(&head.buffer(), &head);
+ for (; dit; dit.forwardChar())
+ if (dit.inTexted() && dit.depth()==1
+ && dit.paragraph().find(align_d, false, false, dit.pos()))
+ break;
+
+ pit_type const psize = head.paragraphs().front().size();
+ hassep = dit;
+ if (hassep)
+ head.paragraphs().front().eraseChars(dit.pos(), psize, false);
+
+ tail.paragraphs().front().eraseChars(0,
+ dit.pos() < psize ? dit.pos() + 1 : psize, false);
+
+ return tail;
+}
+