int const first = top_y() + height;
int const last = top_y() + workarea().workHeight() - height;
+ bv_->cursor().reset();
LyXText * text = bv_->text();
CursorSlice & cur = bv_->cursor().cursor_.front();
int y = text->cursorY(cur);
if (y < first)
- text->setCursorFromCoordinates(cur, 0, first);
+ text->setCursorFromCoordinates(bv_->cursor(), 0, first);
else if (y > last)
- text->setCursorFromCoordinates(cur, 0, last);
+ text->setCursorFromCoordinates(bv_->cursor(), 0, last);
owner_->updateLayoutChoice();
}
// surrounding LyXText will handle this event.
// built temporary path to inset
- LyXText * text = bv_->text();
- InsetBase * const inset_hit = text->checkInsetHit(cmd.x, cmd.y);
- if (inset_hit)
- inset_hit->edit(cur, cmd.x, cmd.y);
- else
- text->setCursorFromCoordinates(cur.current(), cmd.x, cmd.y);
+ InsetBase * inset = bv_->text()->editXY(cur, cmd.x, cmd.y);
+ lyxerr << "hit inset at tip: " << inset << endl;
lyxerr << "created temp cursor: " << cur << endl;
// Try to dispatch to an non-editable inset near this position
DispatchResult res;
- InsetBase * inset = cur.nextInset();
- lyxerr << "next inset: " << inset << endl;
if (inset)
res = inset->dispatch(cur, cmd);
case LFUN_INSERT_LABEL: {
// Try and generate a valid label
string const contents = cmd.argument.empty() ?
- getPossibleLabel(*bv_) : cmd.argument;
+ cur.getPossibleLabel() : cmd.argument;
InsetCommandParams icp("label", contents);
string data = InsetCommandMailer::params2string("label", icp);
owner_->getDialogs().show("label", data, 0);
}
-void LCursor::releaseMathCursor()
-{
- if (inMathed())
- formula()->insetUnlock(bv());
-}
-
-
bool LCursor::inMathed() const
{
return formula();
{
bv().update();
}
+
+
+string LCursor::getPossibleLabel()
+{
+ return inMathed() ? "eq:" : text()->getPossibleLabel(*this);
+}
/// split font inset etc
void handleFont(std::string const & font);
- void releaseMathCursor();
/// are we in mathed?
bool inMathed() const;
/// are we in texted?
void message(std::string const & msg) const;
/// display an error message
void errorMessage(std::string const & msg) const;
+ ///
+ std::string getPossibleLabel();
private:
/// moves cursor index one cell to the left
///
friend std::ostream & operator<<(std::ostream &, CursorSlice const &);
public:
- /// pointer to an inset
+ /// pointer to 'owning' inset
InsetBase * inset_;
/// cell index of a position in this inset
idx_type idx_;
DispatchResult InsetBase::priv_dispatch(LCursor &, FuncRequest const &)
{
+ lyxerr << "InsetBase::priv_dispatch" << std::endl;
return DispatchResult(false);
}
}
-void InsetBase::edit(LCursor & cur, int, int)
+InsetBase * InsetBase::editXY(LCursor & cur, int, int)
{
lyxerr << "InsetBase: edit xy" << std::endl;
- edit(cur, true);
+ return this;
}
/// cursor enters
virtual void edit(LCursor & cur, bool left);
/// cursor enters
- virtual void edit(LCursor & cur, int x, int y);
+ virtual InsetBase * editXY(LCursor & cur, int x, int y);
/// compute the size of the object returned in dim
virtual void metrics(MetricsInfo & mi, Dimension & dim) const = 0;
}
-void InsetCollapsable::edit(LCursor & cur, int x, int y)
+InsetBase * InsetCollapsable::editXY(LCursor & cur, int x, int y)
{
cur.push(this);
//lyxerr << "InsetCollapsable: edit xy" << endl;
#warning look here
//we are not calling edit(x,y) because there are no coordinates in the
//inset yet. I personally think it's ok. (ab)
- } else {
-// if (y <= yo() + inset.ascent() + button_dim.y2)
-// y = yo();
-// else
-// y += inset.ascent() - height_collapsed();
-
- inset.edit(cur, x, y);
+ return this;
}
+
+//if (y <= yo() + inset.ascent() + button_dim.y2)
+// y = yo();
+//else
+// y += inset.ascent() - height_collapsed();
+ return inset.editXY(cur, x, y);
}
///
void edit(LCursor & cur, bool left);
///
- void edit(LCursor & cur, int x, int y);
+ InsetBase * editXY(LCursor & cur, int x, int y);
private:
///
///
InsetExternalParams const & params() const;
+ ///
void setParams(InsetExternalParams const &, Buffer const &);
///
void addPreview(lyx::graphics::PreviewLoader &) const;
///
- void edit(LCursor & cur, bool);
+ void edit(LCursor & cur, bool left);
protected:
///
///
void draw(PainterInfo & pi, int x, int y) const;
///
- void edit(LCursor & cur, bool);
+ void edit(LCursor & cur, bool left);
protected:
///
- virtual
- DispatchResult
- priv_dispatch(LCursor & cur, FuncRequest const & cmd);
+ DispatchResult priv_dispatch(LCursor & cur, FuncRequest const & cmd);
private:
///
friend class InsetGraphicsMailer;
}
-void InsetTabular::edit(LCursor & cur, int x, int y)
+InsetBase * InsetTabular::editXY(LCursor & cur, int x, int y)
{
lyxerr << "InsetTabular::edit: " << this << " first cell "
<< &tabular.cell_info[0][0].inset << endl;
-
- finishUndo();
- setPos(cur, x, y);
clearSelection();
- finishUndo();
- //int xx = cursorx_ - xo_ + tabular.getBeginningOfTextInCell(actcell);
cur.push(this);
+ setPos(cur, x, y);
+ //int xx = cursorx_ - xo_ + tabular.getBeginningOfTextInCell(actcell);
//if (x > xx)
// activateCellInset(bv, cell, x - xx, y - cursory_);
+#warning wrong!
+ return this;
}
//lyxerr << "# InsetTabular::setPos() cursor: " << cur << endl;
int const cell = getCell(x + xo_, y + yo_);
InsetText const & inset = tabular.getCellInset(cell);
- inset.text_.setCursorFromCoordinates(cur.current(), x, y);
+ inset.text_.setCursorFromCoordinates(cur, x, y);
cursory_ = 0;
int actcell = 0;
int actrow = 0;
void InsetTabular::resetPos(LCursor & cur) const
{
-#if 0
+#if 1
#ifdef WITH_WARNINGS
#warning This should be fixed in the right manner (20011128 Jug)
#endif
BufferView & bv = cur.bv();
int cell = 0;
- int actcell = cur.cell();
+ int actcell = cur.idx();
int actcol = tabular.column_of_cell(actcell);
int actrow = 0;
cursory_ = 0;
cursorx_ = new_x;
// cursor.x(getCellXPos(actcell) + offset);
if (actcol < tabular.columns() - 1 && scroll(false) &&
- tabular.getWidthOfTabular() < bv->workWidth()-20)
+ tabular.getWidthOfTabular() < bv.workWidth()-20)
{
scroll(bv, 0.0F);
updateLocal(cur);
} else if (cursorx_ - offset > 20 &&
cursorx_ - offset + tabular.getWidthOfColumn(actcell)
> bv.workWidth() - 20) {
- scroll(&bv, - tabular.getWidthOfColumn(actcell) - 20);
+ scroll(bv, - tabular.getWidthOfColumn(actcell) - 20);
updateLocal(cur);
} else if (cursorx_ - offset < 20) {
- scroll(&bv, 20 - cursorx_ + offset);
+ scroll(bv, 20 - cursorx_ + offset);
updateLocal(cur);
} else if (scroll() && xo_ > 20 &&
- xo_ + tabular.getWidthOfTabular() > bv->workWidth() - 20) {
- scroll(&bv, old_x - cursorx_);
+ xo_ + tabular.getWidthOfTabular() > bv.workWidth() - 20) {
+ scroll(bv, old_x - cursorx_);
updateLocal(cur);
}
- InsetTabularMailer(*this).updateDialog(bv);
+ InsetTabularMailer(*this).updateDialog(&bv);
in_reset_pos = 0;
#endif
}
void InsetTabular::activateCellInset(LCursor & cur, int cell, int x, int y)
{
- tabular.getCellInset(cell).edit(cur, x, y);
cur.idx() = cell;
+ tabular.getCellInset(cell).editXY(cur, x, y);
updateLocal(cur);
}
void InsetTabular::activateCellInset(LCursor & cur, int cell, bool behind)
{
- tabular.getCellInset(cell).edit(cur, behind);
cur.idx() = cell;
+ tabular.getCellInset(cell).edit(cur, behind);
updateLocal(cur);
}
/// set the owning buffer
void buffer(Buffer * buf);
/// lock cell with given index
- void edit(LCursor & cur, bool);
+ void edit(LCursor & cur, bool left);
///
- void edit(LCursor & cur, int, int);
+ InsetBase * editXY(LCursor & cur, int x, int y);
/// can we go further down on mouse click?
bool descendable() const { return true; }
protected:
///
- virtual
- DispatchResult
- priv_dispatch(LCursor & cur, FuncRequest const & cmd);
+ DispatchResult priv_dispatch(LCursor & cur, FuncRequest const & cmd);
private:
///
void lfunMousePress(LCursor & cur, FuncRequest const & cmd);
}
-void InsetText::edit(LCursor & cur, int x, int y)
+InsetBase * InsetText::editXY(LCursor & cur, int x, int y)
{
lyxerr << "InsetText::edit xy" << endl;
old_par = -1;
- text_.edit(cur, x, y);
+ return text_.editXY(cur, x, y);
//sanitizeEmptyText(cur.bv());
//updateLocal(cur);
//dispatch(cur, FuncRequest(LFUN_PARAGRAPH_UPDATE));
///
void edit(LCursor & cur, bool left);
///
- void edit(LCursor & cur, int x, int y);
+ InsetBase * editXY(LCursor & cur, int x, int y);
///
int numParagraphs() const { return 1; }
}
-string const getPossibleLabel(BufferView const & bv)
-{
- ParagraphList::iterator pit = bv.getLyXText()->cursorPar();
- ParagraphList & plist = bv.getLyXText()->paragraphs();
-
- LyXLayout_ptr layout = pit->layout();
-
- if (layout->latextype == LATEX_PARAGRAPH && pit != plist.begin()) {
- ParagraphList::iterator pit2 = boost::prior(pit);
-
- LyXLayout_ptr const & layout2 = pit2->layout();
-
- if (layout2->latextype != LATEX_PARAGRAPH) {
- pit = pit2;
- layout = layout2;
- }
- }
-
- string text = layout->latexname().substr(0, 3);
- if (layout->latexname() == "theorem")
- text = "thm"; // Create a correct prefix for prettyref
-
- text += ':';
- if (layout->latextype == LATEX_PARAGRAPH ||
- lyxrc.label_init_length < 0)
- text.erase();
-
- string par_text = pit->asString(*bv.buffer(), false);
- for (int i = 0; i < lyxrc.label_init_length; ++i) {
- if (par_text.empty())
- break;
- string head;
- par_text = split(par_text, head, ' ');
- // Is it legal to use spaces in labels ?
- if (i > 0)
- text += '-';
- text += head;
- }
-
- return text;
-}
-
-
// This function runs "configure" and then rereads lyx.defaults to
// reconfigure the automatic settings.
void Reconfigure(BufferView * bv)
///
std::string getContentsOfAsciiFile(BufferView * bv, std::string const & f, bool asParagraph);
///
-std::string const getPossibleLabel(BufferView const & bv);
-///
void Reconfigure(BufferView * bv);
#endif
using lyx::pos_type;
-using std::max;
-using std::min;
-using std::endl;
-
-
-int numberOfSeparators(Paragraph const & par, Row const & row)
-{
- pos_type const first = max(row.pos(), par.beginOfBody());
- pos_type const last = row.endpos() - 1;
- int n = 0;
- for (pos_type p = first; p < last; ++p) {
- if (par.isSeparator(p))
- ++n;
- }
-
- return n;
-}
-
-
-// This is called _once_ from LyXText and should at least be moved into
-// an anonymous namespace there. (Lgb)
-int numberOfHfills(Paragraph const & par, Row const & row)
-{
- pos_type const last = row.endpos() - 1;
- pos_type first = row.pos();
-
- // hfill *DO* count at the beginning of paragraphs!
- if (first) {
- while (first < last && par.isHfill(first))
- ++first;
- }
-
- first = max(first, par.beginOfBody());
-
- int n = 0;
-
- // last, because the end is ignored!
- for (pos_type p = first; p < last; ++p) {
- if (par.isHfill(p))
- ++n;
- }
-
- return n;
-}
-
-
-// This is called _once_ from LyXText and should at least be moved into
-// an anonymous namespace there. (Lgb)
-int numberOfLabelHfills(Paragraph const & par, Row const & row)
-{
- pos_type last = row.endpos() - 1;
- pos_type first = row.pos();
-
- // hfill *DO* count at the beginning of paragraphs!
- if (first) {
- while (first < last && par.isHfill(first))
- ++first;
- }
-
- last = min(last, par.beginOfBody());
- int n = 0;
-
- // last, because the end is ignored
- for (pos_type p = first; p < last; ++p) {
- if (par.isHfill(p))
- ++n;
- }
-
- return n;
-}
-
bool hfillExpansion(Paragraph const & par, Row const & row, pos_type pos)
{
class Paragraph;
class Row;
-int numberOfSeparators(Paragraph const & par, Row const & row);
-
-int numberOfHfills(Paragraph const & par, Row const & row);
-
-int numberOfLabelHfills(Paragraph const & par, Row const & row);
-
bool hfillExpansion(Paragraph const & par, Row const & row,
lyx::pos_type pos);
///
void recUndo(par_type first) const;
///
- void setCursorFromCoordinates(CursorSlice &, int x, int y);
+ void setCursorFromCoordinates(LCursor & cur, int x, int y);
///
- void edit(LCursor & cur, int x, int y);
+ InsetBase * editXY(LCursor & cur, int x, int y);
///
void cursorUp(LCursor & cur, bool selecting = false);
///
bool isFirstRow(ParagraphList::iterator pit, Row const & row) const;
///
- double spacing(Paragraph const &) const;
+ double spacing(Paragraph const & par) const;
+ /// make a suggestion for a label
+ std::string getPossibleLabel(LCursor & cur) const;
///
DispatchResult moveRight(LCursor & cur);
void fixCursorAfterDelete(CursorSlice & cur, CursorSlice const & where);
/// delete double space (false) or empty paragraphs (true) around old_cursor
- bool deleteEmptyParagraphMechanism(CursorSlice const & old_cursor);
+ bool deleteEmptyParagraphMechanism(
+ CursorSlice & cur,
+ CursorSlice const & old_cursor);
///
void setCounter(Buffer const &, ParagraphList::iterator pit);
if (bv.cursor().inMathed()) {
if (bv.cursor().inMacroMode())
bv.cursor().macroModeClose();
- bv.cursor().releaseMathCursor();
}
if (bv.buffer())
generatePreview(*bv.buffer());
revealCodes(cur);
cur.bv().stuffClipboard(cur.grabSelection());
} else {
- cur.releaseMathCursor();
if (remove_inset)
cur.bv().owner()->dispatch(FuncRequest(LFUN_DELETE));
}
}
-void MathNestInset::edit(LCursor & cur, int x, int y)
+InsetBase * MathNestInset::editXY(LCursor & cur, int x, int y)
{
int idx_min = 0;
int dist_min = 1000000;
// hit inside cell
for (pos_type i = 0, n = ar.size(); i < n; ++i)
if (ar[i]->covers(x, y))
- ar[i].nucleus()->edit(cur, x, y);
+ return ar[i].nucleus()->editXY(cur, x, y);
}
+ return this;
}
///
void edit(LCursor & cur, bool left);
///
- void edit(LCursor & cur, int x, int y);
+ InsetBase * editXY(LCursor & cur, int x, int y);
/// order of movement through the cells when pressing the left key
bool idxLeft(LCursor &) const;
using lyx::support::bformat;
using lyx::support::contains;
using lyx::support::lowercase;
+using lyx::support::split;
using lyx::support::uppercase;
using std::advance;
using std::distance;
using std::max;
+using std::min;
using std::endl;
using std::string;
namespace {
+int numberOfSeparators(Paragraph const & par, Row const & row)
+{
+ pos_type const first = max(row.pos(), par.beginOfBody());
+ pos_type const last = row.endpos() - 1;
+ int n = 0;
+ for (pos_type p = first; p < last; ++p) {
+ if (par.isSeparator(p))
+ ++n;
+ }
+ return n;
+}
+
+
unsigned int maxParagraphWidth(ParagraphList const & plist)
{
unsigned int width = 0;
return width;
}
+
+int numberOfLabelHfills(Paragraph const & par, Row const & row)
+{
+ pos_type last = row.endpos() - 1;
+ pos_type first = row.pos();
+
+ // hfill *DO* count at the beginning of paragraphs!
+ if (first) {
+ while (first < last && par.isHfill(first))
+ ++first;
+ }
+
+ last = min(last, par.beginOfBody());
+ int n = 0;
+ for (pos_type p = first; p < last; ++p) {
+ if (par.isHfill(p))
+ ++n;
+ }
+ return n;
+}
+
+
+int numberOfHfills(Paragraph const & par, Row const & row)
+{
+ pos_type const last = row.endpos() - 1;
+ pos_type first = row.pos();
+
+ // hfill *DO* count at the beginning of paragraphs!
+ if (first) {
+ while (first < last && par.isHfill(first))
+ ++first;
+ }
+
+ first = max(first, par.beginOfBody());
+
+ int n = 0;
+ for (pos_type p = first; p < last; ++p) {
+ if (par.isHfill(p))
+ ++n;
+ }
+ return n;
+}
+
} // namespace anon
#endif
return os.str();
}
+
+
+string LyXText::getPossibleLabel(LCursor & cur) const
+{
+ ParagraphList & plist = paragraphs();
+ ParagraphList::iterator pit = getPar(cur.par());
+
+ LyXLayout_ptr layout = pit->layout();
+
+ if (layout->latextype == LATEX_PARAGRAPH && pit != plist.begin()) {
+ ParagraphList::iterator pit2 = boost::prior(pit);
+
+ LyXLayout_ptr const & layout2 = pit2->layout();
+
+ if (layout2->latextype != LATEX_PARAGRAPH) {
+ pit = pit2;
+ layout = layout2;
+ }
+ }
+
+ string text = layout->latexname().substr(0, 3);
+ if (layout->latexname() == "theorem")
+ text = "thm"; // Create a correct prefix for prettyref
+
+ text += ':';
+ if (layout->latextype == LATEX_PARAGRAPH ||
+ lyxrc.label_init_length < 0)
+ text.erase();
+
+ string par_text = pit->asString(*cur.bv().buffer(), false);
+ for (int i = 0; i < lyxrc.label_init_length; ++i) {
+ if (par_text.empty())
+ break;
+ string head;
+ par_text = split(par_text, head, ' ');
+ // Is it legal to use spaces in labels ?
+ if (i > 0)
+ text += '-';
+ text += head;
+ }
+
+ return text;
+}
bv()->owner()->dispatch(FuncRequest(LFUN_CUT));
InsetBase * inset = new InsetEnvironment(params, layout);
insertInset(cur, inset);
- //inset->edit(bv());
+ //inset->edit(cur, true);
//bv()->owner()->dispatch(FuncRequest(LFUN_PASTE));
return;
}
{
CursorSlice old_cursor = cur.current();
setCursorIntern(cur, par, pos, setfont, boundary);
- return deleteEmptyParagraphMechanism(old_cursor);
+ return deleteEmptyParagraphMechanism(cur.current(), old_cursor);
}
// x,y are coordinates relative to this LyXText
-void LyXText::setCursorFromCoordinates(CursorSlice & cur, int x, int y)
+void LyXText::setCursorFromCoordinates(LCursor & cur, int x, int y)
{
- CursorSlice old_cursor = cur;
+ CursorSlice old_cursor = cur.current();
ParagraphList::iterator pit;
Row const & row = *getRowNearY(y, pit);
+ lyxerr << "hit row at: " << row.pos() << endl;
bool bound = false;
int xx = x + xo_; // getRowNearX get absolute x coords
pos_type const pos = row.pos() + getColumnNearX(pit, row, xx, bound);
cur.par() = parOffset(pit);
cur.pos() = pos;
cur.boundary() = bound;
- deleteEmptyParagraphMechanism(old_cursor);
+ deleteEmptyParagraphMechanism(cur.current(), old_cursor);
}
// x,y are absolute screen coordinates
-void LyXText::edit(LCursor & cur, int x, int y)
+InsetBase * LyXText::editXY(LCursor & cur, int x, int y)
{
ParagraphList::iterator pit;
Row const & row = *getRowNearY(y - yo_, pit);
// try to descend into nested insets
InsetBase * inset = checkInsetHit(x, y);
- if (inset) {
- // This should be just before or just behind the
- // cursor position set above.
- BOOST_ASSERT((pos != 0 && inset == pit->getInset(pos - 1))
- || inset == pit->getInset(pos));
- // Make sure the cursor points to the position before
- // this inset.
- if (inset == pit->getInset(pos - 1))
- --cur.pos();
- inset->edit(cur, x, y);
- }
+ if (!inset)
+ return 0;
+
+ // This should be just before or just behind the
+ // cursor position set above.
+ BOOST_ASSERT((pos != 0 && inset == pit->getInset(pos - 1))
+ || inset == pit->getInset(pos));
+ // Make sure the cursor points to the position before
+ // this inset.
+ if (inset == pit->getInset(pos - 1))
+ --cur.pos();
+ return inset->editXY(cur, x, y);
}
if (cur.par() != 0) {
// steps into the paragraph above
- setCursor(cur, cur.par() - 1, boost::prior(cursorPar())->size());
+ setCursor(cur, cur.par() - 1, getPar(cur.par() - 1)->size());
return true;
}
Row const & row = cur.textRow();
int x = cur.x_target();
int y = cursorY(cur.current()) - row.baseline() - 1;
- setCursorFromCoordinates(cur.current(), x - xo_, y - yo_);
+ setCursorFromCoordinates(cur, x - xo_, y - yo_);
if (!selecting) {
InsetBase * inset_hit = checkInsetHit(cur.x_target(), y);
if (inset_hit && isHighlyEditableInset(inset_hit))
- inset_hit->edit(cur, cur.x_target(), y);
+ inset_hit->editXY(cur, cur.x_target(), y);
}
}
Row const & row = cur.textRow();
int x = cur.x_target();
int y = cursorY(cur.current()) - row.baseline() + row.height() + 1;
- setCursorFromCoordinates(cur.current(), x - xo_, y - yo_);
+ setCursorFromCoordinates(cur, x - xo_, y - yo_);
if (!selecting) {
InsetBase * inset_hit = checkInsetHit(cur.x_target(), y);
if (inset_hit && isHighlyEditableInset(inset_hit))
- inset_hit->edit(cur, cur.x_target(), y);
+ inset_hit->editXY(cur, cur.x_target(), y);
}
}
// position. Called by deleteEmptyParagraphMechanism
void LyXText::fixCursorAfterDelete(CursorSlice & cur, CursorSlice const & where)
{
- // if cursor is not in the paragraph where the delete occured,
- // do nothing
+ // do notheing if cursor is not in the paragraph where the
+ // deletion occured,
if (cur.par() != where.par())
return;
- // if cursor position is after the place where the delete occured,
- // update it
+ // if cursor position is after the deletion place update it
if (cur.pos() > where.pos())
--cur.pos();
}
-bool LyXText::deleteEmptyParagraphMechanism(CursorSlice const & old_cursor)
+bool LyXText::deleteEmptyParagraphMechanism(CursorSlice & cur,
+ CursorSlice const & old_cursor)
{
#warning Disabled as it crashes after the cursor data shift... (Andre)
return false;
// Would be wrong to delete anything if we have a selection.
- if (bv()->cursor().selection())
- return false;
-
- // Don't do anything if the cursor is invalid
- if (old_cursor.par() == -1)
- return false;
+ //if (cur.selection())
+ // return false;
#if 0
// We allow all kinds of "mumbo-jumbo" when freespacing.
- ParagraphList::iterator const old_pit = getPar(old_cursor);
+ ParagraphList::iterator const old_pit = getPar(old_cursor.par());
if (old_pit->isFreeSpacing())
return false;
// MISSING
// If the pos around the old_cursor were spaces, delete one of them.
- if (old_cursor.par() != cursor().par()
- || old_cursor.pos() != cursor().pos()) {
+ if (old_cursor.par() != cur.par() || old_cursor.pos() != cur.pos()) {
// Only if the cursor has really moved
if (old_cursor.pos() > 0
return false;
// only do our magic if we changed paragraph
- if (old_cursor.par() == cursor().par())
+ if (old_cursor.par() == cur.par())
return false;
// record if we have deleted a paragraph
recUndo(parOffset(old_pit), parOffset(endpit) - 1);
cursor() = tmpcursor;
- // cache cursor pit
- ParagraphList::iterator tmppit = cursorPar();
// delete old par
paragraphs().erase(old_pit);
// update cursor par offset
- cursor().par(parOffset(tmppit));
+ --cur.par();
redoParagraph();
if (selection_position_was_oldcursor_position) {
int x = cur.x_target();
int y = bv()->top_y();
- setCursorFromCoordinates(cur.current(), x, y);
+ setCursorFromCoordinates(cur, x, y);
if (cpar == cur.par() && cpos == cur.pos()) {
// we have a row which is taller than the workarea. The
int x = cur.x_target();
int y = bv()->top_y() + bv()->workHeight();
- setCursorFromCoordinates(cur.current(), x, y);
+ setCursorFromCoordinates(cur, x, y);
if (cpar == cur.par() && cpos == cur.pos()) {
// we have a row which is taller than the workarea. The
lyxerr << "SETXY: Could not parse coordinates in '"
<< cmd.argument << std::endl;
else
- setCursorFromCoordinates(cur.current(), x, y);
+ setCursorFromCoordinates(cur, x, y);
break;
}
break;
}
CursorSlice old = cur.current();
- setCursorFromCoordinates(cur.current(), cmd.x, cmd.y);
+ setCursorFromCoordinates(cur, cmd.x, cmd.y);
// This is to allow jumping over large insets
// FIXME: shouldn't be top-text-specific
// Clear the selection
cur.clearSelection();
- setCursorFromCoordinates(cur.current(), cmd.x - xo_,
- cmd.y - yo_);
+ setCursorFromCoordinates(cur, cmd.x - xo_, cmd.y - yo_);
cur.resetAnchor();
finishUndo();
cur.x_target() = cursorX(cur.current());