GuiWorkArea::GuiWorkArea(QWidget * /* w */)
: d(new Private(this))
{
+ new CompressorProxy(this); // not a leak
}
// the signal valueChanged. (#10311)
QObject::disconnect(p->verticalScrollBar(), SIGNAL(valueChanged(int)),
p, SLOT(scrollTo(int)));
- ScrollbarParameters const & scroll_ = buffer_view_->scrollbarParameters();
- p->verticalScrollBar()->setRange(scroll_.min, scroll_.max);
- p->verticalScrollBar()->setPageStep(scroll_.page_step);
- p->verticalScrollBar()->setSingleStep(scroll_.single_step);
+ ScrollbarParameters const & scroll = buffer_view_->scrollbarParameters();
+ p->verticalScrollBar()->setRange(scroll.min, scroll.max);
+ p->verticalScrollBar()->setPageStep(scroll.page_step);
+ p->verticalScrollBar()->setSingleStep(scroll.single_step);
p->verticalScrollBar()->setSliderPosition(0);
// Connect to the vertical scroll bar
QObject::connect(p->verticalScrollBar(), SIGNAL(valueChanged(int)),
// CompressorProxy adapted from Kuba Ober https://stackoverflow.com/a/21006207
-CompressorProxy::CompressorProxy(GuiWorkArea * wa) : QObject(wa)
+CompressorProxy::CompressorProxy(GuiWorkArea * wa) : QObject(wa), flag_(false)
{
qRegisterMetaType<KeySymbol>("KeySymbol");
qRegisterMetaType<KeyModifier>("KeyModifier");
void GuiWorkArea::paintEvent(QPaintEvent * ev)
{
+ // Do not trigger the painting machinery if we are not ready (see
+ // bug #10989). The second test triggers when in the middle of a
+ // dispatch operation.
+ if (view().busy() || d->buffer_view_->buffer().undo().activeUndoGroup()) {
+ // Since macOS has turned the screen black at this point, our
+ // backing store has to be copied to screen (this is a no-op
+ // except on macOS).
+ d->updateScreen(ev->rect());
+ ev->accept();
+ return;
+ }
+
// LYXERR(Debug::PAINTING, "paintEvent begin: x: " << rc.x()
// << " y: " << rc.y() << " w: " << rc.width() << " h: " << rc.height());
// insert the processed text in the document (handles undo)
if (!e->commitString().isEmpty()) {
- d->buffer_view_->cursor().beginUndoGroup();
- d->buffer_view_->cursor().insert(qstring_to_ucs4(e->commitString()));
+ FuncRequest cmd(LFUN_SELF_INSERT,
+ qstring_to_ucs4(e->commitString()),
+ FuncRequest::KEYBOARD);
+ dispatch(cmd);
+ // FIXME: this is supposed to remove traces from preedit
+ // string. Can we avoid calling it explicitely?
d->buffer_view_->updateMetrics();
- d->buffer_view_->cursor().endUndoGroup();
- viewport()->update();
}
// Hide the caret during the test transformation.