namespace lyx {
namespace {
+
/// Inset identifier (above 0x10ffff, for ucs-4)
char_type const META_INSET = 0x200001;
+
}
class SpellCheckerState {
public:
- SpellCheckerState() {
+ SpellCheckerState()
+ {
needs_refresh_ = true;
current_change_number_ = 0;
}
return empty_;
}
- bool needsRefresh() const {
+ bool needsRefresh() const
+ {
return needs_refresh_;
}
- SpellChecker::ChangeNumber currentChangeNumber() const {
+ SpellChecker::ChangeNumber currentChangeNumber() const
+ {
return current_change_number_;
}
- void refreshRange(pos_type & first, pos_type & last) const {
+ void refreshRange(pos_type & first, pos_type & last) const
+ {
first = refresh_.first;
last = refresh_.last;
}
- void needsRefresh(pos_type pos) {
+ void needsRefresh(pos_type pos)
+ {
if (needs_refresh_ && pos != -1) {
if (pos < refresh_.first)
refresh_.first = pos;
needs_refresh_ = pos != -1;
}
- void needsCompleteRefresh(SpellChecker::ChangeNumber change_number) {
+ void needsCompleteRefresh(SpellChecker::ChangeNumber change_number)
+ {
needs_refresh_ = true;
refresh_.first = 0;
refresh_.last = -1;
current_change_number_ = change_number;
}
-
private:
typedef vector<SpellResultRange> Ranges;
typedef Ranges::const_iterator RangesIterator;
Language * getSpellLanguage(pos_type const from) const;
Language * locateSpellRange(pos_type & from, pos_type & to,
- SkipPositions & skips) const;
+ SkipPositions & skips) const;
- bool hasSpellerChange() const {
+ bool hasSpellerChange() const
+ {
SpellChecker::ChangeNumber speller_change_number = 0;
if (theSpellChecker())
speller_change_number = theSpellChecker()->changeNumber();
speller_state_.setRange(fp, state);
}
- void requestSpellCheck(pos_type pos) {
+ void requestSpellCheck(pos_type pos)
+ {
if (pos == -1)
speller_state_.needsCompleteRefresh(speller_state_.currentChangeNumber());
else
speller_state_.needsRefresh(pos);
}
- void readySpellCheck() {
+ void readySpellCheck()
+ {
speller_state_.needsRefresh(-1);
}
// FIXME: change tracking
// Is this correct WRT change tracking?
Encoding const & encoding = *(runparams.encoding);
- docstring const latex1 = encoding.latexChar(next).first;
+ docstring latex1 = encoding.latexChar(next).first;
+ if (runparams.inIPA) {
+ string const tipashortcut = Encodings::TIPAShortcut(next);
+ if (!tipashortcut.empty()) {
+ latex1 = from_ascii(tipashortcut);
+ }
+ }
docstring const latex2 = encoding.latexChar(c).first;
if (docstring(1, next) == latex1) {
// the encoding supports the combination
bool Paragraph::Private::latexSpecialT3(char_type const c, otexstream & os,
- pos_type /*i*/, unsigned int & /*column*/)
+ pos_type /*i*/, unsigned int & column)
{
switch (c) {
case '*':
case '[':
case ']':
- case '|':
case '\"':
os.put(c);
return true;
+ case '|':
+ os << "\\textvertline{}";
+ column += 14;
+ return true;
default:
return false;
}
retval += inset->xhtml(xs, np);
}
} else {
- char_type c = d->text_[i];
+ char_type c = getUChar(buf.params(), i);
if (style.pass_thru)
xs << c;
wl = WordLangTuple(word, lang);
- if (!word.size())
+ if (word.empty())
return result;
if (needsSpellCheck() || check_learned) {
void Paragraph::spellCheck() const
{
SpellChecker * speller = theSpellChecker();
- if (!speller || !size() ||!needsSpellCheck())
+ if (!speller || empty() ||!needsSpellCheck())
return;
pos_type start;
pos_type endpos;