mirror of
https://git.lyx.org/repos/lyx.git
synced 2025-01-10 18:58:10 +00:00
fix bug 2060
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@10525 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
03eed1b8ba
commit
7c67a37f53
@ -1,3 +1,11 @@
|
||||
2005-10-04 Georg Baum <Georg.Baum@post.rwth-aachen.de>
|
||||
|
||||
* math_macro.C (editXY): new, fix crash (bug 2060)
|
||||
* math_macro.C (cursorPos): new, fix potential crash
|
||||
* math_macro.C (drawSelection): new, fix potential crash
|
||||
* math_nestinset.C (doDispatch): fix crash when inserting math macros
|
||||
with 0 arguments
|
||||
|
||||
2005-09-30 Jean-Marc Lasgouttes <lasgouttes@lyx.org>
|
||||
|
||||
* math_nestinset.C (doDispatch): do not leave the inset after
|
||||
|
@ -46,6 +46,15 @@ string MathMacro::name() const
|
||||
}
|
||||
|
||||
|
||||
void MathMacro::cursorPos(CursorSlice const & sl, bool boundary, int & x,
|
||||
int & y) const
|
||||
{
|
||||
// We may have 0 arguments, but MathNestInset requires at least one.
|
||||
if (nargs() > 0)
|
||||
MathNestInset::cursorPos(sl, boundary, x, y);
|
||||
}
|
||||
|
||||
|
||||
void MathMacro::metrics(MetricsInfo & mi, Dimension & dim) const
|
||||
{
|
||||
if (!MacroTable::globalMacros().has(name())) {
|
||||
@ -102,6 +111,14 @@ void MathMacro::draw(PainterInfo & pi, int x, int y) const
|
||||
}
|
||||
|
||||
|
||||
void MathMacro::drawSelection(PainterInfo & pi, int x, int y) const
|
||||
{
|
||||
// We may have 0 arguments, but MathNestInset requires at least one.
|
||||
if (nargs() > 0)
|
||||
MathNestInset::drawSelection(pi, x, y);
|
||||
}
|
||||
|
||||
|
||||
void MathMacro::validate(LaTeXFeatures & features) const
|
||||
{
|
||||
if (name() == "binom" || name() == "mathcircumflex")
|
||||
@ -109,6 +126,15 @@ void MathMacro::validate(LaTeXFeatures & features) const
|
||||
}
|
||||
|
||||
|
||||
InsetBase * MathMacro::editXY(LCursor & cur, int x, int y)
|
||||
{
|
||||
// We may have 0 arguments, but MathNestInset requires at least one.
|
||||
if (nargs() > 0)
|
||||
return MathNestInset::editXY(cur, x, y);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
void MathMacro::maple(MapleStream & os) const
|
||||
{
|
||||
updateExpansion();
|
||||
|
@ -28,8 +28,14 @@ public:
|
||||
void draw(PainterInfo & pi, int x, int y) const;
|
||||
///
|
||||
void drawExpanded(PainterInfo & pi, int x, int y) const;
|
||||
/// draw selection background
|
||||
void drawSelection(PainterInfo & pi, int x, int y) const;
|
||||
///
|
||||
void metrics(MetricsInfo & mi, Dimension & dim) const;
|
||||
/// get cursor position
|
||||
void cursorPos(CursorSlice const & sl, bool boundary, int & x, int & y) const;
|
||||
///
|
||||
InsetBase * editXY(LCursor & cur, int x, int y);
|
||||
///
|
||||
std::string name() const;
|
||||
///
|
||||
@ -60,7 +66,7 @@ private:
|
||||
std::string name_;
|
||||
/// the unexpanded macro defintition
|
||||
mutable MathArray tmpl_;
|
||||
/// the matcro substituted with our args
|
||||
/// the macro substituted with our args
|
||||
mutable MathArray expanded_;
|
||||
};
|
||||
|
||||
|
@ -859,7 +859,10 @@ void MathNestInset::doDispatch(LCursor & cur, FuncRequest & cmd)
|
||||
int cell(0);
|
||||
if (cmd.argument == "\\root")
|
||||
cell = 1;
|
||||
if (ar.size() == 1 && (ar[0].nucleus()->asNestInset())) {
|
||||
// math macros are nest insets and may have 0 cells.
|
||||
// handleNest would crash in this case.
|
||||
if (ar.size() == 1 && (ar[0].nucleus()->asNestInset()) &&
|
||||
ar[0].nucleus()->nargs() > cell) {
|
||||
cur.handleNest(ar[0], cell);
|
||||
} else
|
||||
cur.niceInsert(cmd.argument);
|
||||
|
Loading…
Reference in New Issue
Block a user