X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2FBufferView.cpp;h=b46be350b850010964b3c6322381b7dd86cda0ba;hb=cca78e3c8ae27431323746abd64f9d7db017099d;hp=0deb667de4b7d2017b6fd8ca15bb272f64f4c47e;hpb=979f5211a49c0d112d5a04cdc039498e9aa94727;p=lyx.git diff --git a/src/BufferView.cpp b/src/BufferView.cpp index 0deb667de4..b46be350b8 100644 --- a/src/BufferView.cpp +++ b/src/BufferView.cpp @@ -282,7 +282,7 @@ BufferView::BufferView(Buffer & buf) d->cursor_.setCurrentFont(); if (graphics::Previews::status() != LyXRC::PREVIEW_OFF) - graphics::Previews::get().generateBufferPreviews(buffer_); + thePreviews().generateBufferPreviews(buffer_); } @@ -296,7 +296,7 @@ BufferView::~BufferView() LastFilePosSection::FilePos fp; fp.pit = d->cursor_.bottom().pit(); fp.pos = d->cursor_.bottom().pos(); - LyX::ref().session().lastFilePos().save(buffer_.fileName(), fp); + theSession().lastFilePos().save(buffer_.fileName(), fp); delete d; } @@ -659,7 +659,7 @@ void BufferView::saveBookmark(unsigned int idx) // acturately locate a bookmark in a 'live' lyx session. // pit and pos will be updated with bottom level pit/pos // when lyx exits. - LyX::ref().session().bookmarks().save( + theSession().bookmarks().save( buffer_.fileName(), d->cursor_.bottom().pit(), d->cursor_.bottom().pos(), @@ -938,7 +938,7 @@ FuncStatus BufferView::getStatus(FuncRequest const & cmd) break; case LFUN_LAYOUT: - flag.setEnabled(!cur.inset().forceEmptyLayout(cur.idx())); + flag.setEnabled(!cur.inset().forcePlainLayout(cur.idx())); break; case LFUN_LAYOUT_PARAGRAPH: @@ -1072,9 +1072,12 @@ bool BufferView::dispatch(FuncRequest const & cmd) if (!inset || !cur.result().dispatched()) cur.dispatch(cmd); + // FIXME I'm adding the last break to solve a crash, + // but that is obviously not right. if (!cur.result().dispatched()) // It did not work too; no action needed. break; + break; } case LFUN_PARAGRAPH_GOTO: { @@ -1165,6 +1168,8 @@ bool BufferView::dispatch(FuncRequest const & cmd) buffer_.text().cursorBottom(d->cursor_); // accept everything in a single step to support atomic undo buffer_.text().acceptOrRejectChanges(d->cursor_, Text::ACCEPT); + // FIXME: Move this LFUN to Buffer so that we don't have to do this: + processUpdateFlags(Update::Force | Update::FitCursor); break; case LFUN_ALL_CHANGES_REJECT: @@ -1175,6 +1180,8 @@ bool BufferView::dispatch(FuncRequest const & cmd) // reject everything in a single step to support atomic undo // Note: reject does not work recursively; the user may have to repeat the operation buffer_.text().acceptOrRejectChanges(d->cursor_, Text::REJECT); + // FIXME: Move this LFUN to Buffer so that we don't have to do this: + processUpdateFlags(Update::Force | Update::FitCursor); break; case LFUN_WORD_FIND: { @@ -1452,7 +1459,7 @@ bool BufferView::dispatch(FuncRequest const & cmd) InsetIterator it = inset_iterator_begin(inset); InsetIterator const end = inset_iterator_end(inset); for (; it != end; ++it) { - if (!it->asInsetMath() + if (it->asInsetCollapsable() && (inset_code == NO_CODE || inset_code == it->lyxCode())) { Cursor tmpcur = cur; @@ -1476,11 +1483,13 @@ docstring const BufferView::requestSelection() { Cursor & cur = d->cursor_; + LYXERR(Debug::SELECTION, "requestSelection: cur.selection: " << cur.selection()); if (!cur.selection()) { d->xsel_cache_.set = false; return docstring(); } + LYXERR(Debug::SELECTION, "requestSelection: xsel_cache.set: " << d->xsel_cache_.set); if (!d->xsel_cache_.set || cur.top() != d->xsel_cache_.cursor || cur.anchor_.top() != d->xsel_cache_.anchor)