mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-09 18:31:04 +00:00
fix tabular crashs
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@8451 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
56a3e2e1c0
commit
48366502d7
@ -981,6 +981,15 @@ bool BufferView::Pimpl::dispatch(FuncRequest const & cmd)
|
||||
|
||||
switch (cmd.action) {
|
||||
|
||||
case LFUN_ESCAPE: {
|
||||
if (bv_->cursor().depth() > 1) {
|
||||
bv_->cursor().pop();
|
||||
// Tell the paragraph dialog that we changed paragraph
|
||||
dispatch(FuncRequest(LFUN_PARAGRAPH_UPDATE));
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case LFUN_UNDO:
|
||||
if (available()) {
|
||||
cur.message(_("Undo"));
|
||||
@ -1118,6 +1127,10 @@ bool BufferView::Pimpl::dispatch(FuncRequest const & cmd)
|
||||
cur.errorMessage(N_("Unknown function!"));
|
||||
break;
|
||||
|
||||
case LFUN_CENTER:
|
||||
bv_->center();
|
||||
break;
|
||||
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
|
@ -80,6 +80,9 @@ void LCursor::reset()
|
||||
DispatchResult LCursor::dispatch(FuncRequest const & cmd0)
|
||||
{
|
||||
lyxerr << "\nLCursor::dispatch: cmd: " << cmd0 << endl << *this << endl;
|
||||
BOOST_ASSERT(pos() <= lastpos());
|
||||
BOOST_ASSERT(idx() <= lastidx());
|
||||
BOOST_ASSERT(par() <= lastpar());
|
||||
FuncRequest cmd = cmd0;
|
||||
disp_.update(true);
|
||||
disp_.val(NONE);
|
||||
@ -529,6 +532,12 @@ LCursor::row_type LCursor::lastcrow() const
|
||||
}
|
||||
|
||||
|
||||
LCursor::idx_type LCursor::lastidx() const
|
||||
{
|
||||
return current_ ? current().lastidx() : 0;
|
||||
}
|
||||
|
||||
|
||||
size_t LCursor::nargs() const
|
||||
{
|
||||
// assume 1x1 grid for 'plain text'
|
||||
|
@ -160,7 +160,7 @@ public:
|
||||
/// return the cell of the inset this cursor is in
|
||||
idx_type & idx() { return current().idx(); }
|
||||
/// return the last possible cell in this inset
|
||||
idx_type lastidx() const { return current().lastidx(); }
|
||||
idx_type lastidx() const;
|
||||
/// return the paragraph this cursor is in
|
||||
par_type par() const { return current().par(); }
|
||||
/// return the paragraph this cursor is in
|
||||
|
@ -43,18 +43,21 @@ CursorSlice::CursorSlice(InsetBase * p)
|
||||
|
||||
size_t CursorSlice::nargs() const
|
||||
{
|
||||
BOOST_ASSERT(inset_);
|
||||
return inset_->nargs();
|
||||
}
|
||||
|
||||
|
||||
size_t CursorSlice::nrows() const
|
||||
{
|
||||
BOOST_ASSERT(inset_);
|
||||
return inset_->nrows();
|
||||
}
|
||||
|
||||
|
||||
size_t CursorSlice::ncols() const
|
||||
{
|
||||
BOOST_ASSERT(inset_);
|
||||
return inset_->ncols();
|
||||
}
|
||||
|
||||
|
@ -491,6 +491,8 @@ void InsetTabular::priv_dispatch(LCursor & cur, FuncRequest const & cmd)
|
||||
if (sl == cur.current())
|
||||
if (tabular.row_of_cell(cur.idx()) != tabular.rows() - 1) {
|
||||
cur.idx() = tabular.getCellBelow(cur.idx());
|
||||
cur.par() = 0;
|
||||
cur.pos() = 0;
|
||||
resetPos(cur);
|
||||
}
|
||||
if (sl == cur.current())
|
||||
@ -503,6 +505,8 @@ void InsetTabular::priv_dispatch(LCursor & cur, FuncRequest const & cmd)
|
||||
if (sl == cur.current())
|
||||
if (tabular.row_of_cell(cur.idx()) != 0) {
|
||||
cur.idx() = tabular.getCellAbove(cur.idx());
|
||||
cur.par() = cur.lastpar();
|
||||
cur.pos() = cur.lastpos();
|
||||
resetPos(cur);
|
||||
}
|
||||
if (sl == cur.current())
|
||||
|
@ -841,15 +841,6 @@ void LyXFunc::dispatch(FuncRequest const & cmd, bool verbose)
|
||||
|
||||
switch (action) {
|
||||
|
||||
case LFUN_ESCAPE: {
|
||||
if (!view()->available())
|
||||
break;
|
||||
view()->cursor().pop();
|
||||
// Tell the paragraph dialog that we changed paragraph
|
||||
dispatch(FuncRequest(LFUN_PARAGRAPH_UPDATE));
|
||||
break;
|
||||
}
|
||||
|
||||
case LFUN_WORDFINDFORWARD:
|
||||
case LFUN_WORDFINDBACKWARD: {
|
||||
static string last_search;
|
||||
@ -901,10 +892,6 @@ void LyXFunc::dispatch(FuncRequest const & cmd, bool verbose)
|
||||
!owner->buffer()->isReadonly());
|
||||
break;
|
||||
|
||||
case LFUN_CENTER: // this is center and redraw.
|
||||
view()->center();
|
||||
break;
|
||||
|
||||
// --- Menus -----------------------------------------------
|
||||
case LFUN_MENUNEW:
|
||||
menuNew(argument, false);
|
||||
@ -1068,11 +1055,6 @@ void LyXFunc::dispatch(FuncRequest const & cmd, bool verbose)
|
||||
open(argument);
|
||||
break;
|
||||
|
||||
case LFUN_LAYOUT_TABULAR:
|
||||
if (InsetTabular * tab = view()->cursor().innerInsetTabular())
|
||||
tab->openLayoutDialog(view());
|
||||
break;
|
||||
|
||||
case LFUN_DROP_LAYOUTS_CHOICE:
|
||||
owner->getToolbar().openLayoutList();
|
||||
break;
|
||||
|
@ -328,7 +328,10 @@ InsetBase const * Paragraph::getInset(pos_type pos) const
|
||||
LyXFont const Paragraph::getFontSettings(BufferParams const & bparams,
|
||||
pos_type pos) const
|
||||
{
|
||||
BOOST_ASSERT(pos <= size());
|
||||
if (pos > size()) {
|
||||
lyxerr << " pos: " << pos << " size: " << size() << endl;
|
||||
BOOST_ASSERT(pos <= size());
|
||||
}
|
||||
|
||||
Pimpl::FontList::const_iterator cit = pimpl_->fontlist.begin();
|
||||
Pimpl::FontList::const_iterator end = pimpl_->fontlist.end();
|
||||
|
Loading…
Reference in New Issue
Block a user