#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();
}
void Text::setFont(Cursor & cur, Font const & font, bool toggleall)
{
LASSERT(this == cur.text(), return);
+
+ // If there is a selection, record undo before the cursor font is changed.
+ if (cur.selection())
+ cur.recordUndoSelection();
+
// Set the current_font
// Determine basis font
FontInfo layoutfont;
return;
// Ok, we have a selection.
- cur.recordUndoSelection();
Font newfont = font;
if (toggleall) {
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());
}
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;
}
if (oldpar.empty() || (oldpar.size() == 1 && oldpar.isLineSeparator(0))) {
// Delete old par.
- old.recordUndo(ATOMIC_UNDO,
- max(old.pit() - 1, pit_type(0)),
- min(old.pit() + 1, old.lastpit()));
+ old.recordUndo(max(old.pit() - 1, pit_type(0)),
+ 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(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(next(pars_.begin(), pit));
--pit;
--last;
continue;
}
-void Text::recUndo(Cursor & cur, pit_type first, pit_type last) const
-{
- cur.recordUndo(ATOMIC_UNDO, first, last);
-}
-
-
-void Text::recUndo(Cursor & cur, pit_type par) const
-{
- cur.recordUndo(ATOMIC_UNDO, par, par);
-}
-
} // namespace lyx