diff --git a/src/BufferView.C b/src/BufferView.C index d75d6c1960..92680d41ef 100644 --- a/src/BufferView.C +++ b/src/BufferView.C @@ -478,6 +478,18 @@ CursorSlice const & BufferView::anchor() const } +Selection & BufferView::selection() +{ + return selection_; +} + + +Selection const & BufferView::selection() const +{ + return selection_; +} + + void BufferView::x_target(int x) { x_target_ = x; diff --git a/src/BufferView.h b/src/BufferView.h index 8781866c5e..d2d55a7b79 100644 --- a/src/BufferView.h +++ b/src/BufferView.h @@ -32,10 +32,33 @@ class LyXText; class LyXScreen; class LyXView; class Painter; +class Selection; class TeXErrors; class UpdatableInset; +// The structure that keeps track of the selections set. +struct Selection { + Selection() + : set_(false), mark_(false) + {} + bool set() const { + return set_; + } + void set(bool s) { + set_ = s; + } + bool mark() const { + return mark_; + } + void mark(bool m) { + mark_ = m; + } +private: + bool set_; // former selection + bool mark_; // former mark_set +}; + /** * A buffer view encapsulates a view onto a particular * buffer, and allows access to operate upon it. A view @@ -206,6 +229,13 @@ public: LyXText * text() const; /// void resetAnchor(); + /// + Selection & selection(); + /// + Selection const & selection() const; + + /// + Selection selection_; private: /// diff --git a/src/BufferView_pimpl.C b/src/BufferView_pimpl.C index 59f74f27d3..8b9556bb5f 100644 --- a/src/BufferView_pimpl.C +++ b/src/BufferView_pimpl.C @@ -381,7 +381,7 @@ void BufferView::Pimpl::resizeCurrentBuffer() pos_type pos = 0; pos_type selstartpos = 0; pos_type selendpos = 0; - bool selection = false; + bool sel = false; bool mark_set = false; owner_->busy(true); @@ -399,18 +399,18 @@ void BufferView::Pimpl::resizeCurrentBuffer() selstartpos = text->selStart().pos(); selendpar = text->selEnd().par(); selendpos = text->selEnd().pos(); - selection = text->selection.set(); - mark_set = text->selection.mark(); + sel = bv_->selection().set(); + mark_set = bv_->selection().mark(); text->textwidth_ = bv_->workWidth(); text->fullRebreak(); update(); if (par != -1) { - text->selection.set(true); + bv_->selection().set(true); // At this point just to avoid the Delete-Empty-Paragraph- // Mechanism when setting the cursor. - text->selection.mark(mark_set); - if (selection) { + bv_->selection().mark(mark_set); + if (sel) { text->setCursor(selstartpar, selstartpos); bv_->resetAnchor(); text->setCursor(selendpar, selendpos); @@ -419,7 +419,7 @@ void BufferView::Pimpl::resizeCurrentBuffer() } else { text->setCursor(par, pos); bv_->resetAnchor(); - text->selection.set(false); + bv_->selection().set(false); } } @@ -531,7 +531,7 @@ void BufferView::Pimpl::selectionRequested() LyXText * text = bv_->getLyXText(); - if (!text->selection.set()) { + if (!bv_->selection().set()) { xsel_cache_.set = false; return; } @@ -542,7 +542,7 @@ void BufferView::Pimpl::selectionRequested() { xsel_cache_.cursor = bv_->cursor(); xsel_cache_.anchor = bv_->anchor(); - xsel_cache_.set = text->selection.set(); + xsel_cache_.set = bv_->selection().set(); sel = text->selectionAsString(*bv_->buffer(), false); if (!sel.empty()) workarea().putClipboard(sel); @@ -634,7 +634,7 @@ Change const BufferView::Pimpl::getCurrentChange() LyXText * text = bv_->getLyXText(); - if (!text->selection.set()) + if (!bv_->selection().set()) return Change(Change::UNCHANGED); return text->getPar(text->selStart()) diff --git a/src/bufferview_funcs.C b/src/bufferview_funcs.C index 13383258d6..93c26024dc 100644 --- a/src/bufferview_funcs.C +++ b/src/bufferview_funcs.C @@ -256,11 +256,10 @@ string const currentState(BufferView * bv) } - // deletes a selection during an insertion void replaceSelection(LyXText * text) { - if (text->selection.set()) { + if (text->bv()->selection().set()) { text->cutSelection(true, false); text->bv()->update(); } diff --git a/src/insets/insettext.C b/src/insets/insettext.C index 065c68a672..f1eedec9e6 100644 --- a/src/insets/insettext.C +++ b/src/insets/insettext.C @@ -235,15 +235,15 @@ void InsetText::updateLocal(BufferView * bv) if (!autoBreakRows_ && paragraphs().size() > 1) collapseParagraphs(bv); - if (!text_.selection.set()) - text_.anchor() = text_.cursor(); + if (!bv->selection().set()) + bv->resetAnchor(); bv->owner()->view_state_changed(); bv->owner()->updateMenubar(); bv->owner()->updateToolbar(); - if (old_par != text_.cursor().par()) { + if (old_par != bv->cursor().par()) { bv->owner()->setLayout(text_.cursorPar()->layout()->name()); - old_par = text_.cursor().par(); + old_par = bv->cursor().par(); } } diff --git a/src/lyxfunc.C b/src/lyxfunc.C index cb4485b587..4b040eb805 100644 --- a/src/lyxfunc.C +++ b/src/lyxfunc.C @@ -344,7 +344,7 @@ FuncStatus LyXFunc::getStatus(FuncRequest const & ev) const if (tab && tab->hasSelection()) disable = false; else - disable = !mathcursor && !view()->getLyXText()->selection.set(); + disable = !mathcursor && !view()->selection().set(); break; case LFUN_RUNCHKTEX: diff --git a/src/lyxtext.h b/src/lyxtext.h index e652eb8efc..b301d0f91d 100644 --- a/src/lyxtext.h +++ b/src/lyxtext.h @@ -41,29 +41,6 @@ class UpdatableInset; class VSpace; -// The structure that keeps track of the selections set. -struct Selection { - Selection() - : set_(false), mark_(false) - {} - bool set() const { - return set_; - } - void set(bool s) { - set_ = s; - } - bool mark() const { - return mark_; - } - void mark(bool m) { - mark_ = m; - } -private: - bool set_; // former selection - bool mark_; // former mark_set -}; - - /// This class encapsulates the main text data and operations in LyX class LyXText { public: @@ -433,33 +410,16 @@ public: /// void clearSelection(); /// - CursorSlice const & selStart() const; - /// - CursorSlice const & selEnd() const; - /// CursorSlice & selStart(); /// + CursorSlice const & selStart() const; + /// CursorSlice & selEnd(); + /// + CursorSlice const & selEnd() const; public: -/** The cursor. - Later this variable has to be removed. There should be no internal - cursor in a text (and thus not in a buffer). By keeping this it is - (I think) impossible to have several views with the same buffer, but - the cursor placed at different places. - [later] - Since the LyXText now has been moved from Buffer to BufferView - it should not be absolutely needed to move the cursor... - [even later] - Nevertheless, it should still be moved, in order to keep classes - and interdependencies small. - */ - // the other end of the selection - CursorSlice anchor_; - // - Selection selection; - /// int height; /// diff --git a/src/rowpainter.C b/src/rowpainter.C index 12b40d365a..5e49460f44 100644 --- a/src/rowpainter.C +++ b/src/rowpainter.C @@ -132,7 +132,7 @@ RowPainter::RowPainter(BufferView const & bv, LyXText const & text, paintBackground(); // paint the selection background - if (text_.selection.set() && &text_ == bv_.fullCursor().innerText()) + if (bv_.selection().set() && &text_ == bv_.fullCursor().innerText()) paintSelection(); // vertical lines for appendix diff --git a/src/text.C b/src/text.C index 4ac22948e3..d8ab74fca4 100644 --- a/src/text.C +++ b/src/text.C @@ -1114,9 +1114,9 @@ void LyXText::selectWord(word_location loc) // selection is currently set bool LyXText::selectWordWhenUnderCursor(word_location loc) { - if (!selection.set()) { + if (!bv()->selection().set()) { selectWord(loc); - return selection.set(); + return bv()->selection().set(); } return false; } @@ -1124,7 +1124,7 @@ bool LyXText::selectWordWhenUnderCursor(word_location loc) void LyXText::acceptChange() { - if (!selection.set() && cursorPar()->size()) + if (!bv()->selection().set() && cursorPar()->size()) return; if (selStart().par() == selEnd().par()) { @@ -1143,7 +1143,7 @@ void LyXText::acceptChange() void LyXText::rejectChange() { - if (!selection.set() && cursorPar()->size()) + if (!bv()->selection().set() && cursorPar()->size()) return; if (selStart().par() == selEnd().par()) { @@ -1167,7 +1167,7 @@ void LyXText::deleteWordForward() cursorRight(bv()); else { CursorSlice tmpcursor = cursor(); - selection.set(true); // to avoid deletion + bv()->selection().set(true); // to avoid deletion cursorRightOneWord(); setCursor(tmpcursor, tmpcursor.par(), tmpcursor.pos()); bv()->resetAnchor(); @@ -1185,7 +1185,7 @@ void LyXText::deleteWordBackward() cursorLeft(bv()); else { CursorSlice tmpcursor = cursor(); - selection.set(true); // to avoid deletion + bv()->selection().set(true); // to avoid deletion cursorLeftOneWord(); setCursor(tmpcursor, tmpcursor.par(), tmpcursor.pos()); bv()->resetAnchor(); @@ -1204,14 +1204,14 @@ void LyXText::deleteLineForward() cursorRight(bv()); } else { CursorSlice tmpcursor = cursor(); - selection.set(true); // to avoid deletion + bv()->selection().set(true); // to avoid deletion cursorEnd(); setCursor(tmpcursor, tmpcursor.par(), tmpcursor.pos()); bv()->resetAnchor(); cursor() = tmpcursor; setSelection(); // What is this test for ??? (JMarc) - if (!selection.set()) + if (!bv()->selection().set()) deleteWordForward(); else cutSelection(true, false); @@ -1224,7 +1224,7 @@ void LyXText::changeCase(LyXText::TextCase action) CursorSlice from; CursorSlice to; - if (selection.set()) { + if (bv()->selection().set()) { from = selStart(); to = selEnd(); } else { @@ -1507,7 +1507,7 @@ void LyXText::previousRow(ParagraphList::iterator & pit, string LyXText::selectionAsString(Buffer const & buffer, bool label) const { - if (!selection.set()) + if (!bv()->selection().set()) return string(); // should be const ... @@ -1961,7 +1961,7 @@ CursorSlice const & LyXText::anchor() const CursorSlice const & LyXText::selStart() const { - if (!selection.set()) + if (!bv()->selection().set()) return cursor(); // can't use std::min as this creates a new object return anchor() < cursor() ? anchor() : cursor(); @@ -1970,7 +1970,7 @@ CursorSlice const & LyXText::selStart() const CursorSlice const & LyXText::selEnd() const { - if (!selection.set()) + if (!bv()->selection().set()) return cursor(); return anchor() > cursor() ? anchor() : cursor(); } @@ -1978,7 +1978,7 @@ CursorSlice const & LyXText::selEnd() const CursorSlice & LyXText::selStart() { - if (!selection.set()) + if (!bv()->selection().set()) return cursor(); return anchor() < cursor() ? anchor() : cursor(); } @@ -1986,7 +1986,7 @@ CursorSlice & LyXText::selStart() CursorSlice & LyXText::selEnd() { - if (!selection.set()) + if (!bv()->selection().set()) return cursor(); return anchor() > cursor() ? anchor() : cursor(); } @@ -1994,17 +1994,17 @@ CursorSlice & LyXText::selEnd() void LyXText::setSelection() { - selection.set(true); + bv()->selection().set(true); // a selection with no contents is not a selection if (cursor().par() == anchor().par() && cursor().pos() == anchor().pos()) - selection.set(false); + bv()->selection().set(false); } void LyXText::clearSelection() { - selection.set(false); - selection.mark(false); + bv()->selection().set(false); + bv()->selection().mark(false); bv()->resetAnchor(); // reset this in the bv()! if (bv() && bv()->text()) diff --git a/src/text2.C b/src/text2.C index 811ca906ee..5745a389cb 100644 --- a/src/text2.C +++ b/src/text2.C @@ -349,7 +349,7 @@ void getSelectionSpan(LyXText & text, ParagraphList::iterator & beg, ParagraphList::iterator & end) { - if (!text.selection.set()) { + if (!text.bv()->selection().set()) { beg = text.cursorPar(); end = boost::next(beg); } else { @@ -425,7 +425,7 @@ void LyXText::changeDepth(bv_funcs::DEPTH_CHANGE type) void LyXText::setFont(LyXFont const & font, bool toggleall) { // if there is no selection just set the current_font - if (!selection.set()) { + if (!bv()->selection().set()) { // Determine basis font LyXFont layoutfont; if (cursor().pos() < cursorPar()->beginOfBody()) @@ -547,7 +547,7 @@ string LyXText::getStringToIndex() selectWordWhenUnderCursor(lyx::PREVIOUS_WORD); string idxstring; - if (!selection.set()) + if (!bv()->selection().set()) bv()->owner()->message(_("Nothing to index!")); else if (selStart().par() != selEnd().par()) bv()->owner()->message(_("Cannot index more than one paragraph!")); @@ -929,7 +929,7 @@ void LyXText::cutSelection(bool doclear, bool realcut) bv()->stuffClipboard(selectionAsString(*bv()->buffer(), true)); // This doesn't make sense, if there is no selection - if (!selection.set()) + if (!bv()->selection().set()) return; // OK, we have a selection. This is always between selStart() @@ -979,7 +979,7 @@ void LyXText::copySelection() bv()->stuffClipboard(selectionAsString(*bv()->buffer(), true)); // this doesnt make sense, if there is no selection - if (!selection.set()) + if (!bv()->selection().set()) return; // ok we have a selection. This is always between selStart() @@ -1563,7 +1563,7 @@ void LyXText::fixCursorAfterDelete(CursorSlice & cur, CursorSlice const & where) bool LyXText::deleteEmptyParagraphMechanism(CursorSlice const & old_cursor) { // Would be wrong to delete anything if we have a selection. - if (selection.set()) + if (bv()->selection().set()) return false; // Don't do anything if the cursor is invalid diff --git a/src/text3.C b/src/text3.C index 61fb2b28b2..e48cb3acaa 100644 --- a/src/text3.C +++ b/src/text3.C @@ -217,13 +217,10 @@ namespace { { LyXText * lt = bv->getLyXText(); -// if (!lt->selection.set()) -// lt->selection.cursor = lt->cursor(); - - if (selecting || lt->selection.mark()) + if (selecting || bv->selection().mark()) lt->setSelection(); - if (!lt->selection.set()) + if (!bv->selection().set()) bv->haveSelection(false); bv->switchKeyMap(); } @@ -414,8 +411,7 @@ void specialChar(LyXText * lt, BufferView * bv, InsetSpecialChar::Kind kind) } -void doInsertInset(LyXText const & lt, FuncRequest const & cmd, - bool edit, bool pastesel) +void doInsertInset(FuncRequest const & cmd, bool edit, bool pastesel) { InsetOld * inset = createInset(cmd); if (!inset) @@ -424,7 +420,7 @@ void doInsertInset(LyXText const & lt, FuncRequest const & cmd, BufferView * bv = cmd.view(); bool gotsel = false; - if (lt.selection.set()) { + if (bv->selection().set()) { bv->owner()->dispatch(FuncRequest(LFUN_CUT)); gotsel = true; } @@ -508,7 +504,7 @@ DispatchResult LyXText::dispatch(FuncRequest const & cmd) break; case LFUN_WORDRIGHT: - if (!selection.mark()) + if (!bv->selection().mark()) clearSelection(); if (rtl()) cursorLeftOneWord(); @@ -518,7 +514,7 @@ DispatchResult LyXText::dispatch(FuncRequest const & cmd) break; case LFUN_WORDLEFT: - if (!selection.mark()) + if (!bv->selection().mark()) clearSelection(); if (rtl()) cursorRightOneWord(); @@ -528,21 +524,21 @@ DispatchResult LyXText::dispatch(FuncRequest const & cmd) break; case LFUN_BEGINNINGBUF: - if (!selection.mark()) + if (!bv->selection().mark()) clearSelection(); cursorTop(); finishChange(bv); break; case LFUN_ENDBUF: - if (selection.mark()) + if (bv->selection().mark()) clearSelection(); cursorBottom(); finishChange(bv); break; case LFUN_RIGHTSEL: - if (!selection.set()) + if (!bv->selection().set()) bv->resetAnchor(); if (rtl()) cursorLeft(bv); @@ -552,7 +548,7 @@ DispatchResult LyXText::dispatch(FuncRequest const & cmd) break; case LFUN_LEFTSEL: - if (!selection.set()) + if (!bv->selection().set()) bv->resetAnchor(); if (rtl()) cursorRight(bv); @@ -562,63 +558,63 @@ DispatchResult LyXText::dispatch(FuncRequest const & cmd) break; case LFUN_UPSEL: - if (!selection.set()) + if (!bv->selection().set()) bv->resetAnchor(); cursorUp(true); finishChange(bv, true); break; case LFUN_DOWNSEL: - if (!selection.set()) + if (!bv->selection().set()) bv->resetAnchor(); cursorDown(true); finishChange(bv, true); break; case LFUN_UP_PARAGRAPHSEL: - if (!selection.set()) + if (!bv->selection().set()) bv->resetAnchor(); cursorUpParagraph(); finishChange(bv, true); break; case LFUN_DOWN_PARAGRAPHSEL: - if (!selection.set()) + if (!bv->selection().set()) bv->resetAnchor(); cursorDownParagraph(); finishChange(bv, true); break; case LFUN_PRIORSEL: - if (!selection.set()) + if (!bv->selection().set()) bv->resetAnchor(); cursorPrevious(); finishChange(bv, true); break; case LFUN_NEXTSEL: - if (!selection.set()) + if (!bv->selection().set()) bv->resetAnchor(); cursorNext(); finishChange(bv, true); break; case LFUN_HOMESEL: - if (!selection.set()) + if (!bv->selection().set()) bv->resetAnchor(); cursorHome(); finishChange(bv, true); break; case LFUN_ENDSEL: - if (!selection.set()) + if (!bv->selection().set()) bv->resetAnchor(); cursorEnd(); finishChange(bv, true); break; case LFUN_WORDRIGHTSEL: - if (!selection.set()) + if (!bv->selection().set()) bv->resetAnchor(); if (rtl()) cursorLeftOneWord(); @@ -628,7 +624,7 @@ DispatchResult LyXText::dispatch(FuncRequest const & cmd) break; case LFUN_WORDLEFTSEL: - if (!selection.set()) + if (!bv->selection().set()) bv->resetAnchor(); if (rtl()) cursorRightOneWord(); @@ -660,21 +656,21 @@ DispatchResult LyXText::dispatch(FuncRequest const & cmd) return moveDown(); case LFUN_UP_PARAGRAPH: - if (!selection.mark()) + if (!bv->selection().mark()) clearSelection(); cursorUpParagraph(); finishChange(bv); break; case LFUN_DOWN_PARAGRAPH: - if (!selection.mark()) + if (!bv->selection().mark()) clearSelection(); cursorDownParagraph(); finishChange(bv, false); break; case LFUN_PRIOR: - if (!selection.mark()) + if (!bv->selection().mark()) clearSelection(); finishChange(bv, false); if (cursorPar() == firstPar() && cursorRow() == firstRow()) @@ -683,7 +679,7 @@ DispatchResult LyXText::dispatch(FuncRequest const & cmd) break; case LFUN_NEXT: - if (!selection.mark()) + if (!bv->selection().mark()) clearSelection(); finishChange(bv, false); if (cursorPar() == lastPar() && cursorRow() == lastRow()) @@ -692,14 +688,14 @@ DispatchResult LyXText::dispatch(FuncRequest const & cmd) break; case LFUN_HOME: - if (!selection.mark()) + if (!bv->selection().mark()) clearSelection(); cursorHome(); finishChange(bv, false); break; case LFUN_END: - if (!selection.mark()) + if (!bv->selection().mark()) clearSelection(); cursorEnd(); finishChange(bv, false); @@ -719,7 +715,7 @@ DispatchResult LyXText::dispatch(FuncRequest const & cmd) } case LFUN_DELETE: - if (!selection.set()) { + if (!bv->selection().set()) { Delete(); bv->resetAnchor(); // It is possible to make it a lot faster still @@ -733,7 +729,7 @@ DispatchResult LyXText::dispatch(FuncRequest const & cmd) case LFUN_DELETE_SKIP: // Reverse the effect of LFUN_BREAKPARAGRAPH_SKIP. - if (!selection.set()) { + if (!bv->selection().set()) { if (cursor().pos() == cursorPar()->size()) { cursorRight(bv); cursorLeft(bv); @@ -751,7 +747,7 @@ DispatchResult LyXText::dispatch(FuncRequest const & cmd) case LFUN_BACKSPACE: - if (!selection.set()) { + if (!bv->selection().set()) { if (bv->owner()->getIntl().getTransManager().backspace()) { backspace(); bv->resetAnchor(); @@ -768,7 +764,7 @@ DispatchResult LyXText::dispatch(FuncRequest const & cmd) case LFUN_BACKSPACE_SKIP: // Reverse the effect of LFUN_BREAKPARAGRAPH_SKIP. - if (!selection.set()) { + if (!bv->selection().set()) { CursorSlice cur = cursor(); backspace(); anchor() = cur; @@ -896,7 +892,7 @@ DispatchResult LyXText::dispatch(FuncRequest const & cmd) if (cursorPar()->layout()->free_spacing) insertChar(' '); else - doInsertInset(*this, cmd, false, false); + doInsertInset(cmd, false, false); moveCursor(bv, false); break; @@ -929,7 +925,7 @@ DispatchResult LyXText::dispatch(FuncRequest const & cmd) case LFUN_MARK_ON: clearSelection(); - selection.mark(true); + bv->selection().mark(true); bv->update(); bv->resetAnchor(); cmd.message(N_("Mark on")); @@ -937,10 +933,10 @@ DispatchResult LyXText::dispatch(FuncRequest const & cmd) case LFUN_SETMARK: clearSelection(); - if (selection.mark()) { + if (bv->selection().mark()) { cmd.message(N_("Mark removed")); } else { - selection.mark(true); + bv->selection().mark(true); cmd.message(N_("Mark set")); } bv->resetAnchor(); @@ -996,7 +992,7 @@ DispatchResult LyXText::dispatch(FuncRequest const & cmd) case LFUN_BEGINNINGBUFSEL: if (in_inset_) return DispatchResult(false); - if (!selection.set()) + if (!bv->selection().set()) bv->resetAnchor(); cursorTop(); finishChange(bv, true); @@ -1005,7 +1001,7 @@ DispatchResult LyXText::dispatch(FuncRequest const & cmd) case LFUN_ENDBUFSEL: if (in_inset_) return DispatchResult(false); - if (!selection.set()) + if (!bv->selection().set()) bv->resetAnchor(); cursorBottom(); finishChange(bv, true); @@ -1076,7 +1072,7 @@ DispatchResult LyXText::dispatch(FuncRequest const & cmd) bool change_layout = (current_layout != layout); - if (!change_layout && selection.set() && + if (!change_layout && bv->selection().set() && selStart().par() != selEnd().par()) { ParagraphList::iterator spit = getPar(selStart()); @@ -1184,7 +1180,7 @@ DispatchResult LyXText::dispatch(FuncRequest const & cmd) bv->resetAnchor(); cursorEnd(); setSelection(); - bv->haveSelection(selection.set()); + bv->haveSelection(bv->selection().set()); } break; @@ -1194,7 +1190,7 @@ DispatchResult LyXText::dispatch(FuncRequest const & cmd) if (cmd.button() == mouse_button::button1) { selection_possible = true; selectWord(lyx::WHOLE_WORD_STRICT); - bv->haveSelection(selection.set()); + bv->haveSelection(bv->selection().set()); } break; @@ -1252,7 +1248,7 @@ DispatchResult LyXText::dispatch(FuncRequest const & cmd) // it could get cleared on the unlocking of the inset so // we have to check this first bool paste_internally = false; - if (cmd.button() == mouse_button::button2 && selection.set()) { + if (cmd.button() == mouse_button::button2 && bv->selection().set()) { bv->owner()->dispatch(FuncRequest(LFUN_COPY)); paste_internally = true; } @@ -1305,7 +1301,7 @@ DispatchResult LyXText::dispatch(FuncRequest const & cmd) // finish selection if (cmd.button() == mouse_button::button1) - bv->haveSelection(selection.set()); + bv->haveSelection(bv->selection().set()); bv->switchKeyMap(); bv->owner()->view_state_changed(); @@ -1325,7 +1321,7 @@ DispatchResult LyXText::dispatch(FuncRequest const & cmd) // true (on). if (lyxrc.auto_region_delete) { - if (selection.set()) + if (bv->selection().set()) cutSelection(false, false); bv->haveSelection(false); } @@ -1393,12 +1389,12 @@ DispatchResult LyXText::dispatch(FuncRequest const & cmd) case LFUN_ENVIRONMENT_INSERT: // Open the inset, and move the current selection // inside it. - doInsertInset(*this, cmd, true, true); + doInsertInset(cmd, true, true); break; case LFUN_INDEX_INSERT: // Just open the inset - doInsertInset(*this, cmd, true, false); + doInsertInset(cmd, true, false); break; case LFUN_INDEX_PRINT: @@ -1407,7 +1403,7 @@ DispatchResult LyXText::dispatch(FuncRequest const & cmd) case LFUN_INSERT_LINE: case LFUN_INSERT_PAGEBREAK: // do nothing fancy - doInsertInset(*this, cmd, false, false); + doInsertInset(cmd, false, false); break; case LFUN_DEPTH_MIN: