#include "CursorSlice.h"
-#include "debug.h"
#include "Text.h"
#include "Paragraph.h"
+#include "support/debug.h"
+
#include "insets/Inset.h"
#include "mathed/InsetMath.h"
#include <boost/assert.hpp>
-using std::endl;
+#include <ostream>
+using namespace std;
namespace lyx {
}
-Paragraph & CursorSlice::paragraph()
-{
- return text()->getPar(pit_);
-}
-
-
-Paragraph const & CursorSlice::paragraph() const
+Paragraph & CursorSlice::paragraph() const
{
return text()->getPar(pit_);
}
return;
}
- // otherwise try to move on one cell if possible
- if (idx() < lastidx()) {
- //lyxerr << "... next idx" << endl;
- ++idx();
- pit() = 0;
- pos() = 0;
- return;
- }
- BOOST_ASSERT(false);
+ // otherwise move on one cell
+ //lyxerr << "... next idx" << endl;
+
+ BOOST_ASSERT(idx() < nargs());
+
+ ++idx();
+ pit() = 0;
+ pos() = 0;
+}
+
+
+void CursorSlice::forwardIdx()
+{
+ BOOST_ASSERT(idx() < nargs());
+
+ ++idx();
+ pit() = 0;
+ pos() = 0;
}
bool operator<(CursorSlice const & p, CursorSlice const & q)
{
if (&p.inset() != &q.inset()) {
- lyxerr << "can't compare cursor and anchor in different insets\n"
- << "p: " << p << '\n' << "q: " << q << endl;
+ LYXERR0("can't compare cursor and anchor in different insets\n"
+ << "p: " << p << '\n' << "q: " << q);
BOOST_ASSERT(false);
}
if (p.idx() != q.idx())
}
-std::ostream & operator<<(std::ostream & os, CursorSlice const & item)
+ostream & operator<<(ostream & os, CursorSlice const & item)
{
return os
- << "inset: " << &item.inset()
+ << "inset: " << (void *)&item.inset()
// << " text: " << item.text()
<< " idx: " << item.idx()
<< " par: " << item.pit()