mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-25 10:58:52 +00:00
fix further crashs due to invalid cursor positions
adjust comment git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@9111 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
f83d81275f
commit
5147e05cc1
@ -375,24 +375,26 @@ void InsetTabular::edit(LCursor & cur, bool left)
|
|||||||
{
|
{
|
||||||
lyxerr << "InsetTabular::edit: " << this << endl;
|
lyxerr << "InsetTabular::edit: " << this << endl;
|
||||||
finishUndo();
|
finishUndo();
|
||||||
int cell;
|
cur.selection() = false;
|
||||||
cur.push(*this);
|
cur.push(*this);
|
||||||
if (left) {
|
if (left) {
|
||||||
if (isRightToLeft(cur))
|
if (isRightToLeft(cur))
|
||||||
cell = tabular.getLastCellInRow(0);
|
cur.idx() = tabular.getLastCellInRow(0);
|
||||||
else
|
else
|
||||||
cell = 0;
|
cur.idx() = 0;
|
||||||
|
cur.par() = 0;
|
||||||
|
cur.pos() = 0;
|
||||||
} else {
|
} else {
|
||||||
if (isRightToLeft(cur))
|
if (isRightToLeft(cur))
|
||||||
cell = tabular.getFirstCellInRow(tabular.rows()-1);
|
cur.idx() = tabular.getFirstCellInRow(tabular.rows() - 1);
|
||||||
else
|
else
|
||||||
cell = tabular.getNumberOfCells() - 1;
|
cur.idx() = tabular.getNumberOfCells() - 1;
|
||||||
|
cur.par() = 0;
|
||||||
|
cur.pos() = cur.lastpos(); // FIXME crude guess
|
||||||
}
|
}
|
||||||
cur.selection() = false;
|
|
||||||
// this accesses the position cache before it is initialized
|
// this accesses the position cache before it is initialized
|
||||||
//resetPos(cur);
|
//resetPos(cur);
|
||||||
//cur.bv().fitCursor();
|
//cur.bv().fitCursor();
|
||||||
cur.idx() = cell;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -533,15 +535,15 @@ void InsetTabular::priv_dispatch(LCursor & cur, FuncRequest & cmd)
|
|||||||
//if (hasSelection())
|
//if (hasSelection())
|
||||||
// cur.selection() = false;
|
// cur.selection() = false;
|
||||||
int const col = tabular.column_of_cell(cur.idx());
|
int const col = tabular.column_of_cell(cur.idx());
|
||||||
if (cur.bv().top_y() + cur.bv().painter().paperHeight()
|
int const t = cur.bv().top_y() + cur.bv().painter().paperHeight();
|
||||||
< yo() + tabular.getHeightOfTabular())
|
if (t < yo() + tabular.getHeightOfTabular()) {
|
||||||
{
|
cur.bv().scrollDocView(t);
|
||||||
cur.bv().scrollDocView(
|
|
||||||
cur.bv().top_y() + cur.bv().painter().paperHeight());
|
|
||||||
cur.idx() = tabular.getCellBelow(first_visible_cell) + col;
|
cur.idx() = tabular.getCellBelow(first_visible_cell) + col;
|
||||||
} else {
|
} else {
|
||||||
cur.idx() = tabular.getFirstCellInRow(tabular.rows() - 1) + col;
|
cur.idx() = tabular.getFirstCellInRow(tabular.rows() - 1) + col;
|
||||||
}
|
}
|
||||||
|
cur.par() = 0;
|
||||||
|
cur.pos() = 0;
|
||||||
resetPos(cur);
|
resetPos(cur);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -550,9 +552,9 @@ void InsetTabular::priv_dispatch(LCursor & cur, FuncRequest & cmd)
|
|||||||
//if (hasSelection())
|
//if (hasSelection())
|
||||||
// cur.selection() = false;
|
// cur.selection() = false;
|
||||||
int const col = tabular.column_of_cell(cur.idx());
|
int const col = tabular.column_of_cell(cur.idx());
|
||||||
|
int const t = cur.bv().top_y() + cur.bv().painter().paperHeight();
|
||||||
if (yo() < 0) {
|
if (yo() < 0) {
|
||||||
cur.bv().scrollDocView(
|
cur.bv().scrollDocView(t);
|
||||||
cur.bv().top_y() - cur.bv().painter().paperHeight());
|
|
||||||
if (yo() > 0)
|
if (yo() > 0)
|
||||||
cur.idx() = col;
|
cur.idx() = col;
|
||||||
else
|
else
|
||||||
@ -560,6 +562,8 @@ void InsetTabular::priv_dispatch(LCursor & cur, FuncRequest & cmd)
|
|||||||
} else {
|
} else {
|
||||||
cur.idx() = col;
|
cur.idx() = col;
|
||||||
}
|
}
|
||||||
|
cur.par() = cur.lastpar();
|
||||||
|
cur.pos() = cur.lastpos();
|
||||||
resetPos(cur);
|
resetPos(cur);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -1029,8 +1033,7 @@ void InsetTabular::moveNextCell(LCursor & cur)
|
|||||||
int row = tabular.row_of_cell(cur.idx());
|
int row = tabular.row_of_cell(cur.idx());
|
||||||
if (row == tabular.rows() - 1)
|
if (row == tabular.rows() - 1)
|
||||||
return;
|
return;
|
||||||
cur.idx() = tabular.getLastCellInRow(row);
|
cur.idx() = tabular.getCellBelow(tabular.getLastCellInRow(row));
|
||||||
cur.idx() = tabular.getCellBelow(cur.idx());
|
|
||||||
} else {
|
} else {
|
||||||
if (cur.idx() == 0)
|
if (cur.idx() == 0)
|
||||||
return;
|
return;
|
||||||
@ -1213,7 +1216,6 @@ void InsetTabular::tabularFeatures(LCursor & cur,
|
|||||||
case LyXTabular::APPEND_COLUMN:
|
case LyXTabular::APPEND_COLUMN:
|
||||||
// append the column into the tabular
|
// append the column into the tabular
|
||||||
tabular.appendColumn(bv.buffer()->params(), cur.idx());
|
tabular.appendColumn(bv.buffer()->params(), cur.idx());
|
||||||
cur.idx() = tabular.getCellNumber(row, column);
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case LyXTabular::DELETE_ROW:
|
case LyXTabular::DELETE_ROW:
|
||||||
@ -1222,6 +1224,7 @@ void InsetTabular::tabularFeatures(LCursor & cur,
|
|||||||
if (sel_row_start >= tabular.rows())
|
if (sel_row_start >= tabular.rows())
|
||||||
--sel_row_start;
|
--sel_row_start;
|
||||||
cur.idx() = tabular.getCellNumber(sel_row_start, column);
|
cur.idx() = tabular.getCellNumber(sel_row_start, column);
|
||||||
|
cur.par() = 0;
|
||||||
cur.pos() = 0;
|
cur.pos() = 0;
|
||||||
cur.selection() = false;
|
cur.selection() = false;
|
||||||
break;
|
break;
|
||||||
@ -1232,6 +1235,7 @@ void InsetTabular::tabularFeatures(LCursor & cur,
|
|||||||
if (sel_col_start >= tabular.columns())
|
if (sel_col_start >= tabular.columns())
|
||||||
--sel_col_start;
|
--sel_col_start;
|
||||||
cur.idx() = tabular.getCellNumber(row, sel_col_start);
|
cur.idx() = tabular.getCellNumber(row, sel_col_start);
|
||||||
|
cur.par() = 0;
|
||||||
cur.pos() = 0;
|
cur.pos() = 0;
|
||||||
cur.selection() = false;
|
cur.selection() = false;
|
||||||
break;
|
break;
|
||||||
@ -1350,6 +1354,8 @@ void InsetTabular::tabularFeatures(LCursor & cur,
|
|||||||
}
|
}
|
||||||
tabular.setMultiColumn(bv.buffer(), s_start, s_end - s_start + 1);
|
tabular.setMultiColumn(bv.buffer(), s_start, s_end - s_start + 1);
|
||||||
cur.idx() = s_start;
|
cur.idx() = s_start;
|
||||||
|
cur.par() = 0;
|
||||||
|
cur.pos() = 0;
|
||||||
#endif
|
#endif
|
||||||
cur.selection() = false;
|
cur.selection() = false;
|
||||||
break;
|
break;
|
||||||
|
@ -10,10 +10,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
// This is the rewrite of the tabular (table) support.
|
// This is Juergen's rewrite of the tabular (table) support.
|
||||||
|
|
||||||
// Ideally the tabular support should do as the mathed and use
|
|
||||||
// LaTeX in the .lyx file too.
|
|
||||||
|
|
||||||
// Things to think of when designing the new tabular support:
|
// Things to think of when designing the new tabular support:
|
||||||
// - color support (colortbl, color)
|
// - color support (colortbl, color)
|
||||||
@ -27,10 +24,7 @@
|
|||||||
// This is what I have written about tabular support in the LyX3-Tasks file:
|
// This is what I have written about tabular support in the LyX3-Tasks file:
|
||||||
//
|
//
|
||||||
// o rewrite of table code. Should probably be written as some
|
// o rewrite of table code. Should probably be written as some
|
||||||
// kind of an inset. At least get the code out of the kernel.
|
// kind of an inset. [Done]
|
||||||
// - colortbl -multirow
|
|
||||||
// - hhline -multicolumn
|
|
||||||
// - dcolumn
|
|
||||||
// o enhance longtable support
|
// o enhance longtable support
|
||||||
|
|
||||||
// Lgb
|
// Lgb
|
||||||
|
Loading…
Reference in New Issue
Block a user