#include "insets/InsetText.h"
#include "mathed/MathData.h"
+#include "mathed/InsetMathNest.h"
#include "frontends/alert.h"
#include "frontends/Application.h"
if (!findNextInset(tmpdit, codes, contents)) {
if (dit.depth() != 1 || dit.pit() != 0 || dit.pos() != 0) {
- Inset * inset = &tmpdit.bottom().inset();
+ inset = &tmpdit.bottom().inset();
tmpdit = doc_iterator_begin(&inset->buffer(), inset);
if (!findNextInset(tmpdit, codes, contents))
return false;
case LFUN_WORD_FIND_FORWARD:
case LFUN_WORD_FIND_BACKWARD:
case LFUN_WORD_REPLACE:
- case LFUN_BUFFER_ANONYMIZE:
case LFUN_MARK_OFF:
case LFUN_MARK_ON:
case LFUN_MARK_TOGGLE:
for (Buffer * b = &buffer_; i == 0 || b != &buffer_;
b = theBufferList().next(b)) {
- Cursor cur(*this);
- cur.setCursor(b->getParFromID(id));
- if (cur.atEnd()) {
+ Cursor curs(*this);
+ curs.setCursor(b->getParFromID(id));
+ if (curs.atEnd()) {
LYXERR(Debug::INFO, "No matching paragraph found! [" << id << "].");
++i;
continue;
}
- LYXERR(Debug::INFO, "Paragraph " << cur.paragraph().id()
+ LYXERR(Debug::INFO, "Paragraph " << curs.paragraph().id()
<< " found in buffer `"
<< b->absFileName() << "'.");
bool success;
if (str_id_end.empty() || str_pos_end.empty()) {
// Set the cursor
- cur.pos() = pos;
- mouseSetCursor(cur);
+ curs.pos() = pos;
+ mouseSetCursor(curs);
success = true;
} else {
int const id_end = convert<int>(str_id_end);
break;
}
- case LFUN_BUFFER_ANONYMIZE: {
- for (char c = '0'; c <= 'Z'; c++) {
- odocstringstream ss;
- ss << "a\n" << c << "\n0 0 1 1 0";
- lyx::dispatch(FuncRequest(LFUN_WORD_REPLACE, ss.str()));
- }
- break;
- }
-
case LFUN_WORD_FINDADV: {
FindAndReplaceOptions opt;
istringstream iss(to_utf8(cmd.argument()));
from = cur.selectionBegin();
to = cur.selectionEnd();
- string newId = cmd.getArg(0);
- bool fetchId=newId.empty(); //if we wait for groupId from first graphics inset
+ string const newId = cmd.getArg(0);
+ bool fetchId = newId.empty(); //if we wait for groupId from first graphics inset
InsetGraphicsParams grp_par;
- InsetGraphics::string2params(graphics::getGroupParams(buffer_, newId), buffer_, grp_par);
+ if (!fetchId)
+ InsetGraphics::string2params(graphics::getGroupParams(buffer_, newId), buffer_, grp_par);
if (!from.nextInset()) //move to closest inset
from.forwardInset();
Inset * inset = from.nextInset();
if (!inset)
break;
- if (inset->lyxCode() == GRAPHICS_CODE) {
- InsetGraphics * ig = inset->asInsetGraphics();
- if (!ig)
- break;
+ InsetGraphics * ig = inset->asInsetGraphics();
+ if (ig) {
InsetGraphicsParams inspar = ig->getParams();
if (fetchId) {
grp_par = inspar;
fetchId = false;
-
} else {
grp_par.filename = inspar.filename;
ig->setParams(grp_par);
}
+ case LFUN_UNICODE_INSERT: {
+ if (cmd.argument().empty())
+ break;
+
+ FuncCode code = cur.inset().currentMode() == Inset::MATH_MODE ?
+ LFUN_MATH_INSERT : LFUN_SELF_INSERT;
+ int i = 0;
+ while (true) {
+ docstring const arg = from_utf8(cmd.getArg(i));
+ if (arg.empty())
+ break;
+ if (!isHex(arg)) {
+ LYXERR0("Not a hexstring: " << arg);
+ ++i;
+ continue;
+ }
+ char_type c = hexToInt(arg);
+ if (c >= 32 && c < 0x10ffff) {
+ LYXERR(Debug::KEY, "Inserting c: " << c);
+ lyx::dispatch(FuncRequest(code, docstring(1, c)));
+ }
+ ++i;
+ }
+ break;
+ }
+
+
// This would be in Buffer class if only Cursor did not
// require a bufferview
case LFUN_INSET_FORALL: {
// an arbitrary number to limit number of iterations
const int max_iter = 100000;
int iterations = 0;
- Cursor & cur = d->cursor_;
- Cursor const savecur = cur;
- cur.reset();
- if (!cur.nextInset())
- cur.forwardInset();
- cur.beginUndoGroup();
- while(cur && iterations < max_iter) {
- Inset * const ins = cur.nextInset();
+ Cursor & curs = d->cursor_;
+ Cursor const savecur = curs;
+ curs.reset();
+ if (!curs.nextInset())
+ curs.forwardInset();
+ curs.beginUndoGroup();
+ while(curs && iterations < max_iter) {
+ Inset * const ins = curs.nextInset();
if (!ins)
break;
docstring insname = ins->layoutName();
while (!insname.empty()) {
if (insname == name || name == from_utf8("*")) {
- cur.recordUndo();
+ curs.recordUndo();
lyx::dispatch(fr, dr);
++iterations;
break;
insname = insname.substr(0, i);
}
// if we did not delete the inset, skip it
- if (!cur.nextInset() || cur.nextInset() == ins)
- cur.forwardInset();
+ if (!curs.nextInset() || curs.nextInset() == ins)
+ curs.forwardInset();
}
- cur = savecur;
- cur.fixIfBroken();
+ curs = savecur;
+ curs.fixIfBroken();
/** This is a dummy undo record only to remember the cursor
* that has just been set; this will be used on a redo action
* (see ticket #10097)
* FIXME: a better fix would be to have a way to set the
* cursor value directly, but I am not sure it is worth it.
*/
- cur.recordUndo();
- cur.endUndoGroup();
+ curs.recordUndo();
+ curs.endUndoGroup();
dr.screenUpdate(Update::Force);
dr.forceBufferUpdate();
icp["key"] = from_utf8(arg);
if (!opt1.empty())
icp["before"] = from_utf8(opt1);
+ icp["literal"] =
+ from_ascii(InsetCitation::last_literal ? "true" : "false");
string icstr = InsetCommand::params2string(icp);
FuncRequest fr(LFUN_INSET_INSERT, icstr);
lyx::dispatch(fr);