}
+void BufferView::setCursor(ParIterator const & par,
+ lyx::pos_type pos)
+{
+ LCursor & cur = cursor();
+ cur.reset();
+ ParIterator::PosHolder const & positions = par.positions();
+ int const last = par.size() - 1;
+ for (int i = 0; i < last; ++i)
+ (*positions[i].it)->inset->edit(cur, true);
+ cur.resetAnchor();
+ LyXText * lt = par.text(*buffer());
+ lt->setCursor(par.pit(), pos);
+}
/*
cursor().clearSelection();
LyXText * text = par.text(*buffer());
- par.lockPath(this);
+ setCursor(par, cur.pos());
+
// hack for the chicken and egg problem
if (par.inset())
top_y(par.outerPar()->y);
#ifndef BUFFER_VIEW_H
#define BUFFER_VIEW_H
+#include "support/types.h"
+
#include <boost/utility.hpp>
#include <string>
class LyXScreen;
class LyXView;
class Painter;
+class ParIterator;
class PosIterator;
class TeXErrors;
class UpdatableInset;
///
LyXText * text() const;
///
+ void setCursor(ParIterator const & par, lyx::pos_type pos);
+ ///
void putSelectionAt(PosIterator const & cur, int length, bool backwards);
private:
screen().hideCursor();
- // either the inset under the cursor or the surrounding LyXText will
- // handle this event.
+ // either the inset under the cursor or the
+ // surrounding LyXText will handle this event.
// built temporary path to inset
LyXText * text = bv_->text();
+
+2004-02-02 Alfredo Braunstein <abraunst@lyx.org>
+
+ * iterators.[Ch] (lockPath): remove in favour of...
+ * BufferView.[Ch] (setCursor): this addition
+ * BufferView.C (putSelectionAt): adjust
+ * undo.C (performUndoOrRedo): adjust
+ * lyxfunc.C (dispatch): adjust
+
2004-02-02 Alfredo Braunstein <abraunst@lyx.org>
* iterators.C (lockPath): add a missing slice
}
-void ParIterator::lockPath(BufferView * bv) const
-{
- LCursor & cur = bv->cursor();
- cur.reset();
- int const last = size() - 1;
- for (int i = 0; i < last; ++i)
- (*positions_[i].it)->inset->edit(cur, true);
- cur.resetAnchor();
-}
-
-
bool operator==(ParIterator const & iter1, ParIterator const & iter2)
{
return iter1.positions() == iter2.positions();
class InsetBase;
class Cursor;
class Buffer;
-class BufferView;
class PosIterator;
int index() const;
///
size_t size() const;
- ///
- void lockPath(BufferView *) const;
typedef std::vector<ParPosition> PosHolder;
PosHolder const & positions() const
<< " found." << endl;
}
- par.lockPath(view());
- LyXText * lt = par.text(*view()->buffer());
-
// Set the cursor
- lt->setCursor(par.pit(), 0);
+ view()->setCursor(par, 0);
+
view()->switchKeyMap();
owner->view_state_changed();
// rebreak the entire lyxtext
buf.text().fullRebreak();
- pit.lockPath(bv);
- text->setCursor(undo.cursor_par, undo.cursor_pos);
+ ParIterator pit2 = num2pit(buf, undo.text);
+ advance(pit2, undo.cursor_par);
+ bv->setCursor(pit2, undo.cursor_pos);
finishUndo();
return true;