#include "Paragraph.h"
#include "ParIterator.h"
#include "Row.h"
+#include "texstream.h"
#include "Text.h"
#include "TextMetrics.h"
#include "TocBackend.h"
#include "mathed/MathData.h"
#include "mathed/MathMacro.h"
-#include "support/bind.h"
-
#include <sstream>
#include <limits>
#include <map>
DocIterator result;
DocIterator it = c;
- it.top().pos() = 0;
+ it.pos() = 0;
DocIterator et = c;
- et.top().pos() = et.top().asInsetMath()->cell(et.top().idx()).size();
+ et.pos() = et.lastpos();
for (size_t i = 0;; ++i) {
int xo;
int yo;
Inset const * inset = &it.inset();
- CoordCache const & cache = c.bv().coordCache();
+ CoordCache::Insets const & insetCache = c.bv().coordCache().getInsets();
// FIXME: in the case where the inset is not in the cache, this
// means that no part of it is visible on screen. In this case
// we don't do elaborate search and we just return the forwarded
// DocIterator at its beginning.
- if (!cache.getInsets().has(inset)) {
+ if (!insetCache.has(inset)) {
it.top().pos() = 0;
return it;
}
- Point const o = cache.getInsets().xy(inset);
+ Point const o = insetCache.xy(inset);
inset->cursorPos(c.bv(), it.top(), c.boundary(), xo, yo);
// Convert to absolute
xo += o.x_;
void Cursor::setSelection()
{
- setSelection(true);
+ selection(true);
if (idx() == normalAnchor().idx() &&
pit() == normalAnchor().pit() &&
pos() == normalAnchor().pos())
- setSelection(false);
+ selection(false);
}
void Cursor::setSelection(DocIterator const & where, int n)
{
setCursor(where);
- setSelection(true);
+ selection(true);
anchor_ = where;
pos() += n;
}
void Cursor::clearSelection()
{
- setSelection(false);
+ selection(false);
setWordSelection(false);
setMark(false);
resetAnchor();
cap::saveSelection(*this);
resetAnchor();
- setSelection(sel);
+ selection(sel);
return true;
}
} // namespace lyx
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);
}
// let's require two backspaces for 'big stuff' and
// highlight on the first
resetAnchor();
- setSelection(true);
+ selection(true);
--pos();
} else {
--pos();
// 'clever' UI hack: only erase large items if previously slected
if (pos() != lastpos() && nextAtom()->nargs() > 0) {
resetAnchor();
- setSelection(true);
+ selection(true);
++pos();
} else {
plainErase();
<< 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;