// 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;
}
void LyXText::acceptChange()
{
- if (!selection.set() && cursorPar()->size())
+ if (!bv()->selection().set() && cursorPar()->size())
return;
if (selStart().par() == selEnd().par()) {
void LyXText::rejectChange()
{
- if (!selection.set() && cursorPar()->size())
+ if (!bv()->selection().set() && cursorPar()->size())
return;
if (selStart().par() == selEnd().par()) {
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();
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();
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);
CursorSlice from;
CursorSlice to;
- if (selection.set()) {
+ if (bv()->selection().set()) {
from = selStart();
to = selEnd();
} else {
string LyXText::selectionAsString(Buffer const & buffer, bool label) const
{
- if (!selection.set())
+ if (!bv()->selection().set())
return string();
// should be 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();
CursorSlice const & LyXText::selEnd() const
{
- if (!selection.set())
+ if (!bv()->selection().set())
return cursor();
return anchor() > cursor() ? anchor() : cursor();
}
CursorSlice & LyXText::selStart()
{
- if (!selection.set())
+ if (!bv()->selection().set())
return cursor();
return anchor() < cursor() ? anchor() : cursor();
}
CursorSlice & LyXText::selEnd()
{
- if (!selection.set())
+ if (!bv()->selection().set())
return cursor();
return anchor() > cursor() ? anchor() : cursor();
}
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())