Stephan Witt
2011-01-06 07:20:07 UTC
While looking at #7209 I stumbled over Cursor::normalize().
Is it really a good idea to use the cursor inset as math whithout
any check to write it to debug output?
Stephan
Possible patch:
Index: src/Cursor.cpp
===================================================================
--- src/Cursor.cpp (Revision 37124)
+++ src/Cursor.cpp (Arbeitskopie)
@@ -1683,12 +1683,15 @@
if (pos() > lastpos()) {
lyxerr << "this should not really happen - 2: "
- << pos() << ' ' << lastpos() << " in idx: " << idx()
- << " in atom: '";
+ << pos() << ' ' << lastpos() << " in idx: " << idx();
odocstringstream os;
WriteStream wi(os, false, true, WriteStream::wsDefault);
- inset().asInsetMath()->write(wi);
- lyxerr << to_utf8(os.str()) << endl;
+ InsetMath const * m = inset().asInsetMath();
+ if (m) {
+ m->write(wi);
+ lyxerr << " in atom: '" << to_utf8(os.str()) << "'";
+ }
+ lyxerr << endl;
pos() = lastpos();
}
}
Is it really a good idea to use the cursor inset as math whithout
any check to write it to debug output?
Stephan
Possible patch:
Index: src/Cursor.cpp
===================================================================
--- src/Cursor.cpp (Revision 37124)
+++ src/Cursor.cpp (Arbeitskopie)
@@ -1683,12 +1683,15 @@
if (pos() > lastpos()) {
lyxerr << "this should not really happen - 2: "
- << pos() << ' ' << lastpos() << " in idx: " << idx()
- << " in atom: '";
+ << pos() << ' ' << lastpos() << " in idx: " << idx();
odocstringstream os;
WriteStream wi(os, false, true, WriteStream::wsDefault);
- inset().asInsetMath()->write(wi);
- lyxerr << to_utf8(os.str()) << endl;
+ InsetMath const * m = inset().asInsetMath();
+ if (m) {
+ m->write(wi);
+ lyxerr << " in atom: '" << to_utf8(os.str()) << "'";
+ }
+ lyxerr << endl;
pos() = lastpos();
}
}