#include "Cursor.h"
#include "CutAndPaste.h"
#include "DispatchResult.h"
+#include "Encoding.h"
#include "ErrorList.h"
#include "FuncRequest.h"
#include "factory.h"
}
// Move over the end-of-par change information
tmp.setChange(tmp.size(), par.lookupChange(par.size()));
- par.setChange(par.size(), Change(bparams.trackChanges ?
+ par.setChange(par.size(), Change(bparams.track_changes ?
Change::INSERTED : Change::UNCHANGED));
}
}
// Move over the end-of-par change information
tmp->setChange(tmp->size(), par.lookupChange(par.size()));
- par.setChange(par.size(), Change(bparams.trackChanges ?
+ par.setChange(par.size(), Change(bparams.track_changes ?
Change::INSERTED : Change::UNCHANGED));
if (pos) {
// Always break behind a space
// It is better to erase the space (Dekel)
if (cur.pos() != cur.lastpos() && cpar.isLineSeparator(cur.pos()))
- cpar.eraseChar(cur.pos(), cur.buffer()->params().trackChanges);
+ cpar.eraseChar(cur.pos(), cur.buffer()->params().track_changes);
// What should the layout for the new paragraph be?
bool keep_layout = layout.isEnvironment()
}
while (!pars_[next_par].empty() && pars_[next_par].isNewline(0)) {
- if (!pars_[next_par].eraseChar(0, cur.buffer()->params().trackChanges))
+ if (!pars_[next_par].eraseChar(0, cur.buffer()->params().track_changes))
break; // the character couldn't be deleted physically due to change tracking
}
} else if (*cit == '\t') {
if (!par.isFreeSpacing()) {
// tabs are like spaces here
- par.insertChar(pos, ' ', font, bparams.trackChanges);
+ par.insertChar(pos, ' ', font, bparams.track_changes);
++pos;
space_inserted = true;
} else {
- par.insertChar(pos, *cit, font, bparams.trackChanges);
+ par.insertChar(pos, *cit, font, bparams.track_changes);
++pos;
space_inserted = true;
}
continue;
} else {
// just insert the character
- par.insertChar(pos, *cit, font, bparams.trackChanges);
+ par.insertChar(pos, *cit, font, bparams.track_changes);
++pos;
space_inserted = (*cit == ' ');
}
}
}
+ // Prevent to insert uncodable characters in verbatim and ERT
+ // (workaround for bug 9012)
+ if (cur.paragraph().isPassThru() && cur.current_font.language()) {
+ Encoding const * e = cur.current_font.language()->encoding();
+ if (!e->encodable(c)) {
+ cur.message(_("Character is uncodable in verbatim paragraphs."));
+ return;
+ }
+ }
+
par.insertChar(cur.pos(), c, cur.current_font,
- cur.buffer()->params().trackChanges);
+ cur.buffer()->params().track_changes);
cur.checkBufferStructure();
// cur.screenUpdateFlags(Update::Force);
// finally, invoke the DEPM
- deleteEmptyParagraphMechanism(begPit, endPit, cur.buffer()->params().trackChanges);
+ deleteEmptyParagraphMechanism(begPit, endPit, cur.buffer()->params().track_changes);
//
{
BufferParams const & bparams = owner_->buffer().params();
lyx::acceptChanges(pars_, bparams);
- deleteEmptyParagraphMechanism(0, pars_.size() - 1, bparams.trackChanges);
+ deleteEmptyParagraphMechanism(0, pars_.size() - 1, bparams.track_changes);
}
}
// finally, invoke the DEPM
- deleteEmptyParagraphMechanism(0, pars_size - 1, bparams.trackChanges);
+ deleteEmptyParagraphMechanism(0, pars_size - 1, bparams.track_changes);
}
// any paragraphs
cur.recordUndo(DELETE_UNDO);
bool const was_inset = cur.paragraph().isInset(cur.pos());
- if(!par.eraseChar(cur.pos(), cur.buffer()->params().trackChanges))
+ if(!par.eraseChar(cur.pos(), cur.buffer()->params().track_changes))
// the character has been logically deleted only => skip it
cur.top().forwardPos();
if (cur.pit() == cur.lastpit())
return dissolveInset(cur);
- if (!par.isMergedOnEndOfParDeletion(cur.buffer()->params().trackChanges)) {
+ if (!par.isMergedOnEndOfParDeletion(cur.buffer()->params().track_changes)) {
par.setChange(cur.pos(), Change(Change::DELETED));
cur.forwardPos();
needsUpdate = true;
Cursor prev_cur = cur;
--prev_cur.pit();
- if (!prev_cur.paragraph().isMergedOnEndOfParDeletion(cur.buffer()->params().trackChanges)) {
+ if (!prev_cur.paragraph().isMergedOnEndOfParDeletion(cur.buffer()->params().track_changes)) {
cur.recordUndo(ATOMIC_UNDO, prev_cur.pit(), prev_cur.pit());
prev_cur.paragraph().setChange(prev_cur.lastpos(), Change(Change::DELETED));
setCursorIntern(cur, prev_cur.pit(), prev_cur.lastpos());
setCursorIntern(cur, cur.pit(), cur.pos() - 1,
false, cur.boundary());
bool const was_inset = cur.paragraph().isInset(cur.pos());
- cur.paragraph().eraseChar(cur.pos(), cur.buffer()->params().trackChanges);
+ cur.paragraph().eraseChar(cur.pos(), cur.buffer()->params().track_changes);
if (was_inset)
cur.forceBufferUpdate();
else
spos += cur.pos();
spit += cur.pit();
Buffer & b = *cur.buffer();
- cur.paragraph().eraseChar(cur.pos(), b.params().trackChanges);
+ cur.paragraph().eraseChar(cur.pos(), b.params().track_changes);
if (!plist.empty()) {
// see bug 7319
Paragraph const & par = cur.paragraph();
odocstringstream os;
- if (buf.params().trackChanges)
+ if (buf.params().track_changes)
os << _("[Change Tracking] ");
Change change = par.lookupChange(cur.pos());
}
-void Text::forToc(docstring & os, size_t maxlen, bool shorten) const
+void Text::forOutliner(docstring & os, size_t maxlen, bool shorten) const
{
if (maxlen == 0)
maxlen = std::numeric_limits<std::size_t>::max();
else
LASSERT(maxlen >= 8, maxlen = TOC_ENTRY_LENGTH);
for (size_t i = 0; i != pars_.size() && os.length() < maxlen; ++i)
- pars_[i].forToc(os, maxlen);
+ pars_[i].forOutliner(os, maxlen);
if (shorten && os.length() >= maxlen)
os = os.substr(0, maxlen - 3) + from_ascii("...");
}
// And finally, we are ready to perform the transposition.
// Track the changes if Change Tracking is enabled.
- bool const trackChanges = cur.buffer()->params().trackChanges;
+ bool const trackChanges = cur.buffer()->params().track_changes;
cur.recordUndo();
CompletionList const * Text::createCompletionList(Cursor const & cur) const
{
- WordList const * list = theWordList(*cur.getFont().language());
+ WordList const * list = theWordList(cur.getFont().language()->lang());
return new TextCompletionList(cur, list);
}