ParagraphList & pars, pit_type pit, pos_type pos)
{
// create a new paragraph
- Paragraph & tmp = *pars.insert(lyx::next(pars.begin(), pit + 1),
- Paragraph());
+ Paragraph & tmp = *pars.insert(pars.iterator_at(pit + 1), Paragraph());
Paragraph & par = pars[pit];
tmp.setInsetOwner(&par.inInset());
// move the change of the end-of-paragraph character
par.setChange(par.size(), change);
- pars.erase(lyx::next(pars.begin(), par_offset + 1));
+ pars.erase(pars.iterator_at(par_offset + 1));
}
}
}
// Final change goes to paragraph break:
- par.setChange(par.size(), change);
+ if (inset().allowMultiPar())
+ par.setChange(par.size(), change);
// Initialize begin_of_body_ on load; redoParagraph maintains
par.setBeginOfBody();
ParagraphList & pars = text.paragraphs();
// create a new paragraph, and insert into the list
ParagraphList::iterator tmp =
- pars.insert(lyx::next(pars.begin(), par_offset + 1),
- Paragraph());
+ pars.insert(pars.iterator_at(par_offset + 1), Paragraph());
Paragraph & par = pars[par_offset];
tmp->params().depth(par.params().depth());
tmp->params().noindent(par.params().noindent());
+ tmp->params().spacing(par.params().spacing());
// move everything behind the break position
// to the new paragraph
pit_type pit = cur.pit();
pos_type pos = cur.pos();
+ // The special chars we handle
+ map<wchar_t, InsetSpecialChar::Kind> specialchars;
+ specialchars[0x200c] = InsetSpecialChar::LIGATURE_BREAK;
+ specialchars[0x200b] = InsetSpecialChar::ALLOWBREAK;
+ specialchars[0x2026] = InsetSpecialChar::LDOTS;
+ specialchars[0x2011] = InsetSpecialChar::NOBREAKDASH;
+
// insert the string, don't insert doublespace
bool space_inserted = true;
for (auto const & ch : str) {
++pos;
space_inserted = true;
}
+ } else if (specialchars.find(ch) != specialchars.end()) {
+ par.insertInset(pos, new InsetSpecialChar(specialchars.find(ch)->second),
+ font, bparams.track_changes ?
+ Change(Change::INSERTED)
+ : Change(Change::UNCHANGED));
+ ++pos;
+ space_inserted = false;
} else if (!isPrintable(ch)) {
- // Ignore unprintables
+ // Ignore (other) unprintables
continue;
} else {
// just insert the character
static docstring const number_operators = from_ascii("+-/*");
static docstring const number_unary_operators = from_ascii("+-");
- // European Number Separators: comma, dot etc.
+ // Common Number Separators: comma, dot etc.
// European Number Terminators: percent, permille, degree, euro etc.
if (cur.current_font.fontInfo().number() == FONT_ON) {
if (!isDigitASCII(c) && !contains(number_operators, c) &&
- !(isEuropeanNumberSeparator(c) &&
+ !(isCommonNumberSeparator(c) &&
cur.pos() != 0 &&
cur.pos() != cur.lastpos() &&
tm.displayFont(pit, cur.pos()).fontInfo().number() == FONT_ON &&
) {
setCharFont(pit, cur.pos() - 1, cur.current_font,
tm.font_);
- } else if (isEuropeanNumberSeparator(ch)
+ } else if (isCommonNumberSeparator(ch)
&& cur.pos() >= 2
&& tm.displayFont(pit, cur.pos() - 2).fontInfo().number() == FONT_ON) {
setCharFont(pit, cur.pos() - 1, cur.current_font,
if (cur.lastpos() == 0
|| (cur.lastpos() == 1 && par.isSeparator(0))) {
cur.recordUndo(prevcur.pit());
- plist.erase(lyx::next(plist.begin(), cur.pit()));
+ plist.erase(plist.iterator_at(cur.pit()));
needsUpdate = true;
}
// is previous par empty?
else if (prevcur.lastpos() == 0
|| (prevcur.lastpos() == 1 && prevpar.isSeparator(0))) {
cur.recordUndo(prevcur.pit());
- plist.erase(lyx::next(plist.begin(), prevcur.pit()));
+ plist.erase(plist.iterator_at(prevcur.pit()));
needsUpdate = true;
}
// FIXME: Do we really not want to allow this???
// save position inside inset
pos_type spos = cur.pos();
pit_type spit = cur.pit();
- ParagraphList plist;
- if (cur.lastpit() != 0 || cur.lastpos() != 0)
- plist = paragraphs();
+ bool const inset_non_empty = cur.lastpit() != 0 || cur.lastpos() != 0;
cur.popBackward();
// update cursor offset
if (spit == 0)
++cur.pos();
Buffer & b = *cur.buffer();
- if (!plist.empty()) {
+ // Is there anything in this text?
+ if (inset_non_empty) {
// see bug 7319
// we clear the cache so that we won't get conflicts with labels
// that get pasted into the buffer. we should update this before
// but we'll try the cheaper solution here.
cur.buffer()->clearReferenceCache();
+ ParagraphList & plist = paragraphs();
if (!lyxrc.ct_markup_copied)
// Do not revive deleted text
lyx::acceptChanges(plist, b.params());