using std::string;
using std::vector;
using std::endl;
-#ifndef CXX_GLOBAL_CSTD
-using std::isalpha;
-#endif
using std::min;
using std::for_each;
it.top().pos() = 0;
DocIterator et = c;
et.top().pos() = et.top().asInsetMath()->cell(et.top().idx()).size();
- for (size_t i = 0; ; ++i) {
+ for (size_t i = 0;; ++i) {
int xo;
int yo;
InsetBase const * inset = &it.inset();
double d = (x - xo) * (x - xo) + (y - yo) * (y - yo);
// '<=' in order to take the last possible position
// this is important for clicking behind \sum in e.g. '\sum_i a'
- lyxerr[Debug::DEBUG] << "i: " << i << " d: " << d
+ LYXERR(Debug::DEBUG) << "i: " << i << " d: " << d
<< " best: " << best_dist << endl;
if (d <= best_dist) {
best_dist = d;
void LCursor::dispatch(FuncRequest const & cmd0)
{
- lyxerr[Debug::DEBUG] << BOOST_CURRENT_FUNCTION
+ LYXERR(Debug::DEBUG) << BOOST_CURRENT_FUNCTION
<< " cmd: " << cmd0 << '\n'
<< *this << endl;
if (empty())
LCursor safe = *this;
for (; depth(); pop()) {
- lyxerr[Debug::DEBUG] << "LCursor::dispatch: cmd: "
+ LYXERR(Debug::DEBUG) << "LCursor::dispatch: cmd: "
<< cmd0 << endl << *this << endl;
BOOST_ASSERT(pos() <= lastpos());
BOOST_ASSERT(idx() <= lastidx());
// it completely to get a 'bomb early' behaviour in case this
// object will be used again.
if (!disp_.dispatched()) {
- lyxerr[Debug::DEBUG] << "RESTORING OLD CURSOR!" << endl;
+ LYXERR(Debug::DEBUG) << "RESTORING OLD CURSOR!" << endl;
operator=(safe);
disp_.update(Update::None);
disp_.dispatched(false);
operator[](i).inset().infoize(os);
os << " ";
}
- if (pos() != 0)
- prevInset()->infoize2(os);
+ if (pos() != 0) {
+ InsetBase const * inset = prevInset();
+ // prevInset() can return 0 in certain case.
+ if (inset)
+ prevInset()->infoize2(os);
+ }
// overwite old message
os << " ";
}
resetAnchor();
selection() = sel;
+ cap::saveSelection(*this);
return true;
}
#include "mathed/InsetMathScript.h"
#include "mathed/InsetMathUnknown.h"
#include "mathed/MathFactory.h"
-#include "mathed/MathMacroArgument.h"
#include "mathed/MathStream.h"
#include "mathed/MathSupport.h"
autocorrect() = false;
if (selection()) {
- cap::selDel(*this);
+ cap::eraseSelection(*this);
return true;
}
// [|], can not delete from inside
return false;
} else {
- // move to left
- popLeft();
+ if (inMathed())
+ pullArg();
+ else
+ popLeft();
return true;
}
}
return true;
if (selection()) {
- cap::selDel(*this);
+ cap::eraseSelection(*this);
return true;
}
if (s == "\\")
return false;
- // prevent entering of recursive macros
- // FIXME: this is only a weak attempt... only prevents immediate
- // recursion
- docstring const name = s.substr(1);
- InsetBase const * macro = innerInsetOfType(InsetBase::MATHMACRO_CODE);
- if (macro && macro->getInsetName() == name)
- lyxerr << "can't enter recursive macro" << endl;
+ // trigger updates of macros, at least, if no full
+ // updates take place anyway
+ updateFlags(Update::Force);
+ docstring const name = s.substr(1);
InsetMathNest * const in = inset().asInsetMath()->asNestInset();
if (in && in->interpretString(*this, s))
return true;
void LCursor::handleFont(string const & font)
{
- lyxerr[Debug::DEBUG] << BOOST_CURRENT_FUNCTION << ": " << font << endl;
+ LYXERR(Debug::DEBUG) << BOOST_CURRENT_FUNCTION << ": " << font << endl;
docstring safe;
if (selection()) {
macroModeClose();
<< ", max is " << copy.lastidx()
<< " at level " << copy.depth()
<< ". Trying to correct this." << endl;
+ lyxerr << "old: " << *this << endl;
newdepth = copy.depth() - 1;
}
else if (copy.pit() > copy.lastpit()) {
<< ", max is " << copy.lastpit()
<< " at level " << copy.depth()
<< ". Trying to correct this." << endl;
+ lyxerr << "old: " << *this << endl;
newdepth = copy.depth() - 1;
}
else if (copy.pos() > copy.lastpos()) {
<< ", max is " << copy.lastpos()
<< " at level " << copy.depth()
<< ". Trying to correct this." << endl;
+ lyxerr << "old: " << *this << endl;
newdepth = copy.depth() - 1;
}
copy.pop();
while (depth() > newdepth) {
pop();
lyxerr << "correcting cursor to level " << depth() << endl;
+ lyxerr << "new: " << *this << endl;
+ clearSelection();
}
}