}
-InsetTableCell splitCell(InsetTableCell & head, docstring const align_d, bool & hassep)
+DocIterator separatorPos(InsetTableCell * cell, docstring const & align_d)
{
- InsetTableCell tail = InsetTableCell(head);
-
- DocIterator dit = doc_iterator_begin(&head.buffer(), &head);
+ DocIterator dit = doc_iterator_begin(&(cell->buffer()), cell);
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();
+ return dit;
+}
+
+
+InsetTableCell splitCell(InsetTableCell & head, docstring const align_d, bool & hassep)
+{
+ InsetTableCell tail = InsetTableCell(head);
+ DocIterator const dit = separatorPos(&head, align_d);
hassep = dit;
if (hassep) {
+ pit_type const psize = head.paragraphs().front().size();
head.paragraphs().front().eraseChars(dit.pos(), psize, false);
tail.paragraphs().front().eraseChars(0,
dit.pos() < psize ? dit.pos() + 1 : psize, false);
|| (coldouble != celldouble);
// we center in multicol when no decimal point
- ismulticol |= ((column_info[c].alignment == LYX_ALIGN_DECIMAL)
- && (cellInfo(cell).decimal_width == 0));
+ if (column_info[c].alignment == LYX_ALIGN_DECIMAL) {
+ docstring const align_d = column_info[c].decimal_point;
+ DocIterator const dit = separatorPos(cellInset(cell).get(), align_d);
+ ismulticol |= !dit;
+ }
// up counter by 1 for each decimally aligned col since they use 2 latex cols
int latexcolspan = columnSpan(cell);
? OutputParams::PLAIN
: OutputParams::ALIGNED;
- if (getAlignment(cell) == LYX_ALIGN_DECIMAL
- && cellInfo(cell).decimal_width != 0) {
+ if (getAlignment(cell) == LYX_ALIGN_DECIMAL) {
// copy cell and split in 2
InsetTableCell head = InsetTableCell(*cellInset(cell).get());
head.setBuffer(buffer());
head.setMacrocontextPositionRecursive(dit);
bool hassep = false;
InsetTableCell tail = splitCell(head, column_info[c].decimal_point, hassep);
- tail.setBuffer(head.buffer());
- dit.pop_back();
- dit.push_back(CursorSlice(tail));
- tail.setMacrocontextPositionRecursive(dit);
head.latex(os, newrp);
- os << '&';
- tail.latex(os, newrp);
+ if (hassep) {
+ os << '&';
+ tail.setBuffer(head.buffer());
+ dit.pop_back();
+ dit.push_back(CursorSlice(tail));
+ tail.setMacrocontextPositionRecursive(dit);
+ tail.latex(os, newrp);
+ }
} else if (!isPartOfMultiRow(row, c)) {
if (!runparams.nice)
os.texrow().start(par.id(), 0);
// remove text leading decimal point
docstring const align_d = tabular.column_info[c].decimal_point;
- dit = doc_iterator_begin(&tail.buffer(), &tail);
- for (; dit; dit.forwardChar())
- if (dit.inTexted() && dit.depth()==1
- && dit.paragraph().find(align_d, false, false, dit.pos()))
- break;
+ dit = separatorPos(&tail, align_d);
pit_type const psize = tail.paragraphs().front().size();
if (dit) {