text()->setCursor(
std::distance(text()->paragraphs().begin(), it.getPar()),
it.getPos());
- text()->anchor() = text()->cursor();
+ resetAnchor();
update();
return;
}
UpdatableInset * BufferView::innerInset() const
{
- return static_cast<UpdatableInset*>(cursor().innerInset());
+ return static_cast<UpdatableInset*>(fullCursor().innerInset());
}
LyXText * BufferView::getLyXText() const
{
- return cursor().innerText();
+ return fullCursor().innerText();
}
}
-LCursor & BufferView::cursor()
+void BufferView::fullCursor(LCursor const & cur)
+{
+ pimpl_->cursor_ = cur;
+}
+
+
+LCursor & BufferView::fullCursor()
{
return pimpl_->cursor_;
}
-LCursor const & BufferView::cursor() const
+LCursor const & BufferView::fullCursor() const
{
return pimpl_->cursor_;
}
+CursorSlice & BufferView::cursor()
+{
+ return fullCursor().cursor_.back();
+}
+
+
+CursorSlice const & BufferView::cursor() const
+{
+ return fullCursor().cursor_.back();
+}
+
+
+CursorSlice & BufferView::anchor()
+{
+ return fullCursor().anchor_.back();
+}
+
+
+CursorSlice const & BufferView::anchor() const
+{
+ return fullCursor().anchor_.back();
+}
+
+
void BufferView::x_target(int x)
{
x_target_ = x;
{
return pimpl_->buffer_ ? &pimpl_->buffer_->text() : 0;
}
+
+
+void BufferView::resetAnchor()
+{
+ return fullCursor().resetAnchor();
+}
class Buffer;
class Change;
+class CursorSlice;
class Encoding;
class ErrorList;
class FuncRequest;
/// clear the X selection
void unsetXSel();
- /// access to cursor
- LCursor & cursor();
- /// access to cursor
- LCursor const & cursor() const;
+ /// access to full cursor
+ LCursor & fullCursor();
+ /// access to full cursor
+ void fullCursor(LCursor const &);
+ /// access to full cursor
+ LCursor const & fullCursor() const;
+ /// access to topmost cursor slice
+ CursorSlice & cursor();
+ /// access to topmost cursor slice
+ CursorSlice const & cursor() const;
+ /// access to selection anchor
+ CursorSlice & anchor();
+ /// access to selection anchor
+ CursorSlice const & anchor() const;
///
UpdatableInset * innerInset() const;
///
LyXText * text() const;
+ ///
+ void resetAnchor();
private:
///
if (!text)
return;
- par = text->cursor().par();
- pos = text->cursor().pos();
+ par = bv_->cursor().par();
+ pos = bv_->cursor().pos();
selstartpar = text->selStart().par();
selstartpos = text->selStart().pos();
selendpar = text->selEnd().par();
text->selection.mark(mark_set);
if (selection) {
text->setCursor(selstartpar, selstartpos);
- text->anchor() = text->cursor();
+ bv_->resetAnchor();
text->setCursor(selendpar, selendpos);
text->setSelection();
text->setCursor(par, pos);
} else {
text->setCursor(par, pos);
- text->anchor() = text->cursor();
+ bv_->resetAnchor();
text->selection.set(false);
}
}
}
if (!xsel_cache_.set ||
- text->cursor() != xsel_cache_.cursor ||
- text->anchor() != xsel_cache_.anchor)
+ bv_->cursor() != xsel_cache_.cursor ||
+ bv_->anchor() != xsel_cache_.anchor)
{
- xsel_cache_.cursor = text->cursor();
- xsel_cache_.anchor = text->anchor();
+ xsel_cache_.cursor = bv_->cursor();
+ xsel_cache_.anchor = bv_->anchor();
xsel_cache_.set = text->selection.set();
sel = text->selectionAsString(*bv_->buffer(), false);
if (!sel.empty())
if (!available())
return false;
FuncRequest cmd1(cmd, bv_);
- UpdatableInset * inset = bv_->cursor().innerInset();
+ UpdatableInset * inset = bv_->fullCursor().innerInset();
DispatchResult res;
if (inset) {
cmd1.x -= inset->x();
res = inset->dispatch(cmd1);
} else {
cmd1.y += bv_->top_y();
- res = bv_->cursor().innerText()->dispatch(cmd1);
+ res = bv_->fullCursor().innerText()->dispatch(cmd1);
}
if (bv_->fitCursor() || res.update()) {
bv_->update();
- bv_->cursor().updatePos();
+ bv_->fullCursor().updatePos();
}
return true;
res = inset->dispatch(cmd2);
if (res.update()) {
bv_->update();
- bv_->cursor().updatePos();
+ bv_->fullCursor().updatePos();
}
res.update(false);
switch (res.val()) {
case FINISHED_UP:
case FINISHED_DOWN:
theTempCursor.pop();
- bv_->cursor() = theTempCursor;
- bv_->cursor().innerText()->setCursorFromCoordinates(cmd.x, top_y() + cmd.y);
+ bv_->fullCursor(theTempCursor);
+ bv_->fullCursor().innerText()
+ ->setCursorFromCoordinates(cmd.x, top_y() + cmd.y);
if (bv_->fitCursor())
bv_->update();
return true;
lyxerr << "dispatching " << cmd1
<< " to surrounding LyXText "
<< theTempCursor.innerText() << endl;
- bv_->cursor() = theTempCursor;
+ bv_->fullCursor(theTempCursor);
cmd1.y += bv_->top_y();
- res = bv_->cursor().innerText()->dispatch(cmd1);
+ res = bv_->fullCursor().innerText()->dispatch(cmd1);
if (bv_->fitCursor() || res.update())
bv_->update();
bv_->text()->setLayout(hasLayout ? lres : tclass.defaultLayoutName());
bv_->text()->setParagraph(Spacing(), LYX_ALIGN_LAYOUT, string(), 0);
}
- bv_->cursor().innerText()->insertInset(inset);
+ bv_->fullCursor().innerText()->insertInset(inset);
unFreezeUndo();
return true;
}
bv->top_y(par.outerPar()->y);
bv->update();
text->setCursor(cur.pit(), cur.pos());
- bv->cursor().updatePos();
+ bv->fullCursor().updatePos();
if (length) {
text->setSelectionRange(length);
using std::endl;
-std::ostream & operator<<(std::ostream & os, LCursor const & cursor)
+std::ostream & operator<<(std::ostream & os, LCursor const & cur)
{
os << "\n";
- for (size_t i = 0, n = cursor.data_.size(); i != n; ++i)
- os << " " << cursor.data_[i] << "\n";
+ for (size_t i = 0, n = cur.cursor_.size(); i != n; ++i)
+ os << " (" << cur.cursor_[i] << " | " << cur.anchor_[i] << "\n";
return os;
}
LCursor::LCursor(BufferView * bv)
- : data_(1), bv_(bv)
+ : cursor_(1), anchor_(1), bv_(bv)
{}
lyxerr << "\nLCursor::dispatch: " << *this << endl;
FuncRequest cmd = cmd0;
- for (int i = data_.size() - 1; i >= 1; --i) {
- CursorSlice const & citem = data_[i];
+ for (int i = cursor_.size() - 1; i >= 1; --i) {
+ CursorSlice const & citem = cursor_[i];
lyxerr << "trying to dispatch to inset " << citem.inset_ << endl;
DispatchResult res = citem.inset_->dispatch(cmd);
if (res.dispatched()) {
void LCursor::push(UpdatableInset * inset)
{
lyxerr << "LCursor::push() inset: " << inset << endl;
- data_.push_back(CursorSlice(inset));
+ cursor_.push_back(CursorSlice(inset));
+ anchor_.push_back(CursorSlice(inset));
updatePos();
}
void LCursor::pop(int depth)
{
lyxerr << "LCursor::pop() to " << depth << endl;
- while (data_.size() > 1 && depth < data_.size()) {
+ while (cursor_.size() > 1 && depth < cursor_.size()) {
lyxerr << "LCursor::pop a level " << endl;
- data_.pop_back();
+ cursor_.pop_back();
+ anchor_.pop_back();
}
}
void LCursor::pop()
{
lyxerr << "LCursor::pop() " << endl;
- //BOOST_ASSERT(!data_.empty());
- if (data_.size() <= 1)
+ //BOOST_ASSERT(!cursor_.empty());
+ if (cursor_.size() <= 1)
lyxerr << "### TRYING TO POP FROM EMPTY CURSOR" << endl;
- else
- data_.pop_back();
+ else {
+ cursor_.pop_back();
+ anchor_.pop_back();
+ }
}
UpdatableInset * LCursor::innerInset() const
{
- return data_.size() <= 1 ? 0 : data_.back().asUpdatableInset();
+ return cursor_.size() <= 1 ? 0 : cursor_.back().asUpdatableInset();
}
LyXText * LCursor::innerText() const
{
- if (data_.size() > 1) {
+ if (cursor_.size() > 1) {
// go up until first non-0 text is hit
// (innermost text is 0 e.g. for mathed and the outer tabular level)
- for (int i = data_.size() - 1; i >= 1; --i)
- if (data_[i].text())
- return data_[i].text();
+ for (int i = cursor_.size() - 1; i >= 1; --i)
+ if (cursor_[i].text())
+ return cursor_[i].text();
}
return bv_->text();
}
void LCursor::updatePos()
{
- if (data_.size() > 1)
+ if (cursor_.size() > 1)
cached_y_ = bv_->top_y() + innerInset()->y();
}
void LCursor::getPos(int & x, int & y) const
{
- if (data_.size() <= 1) {
+ if (cursor_.size() <= 1) {
x = bv_->text()->cursorX();
y = bv_->text()->cursorY();
// y -= bv_->top_y();
// inset->draw() is not called: this doesn't update
// inset.top_baseline, so getCursor() returns an old value.
// Ugly as you like.
- inset->getCursorPos(data_.back().idx_, x, y);
+ inset->getCursorPos(cursor_.back().idx_, x, y);
x += inset->x();
y += cached_y_;
}
UpdatableInset * LCursor::innerInsetOfType(int code) const
{
- for (int i = data_.size() - 1; i >= 1; --i)
- if (data_[i].asUpdatableInset()->lyxCode() == code)
- return data_[i].asUpdatableInset();
+ for (int i = cursor_.size() - 1; i >= 1; --i)
+ if (cursor_[i].asUpdatableInset()->lyxCode() == code)
+ return cursor_[i].asUpdatableInset();
return 0;
}
void LCursor::cell(int idx)
{
- BOOST_ASSERT(!data_.empty());
- data_.back().idx_ = idx;
+ BOOST_ASSERT(!cursor_.empty());
+ cursor_.back().idx_ = idx;
}
int LCursor::cell() const
{
- BOOST_ASSERT(!data_.empty());
- return data_.back().idx_;
+ BOOST_ASSERT(!cursor_.empty());
+ return cursor_.back().idx_;
+}
+
+
+void LCursor::resetAnchor()
+{
+ anchor_ = cursor_;
}
/// pop one level off the cursor
void pop();
/// access to cursor 'tip'
- CursorSlice & top() { return data_.back(); }
+ CursorSlice & top() { return cursor_.back(); }
/// access to cursor 'tip'
- CursorSlice const & top() const { return data_.back(); }
+ CursorSlice const & top() const { return cursor_.back(); }
/// set the cell the cursor is in
void cell(int);
void getDim(int & asc, int & desc) const;
/// cache the absolute coordinate from the top inset
void updatePos();
+ /// sets anchor to cursor position
+ void resetAnchor();
///
friend std::ostream & operator<<(std::ostream &, LCursor const &);
public:
/// mainly used as stack, but wee need random access
- std::vector<CursorSlice> data_;
+ std::vector<CursorSlice> cursor_;
+ /// The
+ std::vector<CursorSlice> anchor_;
///
BufferView * bv_;
private:
int cached_y_;
};
+
+class LCursorS
+{
+};
+
#endif // LYXCURSOR_H
}
-void CursorSlice::par(lyx::paroffset_type par)
+void CursorSlice::idx(idx_type idx)
+{
+ idx_ = idx;
+}
+
+
+CursorSlice::idx_type CursorSlice::idx() const
+{
+ return idx_;
+}
+
+
+void CursorSlice::par(par_type par)
{
par_ = par;
}
-lyx::paroffset_type CursorSlice::par() const
+CursorSlice::par_type CursorSlice::par() const
{
return par_;
}
-void CursorSlice::pos(lyx::pos_type pos)
+void CursorSlice::pos(pos_type pos)
{
pos_ = pos;
}
-lyx::pos_type CursorSlice::pos() const
+CursorSlice::pos_type CursorSlice::pos() const
{
return pos_;
}
MathArray & CursorSlice::cell(CursorSlice::idx_type idx) const
{
BOOST_ASSERT(inset_);
+ BOOST_ASSERT(asMathInset());
return asMathInset()->cell(idx);
}
void CursorSlice::getPos(int & x, int & y) const
{
+ BOOST_ASSERT(inset_);
asMathInset()->getPos(idx_, pos_, x, y);
}
explicit CursorSlice(InsetBase *);
/// set the paragraph that contains this cursor
- void par(par_type pit);
+ void idx(idx_type idx);
+ /// return the paragraph this cursor is in
+ idx_type idx() const;
+ /// set the paragraph that contains this cursor
+ void par(par_type par);
/// return the paragraph this cursor is in
par_type par() const;
/// set the position within the paragraph
- void pos(pos_type p);
+ void pos(pos_type pos);
/// return the position within the paragraph
pos_type pos() const;
int h = ascent + descent;
int x = 0;
int y = 0;
- bv.cursor().getPos(x, y);
+ bv.fullCursor().getPos(x, y);
y -= ascent + bv.top_y();
//lyxerr << "LyXScreen::showCursor x: " << x << " y: " << y << endl;
int newtop = top_y;
int x, y, asc, desc;
- bv->cursor().getPos(x, y);
- bv->cursor().getDim(asc, desc);
+ bv->fullCursor().getPos(x, y);
+ bv->fullCursor().getDim(asc, desc);
bool const big_row = h / 4 < asc + desc && asc + desc < h;
lyxerr << "InsetCollapsable: edit left/right" << endl;
inset.edit(bv, left);
open();
- bv->cursor().push(this);
+ bv->fullCursor().push(this);
}
y += inset.ascent() - height_collapsed();
}
inset.edit(bv, x, y);
- bv->cursor().push(this);
+ bv->fullCursor().push(this);
}
lyxerr << "# InsetTabular::lfunMousePress cell: " << cell << endl;
if (cell == -1) {
tablemode = true;
- bv->cursor() = theTempCursor;
- bv->cursor().data_.push_back(CursorSlice(this));
- bv->cursor().cell(cell);
+ bv->fullCursor(theTempCursor);
+ bv->fullCursor().push(this);
+ bv->fullCursor().cell(cell);
} else {
tablemode = false;
setPos(bv, cmd.x, cmd.y);
- bv->cursor() = theTempCursor;
- bv->cursor().cell(cell);
+ bv->fullCursor(theTempCursor);
+ bv->fullCursor().cell(cell);
}
lyxerr << bv->cursor() << endl;
clearSelection();
resetPos(bv);
bv->fitCursor();
- bv->cursor().push(this);
- bv->cursor().cell(cell);
+ bv->fullCursor().push(this);
+ bv->fullCursor().cell(cell);
lyxerr << bv->cursor() << endl;
}
clearSelection();
finishUndo();
//int xx = cursorx_ - xo_ + tabular.getBeginningOfTextInCell(actcell);
- bv->cursor().push(this);
+ bv->fullCursor().push(this);
//if (x > xx)
// activateCellInset(bv, cell, x - xx, y - cursory_);
}
break;
}
- CursorSlice & cur = bv->cursor().data_.back();
+ CursorSlice & cur = bv->cursor();
if (!tablemode) {
case LFUN_NEXT: {
if (hasSelection())
clearSelection();
- int actcell = bv->cursor().cell();
+ int actcell = bv->cursor().idx();
int actcol = tabular.column_of_cell(actcell);
int column = actcol;
if (bv->top_y() + bv->painter().paperHeight()
case LFUN_PRIOR: {
if (hasSelection())
clearSelection();
- int actcell = bv->cursor().cell();
+ int actcell = bv->cursor().idx();
int actcol = tabular.column_of_cell(actcell);
int column = actcol;
if (yo_ < 0) {
void InsetTabular::tabularFeatures(BufferView * bv,
LyXTabular::Feature feature, string const & value)
{
- int actcell = bv->cursor().cell();
+ int actcell = bv->cursor().idx();
int sel_col_start;
int sel_col_end;
int sel_row_start;
{
if (!paste_tabular)
return false;
- int actcell = bv->cursor().cell();
+ int actcell = bv->cursor().idx();
int actcol = tabular.column_of_cell(actcell);
int actrow = tabular.row_of_cell(actcell);
for (int r1 = 0, r2 = actrow;
string::size_type len = buf.length();
string::size_type p = 0;
- int actcell = bv->cursor().cell();
+ int actcell = bv->cursor().idx();
int actcol = tabular.column_of_cell(actcell);
int actrow = tabular.row_of_cell(actcell);
switch (cmd.action) {
case LFUN_MOUSE_PRESS:
- bv->cursor() = theTempCursor;
+ bv->fullCursor(theTempCursor);
// fall through
default:
result = text_.dispatch(cmd);
void ParIterator::lockPath(BufferView * bv) const
{
- bv->cursor() = LCursor(bv);
+ bv->fullCursor() = LCursor(bv);
int last = size() - 1;
#warning this seems to create just one entry for InsetTabulars
for (int i = 0; i < last; ++i)
// actions
keyseq.clear();
// copied verbatim from do_accent_char
+ view()->resetAnchor();
view()->update();
- view()->getLyXText()->anchor() = view()->getLyXText()->cursor();
}
}
}
- UpdatableInset * tli = view()->cursor().innerInset();
- InsetTabular * tab = view()->cursor().innerInsetTabular();
+ UpdatableInset * tli = view()->fullCursor().innerInset();
+ InsetTabular * tab = view()->fullCursor().innerInsetTabular();
// I would really like to avoid having this switch and rather try to
// encode this in the function itself.
break;
case LFUN_LAYOUT_TABULAR:
- disable = !view()->cursor().innerInsetTabular();
+ disable = !view()->fullCursor().innerInsetTabular();
break;
case LFUN_DEPTH_MIN:
case LFUN_INSET_SETTINGS: {
disable = true;
- UpdatableInset * inset = view()->cursor().innerInset();
+ UpdatableInset * inset = view()->fullCursor().innerInset();
if (!inset)
break;
disable = !Exporter::IsExportable(*buf, "dvi") ||
lyxrc.print_command == "none";
} else if (name == "character") {
- UpdatableInset * tli = view()->cursor().innerInset();
+ UpdatableInset * tli = view()->fullCursor().innerInset();
disable = tli && tli->lyxCode() == InsetOld::ERT_CODE;
} else if (name == "vclog") {
disable = !buf->lyxvc().inUse();
case LFUN_ESCAPE: {
if (!view()->available())
break;
- view()->cursor().pop();
+ view()->fullCursor().pop();
// Tell the paragraph dialog that we changed paragraph
dispatch(FuncRequest(LFUN_PARAGRAPH_UPDATE));
break;
break;
case LFUN_LAYOUT_TABULAR:
- if (InsetTabular * tab = view()->cursor().innerInsetTabular())
+ if (InsetTabular * tab = view()->fullCursor().innerInsetTabular())
tab->openLayoutDialog(view());
break;
default: {
DispatchResult result =
- view()->cursor().dispatch(FuncRequest(func, view()));
+ view()->fullCursor().dispatch(FuncRequest(func, view()));
if (result.dispatched())
lyxerr << "dispatched by Cursor::dispatch()" << endl;
else
if (view()->available()) {
view()->fitCursor();
view()->update();
- view()->cursor().updatePos();
+ view()->fullCursor().updatePos();
// if we executed a mutating lfun, mark the buffer as dirty
if (!getStatus(func).disabled()
&& !lyxaction.funcHasFlag(func.action, LyXAction::NoBuffer)
lyxerr << "Called FormulaBase::edit" << endl;
releaseMathCursor(bv);
mathcursor = new MathCursor(this, left);
- bv->cursor().push(this);
+ bv->fullCursor().push(this);
// if that is removed, we won't get the magenta box when entering an
// inset for the first time
bv->update();
mathcursor = new MathCursor(this, true);
//metrics(bv);
mathcursor->setPos(x + xo_, y + yo_);
- bv->cursor().push(this);
+ bv->fullCursor().push(this);
// if that is removed, we won't get the magenta box when entering an
// inset for the first time
bv->update();
if (sel.empty()) {
InsetFormula * f = new InsetFormula(bv);
if (openNewInset(bv, f)) {
- bv->cursor().innerInset()->
+ bv->fullCursor().innerInset()->
dispatch(FuncRequest(bv, LFUN_MATH_MUTATE, "simple"));
// don't do that also for LFUN_MATH_MODE unless you want end up with
// always changing to mathrm when opening an inlined inset
case LFUN_MATH_DELIM: {
InsetFormula * f = new InsetFormula(bv);
if (openNewInset(bv, f)) {
- UpdatableInset * inset = bv->cursor().innerInset();
+ UpdatableInset * inset = bv->fullCursor().innerInset();
inset->dispatch(FuncRequest(bv, LFUN_MATH_MUTATE, "simple"));
inset->dispatch(cmd);
}
paintBackground();
// paint the selection background
- if (text_.selection.set() && &text_ == bv_.cursor().innerText())
+ if (text_.selection.set() && &text_ == bv_.fullCursor().innerText())
paintSelection();
// vertical lines for appendix
setCursor(from.par(), from.pos());
if (to == from)
return;
- anchor() = cursor();
+ bv()->resetAnchor();
setCursor(to.par(), to.pos());
setSelection();
}
selection.set(true); // to avoid deletion
cursorRightOneWord();
setCursor(tmpcursor, tmpcursor.par(), tmpcursor.pos());
- anchor() = cursor();
+ bv()->resetAnchor();
cursor() = tmpcursor;
setSelection();
cutSelection(true, false);
selection.set(true); // to avoid deletion
cursorLeftOneWord();
setCursor(tmpcursor, tmpcursor.par(), tmpcursor.pos());
- anchor() = cursor();
+ bv()->resetAnchor();
cursor() = tmpcursor;
setSelection();
cutSelection(true, false);
selection.set(true); // to avoid deletion
cursorEnd();
setCursor(tmpcursor, tmpcursor.par(), tmpcursor.pos());
- anchor() = cursor();
+ bv()->resetAnchor();
cursor() = tmpcursor;
setSelection();
// What is this test for ??? (JMarc)
void LyXText::fullRebreak()
{
redoParagraphs(paragraphs().begin(), paragraphs().end());
- anchor() = cursor();
+ bv()->resetAnchor();
}
CursorSlice & LyXText::cursor()
{
- return bv()->cursor().top();
+ return bv()->cursor();
}
CursorSlice const & LyXText::cursor() const
{
- return bv()->cursor().top();
+ return bv()->cursor();
}
CursorSlice & LyXText::anchor()
{
- return anchor_;
+ return bv()->anchor();
}
CursorSlice const & LyXText::anchor() const
{
- return anchor_;
+ return bv()->anchor();
}
{
selection.set(false);
selection.mark(false);
- anchor() = cursor();
+ bv()->resetAnchor();
// reset this in the bv()!
if (bv() && bv()->text())
bv()->unsetXSel();
redoParagraphs(beg, end);
setCursorIntern(0, 0);
- anchor() = cursor();
+ bv()->resetAnchor();
updateCounters();
}
if (implicitSelection) {
clearSelection();
cursor() = resetCursor;
- anchor() = cursor();
+ bv()->resetAnchor();
}
}
// Reset cursors to their original position.
cursor() = reset_cursor;
- anchor() = cursor();
+ bv()->resetAnchor();
// Clear the implicit selection.
if (implicitSelection)
clearSelection();
- anchor() = cursor();
+ bv()->resetAnchor();
setCursor(ppp.first, ppp.second);
setSelection();
updateCounters();
if (!length)
return;
- anchor() = cursor();
+ bv()->resetAnchor();
while (length--)
cursorRight(true);
setSelection();
bv()->buffer()->insertStringAsLines(pit, pos, current_font, str);
redoParagraphs(cursorPar(), endpit);
- anchor() = cursor();
+ bv()->resetAnchor();
setCursor(pit, pos);
setSelection();
}
if (selection_position_was_oldcursor_position) {
// correct selection
- anchor() = cursor();
+ bv()->resetAnchor();
}
}
if (old_pit->stripLeadingSpaces()) {
redoParagraph(old_pit);
- anchor() = cursor();
+ bv()->resetAnchor();
}
return false;
}
}
}
bv()->update();
- anchor() = cursor();
+ bv()->resetAnchor();
}
case LFUN_RIGHTSEL:
if (!selection.set())
- anchor() = cursor();
+ bv->resetAnchor();
if (rtl())
cursorLeft(bv);
else
case LFUN_LEFTSEL:
if (!selection.set())
- anchor() = cursor();
+ bv->resetAnchor();
if (rtl())
cursorRight(bv);
else
case LFUN_UPSEL:
if (!selection.set())
- anchor() = cursor();
+ bv->resetAnchor();
cursorUp(true);
finishChange(bv, true);
break;
case LFUN_DOWNSEL:
if (!selection.set())
- anchor() = cursor();
+ bv->resetAnchor();
cursorDown(true);
finishChange(bv, true);
break;
case LFUN_UP_PARAGRAPHSEL:
if (!selection.set())
- anchor() = cursor();
+ bv->resetAnchor();
cursorUpParagraph();
finishChange(bv, true);
break;
case LFUN_DOWN_PARAGRAPHSEL:
if (!selection.set())
- anchor() = cursor();
+ bv->resetAnchor();
cursorDownParagraph();
finishChange(bv, true);
break;
case LFUN_PRIORSEL:
if (!selection.set())
- anchor() = cursor();
+ bv->resetAnchor();
cursorPrevious();
finishChange(bv, true);
break;
case LFUN_NEXTSEL:
if (!selection.set())
- anchor() = cursor();
+ bv->resetAnchor();
cursorNext();
finishChange(bv, true);
break;
case LFUN_HOMESEL:
if (!selection.set())
- anchor() = cursor();
+ bv->resetAnchor();
cursorHome();
finishChange(bv, true);
break;
case LFUN_ENDSEL:
if (!selection.set())
- anchor() = cursor();
+ bv->resetAnchor();
cursorEnd();
finishChange(bv, true);
break;
case LFUN_DELETE:
if (!selection.set()) {
Delete();
- anchor() = cursor();
+ bv->resetAnchor();
// It is possible to make it a lot faster still
// just comment out the line below...
} else {
cursorRight(bv);
cursorLeft(bv);
Delete();
- anchor() = cursor();
+ bv->resetAnchor();
} else {
Delete();
- anchor() = cursor();
+ bv->resetAnchor();
}
} else {
cutSelection(true, false);
if (!selection.set()) {
if (bv->owner()->getIntl().getTransManager().backspace()) {
backspace();
- anchor() = cursor();
+ bv->resetAnchor();
// It is possible to make it a lot faster still
// just comment out the line below...
}
replaceSelection(bv->getLyXText());
breakParagraph(bv->buffer()->paragraphs(), 0);
bv->update();
- anchor() = cursor();
+ bv->resetAnchor();
bv->switchKeyMap();
bv->owner()->view_state_changed();
break;
replaceSelection(bv->getLyXText());
breakParagraph(bv->buffer()->paragraphs(), 1);
bv->update();
- anchor() = cursor();
+ bv->resetAnchor();
bv->switchKeyMap();
bv->owner()->view_state_changed();
break;
}
case LFUN_INSET_SETTINGS:
- bv->cursor().innerInset()->showInsetDialog(bv);
+ bv->fullCursor().innerInset()->showInsetDialog(bv);
break;
case LFUN_INSET_TOGGLE:
case LFUN_MARK_OFF:
clearSelection();
bv->update();
- anchor() = cursor();
+ bv->resetAnchor();
cmd.message(N_("Mark off"));
break;
clearSelection();
selection.mark(true);
bv->update();
- anchor() = cursor();
+ bv->resetAnchor();
cmd.message(N_("Mark on"));
break;
selection.mark(true);
cmd.message(N_("Mark set"));
}
- anchor() = cursor();
+ bv->resetAnchor();
bv->update();
break;
if (in_inset_)
return DispatchResult(false);
if (!selection.set())
- anchor() = cursor();
+ bv->resetAnchor();
cursorTop();
finishChange(bv, true);
break;
if (in_inset_)
return DispatchResult(false);
if (!selection.set())
- anchor() = cursor();
+ bv->resetAnchor();
cursorBottom();
finishChange(bv, true);
break;
for (int i = 0; i < datetmp_len; i++)
insertChar(datetmp[i]);
- anchor() = cursor();
+ bv->resetAnchor();
moveCursor(bv, false);
break;
}
if (cmd.button() == mouse_button::button1) {
selection_possible = true;
cursorHome();
- anchor() = cursor();
+ bv->resetAnchor();
cursorEnd();
setSelection();
bv->haveSelection(selection.set());
}
setCursorFromCoordinates(cmd.x, cmd.y);
- anchor() = cursor();
+ bv->resetAnchor();
finishUndo();
bv->x_target(cursorX() + xo_);
bv->owner()->getIntl().getTransManager().
TranslateAndInsert(*cit, this);
- anchor() = cursor();
+ bv->resetAnchor();
moveCursor(bv, false);
// real_current_font.number can change so we need to
// clear any selection
text->clearSelection();
- text->anchor() = text->cursor();
+ bv->resetAnchor();
text->updateCounters();
// rebreak the entire lyxtext