if (!cur.paragraph().isPassThru() && owner_->lyxCode() != IPA_CODE &&
cur.real_current_font.fontInfo().family() != TYPEWRITER_FAMILY &&
c == '-' && pos > 0) {
- if (par.getChar(pos - 1) == '-') {
+ pos_type prev_pos = pos - 1;
+ while (prev_pos > 0 && par.isDeleted(prev_pos))
+ --prev_pos;
+ if (!par.isDeleted(prev_pos) && par.getChar(prev_pos) == '-') {
// convert "--" to endash
- par.eraseChar(pos - 1, cur.buffer()->params().track_changes);
+ par.eraseChar(prev_pos, cur.buffer()->params().track_changes);
c = 0x2013;
pos--;
- } else if (par.getChar(pos - 1) == 0x2013) {
+ } else if (!par.isDeleted(prev_pos) && par.getChar(prev_pos) == 0x2013) {
// convert "---" to emdash
par.eraseChar(pos - 1, cur.buffer()->params().track_changes);
c = 0x2014;
if (!atFirstOrLastRow) {
needsUpdate |= cur.selHandle(select);
- cur.upDownInText(up, needsUpdate);
+ needsUpdate |= cur.upDownInText(up);
needsUpdate |= cur.beforeDispatchCursor().inMathed();
} else {
pos_type newpos = up ? 0 : cur.lastpos();
needsUpdate |= cur.selHandle(select);
// we do not reset the targetx of the cursor
cur.pos() = newpos;
- needsUpdate |= bv->checkDepm(cur, bv->cursor());
- cur.updateTextTargetOffset();
- if (needsUpdate)
+ if (bv->checkDepm(cur, bv->cursor())) {
+ needsUpdate = true;
cur.forceBufferUpdate();
+ }
+ cur.updateTextTargetOffset();
break;
}
// the selection right now, but wait for the next dispatch.
if (select)
needsUpdate |= cur.selHandle(select);
- cur.upDownInText(up, needsUpdate);
+ needsUpdate |= cur.upDownInText(up);
cur.undispatched();
}
toggleAndShow(cur, this, font, toggleall);
cur.message(bformat(_("Text properties applied: %1$s"), props));
} else
- LYXERR0("Invalid argument of textstyle-update");
+ cur.message(_("Invalid argument of textstyle-update"));
break;
}
}
}
- // FIXME: The cursor flag is reset two lines below
- // so we need to check here if some of the LFUN did touch that.
- // for now only Text::erase() and Text::backspace() do that.
- // The plan is to verify all the LFUNs and then to remove this
- // singleParUpdate boolean altogether.
- if (cur.result().screenUpdate() & Update::Force) {
- singleParUpdate = false;
- needsUpdate = true;
- }
-
// FIXME: the following code should go in favor of fine grained
// update flag treatment.
- if (singleParUpdate || cur.result().screenUpdate() & Update::SinglePar) {
+ if (needsUpdate || cur.result().screenUpdate() & Update::Force)
+ cur.screenUpdateFlags(Update::Force | Update::FitCursor);
+ else if (singleParUpdate || cur.result().screenUpdate() & Update::SinglePar) {
// Inserting characters does not change par height in general. So, try
// to update _only_ this paragraph. BufferView will detect if a full
// metrics update is needed anyway.
cur.screenUpdateFlags(Update::SinglePar | Update::FitCursor);
return;
}
- if (needsUpdate)
- cur.screenUpdateFlags(Update::Force | Update::FitCursor);
else {
// oldSelection is a backup of cur.selection() at the beginning of the function.
if (!oldSelection && !cur.selection())