#include "insets/InsetRef.h"
#include "insets/InsetText.h"
+#include "mathed/MathData.h"
+
#include "frontends/alert.h"
#include "frontends/Application.h"
#include "frontends/Delegates.h"
return Change(Change::UNCHANGED);
DocIterator dit = d->cursor_.selectionBegin();
+ // The selected content might have been changed (see #7685)
+ while (dit.inMathed())
+ // Find enclosing text cursor
+ dit.pop_back();
return dit.paragraph().lookupChange(dit.pos());
}
case LFUN_BIBTEX_DATABASE_ADD:
case LFUN_BIBTEX_DATABASE_DEL:
case LFUN_STATISTICS:
- case LFUN_BRANCH_ADD_INSERT:
case LFUN_KEYMAP_OFF:
case LFUN_KEYMAP_PRIMARY:
case LFUN_KEYMAP_SECONDARY:
case LFUN_CHANGES_TRACK:
flag.setEnabled(true);
- flag.setOnOff(buffer_.params().trackChanges);
+ flag.setOnOff(buffer_.params().track_changes);
break;
case LFUN_CHANGES_OUTPUT:
flag.setEnabled(true);
- flag.setOnOff(buffer_.params().outputChanges);
+ flag.setOnOff(buffer_.params().output_changes);
break;
case LFUN_CHANGES_MERGE:
flag.setEnabled(cur.inset().allowParagraphCustomization(cur.idx()));
break;
+ case LFUN_BRANCH_ADD_INSERT:
+ flag.setEnabled(!(cur.inTexted() && cur.paragraph().isPassThru()));
+ break;
+
case LFUN_DIALOG_SHOW_NEW_INSET:
// FIXME: this is wrong, but I do not understand the
// intent (JMarc)
}
case LFUN_CHANGES_TRACK:
- buffer_.params().trackChanges = !buffer_.params().trackChanges;
+ buffer_.params().track_changes = !buffer_.params().track_changes;
break;
case LFUN_CHANGES_OUTPUT:
- buffer_.params().outputChanges = !buffer_.params().outputChanges;
- if (buffer_.params().outputChanges) {
+ buffer_.params().output_changes = !buffer_.params().output_changes;
+ if (buffer_.params().output_changes) {
bool dvipost = LaTeXFeatures::isAvailable("dvipost");
bool xcolorulem = LaTeXFeatures::isAvailable("ulem") &&
LaTeXFeatures::isAvailable("xcolor");
case LFUN_WORD_FIND_FORWARD:
case LFUN_WORD_FIND_BACKWARD: {
+ // FIXME THREAD
+ // Would it maybe be better if this variable were view specific anyway?
static docstring last_search;
docstring searched_string;
docstring const data =
find2string(searched_string, true, false, fw);
bool found = lyxfind(this, FuncRequest(LFUN_WORD_FIND, data));
- if (found)
+ if (found) {
dr.screenUpdate(Update::Force | Update::FitCursor);
+ cur.dispatched();
+ dispatched = true;
+ } else {
+ cur.undispatched();
+ dispatched = false;
+ }
break;
}
lyx::dispatch(FuncRequest(LFUN_DIALOG_SHOW, "findreplace"));
break;
}
- if (lyxfind(this, req))
+ if (lyxfind(this, req)) {
dr.screenUpdate(Update::Force | Update::FitCursor);
- else
- message(_("String not found."));
+ cur.dispatched();
+ dispatched = true;
+ } else {
+ cur.undispatched();
+ dispatched = false;
+ }
d->search_request_cache_ = req;
break;
}
if (lyxreplace(this, cmd, has_deleted)) {
dr.forceBufferUpdate();
dr.screenUpdate(Update::Force | Update::FitCursor);
+ cur.dispatched();
+ dispatched = true;
+ } else {
+ cur.undispatched();
+ dispatched = false;
}
break;
}
return false;
d->cursor_ = cur;
+
+ // we would rather not do this here, but it needs to be done before
+ // the changed() signal is sent.
+ buffer_.updateBuffer();
- cur.forceBufferUpdate();
- cur.screenUpdateFlags(Update::Force);
+ buffer_.changed(true);
return true;
}
bool BufferView::selectIfEmpty(DocIterator & cur)
{
- if (!cur.paragraph().empty())
+ if ((cur.inTexted() && !cur.paragraph().empty())
+ || (cur.inMathed() && !cur.cell().empty()))
return false;
pit_type const beg_pit = cur.pit();