#include "CutAndPaste.h"
#include "debug.h"
#include "dispatchresult.h"
+#include "errorlist.h"
#include "factory.h"
#include "funcrequest.h"
#include "gettext.h"
#include "support/lyxlib.h"
#include "support/convert.h"
#include "support/lyxtime.h"
+#include "support/unicode.h"
#include "mathed/math_hullinset.h"
#include "mathed/math_macrotemplate.h"
#include <clocale>
#include <sstream>
+using lyx::char_type;
using lyx::pos_type;
using lyx::cap::copySelection;
using lyx::cap::cutSelection;
+using lyx::cap::pasteParagraphList;
using lyx::cap::pasteSelection;
using lyx::cap::replaceSelection;
}
case LFUN_INSET_DISSOLVE: {
- recordUndo(cur);
+ recordUndoInset(cur);
cur.selHandle(false);
// save position
lyx::pos_type spos = cur.pos();
lyx::pit_type spit = cur.pit();
- bool content = false;
- if (cur.lastpit() != 0 || cur.lastpos() != 0) {
- setCursor(cur, 0, 0);
- cur.resetAnchor();
- cur.pit() = cur.lastpit();
- cur.pos() = cur.lastpos();
- cur.setSelection();
- copySelection(cur);
- content = true;
- }
- cur.popLeft();
- cur.resetAnchor();
- // store cursor offset
- if (spit == 0)
- spos += cur.pos();
- spit += cur.pit();
- cur.pos()++;
- cur.setSelection();
- if (content) {
- lyx::cap::replaceSelection(cur);
- pasteSelection(cur, 0);
- cur.clearSelection();
+ ParagraphList plist;
+ if (cur.lastpit() != 0 || cur.lastpos() != 0)
+ plist = paragraphs();
+ cur.popLeft();
+ // store cursor offset
+ if (spit == 0)
+ spos += cur.pos();
+ spit += cur.pit();
+ cur.paragraph().erase(cur.pos());
+ if (!plist.empty()) {
+ Buffer * b = bv->buffer();
+ pasteParagraphList(cur, plist, b->params().textclass,
+ b->errorList("Paste"));
// restore position
cur.pit() = std::min(cur.lastpit(), spit);
cur.pos() = std::min(cur.lastpos(), spos);
- cur.resetAnchor();
- } else
- cutSelection(cur, false, false);
+ }
+ cur.clearSelection();
+ cur.resetAnchor();
needsUpdate = true;
break;
}
cur.message(_("Paste"));
lyx::cap::replaceSelection(cur);
if (isStrUnsignedInt(cmd.argument))
- pasteSelection(cur, convert<unsigned int>(cmd.argument));
+ pasteSelection(cur, bv->buffer()->errorList("Paste"),
+ convert<unsigned int>(cmd.argument));
else
- pasteSelection(cur, 0);
+ pasteSelection(cur, bv->buffer()->errorList("Paste"),
+ 0);
+ bv->buffer()->errors("Paste");
cur.clearSelection(); // bug 393
bv->switchKeyMap();
finishUndo();
cur.clearSelection();
LyXFont const old_font = real_current_font;
+#if 0
string::const_iterator cit = cmd.argument.begin();
string::const_iterator end = cmd.argument.end();
for (; cit != end; ++cit)
bv->owner()->getIntl().getTransManager().
translateAndInsert(*cit, this);
+#else
+ std::vector<char> in(cmd.argument.begin(), cmd.argument.end());
+ std::vector<boost::uint32_t> const res = utf8_to_ucs4(in);
+ std::vector<boost::uint32_t>::const_iterator cit = res.begin();
+ std::vector<boost::uint32_t>::const_iterator end = res.end();
+ for (; cit != end; ++cit)
+ insertChar(bv->cursor(), *cit);
+#endif
cur.resetAnchor();
moveCursor(cur, false);