#include "Text.h"
-#include "Bidi.h"
#include "Buffer.h"
#include "buffer_funcs.h"
#include "BufferList.h"
#include "support/lassert.h"
#include "support/debug.h"
#include "support/gettext.h"
+#include "support/lyxalgo.h"
#include "support/textutils.h"
-#include <boost/next_prior.hpp>
-
#include <sstream>
using namespace std;
pit_type end = cur.selEnd().pit() + 1;
cur.recordUndoSelection();
setLayout(start, end, layout);
+ cur.setCurrentFont();
cur.forceBufferUpdate();
}
bool Text::cursorBottom(Cursor & cur)
{
LBUFERR(this == cur.text());
- return setCursor(cur, cur.lastpit(), boost::prior(paragraphs().end())->size());
+ return setCursor(cur, cur.lastpit(), prev(paragraphs().end(), 1)->size());
}
}
-bool Text::setCursor(Cursor & cur, pit_type par, pos_type pos,
+bool Text::setCursor(Cursor & cur, pit_type pit, pos_type pos,
bool setfont, bool boundary)
{
TextMetrics const & tm = cur.bv().textMetrics(this);
- bool const update_needed = !tm.contains(par);
+ bool const update_needed = !tm.contains(pit);
Cursor old = cur;
- setCursorIntern(cur, par, pos, setfont, boundary);
+ setCursorIntern(cur, pit, pos, setfont, boundary);
return cur.bv().checkDepm(cur, old) || update_needed;
}
-void Text::setCursor(CursorSlice & cur, pit_type par, pos_type pos)
-{
- LASSERT(par != int(paragraphs().size()), return);
- cur.pit() = par;
- cur.pos() = pos;
-
- // now some strict checking
- Paragraph & para = getPar(par);
-
- // None of these should happen, but we're scaredy-cats
- if (pos < 0) {
- LYXERR0("Don't like -1!");
- LATTEST(false);
- }
-
- if (pos > para.size()) {
- LYXERR0("Don't like 1, pos: " << pos
- << " size: " << para.size()
- << " par: " << par);
- LATTEST(false);
- }
-}
-
-
-void Text::setCursorIntern(Cursor & cur,
- pit_type par, pos_type pos, bool setfont, bool boundary)
+void Text::setCursorIntern(Cursor & cur, pit_type pit, pos_type pos,
+ bool setfont, bool boundary)
{
LBUFERR(this == cur.text());
cur.boundary(boundary);
- setCursor(cur.top(), par, pos);
+ cur.top().setPitPos(pit, pos);
if (setfont)
cur.setCurrentFont();
}
if (!front)
--cur.pos();
inset->edit(cur, front);
+ cur.setCurrentFont();
return true;
}
return false;
inset->edit(cur, movingForward,
movingLeft ? Inset::ENTRY_DIRECTION_RIGHT : Inset::ENTRY_DIRECTION_LEFT);
+ cur.setCurrentFont();
return true;
}
min(old.pit() + 1, old.lastpit()));
ParagraphList & plist = old.text()->paragraphs();
bool const soa = oldpar.params().startOfAppendix();
- plist.erase(boost::next(plist.begin(), old.pit()));
+ plist.erase(lyx::next(plist.begin(), old.pit()));
// do not lose start of appendix marker (bug 4212)
if (soa && old.pit() < pit_type(plist.size()))
plist[old.pit()].params().startOfAppendix(true);
continue;
if (par.empty() || (par.size() == 1 && par.isLineSeparator(0))) {
- pars_.erase(boost::next(pars_.begin(), pit));
+ pars_.erase(lyx::next(pars_.begin(), pit));
--pit;
--last;
continue;