#include "FloatList.h"
using std::copy;
+using std::find;
using std::endl;
+using std::find;
using std::pair;
false);
UpdateCounters(bview, cursor.row());
ClearSelection();
- SetSelection();
+ SetSelection(bview);
SetCursor(bview, tmpcursor.par(), tmpcursor.pos(), true);
}
SetCursor(bview, sel_end_cursor.par(), sel_end_cursor.pos());
UpdateCounters(bview, cursor.row());
ClearSelection();
- SetSelection();
+ SetSelection(bview);
SetCursor(bview, tmpcursor.par(), tmpcursor.pos());
}
SetCursor(bview, sel_end_cursor.par(), sel_end_cursor.pos());
UpdateCounters(bview, cursor.row());
ClearSelection();
- SetSelection();
+ SetSelection(bview);
SetCursor(bview, tmpcursor.par(), tmpcursor.pos());
}
sel_cursor = cursor;
SetCursor(bview, sel_end_cursor.par(), sel_end_cursor.pos());
ClearSelection();
- SetSelection();
+ SetSelection(bview);
SetCursor(bview, tmpcursor.par(), tmpcursor.pos(), true,
tmpcursor.boundary());
}
* They also delete the corresponding row */
// need the selection cursor:
-void LyXText::SetSelection()
+void LyXText::SetSelection(BufferView * bview)
{
+ const bool lsel = selection;
+
if (!selection) {
last_sel_cursor = sel_cursor;
sel_start_cursor = sel_cursor;
if (sel_start_cursor.par() == sel_end_cursor.par() &&
sel_start_cursor.pos() == sel_end_cursor.pos())
selection = false;
+
+ if (inset_owner && (selection || lsel))
+ inset_owner->SetUpdateStatus(bview, InsetText::SELECTION);
}
SetCursor(bview, cursor.par(), cursor.pos());
sel_cursor = cursor;
}
+ if (inset_owner)
+ inset_owner->SetUpdateStatus(bview, InsetText::CURSOR_PAR);
}
SetCursor(bview, sel_start_cursor.par(), sel_start_cursor.pos());
sel_cursor = cursor;
SetCursor(bview, sel_end_cursor.par(), sel_end_cursor.pos());
- SetSelection();
+ SetSelection(bview);
SetCursor(bview, tmpcursor.par(), tmpcursor.pos());
if (inset_owner)
bview->updateInset(inset_owner, true);
SetCursor(bview, sel_start_cursor.par(), sel_start_cursor.pos());
sel_cursor = cursor;
SetCursor(bview, sel_end_cursor.par(), sel_end_cursor.pos());
- SetSelection();
+ SetSelection(bview);
SetCursor(bview, tmpcursor.par(), tmpcursor.pos());
}
Floating const & fl
= floatList.getType(tmp->type());
// We should get the correct number here too.
- s = fl.name + " #:";
+ s = fl.name() + " #:";
} else {
/* par->SetLayout(0);
s = layout->labelstring; */
* The character will not be inserted a
* second time */
#if 1
- // if we enter a text-inset the cursor should be to the left side
- // of it! This couldn't happen before as Undo was not handled inside
+ // If we enter a highly editable inset the cursor should be to before
+ // the inset. This couldn't happen before as Undo was not handled inside
// inset now after the Undo LyX tries to call inset->Edit(...) again
// and cannot do this as the cursor is behind the inset and GetInset
// does not return the inset!
- if (inset->IsTextInset()) {
- if (cursor.par()->isRightToLeftPar(bview->buffer()->params))
- CursorRight(bview);
- else
- CursorLeft(bview);
+ if (inset->Editable() == Inset::HIGHLY_EDITABLE) {
+ CursorLeft(bview, true);
}
#endif
}
sel_cursor = cursor;
SetCursor(bview, actpar, pos);
- SetSelection();
+ SetSelection(bview);
UpdateCounters(bview, cursor.row());
}
sel_cursor = cursor;
for (int i = 0; str[i]; ++i)
CursorRight(bview);
- SetSelection();
+ SetSelection(bview);
}
SetCursor(bview, cursor.par(), cursor.pos());
sel_cursor = cursor;
SetCursor(bview, par, pos);
- SetSelection();
+ SetSelection(bview);
}
}
-bool LyXText::GotoNextError(BufferView * bview) const
+bool LyXText::GotoNextInset(BufferView * bview,
+ std::vector<Inset::Code> const & codes,
+ string const & contents) const
{
LyXCursor res = cursor;
+ Inset * inset;
do {
if (res.pos() < res.par()->Last() - 1) {
res.pos(res.pos() + 1);
} while (res.par() &&
!(res.par()->GetChar(res.pos()) == LyXParagraph::META_INSET
- && res.par()->GetInset(res.pos())->AutoDelete()));
-
- if (res.par()) {
- SetCursor(bview, res.par(), res.pos());
- return true;
- }
- return false;
-}
-
+ && (inset = res.par()->GetInset(res.pos())) != 0
+ && find(codes.begin(), codes.end(), inset->LyxCode())
+ != codes.end()
+ && (contents.empty() ||
+ static_cast<InsetCommand *>(res.par()->GetInset(res.pos()))->getContents()
+ == contents)));
-bool LyXText::GotoNextNote(BufferView * bview) const
-{
- LyXCursor res = cursor;
- do {
- if (res.pos() < res.par()->Last() - 1) {
- res.pos(res.pos() + 1);
- } else {
- res.par(res.par()->Next());
- res.pos(0);
- }
-
- } while (res.par() &&
- !(res.par()->GetChar(res.pos()) == LyXParagraph::META_INSET
- && res.par()->GetInset(res.pos())->LyxCode() == Inset::IGNORE_CODE));
-
if (res.par()) {
SetCursor(bview, res.par(), res.pos());
return true;