if (current_view_ && current_view_->currentBufferView()) {
current_view_->currentBufferView()->cursor().saveBeforeDispatchPosXY();
buffer = ¤t_view_->currentBufferView()->buffer();
- if (buffer)
- buffer->undo().beginUndoGroup();
}
+ // This handles undo groups automagically
+ UndoGroupHelper ugh(buffer);
DispatchResult dr;
// redraw the screen at the end (first of the two drawing steps).
dispatch(cmd, dr);
updateCurrentView(cmd, dr);
- // the buffer may have been closed by one action
- if (theBufferList().isLoaded(buffer))
- buffer->undo().endUndoGroup();
-
d->dispatch_result_ = dr;
return d->dispatch_result_;
}
theSelection().haveSelection(bv->cursor().selection());
// update gui
- current_view_->restartCursor();
+ current_view_->restartCaret();
}
if (dr.needMessageUpdate()) {
// Some messages may already be translated, so we cannot use _()
case LFUN_SCREEN_FONT_UPDATE: {
// handle the screen font changes.
d->font_loader_.update();
- // Backup current_view_
- GuiView * view = current_view_;
- // Set current_view_ to zero to forbid GuiWorkArea::redraw()
- // to skip the refresh.
- current_view_ = 0;
- theBufferList().changed(false);
- // Restore current_view_
- current_view_ = view;
+ dr.screenUpdate(Update::Force | Update::FitCursor);
break;
}
// FIXME: this LFUN should also work without any view.
Buffer * buffer = (current_view_ && current_view_->documentBufferView())
? &(current_view_->documentBufferView()->buffer()) : 0;
- if (buffer)
- buffer->undo().beginUndoGroup();
+ // This handles undo groups automagically
+ UndoGroupHelper ugh(buffer);
while (!arg.empty()) {
string first;
arg = split(arg, first, ';');
func.setOrigin(cmd.origin());
dispatch(func);
}
- // the buffer may have been closed by one action
- if (theBufferList().isLoaded(buffer))
- buffer->undo().endUndoGroup();
break;
}
if (!keysym.isOK())
LYXERR(Debug::KEY, "Empty kbd action (probably composing)");
if (current_view_)
- current_view_->restartCursor();
+ current_view_->restartCaret();
return;
}
if (!isPrintable(encoded_last_key)) {
LYXERR(Debug::KEY, "Non-printable character! Omitting.");
if (current_view_)
- current_view_->restartCursor();
+ current_view_->restartCaret();
return;
}
// The following modifier check is not needed on Mac.
{
if (current_view_) {
current_view_->message(_("Unknown function."));
- current_view_->restartCursor();
+ current_view_->restartCaret();
}
return;
}
LYXERR(Debug::KEY, "Unknown Action and not isText() -- giving up");
if (current_view_) {
current_view_->message(_("Unknown function."));
- current_view_->restartCursor();
+ current_view_->restartCaret();
}
return;
}
void GuiApplication::processFuncRequestQueue()
{
while (!d->func_request_queue_.empty()) {
- processFuncRequest(d->func_request_queue_.front());
+ // take the item from the stack _before_ processing the
+ // request in order to avoid race conditions from nested
+ // or parallel requests (see #10406)
+ FuncRequest const fr(d->func_request_queue_.front());
d->func_request_queue_.pop();
+ processFuncRequest(fr);
}
}