return img_name;
}
-} // namespace anon
+} // namespace
QString themeIconName(QString const & action)
if (getPixmap(pixmap, fpath)) {
return pixmap;
}
-
+
QStringList exts = ext.split(",");
fpath = ":/" + path + name + ".";
for (int i = 0; i < exts.size(); ++i) {
if (current_view_ && current_view_->currentBufferView()) {
current_view_->currentBufferView()->cursor().saveBeforeDispatchPosXY();
buffer = ¤t_view_->currentBufferView()->buffer();
- if (buffer)
- buffer->undo().beginUndoGroup();
}
DispatchResult dr;
+ dr.screenUpdate(Update::FitCursor);
+ {
+ // This handles undo groups automagically
+ UndoGroupHelper ugh(buffer);
+ dispatch(cmd, dr);
+ }
+
// redraw the screen at the end (first of the two drawing steps).
// This is done unless explicitly requested otherwise
- dr.screenUpdate(Update::FitCursor);
- 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;
}
current_view_->message(bformat(_("Opening help file %1$s..."),
makeDisplayPath(fname.absFileName())));
Buffer * buf = current_view_->loadDocument(fname, false);
-
-#ifndef DEVEL_VERSION
if (buf)
- buf->setReadonly(true);
-#else
- (void) buf;
-#endif
+ buf->setReadonly(!current_view_->develMode());
break;
}
dr.setMessage(bformat(_("Cannot iterate more than %1$d times"), max_iter));
dr.setError(true);
} else {
- for (int i = 0; i < count; ++i)
- dispatch(lyxaction.lookupFunc(rest));
+ for (int i = 0; i < count; ++i) {
+ FuncRequest lfun = lyxaction.lookupFunc(rest);
+ lfun.allowAsync(false);
+ dispatch(lfun);
+ }
}
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, ';');
FuncRequest func(lyxaction.lookupFunc(first));
+ func.allowAsync(false);
func.setOrigin(cmd.origin());
dispatch(func);
}
- // the buffer may have been closed by one action
- if (theBufferList().isLoaded(buffer))
- buffer->undo().endUndoGroup();
break;
}
if (current_view_ == 0)
createView();
}
- // fall through
}
-
+ // fall through
default:
// The LFUN must be for one of GuiView, BufferView, Buffer or Cursor;
// let's try that:
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);
}
}
const QFontInfo fi(font);
return fi.fixedPitch();
}
-}
+} // namespace
QFont const GuiApplication::typewriterSystemFont()
#endif
// In release mode, try to exit gracefully.
this->exit(1);
-
+ // FIXME: GCC 7 thinks we can fall through here. Can we?
+ // fall through
case BufferException: {
if (!current_view_ || !current_view_->documentBufferView())
return false;