mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-09 18:31:04 +00:00
add LCursor & parameter to cursor moving functions
additional small stuff git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@8424 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
4da45fc728
commit
df974a3904
@ -264,7 +264,7 @@ bool BufferView::insertLyXFile(string const & filen)
|
||||
string const fname = MakeAbsPath(filen);
|
||||
|
||||
cursor().clearSelection();
|
||||
text()->breakParagraph(buffer()->paragraphs());
|
||||
text()->breakParagraph(cursor());
|
||||
|
||||
bool res = buffer()->readFile(fname, text()->cursorPar());
|
||||
resize();
|
||||
@ -299,7 +299,9 @@ void BufferView::setCursorFromRow(int row)
|
||||
if (tmpid == -1)
|
||||
text()->setCursor(0, 0);
|
||||
else
|
||||
text()->setCursor(buffer()->getParFromID(tmpid).pit(), tmppos);
|
||||
text()->setCursor(
|
||||
text()->parOffset(buffer()->getParFromID(tmpid).pit()),
|
||||
tmppos);
|
||||
}
|
||||
|
||||
|
||||
@ -334,7 +336,7 @@ void BufferView::replaceWord(string const & replacestring)
|
||||
|
||||
// Go back so that replacement string is also spellchecked
|
||||
for (string::size_type i = 0; i < replacestring.length() + 1; ++i)
|
||||
t->cursorLeft(this);
|
||||
t->cursorLeft(cursor(), this);
|
||||
|
||||
// FIXME: should be done through LFUN
|
||||
buffer()->markDirty();
|
||||
@ -417,7 +419,7 @@ void BufferView::setCursor(ParIterator const & par,
|
||||
(*positions[i].it)->inset->edit(cur, true);
|
||||
cur.resetAnchor();
|
||||
LyXText * lt = par.text(*buffer());
|
||||
lt->setCursor(par.pit(), pos);
|
||||
lt->setCursor(lt->parOffset(par.pit()), pos);
|
||||
}
|
||||
|
||||
|
||||
@ -449,7 +451,7 @@ void BufferView::putSelectionAt(PosIterator const & cur,
|
||||
if (par.inset())
|
||||
top_y(par.outerPar()->y);
|
||||
update();
|
||||
text->setCursor(cur.pit(), cur.pos());
|
||||
text->setCursor(text->parOffset(cur.pit()), cur.pos());
|
||||
cursor().updatePos();
|
||||
|
||||
if (length) {
|
||||
|
@ -45,7 +45,6 @@
|
||||
#include "undo.h"
|
||||
#include "vspace.h"
|
||||
|
||||
#include "insets/insetfloatlist.h"
|
||||
#include "insets/insetref.h"
|
||||
|
||||
#include "frontends/Alert.h"
|
||||
@ -346,7 +345,7 @@ void BufferView::Pimpl::buffer(Buffer * b)
|
||||
|
||||
// Don't forget to update the Layout
|
||||
if (buffer_)
|
||||
owner_->setLayout(bv_->text()->cursorPar()->layout()->name());
|
||||
owner_->setLayout(bv_->text()->getPar(0)->layout()->name());
|
||||
|
||||
if (lyx::graphics::Previews::activated() && buffer_)
|
||||
lyx::graphics::Previews::get().generateBufferPreviews(*buffer_);
|
||||
@ -684,7 +683,7 @@ void BufferView::Pimpl::restorePosition(unsigned int i)
|
||||
if (par == buffer_->par_iterator_end())
|
||||
return;
|
||||
|
||||
bv_->text()->setCursor(par.pit(),
|
||||
bv_->text()->setCursor(bv_->text()->parOffset(par.pit()),
|
||||
min(par->size(), saved_positions[i].par_pos));
|
||||
|
||||
if (i > 0)
|
||||
@ -745,15 +744,6 @@ void BufferView::Pimpl::stuffClipboard(string const & stuff) const
|
||||
|
||||
InsetBase * BufferView::Pimpl::getInsetByCode(InsetBase::Code code)
|
||||
{
|
||||
#if 0
|
||||
CursorSlice cursor = bv_->getLyXText()->cursor;
|
||||
Buffer::inset_iterator it =
|
||||
find_if(Buffer::inset_iterator(
|
||||
cursorPar(), cursor().pos()),
|
||||
buffer_->inset_iterator_end(),
|
||||
lyx::compare_memfun(&Inset::lyxCode, code));
|
||||
return it != buffer_->inset_iterator_end() ? (*it) : 0;
|
||||
#else
|
||||
// Ok, this is a little bit too brute force but it
|
||||
// should work for now. Better infrastructure is coming. (Lgb)
|
||||
|
||||
@ -788,7 +778,6 @@ InsetBase * BufferView::Pimpl::getInsetByCode(InsetBase::Code code)
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@ -1063,32 +1052,6 @@ bool BufferView::Pimpl::dispatch(FuncRequest const & cmd)
|
||||
}
|
||||
break;
|
||||
|
||||
case LFUN_FLOAT_LIST:
|
||||
if (tclass.floats().typeExist(cmd.argument)) {
|
||||
InsetBase * inset = new InsetFloatList(cmd.argument);
|
||||
|
||||
// not quite sure if we want this...
|
||||
bv_->text()->recUndo(bv_->text()->cursor().par());
|
||||
freezeUndo();
|
||||
|
||||
cur.clearSelection();
|
||||
bv_->text()->breakParagraph(bv_->buffer()->paragraphs());
|
||||
|
||||
if (!bv_->text()->cursorPar()->empty()) {
|
||||
bv_->text()->cursorLeft(true);
|
||||
bv_->text()->breakParagraph(bv_->buffer()->paragraphs());
|
||||
}
|
||||
|
||||
bv_->text()->setLayout(tclass.defaultLayoutName());
|
||||
bv_->text()->setParagraph(Spacing(), LYX_ALIGN_LAYOUT, string(), 0);
|
||||
bv_->getLyXText()->insertInset(inset);
|
||||
unFreezeUndo();
|
||||
} else {
|
||||
lyxerr << "Non-existent float type: "
|
||||
<< cmd.argument << endl;
|
||||
}
|
||||
break;
|
||||
|
||||
case LFUN_PARAGRAPH_APPLY:
|
||||
setParagraphParams(*bv_, cmd.argument);
|
||||
break;
|
||||
|
@ -1,4 +1,19 @@
|
||||
|
||||
2004-02-12 André Pönitz <poenitz@gmx.net>
|
||||
|
||||
* lyxtext.h:
|
||||
* text.C:
|
||||
* text2.C:
|
||||
* text3.C: add LCursor & parameter to most cursor movement functions
|
||||
|
||||
* cursor.[Ch]: add textRow() needed members
|
||||
|
||||
* BufferView.C:
|
||||
* BufferView_pimpl.C:
|
||||
* paragraph.[Ch]:
|
||||
* BufferView.C:
|
||||
* BufferView_pimpl.C: adjust
|
||||
|
||||
2004-02-11 André Pönitz <poenitz@gmx.net>
|
||||
|
||||
* lyxfunc.C:
|
||||
|
12
src/cursor.C
12
src/cursor.C
@ -482,6 +482,18 @@ Paragraph const & LCursor::paragraph() const
|
||||
}
|
||||
|
||||
|
||||
Row & LCursor::textRow()
|
||||
{
|
||||
return *paragraph().getRow(pos());
|
||||
}
|
||||
|
||||
|
||||
Row const & LCursor::textRow() const
|
||||
{
|
||||
return *paragraph().getRow(pos());
|
||||
}
|
||||
|
||||
|
||||
LCursor::par_type LCursor::lastpar() const
|
||||
{
|
||||
return inMathed() ? 0 : text()->paragraphs().size() - 1;
|
||||
|
18
src/cursor.h
18
src/cursor.h
@ -25,22 +25,20 @@ class FuncRequest;
|
||||
class InsetTabular;
|
||||
class LyXText;
|
||||
class Paragraph;
|
||||
class Row;
|
||||
|
||||
|
||||
// these should go
|
||||
class MathHullInset;
|
||||
class PainterInfo;
|
||||
class MathUnknownInset;
|
||||
class MathGridInset;
|
||||
|
||||
|
||||
// only needed for gcc 2.95, remove when support terminated
|
||||
|
||||
|
||||
template <typename A, typename B>
|
||||
bool ptr_cmp(A const * a, B const * b)
|
||||
{
|
||||
return a == b;
|
||||
return a == b;
|
||||
}
|
||||
|
||||
|
||||
@ -218,14 +216,18 @@ public:
|
||||
|
||||
//
|
||||
// text-specific part
|
||||
///
|
||||
/// see comment for boundary_ below
|
||||
bool boundary() const { return current().boundary(); }
|
||||
///
|
||||
/// see comment for boundary_ below
|
||||
bool & boundary() { return current().boundary(); }
|
||||
///
|
||||
/// the paragraph we're in
|
||||
Paragraph & paragraph();
|
||||
///
|
||||
/// the paragraph we're in
|
||||
Paragraph const & paragraph() const;
|
||||
/// the row in the paragraph we're in
|
||||
Row & textRow();
|
||||
/// the row in the paragraph we're in
|
||||
Row const & textRow() const;
|
||||
///
|
||||
LyXText * text() const;
|
||||
///
|
||||
|
@ -69,7 +69,7 @@ public:
|
||||
LyXFont const & font, bool toggleall);
|
||||
|
||||
/// what you expect when pressing <enter> at cursor position
|
||||
void breakParagraph(ParagraphList & paragraphs, char keep_layout = 0);
|
||||
void breakParagraph(LCursor & cur, char keep_layout = 0);
|
||||
|
||||
/** set layout over selection and make a total rebreak of
|
||||
those paragraphs
|
||||
@ -169,8 +169,6 @@ public:
|
||||
/// reject selected change
|
||||
void rejectChange();
|
||||
|
||||
///
|
||||
void setCursor(ParagraphList::iterator pit, lyx::pos_type pos);
|
||||
/// returns true if par was empty and was removed
|
||||
bool setCursor(lyx::paroffset_type par, lyx::pos_type pos,
|
||||
bool setfont = true, bool boundary = false);
|
||||
@ -194,37 +192,37 @@ public:
|
||||
///
|
||||
void edit(LCursor & cur, int x, int y);
|
||||
///
|
||||
void cursorUp(bool selecting = false);
|
||||
void cursorUp(LCursor & cur, bool selecting = false);
|
||||
///
|
||||
void cursorDown(bool selecting = false);
|
||||
void cursorDown(LCursor & cur, bool selecting = false);
|
||||
///
|
||||
bool cursorLeft(bool internal = true);
|
||||
bool cursorLeft(LCursor & cur, bool internal = true);
|
||||
///
|
||||
bool cursorRight(bool internal = true);
|
||||
bool cursorRight(LCursor & cur, bool internal = true);
|
||||
///
|
||||
void cursorLeftOneWord();
|
||||
void cursorLeftOneWord(LCursor & cur);
|
||||
///
|
||||
void cursorRightOneWord();
|
||||
void cursorRightOneWord(LCursor & cur);
|
||||
///
|
||||
void cursorUpParagraph();
|
||||
void cursorUpParagraph(LCursor & cur);
|
||||
///
|
||||
void cursorDownParagraph();
|
||||
void cursorDownParagraph(LCursor & cur);
|
||||
///
|
||||
void cursorHome();
|
||||
void cursorHome(LCursor & cur);
|
||||
///
|
||||
void cursorEnd();
|
||||
void cursorEnd(LCursor & cur);
|
||||
///
|
||||
void cursorPrevious();
|
||||
void cursorPrevious(LCursor & cur);
|
||||
///
|
||||
void cursorNext();
|
||||
void cursorNext(LCursor & cur);
|
||||
///
|
||||
void cursorTop();
|
||||
void cursorTop(LCursor & cur);
|
||||
///
|
||||
void cursorBottom();
|
||||
void cursorBottom(LCursor & cur);
|
||||
///
|
||||
void Delete();
|
||||
void Delete(LCursor & cur);
|
||||
///
|
||||
void backspace();
|
||||
void backspace(LCursor & cur);
|
||||
///
|
||||
bool selectWordWhenUnderCursor(lyx::word_location);
|
||||
///
|
||||
@ -342,27 +340,23 @@ public:
|
||||
|
||||
///
|
||||
double spacing(Paragraph const &) const;
|
||||
///
|
||||
void cursorLeftOneWord(CursorSlice &);
|
||||
///
|
||||
void cursorRightOneWord(CursorSlice &);
|
||||
|
||||
///
|
||||
DispatchResult moveRight();
|
||||
DispatchResult moveRight(LCursor & cur);
|
||||
///
|
||||
DispatchResult moveLeft();
|
||||
DispatchResult moveLeft(LCursor & cur);
|
||||
///
|
||||
DispatchResult moveRightIntern(bool front,
|
||||
DispatchResult moveRightIntern(LCursor & cur, bool front,
|
||||
bool activate_inset, bool selecting);
|
||||
///
|
||||
DispatchResult moveLeftIntern(bool front,
|
||||
DispatchResult moveLeftIntern(LCursor & cur, bool front,
|
||||
bool activate_inset, bool selecting);
|
||||
///
|
||||
DispatchResult moveUp();
|
||||
DispatchResult moveUp(LCursor & cur);
|
||||
///
|
||||
DispatchResult moveDown();
|
||||
DispatchResult moveDown(LCursor & cur);
|
||||
///
|
||||
bool checkAndActivateInset(bool front);
|
||||
bool checkAndActivateInset(LCursor & cur, bool front);
|
||||
|
||||
///
|
||||
void write(Buffer const & buf, std::ostream & os) const;
|
||||
@ -442,11 +436,11 @@ private:
|
||||
///
|
||||
void setCounter(Buffer const &, ParagraphList::iterator pit);
|
||||
///
|
||||
void deleteWordForward();
|
||||
void deleteWordForward(LCursor & cur);
|
||||
///
|
||||
void deleteWordBackward();
|
||||
void deleteWordBackward(LCursor & cur);
|
||||
///
|
||||
void deleteLineForward();
|
||||
void deleteLineForward(LCursor & cur);
|
||||
|
||||
/// sets row.end to the pos value *after* which a row should break.
|
||||
/// for example, the pos after which isNewLine(pos) == true
|
||||
|
@ -1830,6 +1830,18 @@ RowList::iterator Paragraph::getRow(pos_type pos)
|
||||
}
|
||||
|
||||
|
||||
RowList::const_iterator Paragraph::getRow(pos_type pos) const
|
||||
{
|
||||
RowList::const_iterator rit = rows.end();
|
||||
RowList::const_iterator const begin = rows.begin();
|
||||
|
||||
for (--rit; rit != begin && rit->pos() > pos; --rit)
|
||||
;
|
||||
|
||||
return rit;
|
||||
}
|
||||
|
||||
|
||||
size_t Paragraph::row(pos_type pos) const
|
||||
{
|
||||
RowList::const_iterator rit = rows.end();
|
||||
|
@ -330,6 +330,8 @@ public:
|
||||
///
|
||||
RowList::iterator getRow(lyx::pos_type pos);
|
||||
///
|
||||
RowList::const_iterator getRow(lyx::pos_type pos) const;
|
||||
///
|
||||
size_t row(lyx::pos_type pos) const;
|
||||
|
||||
///
|
||||
|
284
src/text.C
284
src/text.C
@ -752,31 +752,33 @@ void LyXText::setHeightOfRow(ParagraphList::iterator pit, Row & row)
|
||||
}
|
||||
|
||||
|
||||
void LyXText::breakParagraph(ParagraphList & paragraphs, char keep_layout)
|
||||
void LyXText::breakParagraph(LCursor & cur, char keep_layout)
|
||||
{
|
||||
// allow only if at start or end, or all previous is new text
|
||||
ParagraphList::iterator cpit = cursorPar();
|
||||
if (cursor().pos() && cursor().pos() != cpit->size()
|
||||
&& cpit->isChangeEdited(0, cursor().pos()))
|
||||
Paragraph & cpar = cur.paragraph();
|
||||
ParagraphList::iterator cpit = getPar(cur.par());
|
||||
|
||||
if (cur.pos() != 0 && cur.pos() != cur.lastpos()
|
||||
&& cpar.isChangeEdited(0, cur.pos()))
|
||||
return;
|
||||
|
||||
LyXTextClass const & tclass =
|
||||
bv()->buffer()->params().getLyXTextClass();
|
||||
LyXLayout_ptr const & layout = cpit->layout();
|
||||
LyXLayout_ptr const & layout = cpar.layout();
|
||||
|
||||
// this is only allowed, if the current paragraph is not empty
|
||||
// or caption and if it has not the keepempty flag active
|
||||
if (cpit->empty() && !cpit->allowEmpty()
|
||||
if (cur.lastpos() == 0 && !cpar.allowEmpty()
|
||||
&& layout->labeltype != LABEL_SENSITIVE)
|
||||
return;
|
||||
|
||||
// a layout change may affect also the following paragraph
|
||||
recUndo(cursor().par(), parOffset(undoSpan(cpit)) - 1);
|
||||
recUndo(cur.par(), parOffset(undoSpan(cpit)) - 1);
|
||||
|
||||
// Always break behind a space
|
||||
// It is better to erase the space (Dekel)
|
||||
if (cursor().pos() < cpit->size() && cpit->isLineSeparator(cursor().pos()))
|
||||
cpit->erase(cursor().pos());
|
||||
if (cur.pos() != cur.lastpos() && cpar.isLineSeparator(cur.pos()))
|
||||
cpar.erase(cur.pos());
|
||||
|
||||
// break the paragraph
|
||||
if (keep_layout)
|
||||
@ -788,16 +790,16 @@ void LyXText::breakParagraph(ParagraphList & paragraphs, char keep_layout)
|
||||
// breakParagraph call should return a bool if it inserts the
|
||||
// paragraph before or behind and we should react on that one
|
||||
// but we can fix this in 1.3.0 (Jug 20020509)
|
||||
bool const isempty = cpit->allowEmpty() && cpit->empty();
|
||||
::breakParagraph(bv()->buffer()->params(), paragraphs, cpit,
|
||||
cursor().pos(), keep_layout);
|
||||
bool const isempty = cpar.allowEmpty() && cpar.empty();
|
||||
::breakParagraph(bv()->buffer()->params(), paragraphs(), cpit,
|
||||
cur.pos(), keep_layout);
|
||||
|
||||
cpit = cursorPar();
|
||||
cpit = getPar(cur.par());
|
||||
ParagraphList::iterator next_par = boost::next(cpit);
|
||||
|
||||
// well this is the caption hack since one caption is really enough
|
||||
if (layout->labeltype == LABEL_SENSITIVE) {
|
||||
if (!cursor().pos())
|
||||
if (!cur.pos())
|
||||
// set to standard-layout
|
||||
cpit->applyLayout(tclass.defaultLayout());
|
||||
else
|
||||
@ -809,11 +811,10 @@ void LyXText::breakParagraph(ParagraphList & paragraphs, char keep_layout)
|
||||
// move one row up!
|
||||
// This touches only the screen-update. Otherwise we would may have
|
||||
// an empty row on the screen
|
||||
RowList::iterator crit = cpit->getRow(cursor().pos());
|
||||
if (cursor().pos() && crit->pos() == cursor().pos()
|
||||
&& !cpit->isNewline(cursor().pos() - 1))
|
||||
if (cur.pos() != 0 && cur.textRow().pos() == cur.pos()
|
||||
&& !cpit->isNewline(cur.pos() - 1))
|
||||
{
|
||||
cursorLeft(bv());
|
||||
cursorLeft(cur, true);
|
||||
}
|
||||
|
||||
while (!next_par->empty() && next_par->isNewline(0))
|
||||
@ -825,10 +826,10 @@ void LyXText::breakParagraph(ParagraphList & paragraphs, char keep_layout)
|
||||
|
||||
// This check is necessary. Otherwise the new empty paragraph will
|
||||
// be deleted automatically. And it is more friendly for the user!
|
||||
if (cursor().pos() || isempty)
|
||||
setCursor(next_par, 0);
|
||||
if (cur.pos() != 0 || isempty)
|
||||
setCursor(cur.par() + 1, 0);
|
||||
else
|
||||
setCursor(cpit, 0);
|
||||
setCursor(cur.par(), 0);
|
||||
}
|
||||
|
||||
|
||||
@ -1080,20 +1081,39 @@ void LyXText::prepareToPrint(ParagraphList::iterator pit, Row & row) const
|
||||
// the cursor set functions have a special mechanism. When they
|
||||
// realize, that you left an empty paragraph, they will delete it.
|
||||
|
||||
void LyXText::cursorRightOneWord()
|
||||
void LyXText::cursorRightOneWord(LCursor & cur)
|
||||
{
|
||||
cursorRightOneWord(cursor());
|
||||
setCursor(cursorPar(), cursor().pos());
|
||||
if (cur.pos() == cur.lastpos() && cur.par() != cur.lastpar()) {
|
||||
++cur.par();
|
||||
cur.pos() = 0;
|
||||
} else {
|
||||
// Skip through initial nonword stuff.
|
||||
// Treat floats and insets as words.
|
||||
while (cur.pos() != cur.lastpos() && !cur.paragraph().isWord(cur.pos()))
|
||||
++cur.pos();
|
||||
// Advance through word.
|
||||
while (cur.pos() != cur.lastpos() && cur.paragraph().isWord(cur.pos()))
|
||||
++cur.pos();
|
||||
}
|
||||
setCursor(cur.par(), cur.pos());
|
||||
}
|
||||
|
||||
|
||||
// Skip initial whitespace at end of word and move cursor to *start*
|
||||
// of prior word, not to end of next prior word.
|
||||
void LyXText::cursorLeftOneWord()
|
||||
void LyXText::cursorLeftOneWord(LCursor & cur)
|
||||
{
|
||||
CursorSlice tmpcursor = cursor();
|
||||
cursorLeftOneWord(tmpcursor);
|
||||
setCursor(getPar(tmpcursor), tmpcursor.pos());
|
||||
if (cur.pos() == 0 && cur.par() != 0) {
|
||||
--cur.par();
|
||||
cur.pos() = cur.lastpos();
|
||||
} else {
|
||||
// Skip through initial nonword stuff.
|
||||
// Treat floats and insets as words.
|
||||
while (cur.pos() != 0 && !cur.paragraph().isWord(cur.pos() - 1))
|
||||
--cur.pos();
|
||||
// Advance through word.
|
||||
while (cur.pos() != 0 && cur.paragraph().isWord(cur.pos() - 1))
|
||||
--cur.pos();
|
||||
}
|
||||
setCursor(cur.par(), cur.pos());
|
||||
}
|
||||
|
||||
|
||||
@ -1164,18 +1184,14 @@ void LyXText::rejectChange()
|
||||
|
||||
|
||||
// Delete from cursor up to the end of the current or next word.
|
||||
void LyXText::deleteWordForward()
|
||||
void LyXText::deleteWordForward(LCursor & cur)
|
||||
{
|
||||
LCursor & cur = bv()->cursor();
|
||||
if (cursorPar()->empty())
|
||||
cursorRight(true);
|
||||
if (cur.lastpos() == 0)
|
||||
cursorRight(cur, true);
|
||||
else {
|
||||
CursorSlice tmpcursor = cursor();
|
||||
cur.selection() = true; // to avoid deletion
|
||||
cursorRightOneWord();
|
||||
setCursor(tmpcursor, tmpcursor.par(), tmpcursor.pos());
|
||||
cur.resetAnchor();
|
||||
cursor() = tmpcursor;
|
||||
cur.selection() = true;
|
||||
cursorRightOneWord(cur);
|
||||
cur.setSelection();
|
||||
cutSelection(true, false);
|
||||
}
|
||||
@ -1183,18 +1199,14 @@ void LyXText::deleteWordForward()
|
||||
|
||||
|
||||
// Delete from cursor to start of current or prior word.
|
||||
void LyXText::deleteWordBackward()
|
||||
void LyXText::deleteWordBackward(LCursor & cur)
|
||||
{
|
||||
LCursor & cur = bv()->cursor();
|
||||
if (cursorPar()->empty())
|
||||
cursorLeft(true);
|
||||
if (cur.lastpos() == 0)
|
||||
cursorLeft(cur, true);
|
||||
else {
|
||||
CursorSlice tmpcursor = cursor();
|
||||
cur.selection() = true; // to avoid deletion
|
||||
cursorLeftOneWord();
|
||||
setCursor(tmpcursor, tmpcursor.par(), tmpcursor.pos());
|
||||
cur.resetAnchor();
|
||||
cursor() = tmpcursor;
|
||||
cur.selection() = true;
|
||||
cursorLeftOneWord(cur);
|
||||
cur.setSelection();
|
||||
cutSelection(true, false);
|
||||
}
|
||||
@ -1202,23 +1214,19 @@ void LyXText::deleteWordBackward()
|
||||
|
||||
|
||||
// Kill to end of line.
|
||||
void LyXText::deleteLineForward()
|
||||
void LyXText::deleteLineForward(LCursor & cur)
|
||||
{
|
||||
LCursor & cur = bv()->cursor();
|
||||
if (cursorPar()->empty()) {
|
||||
if (cur.lastpos() == 0) {
|
||||
// Paragraph is empty, so we just go to the right
|
||||
cursorRight(true);
|
||||
cursorRight(cur, true);
|
||||
} else {
|
||||
CursorSlice tmpcursor = cursor();
|
||||
cur.selection() = true; // to avoid deletion
|
||||
cursorEnd();
|
||||
setCursor(tmpcursor, tmpcursor.par(), tmpcursor.pos());
|
||||
cur.resetAnchor();
|
||||
cursor() = tmpcursor;
|
||||
cur.selection() = true; // to avoid deletion
|
||||
cursorEnd(cur);
|
||||
cur.setSelection();
|
||||
// What is this test for ??? (JMarc)
|
||||
if (!cur.selection())
|
||||
deleteWordForward();
|
||||
deleteWordForward(cur);
|
||||
else
|
||||
cutSelection(true, false);
|
||||
}
|
||||
@ -1275,30 +1283,26 @@ void LyXText::changeCase(LyXText::TextCase action)
|
||||
}
|
||||
|
||||
|
||||
void LyXText::Delete()
|
||||
void LyXText::Delete(LCursor & cur)
|
||||
{
|
||||
// this is a very easy implementation
|
||||
CursorSlice old_cursor = cursor();
|
||||
|
||||
// this is a very simple implementation
|
||||
// just move to the right
|
||||
cursorRight(true);
|
||||
|
||||
// if you had success make a backspace
|
||||
if (old_cursor.par() != cursor().par()
|
||||
|| old_cursor.pos() != cursor().pos()) {
|
||||
recordUndo(bv()->cursor(), Undo::DELETE, old_cursor.par());
|
||||
backspace();
|
||||
size_t oldpar = cur.par();
|
||||
if (cursorRight(cur, true)) {
|
||||
recordUndo(cur, Undo::DELETE, oldpar);
|
||||
backspace(cur);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void LyXText::backspace()
|
||||
void LyXText::backspace(LCursor & cur)
|
||||
{
|
||||
// Get the font that is used to calculate the baselineskip
|
||||
ParagraphList::iterator pit = cursorPar();
|
||||
pos_type lastpos = pit->size();
|
||||
|
||||
if (cursor().pos() == 0) {
|
||||
if (cur.pos() == 0) {
|
||||
// The cursor is at the beginning of a paragraph, so
|
||||
// the the backspace will collapse two paragraphs into
|
||||
// one.
|
||||
@ -1316,26 +1320,26 @@ void LyXText::backspace()
|
||||
// left and let the DeleteEmptyParagraphMechanism
|
||||
// handle the actual deletion of the paragraph.
|
||||
|
||||
if (cursor().par()) {
|
||||
cursorLeft(bv());
|
||||
if (cur.par() != 0) {
|
||||
cursorLeft(cur, true);
|
||||
// the layout things can change the height of a row !
|
||||
redoParagraph();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (cursor().par() != 0)
|
||||
recordUndo(bv()->cursor(), Undo::DELETE, cursor().par() - 1);
|
||||
if (cur.par() != 0)
|
||||
recordUndo(cur, Undo::DELETE, cur.par() - 1);
|
||||
|
||||
ParagraphList::iterator tmppit = cursorPar();
|
||||
// We used to do cursorLeftIntern() here, but it is
|
||||
// not a good idea since it triggers the auto-delete
|
||||
// mechanism. So we do a cursorLeftIntern()-lite,
|
||||
// without the dreaded mechanism. (JMarc)
|
||||
if (cursor().par() != 0) {
|
||||
if (cur.par() != 0) {
|
||||
// steps into the above paragraph.
|
||||
setCursorIntern(cursor().par() - 1,
|
||||
getPar(cursor().par() - 1)->size(),
|
||||
setCursorIntern(cur.par() - 1,
|
||||
getPar(cur.par() - 1)->size(),
|
||||
false);
|
||||
}
|
||||
|
||||
@ -1354,32 +1358,31 @@ void LyXText::backspace()
|
||||
&& cpit->getAlign() == tmppit->getAlign()) {
|
||||
mergeParagraph(bufparams, buf.paragraphs(), cpit);
|
||||
|
||||
if (cursor().pos() && cpit->isSeparator(cursor().pos() - 1))
|
||||
cursor().pos(cursor().pos() - 1);
|
||||
if (cur.pos() != 0 && cpit->isSeparator(cur.pos() - 1))
|
||||
--cur.pos();
|
||||
|
||||
// the counters may have changed
|
||||
updateCounters();
|
||||
setCursor(cursor().par(), cursor().pos(), false);
|
||||
setCursor(cur.par(), cur.pos(), false);
|
||||
}
|
||||
} else {
|
||||
// this is the code for a normal backspace, not pasting
|
||||
// any paragraphs
|
||||
recordUndo(bv()->cursor(), Undo::DELETE);
|
||||
recordUndo(cur, Undo::DELETE);
|
||||
// We used to do cursorLeftIntern() here, but it is
|
||||
// not a good idea since it triggers the auto-delete
|
||||
// mechanism. So we do a cursorLeftIntern()-lite,
|
||||
// without the dreaded mechanism. (JMarc)
|
||||
setCursorIntern(cursor().par(), cursor().pos() - 1,
|
||||
false, cursor().boundary());
|
||||
cursorPar()->erase(cursor().pos());
|
||||
setCursorIntern(cur.par(), cur.pos() - 1,
|
||||
false, cur.boundary());
|
||||
cur.paragraph().erase(cur.pos());
|
||||
}
|
||||
|
||||
lastpos = cursorPar()->size();
|
||||
if (cursor().pos() == lastpos)
|
||||
if (cur.pos() == cur.lastpos())
|
||||
setCurrentFont();
|
||||
|
||||
redoParagraph();
|
||||
setCursor(cursor().par(), cursor().pos(), false, cursor().boundary());
|
||||
setCursor(cur.par(), cur.pos(), false, cur.boundary());
|
||||
}
|
||||
|
||||
|
||||
@ -1599,7 +1602,7 @@ void LyXText::draw(PainterInfo & pi, int x, int y) const
|
||||
|
||||
|
||||
// only used for inset right now. should also be used for main text
|
||||
void LyXText::drawSelection(PainterInfo & pi, int x, int y) const
|
||||
void LyXText::drawSelection(PainterInfo &, int x, int y) const
|
||||
{
|
||||
lyxerr << "LyXText::drawSelection at " << x << " " << y << endl;
|
||||
}
|
||||
@ -1618,78 +1621,19 @@ bool LyXText::isFirstRow(ParagraphList::iterator pit, Row const & row) const
|
||||
}
|
||||
|
||||
|
||||
void LyXText::cursorLeftOneWord(CursorSlice & cur)
|
||||
void LyXText::getWord(CursorSlice & from, CursorSlice & to,
|
||||
word_location const loc)
|
||||
{
|
||||
// treat HFills, floats and Insets as words
|
||||
|
||||
ParagraphList::iterator pit = cursorPar();
|
||||
size_t pos = cur.pos();
|
||||
|
||||
while (pos &&
|
||||
(pit->isSeparator(pos - 1) ||
|
||||
pit->isKomma(pos - 1) ||
|
||||
pit->isNewline(pos - 1)) &&
|
||||
!(pit->isHfill(pos - 1) ||
|
||||
pit->isInset(pos - 1)))
|
||||
--pos;
|
||||
|
||||
if (pos &&
|
||||
(pit->isInset(pos - 1) ||
|
||||
pit->isHfill(pos - 1))) {
|
||||
--pos;
|
||||
} else if (!pos) {
|
||||
if (pit != paragraphs().begin()) {
|
||||
--pit;
|
||||
pos = pit->size();
|
||||
}
|
||||
} else { // Here, cur != 0
|
||||
while (pos > 0 && pit->isWord(pos - 1))
|
||||
--pos;
|
||||
}
|
||||
|
||||
cur.par(parOffset(pit));
|
||||
cur.pos(pos);
|
||||
}
|
||||
|
||||
|
||||
void LyXText::cursorRightOneWord(CursorSlice & cur)
|
||||
{
|
||||
// treat floats, HFills and Insets as words
|
||||
ParagraphList::iterator pit = cursorPar();
|
||||
pos_type pos = cur.pos();
|
||||
|
||||
if (pos == pit->size() &&
|
||||
boost::next(pit) != paragraphs().end()) {
|
||||
++pit;
|
||||
pos = 0;
|
||||
} else {
|
||||
// Skip through initial nonword stuff.
|
||||
while (pos < pit->size() && !pit->isWord(pos)) {
|
||||
++pos;
|
||||
}
|
||||
// Advance through word.
|
||||
while (pos < pit->size() && pit->isWord(pos)) {
|
||||
++pos;
|
||||
}
|
||||
}
|
||||
|
||||
cur.par(parOffset(pit));
|
||||
cur.pos(pos);
|
||||
}
|
||||
|
||||
|
||||
void LyXText::getWord(CursorSlice & from, CursorSlice & to, word_location const loc)
|
||||
{
|
||||
ParagraphList::iterator from_par = getPar(from);
|
||||
Paragraph & from_par = *getPar(from);
|
||||
switch (loc) {
|
||||
case lyx::WHOLE_WORD_STRICT:
|
||||
if (from.pos() == 0 || from.pos() == from_par->size()
|
||||
|| from_par->isSeparator(from.pos())
|
||||
|| from_par->isKomma(from.pos())
|
||||
|| from_par->isNewline(from.pos())
|
||||
|| from_par->isSeparator(from.pos() - 1)
|
||||
|| from_par->isKomma(from.pos() - 1)
|
||||
|| from_par->isNewline(from.pos() - 1)) {
|
||||
if (from.pos() == 0 || from.pos() == from_par.size()
|
||||
|| from_par.isSeparator(from.pos())
|
||||
|| from_par.isKomma(from.pos())
|
||||
|| from_par.isNewline(from.pos())
|
||||
|| from_par.isSeparator(from.pos() - 1)
|
||||
|| from_par.isKomma(from.pos() - 1)
|
||||
|| from_par.isNewline(from.pos() - 1)) {
|
||||
to = from;
|
||||
return;
|
||||
}
|
||||
@ -1697,14 +1641,14 @@ void LyXText::getWord(CursorSlice & from, CursorSlice & to, word_location const
|
||||
|
||||
case lyx::WHOLE_WORD:
|
||||
// Move cursor to the beginning, when not already there.
|
||||
if (from.pos() && !from_par->isSeparator(from.pos() - 1)
|
||||
&& !(from_par->isKomma(from.pos() - 1)
|
||||
|| from_par->isNewline(from.pos() - 1)))
|
||||
cursorLeftOneWord(from);
|
||||
if (from.pos() && !from_par.isSeparator(from.pos() - 1)
|
||||
&& !(from_par.isKomma(from.pos() - 1)
|
||||
|| from_par.isNewline(from.pos() - 1)))
|
||||
cursorLeftOneWord(bv()->cursor());
|
||||
break;
|
||||
case lyx::PREVIOUS_WORD:
|
||||
// always move the cursor to the beginning of previous word
|
||||
cursorLeftOneWord(from);
|
||||
cursorLeftOneWord(bv()->cursor());
|
||||
break;
|
||||
case lyx::NEXT_WORD:
|
||||
lyxerr << "LyXText::getWord: NEXT_WORD not implemented yet"
|
||||
@ -1714,15 +1658,15 @@ void LyXText::getWord(CursorSlice & from, CursorSlice & to, word_location const
|
||||
break;
|
||||
}
|
||||
to = from;
|
||||
ParagraphList::iterator to_par = getPar(to);
|
||||
while (to.pos() < to_par->size()
|
||||
&& !to_par->isSeparator(to.pos())
|
||||
&& !to_par->isKomma(to.pos())
|
||||
&& !to_par->isNewline(to.pos())
|
||||
&& !to_par->isHfill(to.pos())
|
||||
&& !to_par->isInset(to.pos()))
|
||||
Paragraph & to_par = *getPar(to);
|
||||
while (to.pos() < to_par.size()
|
||||
&& !to_par.isSeparator(to.pos())
|
||||
&& !to_par.isKomma(to.pos())
|
||||
&& !to_par.isNewline(to.pos())
|
||||
&& !to_par.isHfill(to.pos())
|
||||
&& !to_par.isInset(to.pos()))
|
||||
{
|
||||
to.pos(to.pos() + 1);
|
||||
++to.pos();
|
||||
}
|
||||
}
|
||||
|
||||
|
142
src/text2.C
142
src/text2.C
@ -441,33 +441,30 @@ void LyXText::setFont(LyXFont const & font, bool toggleall)
|
||||
// the cursor set functions have a special mechanism. When they
|
||||
// realize you left an empty paragraph, they will delete it.
|
||||
|
||||
void LyXText::cursorHome()
|
||||
void LyXText::cursorHome(LCursor & cur)
|
||||
{
|
||||
ParagraphList::iterator cpit = cursorPar();
|
||||
setCursor(cpit, cpit->getRow(cursor().pos())->pos());
|
||||
setCursor(cur.par(), cur.textRow().pos());
|
||||
}
|
||||
|
||||
|
||||
void LyXText::cursorEnd()
|
||||
void LyXText::cursorEnd(LCursor & cur)
|
||||
{
|
||||
ParagraphList::iterator cpit = cursorPar();
|
||||
pos_type end = cpit->getRow(cursor().pos())->endpos();
|
||||
// if not on the last row of the par, put the cursor before
|
||||
// the final space
|
||||
setCursor(cpit, end == cpit->size() ? end : end - 1);
|
||||
pos_type const end = cur.textRow().endpos();
|
||||
setCursor(cur.par(), end == cur.lastpos() ? end : end - 1);
|
||||
}
|
||||
|
||||
|
||||
void LyXText::cursorTop()
|
||||
void LyXText::cursorTop(LCursor &)
|
||||
{
|
||||
setCursor(paragraphs().begin(), 0);
|
||||
setCursor(0, 0);
|
||||
}
|
||||
|
||||
|
||||
void LyXText::cursorBottom()
|
||||
void LyXText::cursorBottom(LCursor & cur)
|
||||
{
|
||||
ParagraphList::iterator lastpit = boost::prior(paragraphs().end());
|
||||
setCursor(lastpit, lastpit->size());
|
||||
setCursor(cur.lastpar(), boost::prior(paragraphs().end())->size());
|
||||
}
|
||||
|
||||
|
||||
@ -878,7 +875,7 @@ void LyXText::insertInset(InsetBase * inset)
|
||||
// and fails if the cursor is behind the inset and getInset
|
||||
// does not return the inset!
|
||||
if (isHighlyEditableInset(inset))
|
||||
cursorLeft(true);
|
||||
cursorLeft(bv()->cursor(), true);
|
||||
|
||||
unFreezeUndo();
|
||||
}
|
||||
@ -997,7 +994,7 @@ void LyXText::pasteSelection(size_t sel_index)
|
||||
|
||||
cur.clearSelection();
|
||||
cur.resetAnchor();
|
||||
setCursor(ppp.first, ppp.second);
|
||||
setCursor(parOffset(ppp.first), ppp.second);
|
||||
cur.setSelection();
|
||||
updateCounters();
|
||||
}
|
||||
@ -1011,7 +1008,7 @@ void LyXText::setSelectionRange(lyx::pos_type length)
|
||||
LCursor & cur = bv()->cursor();
|
||||
cur.resetAnchor();
|
||||
while (length--)
|
||||
cursorRight(true);
|
||||
cursorRight(cur, true);
|
||||
cur.setSelection();
|
||||
}
|
||||
|
||||
@ -1059,7 +1056,7 @@ void LyXText::insertStringAsLines(string const & str)
|
||||
|
||||
redoParagraphs(cursorPar(), endpit);
|
||||
cur.resetAnchor();
|
||||
setCursor(pit, pos);
|
||||
setCursor(parOffset(pit), pos);
|
||||
cur.setSelection();
|
||||
}
|
||||
|
||||
@ -1092,12 +1089,6 @@ void LyXText::insertStringAsParagraphs(string const & str)
|
||||
}
|
||||
|
||||
|
||||
void LyXText::setCursor(ParagraphList::iterator pit, pos_type pos)
|
||||
{
|
||||
setCursor(parOffset(pit), pos);
|
||||
}
|
||||
|
||||
|
||||
bool LyXText::setCursor(paroffset_type par, pos_type pos, bool setfont,
|
||||
bool boundary)
|
||||
{
|
||||
@ -1363,91 +1354,87 @@ void LyXText::edit(LCursor & cur, int x, int y)
|
||||
}
|
||||
|
||||
|
||||
bool LyXText::checkAndActivateInset(bool front)
|
||||
bool LyXText::checkAndActivateInset(LCursor & cur, bool front)
|
||||
{
|
||||
if (cursor().pos() == cursorPar()->size())
|
||||
if (cur.pos() == cur.lastpos())
|
||||
return false;
|
||||
InsetBase * inset = cursorPar()->getInset(cursor().pos());
|
||||
InsetBase * inset = cur.nextInset();
|
||||
if (!isHighlyEditableInset(inset))
|
||||
return false;
|
||||
inset->edit(bv()->cursor(), front);
|
||||
inset->edit(cur, front);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
DispatchResult LyXText::moveRight()
|
||||
DispatchResult LyXText::moveRight(LCursor & cur)
|
||||
{
|
||||
if (cursorPar()->isRightToLeftPar(bv()->buffer()->params()))
|
||||
return moveLeftIntern(false, true, false);
|
||||
if (cur.paragraph().isRightToLeftPar(bv()->buffer()->params()))
|
||||
return moveLeftIntern(cur, false, true, false);
|
||||
else
|
||||
return moveRightIntern(true, true, false);
|
||||
return moveRightIntern(cur, true, true, false);
|
||||
}
|
||||
|
||||
|
||||
DispatchResult LyXText::moveLeft()
|
||||
DispatchResult LyXText::moveLeft(LCursor & cur)
|
||||
{
|
||||
if (cursorPar()->isRightToLeftPar(bv()->buffer()->params()))
|
||||
return moveRightIntern(true, true, false);
|
||||
if (cur.paragraph().isRightToLeftPar(bv()->buffer()->params()))
|
||||
return moveRightIntern(cur, true, true, false);
|
||||
else
|
||||
return moveLeftIntern(false, true, false);
|
||||
return moveLeftIntern(cur, false, true, false);
|
||||
}
|
||||
|
||||
|
||||
DispatchResult LyXText::moveRightIntern(bool front, bool activate_inset, bool selecting)
|
||||
DispatchResult LyXText::moveRightIntern(LCursor & cur,
|
||||
bool front, bool activate_inset, bool selecting)
|
||||
{
|
||||
ParagraphList::iterator c_par = cursorPar();
|
||||
if (boost::next(c_par) == paragraphs().end()
|
||||
&& cursor().pos() >= c_par->size())
|
||||
if (cur.par() == cur.lastpar() && cur.pos() == cur.lastpos())
|
||||
return DispatchResult(false, FINISHED_RIGHT);
|
||||
if (activate_inset && checkAndActivateInset(front))
|
||||
if (activate_inset && checkAndActivateInset(cur, front))
|
||||
return DispatchResult(true, true);
|
||||
cursorRight(true);
|
||||
cursorRight(cur, true);
|
||||
if (!selecting)
|
||||
bv()->cursor().clearSelection();
|
||||
cur.clearSelection();
|
||||
return DispatchResult(true);
|
||||
}
|
||||
|
||||
|
||||
DispatchResult LyXText::moveLeftIntern(bool front,
|
||||
bool activate_inset, bool selecting)
|
||||
DispatchResult LyXText::moveLeftIntern(LCursor & cur,
|
||||
bool front, bool activate_inset, bool selecting)
|
||||
{
|
||||
if (cursor().par() == 0 && cursor().pos() <= 0)
|
||||
if (cur.par() == 0 && cur.pos() == 0)
|
||||
return DispatchResult(false, FINISHED);
|
||||
cursorLeft(true);
|
||||
cursorLeft(cur, true);
|
||||
if (!selecting)
|
||||
bv()->cursor().clearSelection();
|
||||
if (activate_inset && checkAndActivateInset(front))
|
||||
cur.clearSelection();
|
||||
if (activate_inset && checkAndActivateInset(cur, front))
|
||||
return DispatchResult(true, true);
|
||||
return DispatchResult(true);
|
||||
}
|
||||
|
||||
|
||||
DispatchResult LyXText::moveUp()
|
||||
DispatchResult LyXText::moveUp(LCursor & cur)
|
||||
{
|
||||
LCursor & cur = bv()->cursor();
|
||||
if (cur.par() == 0 && cursorRow() == firstRow())
|
||||
if (cur.par() == 0 && cur.row() == 0)
|
||||
return DispatchResult(false, FINISHED_UP);
|
||||
cursorUp(false);
|
||||
cursorUp(cur, false);
|
||||
cur.clearSelection();
|
||||
return DispatchResult(true);
|
||||
}
|
||||
|
||||
|
||||
DispatchResult LyXText::moveDown()
|
||||
DispatchResult LyXText::moveDown(LCursor & cur)
|
||||
{
|
||||
LCursor & cur = bv()->cursor();
|
||||
if (cur.par() == cur.lastpar() && cursorRow() == lastRow())
|
||||
if (cur.par() == cur.lastpar() && cur.textRow().endpos() == cur.lastpos())
|
||||
return DispatchResult(false, FINISHED_DOWN);
|
||||
cursorDown(false);
|
||||
cursorDown(cur, false);
|
||||
cur.clearSelection();
|
||||
return DispatchResult(true);
|
||||
}
|
||||
|
||||
|
||||
bool LyXText::cursorLeft(bool internal)
|
||||
bool LyXText::cursorLeft(LCursor & cur, bool internal)
|
||||
{
|
||||
LCursor & cur = bv()->cursor();
|
||||
if (cur.pos() > 0) {
|
||||
if (cur.pos() != 0) {
|
||||
bool boundary = cur.boundary();
|
||||
setCursor(cur.par(), cur.pos() - 1, true, false);
|
||||
if (!internal && !boundary &&
|
||||
@ -1466,9 +1453,8 @@ bool LyXText::cursorLeft(bool internal)
|
||||
}
|
||||
|
||||
|
||||
bool LyXText::cursorRight(bool internal)
|
||||
bool LyXText::cursorRight(LCursor & cur, bool internal)
|
||||
{
|
||||
LCursor & cur = bv()->cursor();
|
||||
if (!internal && cur.boundary()) {
|
||||
setCursor(cur.par(), cur.pos(), true, false);
|
||||
return true;
|
||||
@ -1482,7 +1468,7 @@ bool LyXText::cursorRight(bool internal)
|
||||
return true;
|
||||
}
|
||||
|
||||
if (cur.par() + 1 != int(paragraphs().size())) {
|
||||
if (cur.par() != cur.lastpar()) {
|
||||
setCursor(cur.par() + 1, 0);
|
||||
return true;
|
||||
}
|
||||
@ -1491,9 +1477,8 @@ bool LyXText::cursorRight(bool internal)
|
||||
}
|
||||
|
||||
|
||||
void LyXText::cursorUp(bool selecting)
|
||||
void LyXText::cursorUp(LCursor & cur, bool selecting)
|
||||
{
|
||||
LCursor & cur = bv()->cursor();
|
||||
Row const & row = *cursorRow();
|
||||
int x = cur.x_target();
|
||||
int y = cursorY(cur.current()) - row.baseline() - 1;
|
||||
@ -1507,13 +1492,12 @@ void LyXText::cursorUp(bool selecting)
|
||||
}
|
||||
|
||||
|
||||
void LyXText::cursorDown(bool selecting)
|
||||
void LyXText::cursorDown(LCursor & cur, bool selecting)
|
||||
{
|
||||
LCursor & cur = bv()->cursor();
|
||||
Row const & row = *cursorRow();
|
||||
Row const & row = cur.textRow();
|
||||
int x = cur.x_target();
|
||||
int y = cursorY(cur.current()) - row.baseline() + row.height() + 1;
|
||||
setCursorFromCoordinates(x, y);
|
||||
setCursorFromCoordinates(cur.current(), x, y);
|
||||
|
||||
if (!selecting) {
|
||||
InsetBase * inset_hit = checkInsetHit(cur.x_target(), y);
|
||||
@ -1523,25 +1507,21 @@ void LyXText::cursorDown(bool selecting)
|
||||
}
|
||||
|
||||
|
||||
void LyXText::cursorUpParagraph()
|
||||
void LyXText::cursorUpParagraph(LCursor & cur)
|
||||
{
|
||||
ParagraphList::iterator cpit = cursorPar();
|
||||
if (cursor().pos() > 0)
|
||||
setCursor(cpit, 0);
|
||||
else if (cpit != paragraphs().begin())
|
||||
setCursor(boost::prior(cpit), 0);
|
||||
if (cur.pos() > 0)
|
||||
setCursor(cur.par(), 0);
|
||||
else if (cur.par() != 0)
|
||||
setCursor(cur.par() - 1, 0);
|
||||
}
|
||||
|
||||
|
||||
void LyXText::cursorDownParagraph()
|
||||
void LyXText::cursorDownParagraph(LCursor & cur)
|
||||
{
|
||||
ParagraphList::iterator pit = cursorPar();
|
||||
ParagraphList::iterator next_pit = boost::next(pit);
|
||||
|
||||
if (next_pit != paragraphs().end())
|
||||
setCursor(next_pit, 0);
|
||||
if (cur.par() != cur.lastpar())
|
||||
setCursor(cur.par() + 1, 0);
|
||||
else
|
||||
setCursor(pit, pit->size());
|
||||
setCursor(cur.par(), cur.lastpos());
|
||||
}
|
||||
|
||||
|
||||
@ -1557,7 +1537,7 @@ void LyXText::fixCursorAfterDelete(CursorSlice & cur, CursorSlice const & where)
|
||||
// if cursor position is after the place where the delete occured,
|
||||
// update it
|
||||
if (cur.pos() > where.pos())
|
||||
cur.pos(cur.pos()-1);
|
||||
--cur.pos();
|
||||
|
||||
// check also if we don't want to set the cursor on a spot behind the
|
||||
// pagragraph because we erased the last character.
|
||||
|
174
src/text3.C
174
src/text3.C
@ -24,6 +24,7 @@
|
||||
#include "debug.h"
|
||||
#include "dispatchresult.h"
|
||||
#include "factory.h"
|
||||
#include "FloatList.h"
|
||||
#include "funcrequest.h"
|
||||
#include "gettext.h"
|
||||
#include "intl.h"
|
||||
@ -41,6 +42,7 @@
|
||||
#include "frontends/LyXView.h"
|
||||
|
||||
#include "insets/insetcommand.h"
|
||||
#include "insets/insetfloatlist.h"
|
||||
#include "insets/insetnewline.h"
|
||||
#include "insets/insetspecialchar.h"
|
||||
#include "insets/insettext.h"
|
||||
@ -286,20 +288,19 @@ void LyXText::gotoInset(InsetOld_code code, bool same_content)
|
||||
}
|
||||
|
||||
|
||||
void LyXText::cursorPrevious()
|
||||
void LyXText::cursorPrevious(LCursor & cur)
|
||||
{
|
||||
LCursor & cur = bv()->cursor();
|
||||
pos_type cpos = cur.pos();
|
||||
lyx::paroffset_type cpar = cur.par();
|
||||
|
||||
int x = bv()->cursor().x_target();
|
||||
int x = cur.x_target();
|
||||
int y = bv()->top_y();
|
||||
setCursorFromCoordinates(x, y);
|
||||
|
||||
if (cpar == cur.par() && cpos == cur.pos()) {
|
||||
// we have a row which is taller than the workarea. The
|
||||
// simplest solution is to move to the previous row instead.
|
||||
cursorUp(true);
|
||||
cursorUp(cur, true);
|
||||
}
|
||||
|
||||
bv()->updateScrollbar();
|
||||
@ -307,9 +308,8 @@ void LyXText::cursorPrevious()
|
||||
}
|
||||
|
||||
|
||||
void LyXText::cursorNext()
|
||||
void LyXText::cursorNext(LCursor & cur)
|
||||
{
|
||||
LCursor & cur = bv()->cursor();
|
||||
pos_type cpos = cur.pos();
|
||||
lyx::paroffset_type cpar = cur.par();
|
||||
|
||||
@ -320,7 +320,7 @@ void LyXText::cursorNext()
|
||||
if (cpar == cur.par() && cpos == cur.pos()) {
|
||||
// we have a row which is taller than the workarea. The
|
||||
// simplest solution is to move to the next row instead.
|
||||
cursorDown(true);
|
||||
cursorDown(cur, true);
|
||||
}
|
||||
|
||||
bv()->updateScrollbar();
|
||||
@ -413,19 +413,19 @@ DispatchResult LyXText::dispatch(LCursor & cur, FuncRequest const & cmd)
|
||||
|
||||
case LFUN_DELETE_WORD_FORWARD:
|
||||
cur.clearSelection();
|
||||
deleteWordForward();
|
||||
deleteWordForward(cur);
|
||||
finishChange(cur);
|
||||
break;
|
||||
|
||||
case LFUN_DELETE_WORD_BACKWARD:
|
||||
cur.clearSelection();
|
||||
deleteWordBackward();
|
||||
deleteWordBackward(cur);
|
||||
finishChange(cur);
|
||||
break;
|
||||
|
||||
case LFUN_DELETE_LINE_FORWARD:
|
||||
cur.clearSelection();
|
||||
deleteLineForward();
|
||||
deleteLineForward(cur);
|
||||
finishChange(cur);
|
||||
break;
|
||||
|
||||
@ -433,9 +433,9 @@ DispatchResult LyXText::dispatch(LCursor & cur, FuncRequest const & cmd)
|
||||
if (!cur.mark())
|
||||
cur.clearSelection();
|
||||
if (rtl())
|
||||
cursorLeftOneWord();
|
||||
cursorLeftOneWord(cur);
|
||||
else
|
||||
cursorRightOneWord();
|
||||
cursorRightOneWord(cur);
|
||||
finishChange(cur);
|
||||
break;
|
||||
|
||||
@ -443,23 +443,23 @@ DispatchResult LyXText::dispatch(LCursor & cur, FuncRequest const & cmd)
|
||||
if (!cur.mark())
|
||||
cur.clearSelection();
|
||||
if (rtl())
|
||||
cursorRightOneWord();
|
||||
cursorRightOneWord(cur);
|
||||
else
|
||||
cursorLeftOneWord();
|
||||
cursorLeftOneWord(cur);
|
||||
finishChange(cur);
|
||||
break;
|
||||
|
||||
case LFUN_BEGINNINGBUF:
|
||||
if (!cur.mark())
|
||||
cur.clearSelection();
|
||||
cursorTop();
|
||||
cursorTop(cur);
|
||||
finishChange(cur);
|
||||
break;
|
||||
|
||||
case LFUN_ENDBUF:
|
||||
if (!cur.mark())
|
||||
cur.clearSelection();
|
||||
cursorBottom();
|
||||
cursorBottom(cur);
|
||||
finishChange(cur);
|
||||
break;
|
||||
|
||||
@ -467,9 +467,9 @@ DispatchResult LyXText::dispatch(LCursor & cur, FuncRequest const & cmd)
|
||||
if (!cur.selection())
|
||||
cur.resetAnchor();
|
||||
if (rtl())
|
||||
cursorLeft(true);
|
||||
cursorLeft(cur, true);
|
||||
else
|
||||
cursorRight(true);
|
||||
cursorRight(cur, true);
|
||||
finishChange(cur, true);
|
||||
break;
|
||||
|
||||
@ -477,65 +477,65 @@ DispatchResult LyXText::dispatch(LCursor & cur, FuncRequest const & cmd)
|
||||
if (!cur.selection())
|
||||
cur.resetAnchor();
|
||||
if (rtl())
|
||||
cursorRight(true);
|
||||
cursorRight(cur, true);
|
||||
else
|
||||
cursorLeft(true);
|
||||
cursorLeft(cur, true);
|
||||
finishChange(cur, true);
|
||||
break;
|
||||
|
||||
case LFUN_UPSEL:
|
||||
if (!cur.selection())
|
||||
cur.resetAnchor();
|
||||
cursorUp(true);
|
||||
cursorUp(cur, true);
|
||||
finishChange(cur, true);
|
||||
break;
|
||||
|
||||
case LFUN_DOWNSEL:
|
||||
if (!cur.selection())
|
||||
cur.resetAnchor();
|
||||
cursorDown(true);
|
||||
cursorDown(cur, true);
|
||||
finishChange(cur, true);
|
||||
break;
|
||||
|
||||
case LFUN_UP_PARAGRAPHSEL:
|
||||
if (!cur.selection())
|
||||
cur.resetAnchor();
|
||||
cursorUpParagraph();
|
||||
cursorUpParagraph(cur);
|
||||
finishChange(cur, true);
|
||||
break;
|
||||
|
||||
case LFUN_DOWN_PARAGRAPHSEL:
|
||||
if (!cur.selection())
|
||||
cur.resetAnchor();
|
||||
cursorDownParagraph();
|
||||
cursorDownParagraph(cur);
|
||||
finishChange(cur, true);
|
||||
break;
|
||||
|
||||
case LFUN_PRIORSEL:
|
||||
if (!cur.selection())
|
||||
cur.resetAnchor();
|
||||
cursorPrevious();
|
||||
cursorPrevious(cur);
|
||||
finishChange(cur, true);
|
||||
break;
|
||||
|
||||
case LFUN_NEXTSEL:
|
||||
if (!cur.selection())
|
||||
cur.resetAnchor();
|
||||
cursorNext();
|
||||
cursorNext(cur);
|
||||
finishChange(cur, true);
|
||||
break;
|
||||
|
||||
case LFUN_HOMESEL:
|
||||
if (!cur.selection())
|
||||
cur.resetAnchor();
|
||||
cursorHome();
|
||||
cursorHome(cur);
|
||||
finishChange(cur, true);
|
||||
break;
|
||||
|
||||
case LFUN_ENDSEL:
|
||||
if (!cur.selection())
|
||||
cur.resetAnchor();
|
||||
cursorEnd();
|
||||
cursorEnd(cur);
|
||||
finishChange(cur, true);
|
||||
break;
|
||||
|
||||
@ -543,9 +543,9 @@ DispatchResult LyXText::dispatch(LCursor & cur, FuncRequest const & cmd)
|
||||
if (!cur.selection())
|
||||
cur.resetAnchor();
|
||||
if (rtl())
|
||||
cursorLeftOneWord();
|
||||
cursorLeftOneWord(cur);
|
||||
else
|
||||
cursorRightOneWord();
|
||||
cursorRightOneWord(cur);
|
||||
finishChange(cur, true);
|
||||
break;
|
||||
|
||||
@ -553,9 +553,9 @@ DispatchResult LyXText::dispatch(LCursor & cur, FuncRequest const & cmd)
|
||||
if (!cur.selection())
|
||||
cur.resetAnchor();
|
||||
if (rtl())
|
||||
cursorRightOneWord();
|
||||
cursorRightOneWord(cur);
|
||||
else
|
||||
cursorLeftOneWord();
|
||||
cursorLeftOneWord(cur);
|
||||
finishChange(cur, true);
|
||||
break;
|
||||
|
||||
@ -567,31 +567,31 @@ DispatchResult LyXText::dispatch(LCursor & cur, FuncRequest const & cmd)
|
||||
|
||||
case LFUN_RIGHT:
|
||||
finishChange(cur);
|
||||
return moveRight();
|
||||
return moveRight(cur);
|
||||
|
||||
case LFUN_LEFT:
|
||||
finishChange(cur);
|
||||
return moveLeft();
|
||||
return moveLeft(cur);
|
||||
|
||||
case LFUN_UP:
|
||||
finishChange(cur);
|
||||
return moveUp();
|
||||
return moveUp(cur);
|
||||
|
||||
case LFUN_DOWN:
|
||||
finishChange(cur);
|
||||
return moveDown();
|
||||
return moveDown(cur);
|
||||
|
||||
case LFUN_UP_PARAGRAPH:
|
||||
if (!cur.mark())
|
||||
cur.clearSelection();
|
||||
cursorUpParagraph();
|
||||
cursorUpParagraph(cur);
|
||||
finishChange(cur);
|
||||
break;
|
||||
|
||||
case LFUN_DOWN_PARAGRAPH:
|
||||
if (!cur.mark())
|
||||
cur.clearSelection();
|
||||
cursorDownParagraph();
|
||||
cursorDownParagraph(cur);
|
||||
finishChange(cur, false);
|
||||
break;
|
||||
|
||||
@ -599,31 +599,32 @@ DispatchResult LyXText::dispatch(LCursor & cur, FuncRequest const & cmd)
|
||||
if (!cur.mark())
|
||||
cur.clearSelection();
|
||||
finishChange(cur, false);
|
||||
if (cur.par() == 0 && cursorRow() == firstRow())
|
||||
if (cur.par() == 0 && cur.textRow().pos() == 0)
|
||||
return DispatchResult(false, FINISHED_UP);
|
||||
cursorPrevious();
|
||||
cursorPrevious(cur);
|
||||
break;
|
||||
|
||||
case LFUN_NEXT:
|
||||
if (!cur.mark())
|
||||
cur.clearSelection();
|
||||
finishChange(cur, false);
|
||||
if (cur.par() == cur.lastpar() && cursorRow() == lastRow())
|
||||
if (cur.par() == cur.lastpar()
|
||||
&& cur.textRow().endpos() == cur.lastpos())
|
||||
return DispatchResult(false, FINISHED_DOWN);
|
||||
cursorNext();
|
||||
cursorNext(cur);
|
||||
break;
|
||||
|
||||
case LFUN_HOME:
|
||||
if (!cur.mark())
|
||||
cur.clearSelection();
|
||||
cursorHome();
|
||||
cursorHome(cur);
|
||||
finishChange(cur, false);
|
||||
break;
|
||||
|
||||
case LFUN_END:
|
||||
if (!cur.mark())
|
||||
cur.clearSelection();
|
||||
cursorEnd();
|
||||
cursorEnd(cur);
|
||||
finishChange(cur, false);
|
||||
break;
|
||||
|
||||
@ -639,7 +640,7 @@ DispatchResult LyXText::dispatch(LCursor & cur, FuncRequest const & cmd)
|
||||
|
||||
case LFUN_DELETE:
|
||||
if (!cur.selection()) {
|
||||
Delete();
|
||||
Delete(cur);
|
||||
cur.resetAnchor();
|
||||
// It is possible to make it a lot faster still
|
||||
// just comment out the line below...
|
||||
@ -653,15 +654,12 @@ DispatchResult LyXText::dispatch(LCursor & cur, FuncRequest const & cmd)
|
||||
case LFUN_DELETE_SKIP:
|
||||
// Reverse the effect of LFUN_BREAKPARAGRAPH_SKIP.
|
||||
if (!cur.selection()) {
|
||||
if (cursor().pos() == cursorPar()->size()) {
|
||||
cursorRight(bv);
|
||||
cursorLeft(bv);
|
||||
Delete();
|
||||
cur.resetAnchor();
|
||||
} else {
|
||||
Delete();
|
||||
cur.resetAnchor();
|
||||
if (cur.pos() == cur.lastpos()) {
|
||||
cursorRight(cur, true);
|
||||
cursorLeft(cur, true);
|
||||
}
|
||||
Delete(cur);
|
||||
cur.resetAnchor();
|
||||
} else {
|
||||
cutSelection(true, false);
|
||||
}
|
||||
@ -672,7 +670,7 @@ DispatchResult LyXText::dispatch(LCursor & cur, FuncRequest const & cmd)
|
||||
case LFUN_BACKSPACE:
|
||||
if (!cur.selection()) {
|
||||
if (bv->owner()->getIntl().getTransManager().backspace()) {
|
||||
backspace();
|
||||
backspace(cur);
|
||||
cur.resetAnchor();
|
||||
// It is possible to make it a lot faster still
|
||||
// just comment out the line below...
|
||||
@ -690,7 +688,7 @@ DispatchResult LyXText::dispatch(LCursor & cur, FuncRequest const & cmd)
|
||||
if (!cur.selection()) {
|
||||
#warning look here
|
||||
//CursorSlice cur = cursor();
|
||||
backspace();
|
||||
backspace(cur);
|
||||
//anchor() = cur;
|
||||
} else {
|
||||
cutSelection(true, false);
|
||||
@ -700,7 +698,7 @@ DispatchResult LyXText::dispatch(LCursor & cur, FuncRequest const & cmd)
|
||||
|
||||
case LFUN_BREAKPARAGRAPH:
|
||||
replaceSelection(this);
|
||||
breakParagraph(bv->buffer()->paragraphs(), 0);
|
||||
breakParagraph(cur, 0);
|
||||
bv->update();
|
||||
cur.resetAnchor();
|
||||
bv->switchKeyMap();
|
||||
@ -709,7 +707,7 @@ DispatchResult LyXText::dispatch(LCursor & cur, FuncRequest const & cmd)
|
||||
|
||||
case LFUN_BREAKPARAGRAPHKEEPLAYOUT:
|
||||
replaceSelection(this);
|
||||
breakParagraph(bv->buffer()->paragraphs(), 1);
|
||||
breakParagraph(cur, 1);
|
||||
bv->update();
|
||||
cur.resetAnchor();
|
||||
bv->switchKeyMap();
|
||||
@ -721,16 +719,15 @@ DispatchResult LyXText::dispatch(LCursor & cur, FuncRequest const & cmd)
|
||||
// indentation and add a "defskip" at the top.
|
||||
// Otherwise, do the same as LFUN_BREAKPARAGRAPH.
|
||||
#warning look here
|
||||
// CursorSlice cur = cursor();
|
||||
replaceSelection(this);
|
||||
if (cur.pos() == 0) {
|
||||
ParagraphParameters & params = getPar(cur.current())->params();
|
||||
ParagraphParameters & params = cur.paragraph().params();
|
||||
setParagraph(
|
||||
params.spacing(),
|
||||
params.align(),
|
||||
params.labelWidthString(), 1);
|
||||
} else {
|
||||
breakParagraph(bv->buffer()->paragraphs(), 0);
|
||||
breakParagraph(cur, 0);
|
||||
}
|
||||
bv->update();
|
||||
// anchor() = cur;
|
||||
@ -740,11 +737,11 @@ DispatchResult LyXText::dispatch(LCursor & cur, FuncRequest const & cmd)
|
||||
}
|
||||
|
||||
case LFUN_PARAGRAPH_SPACING: {
|
||||
ParagraphList::iterator pit = cursorPar();
|
||||
Spacing::Space cur_spacing = pit->params().spacing().getSpace();
|
||||
Paragraph & par = cur.paragraph();
|
||||
Spacing::Space cur_spacing = par.params().spacing().getSpace();
|
||||
float cur_value = 1.0;
|
||||
if (cur_spacing == Spacing::Other)
|
||||
cur_value = pit->params().spacing().getValue();
|
||||
cur_value = par.params().spacing().getValue();
|
||||
|
||||
istringstream is(cmd.argument);
|
||||
string tmp;
|
||||
@ -774,7 +771,7 @@ DispatchResult LyXText::dispatch(LCursor & cur, FuncRequest const & cmd)
|
||||
<< cmd.argument << endl;
|
||||
}
|
||||
if (cur_spacing != new_spacing || cur_value != new_value) {
|
||||
pit->params().spacing(Spacing(new_spacing, new_value));
|
||||
par.params().spacing(Spacing(new_spacing, new_value));
|
||||
redoParagraph();
|
||||
bv->update();
|
||||
}
|
||||
@ -890,7 +887,7 @@ DispatchResult LyXText::dispatch(LCursor & cur, FuncRequest const & cmd)
|
||||
return DispatchResult(false);
|
||||
if (!cur.selection())
|
||||
cur.resetAnchor();
|
||||
cursorTop();
|
||||
cursorTop(cur);
|
||||
finishChange(cur, true);
|
||||
break;
|
||||
|
||||
@ -899,7 +896,7 @@ DispatchResult LyXText::dispatch(LCursor & cur, FuncRequest const & cmd)
|
||||
return DispatchResult(false);
|
||||
if (!cur.selection())
|
||||
cur.resetAnchor();
|
||||
cursorBottom();
|
||||
cursorBottom(cur);
|
||||
finishChange(cur, true);
|
||||
break;
|
||||
|
||||
@ -1070,9 +1067,9 @@ DispatchResult LyXText::dispatch(LCursor & cur, FuncRequest const & cmd)
|
||||
case LFUN_MOUSE_TRIPLE:
|
||||
if (cmd.button() == mouse_button::button1) {
|
||||
selection_possible = true;
|
||||
cursorHome();
|
||||
cursorHome(cur);
|
||||
cur.resetAnchor();
|
||||
cursorEnd();
|
||||
cursorEnd(cur);
|
||||
cur.setSelection();
|
||||
bv->haveSelection(cur.selection());
|
||||
}
|
||||
@ -1107,9 +1104,9 @@ DispatchResult LyXText::dispatch(LCursor & cur, FuncRequest const & cmd)
|
||||
// FIXME: shouldn't be top-text-specific
|
||||
if (cursorrow == cursorRow() && !in_inset_) {
|
||||
if (cmd.y - bv->top_y() >= bv->workHeight())
|
||||
cursorDown(true);
|
||||
cursorDown(cur, true);
|
||||
else if (cmd.y - bv->top_y() < 0)
|
||||
cursorUp(true);
|
||||
cursorUp(cur, true);
|
||||
}
|
||||
|
||||
// don't set anchor_
|
||||
@ -1450,31 +1447,31 @@ DispatchResult LyXText::dispatch(LCursor & cur, FuncRequest const & cmd)
|
||||
case LFUN_FINISHED_LEFT:
|
||||
lyxerr << "handle LFUN_FINISHED_LEFT" << endl;
|
||||
cur.pop(cur.currentDepth());
|
||||
cur.bv().cursor() = cur;
|
||||
if (rtl())
|
||||
cursorLeft(true);
|
||||
cursorLeft(cur, true);
|
||||
cur.bv().cursor() = cur;
|
||||
break;
|
||||
|
||||
case LFUN_FINISHED_RIGHT:
|
||||
lyxerr << "handle LFUN_FINISHED_RIGHT" << endl;
|
||||
cur.pop(cur.currentDepth());
|
||||
cur.bv().cursor() = cur;
|
||||
if (!rtl())
|
||||
cursorRight(true);
|
||||
cursorRight(cur, true);
|
||||
cur.bv().cursor() = cur;
|
||||
break;
|
||||
|
||||
case LFUN_FINISHED_UP:
|
||||
lyxerr << "handle LFUN_FINISHED_UP" << endl;
|
||||
cur.pop(cur.currentDepth());
|
||||
cursorUp(cur, true);
|
||||
cur.bv().cursor() = cur;
|
||||
cursorUp(true);
|
||||
break;
|
||||
|
||||
case LFUN_FINISHED_DOWN:
|
||||
lyxerr << "handle LFUN_FINISHED_DOWN" << endl;
|
||||
cur.pop(cur.currentDepth());
|
||||
cursorDown(cur, true);
|
||||
cur.bv().cursor() = cur;
|
||||
cursorDown(true);
|
||||
break;
|
||||
|
||||
case LFUN_LAYOUT_PARAGRAPH: {
|
||||
@ -1524,6 +1521,31 @@ DispatchResult LyXText::dispatch(LCursor & cur, FuncRequest const & cmd)
|
||||
.TranslateAndInsert(cmd.argument[0], this);
|
||||
break;
|
||||
|
||||
case LFUN_FLOAT_LIST: {
|
||||
LyXTextClass const & tclass = bv->buffer()->params().getLyXTextClass();
|
||||
if (tclass.floats().typeExist(cmd.argument)) {
|
||||
// not quite sure if we want this...
|
||||
recordUndo(cur);
|
||||
freezeUndo();
|
||||
cur.clearSelection();
|
||||
breakParagraph(cur);
|
||||
|
||||
if (cur.lastpos() != 0) {
|
||||
cursorLeft(cur, true);
|
||||
breakParagraph(cur);
|
||||
}
|
||||
|
||||
setLayout(tclass.defaultLayoutName());
|
||||
setParagraph(Spacing(), LYX_ALIGN_LAYOUT, string(), 0);
|
||||
insertInset(new InsetFloatList(cmd.argument));
|
||||
unFreezeUndo();
|
||||
} else {
|
||||
lyxerr << "Non-existent float type: "
|
||||
<< cmd.argument << endl;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
return DispatchResult(false);
|
||||
}
|
||||
|
@ -101,7 +101,7 @@ void recordUndo(LCursor & cur, Undo::undo_kind kind,
|
||||
void recordUndo(LCursor & cur, Undo::undo_kind kind, lyx::paroffset_type from);
|
||||
|
||||
/// convienience: prepare undo for the single paragraph containing the cursor
|
||||
void recordUndo(LCursor & cur, Undo::undo_kind kind);
|
||||
void recordUndo(LCursor & cur, Undo::undo_kind kind = Undo::ATOMIC);
|
||||
|
||||
/// convienience: prepare undo for the single paragraph containing the cursor
|
||||
void recordUndoFullDocument(LCursor & cur);
|
||||
|
Loading…
Reference in New Issue
Block a user