diff --git a/src/mathed/math_cursor.C b/src/mathed/math_cursor.C index 5c20087256..d7f2b8d574 100644 --- a/src/mathed/math_cursor.C +++ b/src/mathed/math_cursor.C @@ -1483,25 +1483,10 @@ MathCursorPos MathCursor::normalAnchor() const MathInset::result_type MathCursor::dispatch(FuncRequest const & cmd) { - // try to dispatch to adajcent items if they are not editable - // actually, this should only happen for mouse clicks... - idx_type d1; - pos_type d2; - if (hasNextAtom() && !openable(nextAtom(), false)) { - MathInset::result_type res = nextAtom().nucleus()->dispatch(cmd, d1, d2); - if (res != MathInset::UNDISPATCHED) - return res; - } - if (hasPrevAtom() && !openable(prevAtom(), false)) { - MathInset::result_type res = prevAtom().nucleus()->dispatch(cmd, d1, d2); - if (res != MathInset::UNDISPATCHED) - return res; - } - for (int i = Cursor_.size() - 1; i >= 0; --i) { MathCursorPos & pos = Cursor_[i]; - MathInset::result_type const res - = pos.par_->dispatch(cmd, pos.idx_, pos.pos_); + MathInset::result_type + res = pos.par_->dispatch(cmd, pos.idx_, pos.pos_); if (res != MathInset::UNDISPATCHED) { if (res == MathInset::DISPATCHED_POP) { Cursor_.shrink(i + 1); diff --git a/src/mathed/math_data.C b/src/mathed/math_data.C index 127d09ce89..c53341d35e 100644 --- a/src/mathed/math_data.C +++ b/src/mathed/math_data.C @@ -66,6 +66,7 @@ void MathArray::insert(size_type pos, MathAtom const & t) void MathArray::insert(size_type pos, MathArray const & ar) { + lyx::Assert(pos <= size()); base_type::insert(begin() + pos, ar.begin(), ar.end()); } diff --git a/src/mathed/math_nestinset.C b/src/mathed/math_nestinset.C index 738e89ea10..9dd85d446a 100644 --- a/src/mathed/math_nestinset.C +++ b/src/mathed/math_nestinset.C @@ -332,7 +332,8 @@ MathInset::result_type MathNestInset::dispatch case LFUN_PASTESELECTION: return - dispatch(FuncRequest(bv, LFUN_PASTE, bv->getClipboard()), idx, pos); + dispatch( + FuncRequest(bv, LFUN_PASTE, bv->getClipboard()), idx, pos); case LFUN_MOUSE_PRESS: if (cmd.button() == mouse_button::button2)