summaryrefslogtreecommitdiffstats
path: root/src/gui/text/qtexttable.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/text/qtexttable.cpp')
-rw-r--r--src/gui/text/qtexttable.cpp12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/gui/text/qtexttable.cpp b/src/gui/text/qtexttable.cpp
index 9639c18d2b..39f26d5d42 100644
--- a/src/gui/text/qtexttable.cpp
+++ b/src/gui/text/qtexttable.cpp
@@ -696,18 +696,22 @@ void QTextTable::insertRows(int pos, int num)
int extended = 0;
int insert_before = 0;
if (pos > 0 && pos < d->nRows) {
+ int lastCell = -1;
for (int i = 0; i < d->nCols; ++i) {
int cell = d->grid[pos*d->nCols + i];
if (cell == d->grid[(pos-1)*d->nCols+i]) {
// cell spans the insertion place, extend it
- QTextDocumentPrivate::FragmentIterator it(&p->fragmentMap(), cell);
- QTextCharFormat fmt = c->charFormat(it->format);
- fmt.setTableCellRowSpan(fmt.tableCellRowSpan() + num);
- p->setCharFormat(it.position(), 1, fmt);
+ if (cell != lastCell) {
+ QTextDocumentPrivate::FragmentIterator it(&p->fragmentMap(), cell);
+ QTextCharFormat fmt = c->charFormat(it->format);
+ fmt.setTableCellRowSpan(fmt.tableCellRowSpan() + num);
+ p->setCharFormat(it.position(), 1, fmt);
+ }
extended++;
} else if (!insert_before) {
insert_before = cell;
}
+ lastCell = cell;
}
} else {
insert_before = (pos == 0 ? d->grid[0] : d->fragment_end);