This commit is contained in:
Richard Heck 2018-02-23 23:35:17 -05:00
parent 59e6610d8a
commit cc42634665

View File

@ -164,7 +164,7 @@ bool findInset(DocIterator & dit, vector<InsetCode> const & codes,
if (!findNextInset(tmpdit, codes, contents)) { if (!findNextInset(tmpdit, codes, contents)) {
if (dit.depth() != 1 || dit.pit() != 0 || dit.pos() != 0) { 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); tmpdit = doc_iterator_begin(&inset->buffer(), inset);
if (!findNextInset(tmpdit, codes, contents)) if (!findNextInset(tmpdit, codes, contents))
return false; return false;
@ -1463,14 +1463,14 @@ void BufferView::dispatch(FuncRequest const & cmd, DispatchResult & dr)
for (Buffer * b = &buffer_; i == 0 || b != &buffer_; for (Buffer * b = &buffer_; i == 0 || b != &buffer_;
b = theBufferList().next(b)) { b = theBufferList().next(b)) {
Cursor cur(*this); Cursor curs(*this);
cur.setCursor(b->getParFromID(id)); curs.setCursor(b->getParFromID(id));
if (cur.atEnd()) { if (curs.atEnd()) {
LYXERR(Debug::INFO, "No matching paragraph found! [" << id << "]."); LYXERR(Debug::INFO, "No matching paragraph found! [" << id << "].");
++i; ++i;
continue; continue;
} }
LYXERR(Debug::INFO, "Paragraph " << cur.paragraph().id() LYXERR(Debug::INFO, "Paragraph " << curs.paragraph().id()
<< " found in buffer `" << " found in buffer `"
<< b->absFileName() << "'."); << b->absFileName() << "'.");
@ -1478,8 +1478,8 @@ void BufferView::dispatch(FuncRequest const & cmd, DispatchResult & dr)
bool success; bool success;
if (str_id_end.empty() || str_pos_end.empty()) { if (str_id_end.empty() || str_pos_end.empty()) {
// Set the cursor // Set the cursor
cur.pos() = pos; curs.pos() = pos;
mouseSetCursor(cur); mouseSetCursor(curs);
success = true; success = true;
} else { } else {
int const id_end = convert<int>(str_id_end); int const id_end = convert<int>(str_id_end);
@ -1917,20 +1917,20 @@ void BufferView::dispatch(FuncRequest const & cmd, DispatchResult & dr)
// an arbitrary number to limit number of iterations // an arbitrary number to limit number of iterations
const int max_iter = 100000; const int max_iter = 100000;
int iterations = 0; int iterations = 0;
Cursor & cur = d->cursor_; Cursor & curs = d->cursor_;
Cursor const savecur = cur; Cursor const savecur = curs;
cur.reset(); curs.reset();
if (!cur.nextInset()) if (!curs.nextInset())
cur.forwardInset(); curs.forwardInset();
cur.beginUndoGroup(); curs.beginUndoGroup();
while(cur && iterations < max_iter) { while(curs && iterations < max_iter) {
Inset * const ins = cur.nextInset(); Inset * const ins = curs.nextInset();
if (!ins) if (!ins)
break; break;
docstring insname = ins->layoutName(); docstring insname = ins->layoutName();
while (!insname.empty()) { while (!insname.empty()) {
if (insname == name || name == from_utf8("*")) { if (insname == name || name == from_utf8("*")) {
cur.recordUndo(); curs.recordUndo();
lyx::dispatch(fr, dr); lyx::dispatch(fr, dr);
++iterations; ++iterations;
break; break;
@ -1941,11 +1941,11 @@ void BufferView::dispatch(FuncRequest const & cmd, DispatchResult & dr)
insname = insname.substr(0, i); insname = insname.substr(0, i);
} }
// if we did not delete the inset, skip it // if we did not delete the inset, skip it
if (!cur.nextInset() || cur.nextInset() == ins) if (!curs.nextInset() || curs.nextInset() == ins)
cur.forwardInset(); curs.forwardInset();
} }
cur = savecur; curs = savecur;
cur.fixIfBroken(); curs.fixIfBroken();
/** This is a dummy undo record only to remember the cursor /** This is a dummy undo record only to remember the cursor
* that has just been set; this will be used on a redo action * that has just been set; this will be used on a redo action
* (see ticket #10097) * (see ticket #10097)
@ -1953,8 +1953,8 @@ void BufferView::dispatch(FuncRequest const & cmd, DispatchResult & dr)
* FIXME: a better fix would be to have a way to set the * 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. * cursor value directly, but I am not sure it is worth it.
*/ */
cur.recordUndo(); curs.recordUndo();
cur.endUndoGroup(); curs.endUndoGroup();
dr.screenUpdate(Update::Force); dr.screenUpdate(Update::Force);
dr.forceBufferUpdate(); dr.forceBufferUpdate();