]> git.lyx.org Git - lyx.git/blobdiff - src/TexRow.cpp
Check path of Qt tools if qtchooser is detected
[lyx.git] / src / TexRow.cpp
index 37e5f64c21a1918f169b3903f29241df4938d022..4e23cf7641b8834dbefae7a03e2c6553f1247bd6 100644 (file)
@@ -35,8 +35,11 @@ bool TexRow::RowEntryList::addEntry(RowEntry const & entry)
        if (!entry.is_math) {
                if (text_entry_ < size())
                        return false;
-               else
+               else {
                        text_entry_ = size();
+                       push_back(RowEntry(entry));
+                       return true;
+               }
        }
        forceAddEntry(entry);
        return true;
@@ -50,7 +53,7 @@ void TexRow::RowEntryList::forceAddEntry(RowEntry const & entry)
 }
 
 
-TexRow::TextEntry TexRow::RowEntryList::getTextEntry() const
+TextEntry TexRow::RowEntryList::getTextEntry() const
 {
        if (text_entry_ < size())
                return operator[](text_entry_).text;
@@ -58,7 +61,7 @@ TexRow::TextEntry TexRow::RowEntryList::getTextEntry() const
 }
 
 
-TexRow::RowEntry TexRow::RowEntryList::entry() const
+RowEntry TexRow::RowEntryList::entry() const
 {
        if (0 < size())
                return operator[](0);
@@ -74,8 +77,8 @@ void TexRow::RowEntryList::append(RowEntryList const & row)
 }
 
 
-TexRow::TextEntry const TexRow::text_none = { -1, 0 };
-TexRow::RowEntry const TexRow::row_none = { false, { TexRow::text_none } };
+TextEntry const TexRow::text_none = { -1, 0 };
+RowEntry const TexRow::row_none = { false, { TexRow::text_none } };
 
 
 bool TexRow::isNone(TextEntry const & t)
@@ -98,7 +101,7 @@ void TexRow::reset(bool enable)
 }
 
 
-TexRow::RowEntry TexRow::textEntry(int id, int pos)
+RowEntry TexRow::textEntry(int id, int pos)
 {
        RowEntry entry;
        entry.is_math = false;
@@ -108,7 +111,7 @@ TexRow::RowEntry TexRow::textEntry(int id, int pos)
 }
 
 
-TexRow::RowEntry TexRow::mathEntry(uid_type id, idx_type cell)
+RowEntry TexRow::mathEntry(uid_type id, idx_type cell)
 {
        RowEntry entry;
        entry.is_math = true;
@@ -118,8 +121,8 @@ TexRow::RowEntry TexRow::mathEntry(uid_type id, idx_type cell)
 }
 
 
-bool operator==(TexRow::RowEntry const & entry1,
-                               TexRow::RowEntry const & entry2)
+bool operator==(RowEntry const & entry1,
+                               RowEntry const & entry2)
 {
        return entry1.is_math == entry2.is_math
                && (entry1.is_math
@@ -213,7 +216,7 @@ bool TexRow::getIdFromRow(int row, int & id, int & pos) const
 }
 
 
-TexRow::RowEntry TexRow::rowEntryFromCursorSlice(CursorSlice const & slice)
+RowEntry TexRow::rowEntryFromCursorSlice(CursorSlice const & slice)
 {
        RowEntry entry;
        InsetMath * insetMath = slice.asInsetMath();
@@ -405,7 +408,7 @@ std::pair<int,int> TexRow::rowFromDocIterator(DocIterator const & dit) const
                // matches either at a deeper level, or at the same level but not
                // before.
                for (size_t i = best_slice; i < n; ++i) {
-                       TexRow::RowEntry entry_i = rowEntryFromCursorSlice(dit[i]);
+                       RowEntry entry_i = rowEntryFromCursorSlice(dit[i]);
                        if (sameParOrInsetMath(*it, entry_i)) {
                                if (comparePos(*it, entry_i) >= 0
                                        && (i > best_slice
@@ -475,7 +478,7 @@ docstring TexRow::asString(RowEntry const & entry)
 ///prepends the texrow to the source given by tex, for debugging purpose
 void TexRow::prepend(docstring_list & tex) const
 {
-       int const prefix_length = 25;
+       size_type const prefix_length = 25;
        if (tex.size() < rowlist_.size())
                tex.resize(rowlist_.size());
        std::vector<RowEntryList>::const_iterator it = rowlist_.begin();
@@ -489,7 +492,7 @@ void TexRow::prepend(docstring_list & tex) const
                        entry += asString(*it2);
                if (entry.length() < prefix_length)
                        entry = entry + docstring(prefix_length - entry.length(), L' ');
-               int i = it - beg;
+               ptrdiff_t i = it - beg;
                tex[i] = entry + "  " + tex[i];
        }
 }