#include "support/lstrings.h"
#include "support/Messages.h"
#include "support/textutils.h"
-#include "support/unicode.h"
#include <sstream>
#include <vector>
}
-bool Paragraph::isMergedOnEndOfParDeletion(bool trackChanges) const {
+bool Paragraph::isMergedOnEndOfParDeletion(bool trackChanges) const
+{
// keep the logic here in sync with the logic of eraseChars()
-
- if (!trackChanges) {
+ if (!trackChanges)
return true;
- }
-
- Change change = d->changes_.lookup(size());
+ Change const change = d->changes_.lookup(size());
return change.type == Change::INSERTED && change.author == 0;
}
void Paragraph::setChange(pos_type pos, Change const & change)
{
BOOST_ASSERT(pos >= 0 && pos <= size());
-
d->changes_.set(change, pos);
// see comment in setChange(Change const &) above
-
- if (change.type != Change::DELETED &&
- pos < size() && isInset(pos)) {
+ if (change.type != Change::DELETED && pos < size() && isInset(pos))
getInset(pos)->setChange(change);
- }
}
Change const & Paragraph::lookupChange(pos_type pos) const
{
BOOST_ASSERT(pos >= 0 && pos <= size());
-
return d->changes_.lookup(pos);
}
}
// this check is to amend a bug. LyX sometimes
// inserts '\0' this could cause problems.
- if (c != '\0') {
- vector<char> tmp = ucs4_to_utf8(c);
- tmp.push_back('\0');
- os << &tmp[0];
- } else
+ if (c != '\0')
+ os << to_utf8(docstring(1, c));
+ else
lyxerr << "ERROR (Paragraph::writeFile):"
" NULL char in structure." << endl;
++column;
*style, i, column);
} catch (EncodingException & e) {
if (runparams.dryrun) {
- os << _("<LyX Warning: uncodable character>");
+ os << "<" << _("LyX Warning: ")
+ << _("uncodable character") << " '";
os.put(c);
- os << _("</LyX Warning>");
+ os << "'>";
} else {
// add location information and throw again.
e.par_id = id();
bool Paragraph::isHfill(pos_type pos) const
{
- return isInset(pos)
- && getInset(pos)->lyxCode() == HFILL_CODE;
+ return isInset(pos) && getInset(pos)->lyxCode() == HFILL_CODE;
}
bool Paragraph::isNewline(pos_type pos) const
{
- return isInset(pos)
- && getInset(pos)->lyxCode() == NEWLINE_CODE;
+ return isInset(pos) && getInset(pos)->lyxCode() == NEWLINE_CODE;
}
{
if (isInset(pos))
return getInset(pos)->isLetter();
- else {
- char_type const c = d->text_[pos];
- return isLetterChar(c) || isDigit(c);
- }
+ char_type const c = d->text_[pos];
+ return isLetterChar(c) || isDigit(c);
}
InsetCode Paragraph::ownerCode() const
{
- return d->inset_owner_ ?
- d->inset_owner_->lyxCode() : NO_CODE;
+ return d->inset_owner_ ? d->inset_owner_->lyxCode() : NO_CODE;
}
void Paragraph::changeCase(BufferParams const & bparams, pos_type pos,
- pos_type right, TextCase action)
+ pos_type & right, TextCase action)
{
// process sequences of modified characters; in change
// tracking mode, this approach results in much better