#include "BufferParams.h"
#include "BufferView.h"
#include "Bullet.h"
+#include "Changes.h"
#include "Color.h"
#include "Cursor.h"
#include "CutAndPaste.h"
#include "FuncRequest.h"
#include "gettext.h"
#include "Language.h"
+#include "Layout.h"
#include "Lexer.h"
#include "LyXFunc.h"
#include "LyXRC.h"
#include "ParIterator.h"
#include "Server.h"
#include "ServerSocket.h"
-#include "Undo.h"
+#include "TextMetrics.h"
#include "VSpace.h"
#include "frontends/FontMetrics.h"
#include "support/textutils.h"
#include <boost/current_function.hpp>
+#include <boost/next_prior.hpp>
#include <sstream>
BOOST_ASSERT(this == cur.text());
pit_type const beg = cur.selBegin().pit();
pit_type const end = cur.selEnd().pit() + 1;
- recordUndoSelection(cur);
+ cur.recordUndoSelection();
int max_depth = (beg != 0 ? pars_[beg - 1].getMaxDepthAfter() : 0);
for (pit_type pit = beg; pit != end; ++pit) {
return;
// Ok, we have a selection.
- recordUndoSelection(cur);
+ cur.recordUndoSelection();
setFont(cur.bv(), cur.selectionBegin().top(),
cur.selectionEnd().top(), font, toggleall);
if (!front && cur.pos() == 0)
return false;
Inset * inset = front ? cur.nextInset() : cur.prevInset();
- if (!isHighlyEditableInset(inset))
+ if (!inset || inset->editable() != Inset::HIGHLY_EDITABLE)
return false;
/*
* Apparently, when entering an inset we are expected to be positioned
}
-bool Text::cursorLeft(Cursor & cur)
+bool Text::cursorBackward(Cursor & cur)
{
// Tell BufferView to test for FitCursor in any case!
cur.updateFlags(Update::FitCursor);
// move to the previous paragraph or do nothing
if (cur.pit() > 0)
- return setCursor(cur, cur.pit() - 1, getPar(cur.pit() - 1).size());
+ return setCursor(cur, cur.pit() - 1, getPar(cur.pit() - 1).size(), true, false);
return false;
}
-bool Text::cursorRight(Cursor & cur)
+bool Text::cursorForward(Cursor & cur)
{
// Tell BufferView to test for FitCursor in any case!
cur.updateFlags(Update::FitCursor);
// move to next paragraph
if (cur.pit() != cur.lastpit())
- return setCursor(cur, cur.pit() + 1, 0);
+ return setCursor(cur, cur.pit() + 1, 0, true, false);
return false;
}
if (oldpar.empty() || (oldpar.size() == 1 && oldpar.isLineSeparator(0))) {
// Delete old par.
- recordUndo(old, Undo::ATOMIC,
+ old.recordUndo(ATOMIC_UNDO,
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()));
+ // do not lose start of appendix marker (bug 4212)
+ if (soa)
+ plist[old.pit()].params().startOfAppendix(true);
// see #warning (FIXME?) above
if (cur.depth() >= old.depth()) {
void Text::recUndo(Cursor & cur, pit_type first, pit_type last) const
{
- recordUndo(cur, Undo::ATOMIC, first, last);
+ cur.recordUndo(ATOMIC_UNDO, first, last);
}
void Text::recUndo(Cursor & cur, pit_type par) const
{
- recordUndo(cur, Undo::ATOMIC, par, par);
+ cur.recordUndo(ATOMIC_UNDO, par, par);
}
} // namespace lyx