]> git.lyx.org Git - lyx.git/blobdiff - src/Paragraph.cpp
Add support for todonotes package
[lyx.git] / src / Paragraph.cpp
index cd9118f2a34a5ad262a392474a157f9edb6f7db1..eb239edbe04326167be6b1dd69c74d0fda162b9a 100644 (file)
@@ -96,7 +96,7 @@ public:
        ///
        void result(SpellChecker::Result r) { result_ = r; }
        ///
-       bool inside(pos_type pos) const { return range_.inside(pos); }
+       bool contains(pos_type pos) const { return range_.contains(pos); }
        ///
        bool covered(FontSpan const & r) const
        {
@@ -104,8 +104,9 @@ public:
                // 2. last of new range inside current range or
                // 3. first of current range inside new range or
                // 4. last of current range inside new range
-               return range_.inside(r.first) || range_.inside(r.last) ||
-                       r.inside(range_.first) || r.inside(range_.last);
+               //FIXME: is this the same as !range_.intersect(r).empty() ?
+               return range_.contains(r.first) || range_.contains(r.last) ||
+                       r.contains(range_.first) || r.contains(range_.last);
        }
        ///
        void shift(pos_type pos, int offset)
@@ -191,7 +192,7 @@ public:
                RangesIterator et = ranges_.end();
                RangesIterator it = ranges_.begin();
                for (; it != et; ++it) {
-                       if(it->inside(pos)) {
+                       if(it->contains(pos)) {
                                return it->result();
                        }
                }
@@ -205,7 +206,7 @@ public:
                RangesIterator et = ranges_.end();
                RangesIterator it = ranges_.begin();
                for (; it != et; ++it) {
-                       if(it->inside(pos)) {
+                       if(it->contains(pos)) {
                                return it->range();
                        }
                }
@@ -1669,11 +1670,11 @@ void Paragraph::write(ostream & os, BufferParams const & bparams,
                                        os << "\\begin_inset ";
                                        inset->write(os);
                                        os << "\n\\end_inset\n\n";
-                                       // FIXME This can be removed again once the mystery
-                                       // crash has been resolved.
-                                       os << flush;
                                        column = 0;
                                }
+                               // FIXME This can be removed again once the mystery
+                               // crash has been resolved.
+                               os << flush;
                        }
                        break;
                case '\\':
@@ -3810,7 +3811,16 @@ void Paragraph::collectWords()
                        continue;
                pos_type from = pos;
                locateWord(from, pos, WHOLE_WORD);
-               if (pos < from + lyxrc.completion_minlength)
+               // Work around MSVC warning: The statement
+               // if (pos < from + lyxrc.completion_minlength)
+               // triggers a signed vs. unsigned warning.
+               // I don't know why this happens, it could be a MSVC bug, or
+               // related to LLP64 (windows) vs. LP64 (unix) programming
+               // model, or the C++ standard might be ambigous in the section
+               // defining the "usual arithmetic conversions". However, using
+               // a temporary variable is safe and works on all compilers.
+               pos_type const endpos = from + lyxrc.completion_minlength;
+               if (pos < endpos)
                        continue;
                FontList::const_iterator cit = d->fontlist_.fontIterator(from);
                if (cit == d->fontlist_.end())