mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-22 18:08:10 +00:00
Fix the assert when copying rows or columns in math.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@10114 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
58f654142c
commit
883decc7da
@ -1,3 +1,9 @@
|
||||
|
||||
2005-06-29 Martin Vermeer <martin.vermeer@hut.fi>
|
||||
|
||||
* cursor_slice.h:
|
||||
* dociterator.h: Fix the assert when copying rows/cols in math
|
||||
|
||||
2005-06-25 Jürgen Spitzmüller <j.spitzmueller@gmx.de>
|
||||
|
||||
* BufferView_pimpl.C:
|
||||
|
@ -62,6 +62,10 @@ public:
|
||||
idx_type idx() const { return idx_; }
|
||||
/// return the cell this cursor is in
|
||||
idx_type & idx() { return idx_; }
|
||||
/// Save current cursor idx as row, col
|
||||
void idxSave() { col_ = idx_ % ncols(); row_ = idx_ / ncols(); }
|
||||
/// update idx to correspond to row, col
|
||||
void idxLoad() { idx_ = col_ + ncols() * row_; }
|
||||
/// return the last cell in this inset
|
||||
idx_type lastidx() const { return nargs() - 1; }
|
||||
/// return the offset of the paragraph this cursor is in
|
||||
@ -70,7 +74,7 @@ public:
|
||||
pit_type & pit() { return pit_; }
|
||||
/// increments the paragraph this cursor is in
|
||||
void incrementPar();
|
||||
/// increments the paragraph this cursor is in
|
||||
/// decrements the paragraph this cursor is in
|
||||
void decrementPar();
|
||||
/// return the position within the paragraph
|
||||
pos_type pos() const { return pos_; }
|
||||
@ -80,13 +84,13 @@ public:
|
||||
pos_type lastpos() const;
|
||||
/// return the number of embedded cells
|
||||
size_t nargs() const;
|
||||
/// return the number of embedded cells
|
||||
/// return the number of columns
|
||||
size_t ncols() const;
|
||||
/// return the number of embedded cells
|
||||
/// return the number of rows
|
||||
size_t nrows() const;
|
||||
/// return the grid row of the current cell
|
||||
row_type row() const;
|
||||
/// return the grid row of the current cell
|
||||
/// return the grid column of the current cell
|
||||
col_type col() const;
|
||||
|
||||
///
|
||||
@ -123,6 +127,10 @@ public:
|
||||
private:
|
||||
/// cell index of a position in this inset
|
||||
idx_type idx_;
|
||||
/// row position in inset
|
||||
row_type row_;
|
||||
/// column position in inset
|
||||
col_type col_;
|
||||
/// paragraph in this cell (used by texted)
|
||||
pit_type pit_;
|
||||
/// true of 'pit' was properly initialized
|
||||
|
@ -91,6 +91,10 @@ public:
|
||||
idx_type idx() const { return top().idx(); }
|
||||
/// return the cell of the inset this cursor is in
|
||||
idx_type & idx() { return top().idx(); }
|
||||
///
|
||||
void idxSave() { top().idxSave(); }
|
||||
///
|
||||
void idxLoad() { top().idxLoad(); }
|
||||
/// return the last possible cell in this inset
|
||||
idx_type lastidx() const;
|
||||
/// return the paragraph this cursor is in
|
||||
|
@ -1,3 +1,9 @@
|
||||
|
||||
2005-06-29 Martin Vermeer <martin.vermeer@hut.fi>
|
||||
|
||||
* math_gridinset.C (doDispatch): fix assert copying row or
|
||||
column in math
|
||||
|
||||
2005-06-24 Jürgen Spitzmüller <j.spitzmueller@gmx.de>
|
||||
|
||||
* math_nestinset.C (doDispatch): use text font attributes in text mode.
|
||||
|
@ -1108,11 +1108,20 @@ void MathGridInset::doDispatch(LCursor & cur, FuncRequest & cmd)
|
||||
if (cur.idx() > nargs())
|
||||
cur.idx() -= ncols();
|
||||
}
|
||||
else if (s == "copy-row")
|
||||
else if (s == "copy-row") {
|
||||
// Here (as later) we save the cursor col/row
|
||||
// in order to restore it after operation.
|
||||
cur.idxSave();
|
||||
for (int i = 0, n = extractInt(is); i < n; ++i)
|
||||
copyRow(cur.row());
|
||||
else if (s == "swap-row")
|
||||
cur.idxLoad();
|
||||
}
|
||||
else if (s == "swap-row") {
|
||||
swapRow(cur.row());
|
||||
// Trick to suppress same-idx-means-different-cell
|
||||
// assertion crash:
|
||||
cur.pos() = 0;
|
||||
}
|
||||
else if (s == "add-hline-above")
|
||||
rowinfo_[cur.row()].lines_++;
|
||||
else if (s == "add-hline-below")
|
||||
@ -1123,24 +1132,27 @@ void MathGridInset::doDispatch(LCursor & cur, FuncRequest & cmd)
|
||||
rowinfo_[cur.row()+1].lines_--;
|
||||
else if (s == "append-column")
|
||||
for (int i = 0, n = extractInt(is); i < n; ++i) {
|
||||
row_type const r = cur.row();
|
||||
col_type const c = cur.col();
|
||||
addCol(c);
|
||||
cur.idx() = index(r, c);
|
||||
cur.idxSave();
|
||||
addCol(cur.col());
|
||||
cur.idxLoad();
|
||||
}
|
||||
else if (s == "delete-column")
|
||||
for (int i = 0, n = extractInt(is); i < n; ++i) {
|
||||
row_type const r = cur.row();
|
||||
col_type const c = cur.col();
|
||||
cur.idxSave();
|
||||
delCol(col(cur.idx()));
|
||||
cur.idx() = index(r, c);
|
||||
cur.idxLoad();
|
||||
if (cur.idx() > nargs())
|
||||
cur.idx() -= ncols();
|
||||
}
|
||||
else if (s == "copy-column")
|
||||
else if (s == "copy-column") {
|
||||
cur.idxSave();
|
||||
copyCol(cur.col());
|
||||
else if (s == "swap-column")
|
||||
cur.idxLoad();
|
||||
}
|
||||
else if (s == "swap-column") {
|
||||
swapCol(cur.col());
|
||||
cur.pos() = 0; // trick, see above
|
||||
}
|
||||
else if (s == "add-vline-left")
|
||||
colinfo_[cur.col()].lines_++;
|
||||
else if (s == "add-vline-right")
|
||||
|
Loading…
Reference in New Issue
Block a user