- if (!gotoNextInset(tmpcur, codes, contents)) {
- if (tmpcur != doc_iterator_begin(tmpcur.inset())) {
- tmpcur.reset(tmpcur.bottom().inset());
- if (!gotoNextInset(tmpcur, codes, contents))
- bv->cursor().message(_("No more insets"));
- } else {
- bv->cursor().message(_("No more insets"));
- }
+ if (!findNextInset(tmpdit, codes, contents)) {
+ if (dit.depth() != 1 || dit.pit() != 0 || dit.pos() != 0) {
+ tmpdit = doc_iterator_begin(tmpdit.bottom().inset());
+ if (!findNextInset(tmpdit, codes, contents)) {
+ return false;
+ }
+ } else
+ return false;
+ }
+
+ dit = tmpdit;
+ return true;
+}
+
+
+void findInset(DocIterator & dit, InsetBase_code code, bool same_content)
+{
+ findInset(dit, vector<InsetBase_code>(1, code), same_content);
+}
+
+
+void gotoInset(BufferView * bv, vector<InsetBase_code> const & codes,
+ bool same_content)
+{
+ LCursor tmpcur = bv->cursor();
+ if (!findInset(tmpcur, codes, same_content)) {
+ bv->cursor().message(_("No more insets"));
+ return;