#include "Paragraph.h"
#include "ParIterator.h"
#include "Row.h"
+#include "texstream.h"
#include "Text.h"
#include "TextMetrics.h"
#include "TocBackend.h"
#include "mathed/InsetMath.h"
#include "mathed/InsetMathBrace.h"
+#include "mathed/InsetMathEnsureMath.h"
#include "mathed/InsetMathScript.h"
#include "mathed/MacroTable.h"
#include "mathed/MathData.h"
+#include "mathed/MathFactory.h"
#include "mathed/MathMacro.h"
-#include "support/bind.h"
-
#include <sstream>
#include <limits>
#include <map>
void Cursor::insert(docstring const & str)
{
- for_each(str.begin(), str.end(),
- bind(static_cast<void(Cursor::*)(char_type)>
- (&Cursor::insert), this, _1));
+ for (char_type c : str)
+ insert(c);
}
else if (atom.nucleus()->nargs() > 0)
atom.nucleus()->cell(0).append(selection);
- plainInsert(atom);
+ if (in->currentMode() == Inset::TEXT_MODE
+ && atom.nucleus()->currentMode() == Inset::MATH_MODE
+ && name != from_ascii("ensuremath")) {
+ MathAtom at(new InsetMathEnsureMath(buffer()));
+ at.nucleus()->cell(0).push_back(atom);
+ niceInsert(at);
+ posForward();
+ } else if (in->currentMode() == Inset::MATH_MODE
+ && atom.nucleus()->currentMode() == Inset::TEXT_MODE
+ && name != from_ascii("text")) {
+ MathAtom at = createInsetMath("text", buffer());
+ at.nucleus()->cell(0).push_back(atom);
+ niceInsert(at);
+ posForward();
+ } else
+ plainInsert(atom);
// finally put the macro argument behind, if needed
if (macroArg) {
<< pos() << ' ' << lastpos() << " in idx: " << idx()
<< " in atom: '";
odocstringstream os;
- TexRow texrow(false);
- otexrowstream ots(os,texrow);
+ otexrowstream ots(os, false);
WriteStream wi(ots, false, true, WriteStream::wsDefault);
inset().asInsetMath()->write(wi);
lyxerr << to_utf8(os.str()) << endl;